]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[BRANCHES] remove old version of opensm
authorStan Smith <stan.smith@intel.com>
Fri, 10 Sep 2010 20:46:58 +0000 (20:46 +0000)
committerStan Smith <stan.smith@intel.com>
Fri, 10 Sep 2010 20:46:58 +0000 (20:46 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@2914 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

253 files changed:
branches/opensm_3/dirs [deleted file]
branches/opensm_3/user/AUTHORS [deleted file]
branches/opensm_3/user/README [deleted file]
branches/opensm_3/user/README.windows [deleted file]
branches/opensm_3/user/complib/README.txt [deleted file]
branches/opensm_3/user/complib/cl_dispatcher.c [deleted file]
branches/opensm_3/user/complib/cl_event_wheel.c [deleted file]
branches/opensm_3/user/config.h [deleted file]
branches/opensm_3/user/dirs [deleted file]
branches/opensm_3/user/doc/OpenSM_PKey_Mgr.txt [deleted file]
branches/opensm_3/user/doc/OpenSM_RN.pdf [deleted file]
branches/opensm_3/user/doc/OpenSM_UM.pdf [deleted file]
branches/opensm_3/user/doc/QoS_management_in_OpenSM.txt [deleted file]
branches/opensm_3/user/doc/current-routing.txt [deleted file]
branches/opensm_3/user/doc/opensm_release_notes-3.3.txt [deleted file]
branches/opensm_3/user/doc/partition-config.txt [deleted file]
branches/opensm_3/user/doc/perf-manager-arch.txt [deleted file]
branches/opensm_3/user/doc/performance-manager-HOWTO.txt [deleted file]
branches/opensm_3/user/doc/qos-config.txt [deleted file]
branches/opensm_3/user/ibtrapgen/Makefile [deleted file]
branches/opensm_3/user/ibtrapgen/SOURCES [deleted file]
branches/opensm_3/user/ibtrapgen/ibtrapgen.c [deleted file]
branches/opensm_3/user/ibtrapgen/ibtrapgen.h [deleted file]
branches/opensm_3/user/ibtrapgen/main.c [deleted file]
branches/opensm_3/user/ibtrapgen/osm_files.c [deleted file]
branches/opensm_3/user/ibtrapgen/vendor-ibal.inc [deleted file]
branches/opensm_3/user/ibtrapgen/vendor-umad.inc [deleted file]
branches/opensm_3/user/include/complib/cl_dispatcher.h [deleted file]
branches/opensm_3/user/include/complib/cl_event_wheel.h [deleted file]
branches/opensm_3/user/include/iba/ib_cm_types.h [deleted file]
branches/opensm_3/user/include/opensm/osm_attrib_req.h [deleted file]
branches/opensm_3/user/include/opensm/osm_base.h [deleted file]
branches/opensm_3/user/include/opensm/osm_config.h [deleted file]
branches/opensm_3/user/include/opensm/osm_config.h.in [deleted file]
branches/opensm_3/user/include/opensm/osm_console.h [deleted file]
branches/opensm_3/user/include/opensm/osm_console_io.h [deleted file]
branches/opensm_3/user/include/opensm/osm_db.h [deleted file]
branches/opensm_3/user/include/opensm/osm_db_pack.h [deleted file]
branches/opensm_3/user/include/opensm/osm_errors.h [deleted file]
branches/opensm_3/user/include/opensm/osm_event_plugin.h [deleted file]
branches/opensm_3/user/include/opensm/osm_helper.h [deleted file]
branches/opensm_3/user/include/opensm/osm_inform.h [deleted file]
branches/opensm_3/user/include/opensm/osm_lid_mgr.h [deleted file]
branches/opensm_3/user/include/opensm/osm_log.h [deleted file]
branches/opensm_3/user/include/opensm/osm_mad_pool.h [deleted file]
branches/opensm_3/user/include/opensm/osm_madw.h [deleted file]
branches/opensm_3/user/include/opensm/osm_mcast_tbl.h [deleted file]
branches/opensm_3/user/include/opensm/osm_mcm_port.h [deleted file]
branches/opensm_3/user/include/opensm/osm_mesh.h [deleted file]
branches/opensm_3/user/include/opensm/osm_msgdef.h [deleted file]
branches/opensm_3/user/include/opensm/osm_mtree.h [deleted file]
branches/opensm_3/user/include/opensm/osm_multicast.h [deleted file]
branches/opensm_3/user/include/opensm/osm_node.h [deleted file]
branches/opensm_3/user/include/opensm/osm_opensm.h [deleted file]
branches/opensm_3/user/include/opensm/osm_partition.h [deleted file]
branches/opensm_3/user/include/opensm/osm_path.h [deleted file]
branches/opensm_3/user/include/opensm/osm_perfmgr.h [deleted file]
branches/opensm_3/user/include/opensm/osm_perfmgr_db.h [deleted file]
branches/opensm_3/user/include/opensm/osm_pkey.h [deleted file]
branches/opensm_3/user/include/opensm/osm_port.h [deleted file]
branches/opensm_3/user/include/opensm/osm_port_profile.h [deleted file]
branches/opensm_3/user/include/opensm/osm_prefix_route.h [deleted file]
branches/opensm_3/user/include/opensm/osm_qos_policy.h [deleted file]
branches/opensm_3/user/include/opensm/osm_remote_sm.h [deleted file]
branches/opensm_3/user/include/opensm/osm_router.h [deleted file]
branches/opensm_3/user/include/opensm/osm_sa.h [deleted file]
branches/opensm_3/user/include/opensm/osm_sa_mad_ctrl.h [deleted file]
branches/opensm_3/user/include/opensm/osm_service.h [deleted file]
branches/opensm_3/user/include/opensm/osm_sm.h [deleted file]
branches/opensm_3/user/include/opensm/osm_sm_mad_ctrl.h [deleted file]
branches/opensm_3/user/include/opensm/osm_stats.h [deleted file]
branches/opensm_3/user/include/opensm/osm_subnet.h [deleted file]
branches/opensm_3/user/include/opensm/osm_switch.h [deleted file]
branches/opensm_3/user/include/opensm/osm_ucast_cache.h [deleted file]
branches/opensm_3/user/include/opensm/osm_ucast_lash.h [deleted file]
branches/opensm_3/user/include/opensm/osm_ucast_mgr.h [deleted file]
branches/opensm_3/user/include/opensm/osm_version.h [deleted file]
branches/opensm_3/user/include/opensm/osm_version.h.in [deleted file]
branches/opensm_3/user/include/opensm/osm_vl15intf.h [deleted file]
branches/opensm_3/user/include/opensm/st.h [deleted file]
branches/opensm_3/user/include/vendor/osm_mtl_bind.h [deleted file]
branches/opensm_3/user/include/vendor/osm_pkt_randomizer.h [deleted file]
branches/opensm_3/user/include/vendor/osm_ts_useraccess.h [deleted file]
branches/opensm_3/user/include/vendor/osm_umadt.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_al.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_api.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_ibumad.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_dispatcher.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_hca.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_inout.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_rmpp_ctx.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_sar.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_sender.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_svc.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport_anafa.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mlx_txn.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mtl.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mtl_hca_guid.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_mtl_transaction_mgr.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_sa_api.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_test.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_ts.h [deleted file]
branches/opensm_3/user/include/vendor/osm_vendor_umadt.h [deleted file]
branches/opensm_3/user/include/vendor/winosm_common.h [deleted file]
branches/opensm_3/user/libvendor/Makefile [deleted file]
branches/opensm_3/user/libvendor/SOURCES [deleted file]
branches/opensm_3/user/libvendor/complib_files.c [deleted file]
branches/opensm_3/user/libvendor/libosmvendor.ver [deleted file]
branches/opensm_3/user/libvendor/osm_pkt_randomizer.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_al.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_ibumad.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_dispatcher.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_ibmgt.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_rmpp_ctx.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_sar.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_sender.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_sim.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_ts.c [deleted file]
branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c [deleted file]
branches/opensm_3/user/libvendor/osmv_ibal.exports [deleted file]
branches/opensm_3/user/libvendor/osmv_openib.exports [deleted file]
branches/opensm_3/user/libvendor/vendor-ibal.inc [deleted file]
branches/opensm_3/user/libvendor/vendor-umad.inc [deleted file]
branches/opensm_3/user/libvendor/winosm_common.c [deleted file]
branches/opensm_3/user/mad-vendor.inc [deleted file]
branches/opensm_3/user/man/opensm.8 [deleted file]
branches/opensm_3/user/man/osmtest.8 [deleted file]
branches/opensm_3/user/opensm/Makefile [deleted file]
branches/opensm_3/user/opensm/SOURCES [deleted file]
branches/opensm_3/user/opensm/dlfcn.h [deleted file]
branches/opensm_3/user/opensm/libopensm.map [deleted file]
branches/opensm_3/user/opensm/libopensm.ver [deleted file]
branches/opensm_3/user/opensm/main.c [deleted file]
branches/opensm_3/user/opensm/opensm.rc [deleted file]
branches/opensm_3/user/opensm/osm.mc [deleted file]
branches/opensm_3/user/opensm/osm_console.c [deleted file]
branches/opensm_3/user/opensm/osm_console_io.c [deleted file]
branches/opensm_3/user/opensm/osm_db_files.c [deleted file]
branches/opensm_3/user/opensm/osm_db_pack.c [deleted file]
branches/opensm_3/user/opensm/osm_drop_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_dump.c [deleted file]
branches/opensm_3/user/opensm/osm_event_plugin.c [deleted file]
branches/opensm_3/user/opensm/osm_files.c [deleted file]
branches/opensm_3/user/opensm/osm_helper.c [deleted file]
branches/opensm_3/user/opensm/osm_inform.c [deleted file]
branches/opensm_3/user/opensm/osm_lid_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_link_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_log.c [deleted file]
branches/opensm_3/user/opensm/osm_mad_pool.c [deleted file]
branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_mcast_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_mcast_tbl.c [deleted file]
branches/opensm_3/user/opensm/osm_mcm_port.c [deleted file]
branches/opensm_3/user/opensm/osm_mesh.c [deleted file]
branches/opensm_3/user/opensm/osm_mtree.c [deleted file]
branches/opensm_3/user/opensm/osm_multicast.c [deleted file]
branches/opensm_3/user/opensm/osm_node.c [deleted file]
branches/opensm_3/user/opensm/osm_node_desc_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_node_info_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_opensm.c [deleted file]
branches/opensm_3/user/opensm/osm_perfmgr.c [deleted file]
branches/opensm_3/user/opensm/osm_perfmgr_db.c [deleted file]
branches/opensm_3/user/opensm/osm_pkey.c [deleted file]
branches/opensm_3/user/opensm/osm_pkey_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_pkey_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_port.c [deleted file]
branches/opensm_3/user/opensm/osm_port_info_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_prtn.c [deleted file]
branches/opensm_3/user/opensm/osm_prtn_config.c [deleted file]
branches/opensm_3/user/opensm/osm_qos.c [deleted file]
branches/opensm_3/user/opensm/osm_qos_parser_l.c [deleted file]
branches/opensm_3/user/opensm/osm_qos_parser_l.l [deleted file]
branches/opensm_3/user/opensm/osm_qos_parser_y.c [deleted file]
branches/opensm_3/user/opensm/osm_qos_parser_y.h [deleted file]
branches/opensm_3/user/opensm/osm_qos_parser_y.y [deleted file]
branches/opensm_3/user/opensm/osm_qos_policy.c [deleted file]
branches/opensm_3/user/opensm/osm_remote_sm.c [deleted file]
branches/opensm_3/user/opensm/osm_req.c [deleted file]
branches/opensm_3/user/opensm/osm_resp.c [deleted file]
branches/opensm_3/user/opensm/osm_router.c [deleted file]
branches/opensm_3/user/opensm/osm_sa.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_class_port_info.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_informinfo.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_lft_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_link_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_mcmember_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_mft_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_multipath_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_node_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_path_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_pkey_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_portinfo_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_service_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_slvl_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_sminfo_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_sw_info_record.c [deleted file]
branches/opensm_3/user/opensm/osm_sa_vlarb_record.c [deleted file]
branches/opensm_3/user/opensm/osm_service.c [deleted file]
branches/opensm_3/user/opensm/osm_slvl_map_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_sm.c [deleted file]
branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c [deleted file]
branches/opensm_3/user/opensm/osm_sm_state_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_sminfo_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_state_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_subnet.c [deleted file]
branches/opensm_3/user/opensm/osm_sw_info_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_switch.c [deleted file]
branches/opensm_3/user/opensm/osm_trap_rcv.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_cache.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_file.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_ftree.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_lash.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_mgr.c [deleted file]
branches/opensm_3/user/opensm/osm_ucast_updn.c [deleted file]
branches/opensm_3/user/opensm/osm_vl15intf.c [deleted file]
branches/opensm_3/user/opensm/osm_vl_arb_rcv.c [deleted file]
branches/opensm_3/user/opensm/st.c [deleted file]
branches/opensm_3/user/opensm/vendor-ibal.inc [deleted file]
branches/opensm_3/user/opensm/vendor-umad.inc [deleted file]
branches/opensm_3/user/osmeventplugin/libosmeventplugin.map [deleted file]
branches/opensm_3/user/osmeventplugin/libosmeventplugin.ver [deleted file]
branches/opensm_3/user/osmeventplugin/src/osmeventplugin.c [deleted file]
branches/opensm_3/user/osmtest/Makefile [deleted file]
branches/opensm_3/user/osmtest/SOURCES [deleted file]
branches/opensm_3/user/osmtest/include/osmt_inform.h [deleted file]
branches/opensm_3/user/osmtest/include/osmt_mtl_regular_qp.h [deleted file]
branches/opensm_3/user/osmtest/include/osmtest.h [deleted file]
branches/opensm_3/user/osmtest/include/osmtest_base.h [deleted file]
branches/opensm_3/user/osmtest/include/osmtest_subnet.h [deleted file]
branches/opensm_3/user/osmtest/main.c [deleted file]
branches/opensm_3/user/osmtest/osmt_files.c [deleted file]
branches/opensm_3/user/osmtest/osmt_inform.c [deleted file]
branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c [deleted file]
branches/opensm_3/user/osmtest/osmt_multicast.c [deleted file]
branches/opensm_3/user/osmtest/osmt_service.c [deleted file]
branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c [deleted file]
branches/opensm_3/user/osmtest/osmtest.c [deleted file]
branches/opensm_3/user/osmtest/osmtest.rc [deleted file]
branches/opensm_3/user/osmtest/vendor-ibal.inc [deleted file]
branches/opensm_3/user/osmtest/vendor-umad.inc [deleted file]
branches/opensm_3/user/scripts/osm-regress.bat [deleted file]

diff --git a/branches/opensm_3/dirs b/branches/opensm_3/dirs
deleted file mode 100644 (file)
index db5a897..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-DIRS=\\r
-       user    \r
diff --git a/branches/opensm_3/user/AUTHORS b/branches/opensm_3/user/AUTHORS
deleted file mode 100644 (file)
index 7f5d6cb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-\r
-By the chronological order of involvement:\r
-Steve King,          Intel\r
-Anil Keshavamurthy,  Intel\r
-Eitan Zahavi,        Mellanox Technologies,  eitan@mellanox.co.il\r
-Yael Kalka,          Mellanox Technologies,  yael@mellanox.co.il\r
-Shahar Frank,        Voltaire\r
-Hal Rosenstock,      Voltaire,               halr@voltaire.com\r
-Sasha Khapyorsky,    Voltaire,               sashak@voltaire.com\r
diff --git a/branches/opensm_3/user/README b/branches/opensm_3/user/README
deleted file mode 100644 (file)
index 55a837f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-OpenSM README:\r
---------------\r
-\r
-OpenSM provides an implementation for an InfiniBand Subnet Manager and\r
-Administrator. Such a software entity is required to run for in order\r
-to initialize the InfiniBand hardware (at least one per each\r
-InfiniBand subnet).\r
-\r
-The full list of OpenSM features is described in the user manual\r
-provided in the doc sub directory.\r
-\r
-The installation of OpenSM includes:\r
-\r
-sbin/\r
-   opensm - the SM/SA executable\r
-   osmtest - a test program for the SM/SA\r
-lib/\r
-   libosmcomp.{a,so} - component library with generic services and containers\r
-   libopensm.{a,so} - opensm services for logs and mad buffer pool\r
-   libosmvendor.{a,so} - interface to the user mad service of the driver\r
-include/\r
-   iba/ib_types.h - IBA types header file\r
-   complib/ - component library includes\r
-   vendor/  - vendor library includes\r
-   opensm/  - public opensm library includes\r
diff --git a/branches/opensm_3/user/README.windows b/branches/opensm_3/user/README.windows
deleted file mode 100644 (file)
index 99c8fc3..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-OpenSM for Windows: last updated [5-27-10]\r
---------------------------------------------------\r
-\r
-OpenSM provides a user-mode implementation for an InfiniBand Subnet Manager and\r
-Administrator. Such a software entity is required to run in order to\r
-initialize the InfiniBand hardware (at least one per each InfiniBand subnet).\r
-\r
-The full list of OpenSM features is described in the user manual\r
-provided in the doc sub directory.\r
-\r
-The installation of OpenSM includes:\r
-\r
-%ProgramFiles%\OFED\\r
-   opensm.exe - the SM/SA executable\r
-   osmtest.exe - a test program for the SM/SA\r
-\r
-The standard OFED installation creates an OpenSM Windows Service which is\r
-inactive by default. If one chooses the install feature 'Startup OpenSM' then\r
-the OpenSM Windows Service is reset to start automatically at System boot.\r
-Multiple OpenSM instances within a fabric are supported; the 1st OpenSM instance\r
-will be the MASTER opensm, while others will be in STANDBY mode awaiting\r
-the demise of the MASTER opensm instance.\r
-\r
-\r
-Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600+\r
-----------------------------------------------------------------------\r
-  cd trunk\ulp\opensm\r
-  build /wg\r
-\r
-\r
-OpenSM 3.3.6 status\r
--------------\r
-\r
-openSM 3.3.6 [vendor-IBAL] configured a 53 node HPC fabric runing Intel MPI regression tests.\r
-All osmtests pass successfully; see 'opensm\user\scripts\osm-regress.bat'.\r
-\r
-The openSM as a service is functioning correctly; the OpenSM log file resides in\r
-%TEMP\osm.log which translates to %windir%\temp\osm.log when run as a service.\r
-Additionally %TEMP\osm.syslog or '%windir%\temp\osm.syslog', when run as a service, exists\r
-as a high level record of OpenSM events; where osm.log contains more detailed information\r
-which controlled by opensm.exe -V and/or -D command line switches.\r
-\r
-The log path is now static in definition as the usage output changed which no\r
-longer allowed calls to GetTempPath(). In order to work around this fopen()\r
-is actually a macro which redirects to Fopen(). The difference being Fopen()\r
-will strdup_expand() the filename argument and then call the Windows version\r
-of fopen(). This approach allows filenames like '%TEMP%\osm.log' to be properly\r
-expanded and opened without excessive code changes to filenames.\r
-\r
-The osm vendor is 'IBAL' until UMAD QP1/SA interfaces are debugged.\r
-The include file user\mad-vendor.inc define which osm vendor is being built/used.\r
-Make sure all SOURCES files are using the same vendor!\r
-\r
-\r
-\r
-OpenSM Code Base\r
-----------------\r
-\r
-OpenSM src is based on the OFED management\opensm sources for the 3.3.6 release.\r
-\r
-Based-on implies the following build processes:\r
-\r
-  If you use the [ANNOUNCE]'d management (OpenSM and infiniband diagnostics) \r
-  tarballs, the lex/yacc and config files are already constructed:\r
-   see http://www.openfabrics.org/downloads/management/\r
-    (listed in http://www.openfabrics.org/downloads/management/latest.txt)\r
-\r
-  otherwise\r
-\r
-  From the OFED management maintainers git repository on a Linux system\r
-    1) git clone git://git.openfabrics.org/~sashak/management\r
-    2) cd management/libibumad; ./autogen.sh && ./configure && make\r
-    3) cd management/libibmad; ./autogen.sh && ./configure && make\r
-    4) cd management/opensm; ./autogen.sh && ./configure && make\r
-    5) remove *.o *.po *.lo .deps/ .libs/\r
-    6) tar zcf ofed-mgmt.tgz management\r
-    7) Move the ofed-mgmt.tgz tarball to a Windows system where current \r
-       Windows opensm src resides.\r
-    8) unzip tar ball\r
-    9) diff trunk\ulp\opensm management\opensm\r
-\r
-    10) Carefully apply/reject changes.\r
-         There are a few (<30) differing files which the OFED community\r
-         declined to accept due to Windows orientation; an ongoing story...sigh.\r
-         The bigger change blocks are found in the following files:\r
-           opensm\main.c OpenSM as a Windows service support.\r
-           opensm\console.c Windows console support without poll().\r
-           libvendor\osm_vendor_al.c\r
-         Makefile(s) are Windows specific; leave'em be.\r
-\r
-    10) Due to the usage of Linux only tools AutoTools, lex & yacc, the\r
-        following files are static in the windows src. Static in the sense the\r
-        files are configured in the Linux environment with the resultant .c .h\r
-        files moved into the Windows opensm src tree.\r
-        Watch out for differing versions of yacc/bison/lex. The .y & .l files\r
-        are modified in the Windows src to emphasize changes required in the\r
-        .c & .h files; basically minor changes.\r
-\r
-        a) management/opensm/opensm/osm_qow_parser_y.y\r
-        b) management/opensm/opensm/osm_qos_parser_l.l\r
-        c) management/opensm/opensm/configure.h\r
-        d) management/opensm/include/opensm/osm_version.h \r
-\r
diff --git a/branches/opensm_3/user/complib/README.txt b/branches/opensm_3/user/complib/README.txt
deleted file mode 100644 (file)
index abc98b4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-\r
-\r
-******* DO NOT Confuse this complib\ with trunk\core\complib; trunk\core\complib\ and\r
-        trunk\inc\complib are the prefered versions and searched 1st.\r
-\r
-This complib\ exists only for OFED openSM code compatibility.
\ No newline at end of file
diff --git a/branches/opensm_3/user/complib/cl_dispatcher.c b/branches/opensm_3/user/complib/cl_dispatcher.c
deleted file mode 100644 (file)
index d09c9b3..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of Dispatcher abstraction.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_timer.h>\r
-\r
-/* give some guidance when we build our cl_pool of messages */\r
-#define CL_DISP_INITIAL_MSG_COUNT   256\r
-#define CL_DISP_MSG_GROW_SIZE       64\r
-\r
-/* give some guidance when we build our cl_pool of registration elements */\r
-#define CL_DISP_INITIAL_REG_COUNT   16\r
-#define CL_DISP_REG_GROW_SIZE       16\r
-\r
-/********************************************************************\r
-   __cl_disp_worker\r
-\r
-   Description:\r
-   This function takes messages off the FIFO and calls Processmsg()\r
-   This function executes as passive level.\r
-\r
-   Inputs:\r
-   p_disp - Pointer to Dispatcher object\r
-\r
-   Outputs:\r
-   None\r
-\r
-   Returns:\r
-   None\r
-********************************************************************/\r
-void __cl_disp_worker(IN void *context)\r
-{\r
-       cl_disp_msg_t *p_msg;\r
-       cl_dispatcher_t *p_disp = (cl_dispatcher_t *) context;\r
-\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-\r
-       /* Process the FIFO until we drain it dry. */\r
-       while (cl_qlist_count(&p_disp->msg_fifo)) {\r
-               /* Pop the message at the head from the FIFO. */\r
-               p_msg =\r
-                   (cl_disp_msg_t *) cl_qlist_remove_head(&p_disp->msg_fifo);\r
-\r
-               /* we track the tim ethe last message spent in the queue */\r
-               p_disp->last_msg_queue_time_us =\r
-                   cl_get_time_stamp() - p_msg->in_time;\r
-\r
-               /*\r
-                * Release the spinlock while the message is processed.\r
-                * The user's callback may reenter the dispatcher\r
-                * and cause the lock to be reaquired.\r
-                */\r
-               cl_spinlock_release(&p_disp->lock);\r
-               p_msg->p_dest_reg->pfn_rcv_callback((void *)p_msg->p_dest_reg->\r
-                                                   context,\r
-                                                   (void *)p_msg->p_data);\r
-\r
-               cl_atomic_dec(&p_msg->p_dest_reg->ref_cnt);\r
-\r
-               /* The client has seen the data.  Notify the sender as appropriate. */\r
-               if (p_msg->pfn_xmt_callback) {\r
-                       p_msg->pfn_xmt_callback((void *)p_msg->context,\r
-                                               (void *)p_msg->p_data);\r
-                       cl_atomic_dec(&p_msg->p_src_reg->ref_cnt);\r
-               }\r
-\r
-               /* Grab the lock for the next iteration through the list. */\r
-               cl_spinlock_acquire(&p_disp->lock);\r
-\r
-               /* Return this message to the pool. */\r
-               cl_qpool_put(&p_disp->msg_pool, (cl_pool_item_t *) p_msg);\r
-       }\r
-\r
-       cl_spinlock_release(&p_disp->lock);\r
-}\r
-\r
-void cl_disp_construct(IN cl_dispatcher_t * const p_disp)\r
-{\r
-       CL_ASSERT(p_disp);\r
-\r
-       cl_qlist_init(&p_disp->reg_list);\r
-       cl_ptr_vector_construct(&p_disp->reg_vec);\r
-       cl_qlist_init(&p_disp->msg_fifo);\r
-       cl_spinlock_construct(&p_disp->lock);\r
-       cl_qpool_construct(&p_disp->msg_pool);\r
-}\r
-\r
-void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)\r
-{\r
-       CL_ASSERT(p_disp);\r
-\r
-       /* Stop the thread pool. */\r
-       cl_thread_pool_destroy(&p_disp->worker_threads);\r
-\r
-       /* Process all outstanding callbacks. */\r
-       __cl_disp_worker(p_disp);\r
-\r
-       /* Free all registration info. */\r
-       while (!cl_is_qlist_empty(&p_disp->reg_list))\r
-               free(cl_qlist_remove_head(&p_disp->reg_list));\r
-}\r
-\r
-void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)\r
-{\r
-       CL_ASSERT(p_disp);\r
-\r
-       cl_spinlock_destroy(&p_disp->lock);\r
-       /* Destroy the message pool */\r
-       cl_qpool_destroy(&p_disp->msg_pool);\r
-       /* Destroy the pointer vector of registrants. */\r
-       cl_ptr_vector_destroy(&p_disp->reg_vec);\r
-}\r
-\r
-cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp,\r
-                        IN const uint32_t thread_count,\r
-                        IN const char *const name)\r
-{\r
-       cl_status_t status;\r
-\r
-       CL_ASSERT(p_disp);\r
-\r
-       cl_disp_construct(p_disp);\r
-\r
-       status = cl_spinlock_init(&p_disp->lock);\r
-       if (status != CL_SUCCESS) {\r
-               cl_disp_destroy(p_disp);\r
-               return (status);\r
-       }\r
-\r
-       /* Specify no upper limit to the number of messages in the pool */\r
-       status = cl_qpool_init(&p_disp->msg_pool, CL_DISP_INITIAL_MSG_COUNT,\r
-                              0, CL_DISP_MSG_GROW_SIZE, sizeof(cl_disp_msg_t),\r
-                              NULL, NULL, NULL);\r
-       if (status != CL_SUCCESS) {\r
-               cl_disp_destroy(p_disp);\r
-               return (status);\r
-       }\r
-\r
-       status = cl_ptr_vector_init(&p_disp->reg_vec, CL_DISP_INITIAL_REG_COUNT,\r
-                                   CL_DISP_REG_GROW_SIZE);\r
-       if (status != CL_SUCCESS) {\r
-               cl_disp_destroy(p_disp);\r
-               return (status);\r
-       }\r
-\r
-       status = cl_thread_pool_init(&p_disp->worker_threads, thread_count,\r
-                                    __cl_disp_worker, p_disp, name);\r
-       if (status != CL_SUCCESS)\r
-               cl_disp_destroy(p_disp);\r
-\r
-       return (status);\r
-}\r
-\r
-cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp,\r
-                                     IN const cl_disp_msgid_t msg_id,\r
-                                     IN cl_pfn_msgrcv_cb_t pfn_callback\r
-                                     OPTIONAL,\r
-                                     IN const void *const context OPTIONAL)\r
-{\r
-       cl_disp_reg_info_t *p_reg;\r
-       cl_status_t status;\r
-\r
-       CL_ASSERT(p_disp);\r
-\r
-       /* Check that the requested registrant ID is available. */\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-       if ((msg_id != CL_DISP_MSGID_NONE) &&\r
-           (msg_id < cl_ptr_vector_get_size(&p_disp->reg_vec)) &&\r
-           (cl_ptr_vector_get(&p_disp->reg_vec, msg_id))) {\r
-               cl_spinlock_release(&p_disp->lock);\r
-               return (NULL);\r
-       }\r
-\r
-       /* Get a registration info from the pool. */\r
-       p_reg = (cl_disp_reg_info_t *) malloc(sizeof(cl_disp_reg_info_t));\r
-       if (!p_reg) {\r
-               cl_spinlock_release(&p_disp->lock);\r
-               return (NULL);\r
-       } else {\r
-               memset(p_reg, 0, sizeof(cl_disp_reg_info_t));\r
-       }\r
-\r
-       p_reg->p_disp = p_disp;\r
-       p_reg->ref_cnt = 0;\r
-       p_reg->pfn_rcv_callback = pfn_callback;\r
-       p_reg->context = context;\r
-       p_reg->msg_id = msg_id;\r
-\r
-       /* Insert the registration in the list. */\r
-       cl_qlist_insert_tail(&p_disp->reg_list, (cl_list_item_t *) p_reg);\r
-\r
-       /* Set the array entry to the registrant. */\r
-       /* The ptr_vector grow automatically as necessary. */\r
-       if (msg_id != CL_DISP_MSGID_NONE) {\r
-               status = cl_ptr_vector_set(&p_disp->reg_vec, msg_id, p_reg);\r
-               if (status != CL_SUCCESS) {\r
-                       free(p_reg);\r
-                       cl_spinlock_release(&p_disp->lock);\r
-                       return (NULL);\r
-               }\r
-       }\r
-\r
-       cl_spinlock_release(&p_disp->lock);\r
-\r
-       return (p_reg);\r
-}\r
-\r
-void cl_disp_unregister(IN const cl_disp_reg_handle_t handle)\r
-{\r
-       cl_disp_reg_info_t *p_reg;\r
-       cl_dispatcher_t *p_disp;\r
-\r
-       if (handle == CL_DISP_INVALID_HANDLE)\r
-               return;\r
-\r
-       p_reg = (cl_disp_reg_info_t *) handle;\r
-       p_disp = p_reg->p_disp;\r
-       CL_ASSERT(p_disp);\r
-\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-       /*\r
-        * Clear the registrant vector entry.  This will cause any further\r
-        * post calls to fail.\r
-        */\r
-       if (p_reg->msg_id != CL_DISP_MSGID_NONE) {\r
-               CL_ASSERT(p_reg->msg_id <\r
-                         cl_ptr_vector_get_size(&p_disp->reg_vec));\r
-               cl_ptr_vector_set(&p_disp->reg_vec, p_reg->msg_id, NULL);\r
-       }\r
-       cl_spinlock_release(&p_disp->lock);\r
-\r
-       while (p_reg->ref_cnt > 0)\r
-               cl_thread_suspend(1);\r
-\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-       /* Remove the registrant from the list. */\r
-       cl_qlist_remove_item(&p_disp->reg_list, (cl_list_item_t *) p_reg);\r
-       /* Return the registration info to the pool */\r
-       free(p_reg);\r
-\r
-       cl_spinlock_release(&p_disp->lock);\r
-}\r
-\r
-cl_status_t cl_disp_post(IN const cl_disp_reg_handle_t handle,\r
-                        IN const cl_disp_msgid_t msg_id,\r
-                        IN const void *const p_data,\r
-                        IN cl_pfn_msgdone_cb_t pfn_callback OPTIONAL,\r
-                        IN const void *const context OPTIONAL)\r
-{\r
-       cl_disp_reg_info_t *p_src_reg = (cl_disp_reg_info_t *) handle;\r
-       cl_disp_reg_info_t *p_dest_reg;\r
-       cl_dispatcher_t *p_disp;\r
-       cl_disp_msg_t *p_msg;\r
-\r
-       p_disp = handle->p_disp;\r
-       CL_ASSERT(p_disp);\r
-       CL_ASSERT(msg_id != CL_DISP_MSGID_NONE);\r
-\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-       /* Check that the recipient exists. */\r
-       p_dest_reg = cl_ptr_vector_get(&p_disp->reg_vec, msg_id);\r
-       if (!p_dest_reg) {\r
-               cl_spinlock_release(&p_disp->lock);\r
-               return (CL_NOT_FOUND);\r
-       }\r
-\r
-       /* Get a free message from the pool. */\r
-       p_msg = (cl_disp_msg_t *) cl_qpool_get(&p_disp->msg_pool);\r
-       if (!p_msg) {\r
-               cl_spinlock_release(&p_disp->lock);\r
-               return (CL_INSUFFICIENT_MEMORY);\r
-       }\r
-\r
-       /* Initialize the message */\r
-       p_msg->p_src_reg = p_src_reg;\r
-       p_msg->p_dest_reg = p_dest_reg;\r
-       p_msg->p_data = p_data;\r
-       p_msg->pfn_xmt_callback = pfn_callback;\r
-       p_msg->context = context;\r
-       p_msg->in_time = cl_get_time_stamp();\r
-\r
-       /*\r
-        * Increment the sender's reference count if they request a completion\r
-        * notification.\r
-        */\r
-       if (pfn_callback)\r
-               cl_atomic_inc(&p_src_reg->ref_cnt);\r
-\r
-       /* Increment the recipient's reference count. */\r
-       cl_atomic_inc(&p_dest_reg->ref_cnt);\r
-\r
-       /* Queue the message in the FIFO. */\r
-       cl_qlist_insert_tail(&p_disp->msg_fifo, (cl_list_item_t *) p_msg);\r
-       cl_spinlock_release(&p_disp->lock);\r
-\r
-       /* Signal the thread pool that there is work to be done. */\r
-       cl_thread_pool_signal(&p_disp->worker_threads);\r
-       return (CL_SUCCESS);\r
-}\r
-\r
-void cl_disp_get_queue_status(IN const cl_disp_reg_handle_t handle,\r
-                             OUT uint32_t * p_num_queued_msgs,\r
-                             OUT uint64_t * p_last_msg_queue_time_ms)\r
-{\r
-       cl_dispatcher_t *p_disp = ((cl_disp_reg_info_t *) handle)->p_disp;\r
-\r
-       cl_spinlock_acquire(&p_disp->lock);\r
-\r
-       if (p_last_msg_queue_time_ms)\r
-               *p_last_msg_queue_time_ms =\r
-                   p_disp->last_msg_queue_time_us / 1000;\r
-\r
-       if (p_num_queued_msgs)\r
-               *p_num_queued_msgs = cl_qlist_count(&p_disp->msg_fifo);\r
-\r
-       cl_spinlock_release(&p_disp->lock);\r
-}\r
diff --git a/branches/opensm_3/user/complib/cl_event_wheel.c b/branches/opensm_3/user/complib/cl_event_wheel.c
deleted file mode 100644 (file)
index 03e27b3..0000000
+++ /dev/null
@@ -1,566 +0,0 @@
-/*\r
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <math.h>\r
-#include <stdlib.h>\r
-#include <complib/cl_event_wheel.h>\r
-#include <complib/cl_debug.h>\r
-\r
-#define CL_DBG(fmt, ...)\r
-\r
-static cl_status_t __event_will_age_before(IN const cl_list_item_t *\r
-                                          const p_list_item, IN void *context)\r
-{\r
-       uint64_t aging_time = *((uint64_t *) context);\r
-       cl_event_wheel_reg_info_t *p_event;\r
-\r
-       p_event =\r
-           PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t, list_item);\r
-\r
-       if (p_event->aging_time < aging_time)\r
-               return CL_SUCCESS;\r
-       else\r
-               return CL_NOT_FOUND;\r
-}\r
-\r
-static void __cl_event_wheel_callback(IN void *context)\r
-{\r
-       cl_event_wheel_t *p_event_wheel = (cl_event_wheel_t *) context;\r
-       cl_list_item_t *p_list_item, *p_prev_event_list_item;\r
-       cl_list_item_t *p_list_next_item;\r
-       cl_event_wheel_reg_info_t *p_event;\r
-       uint64_t current_time;\r
-       uint64_t next_aging_time;\r
-       uint32_t new_timeout;\r
-       cl_status_t cl_status;\r
-\r
-       /* might be during closing ...  */\r
-       if (p_event_wheel->closing)\r
-               return;\r
-\r
-       current_time = cl_get_time_stamp();\r
-\r
-       if (NULL != p_event_wheel->p_external_lock)\r
-\r
-               /* Take care of the order of acquiring locks to avoid the deadlock!\r
-                * The external lock goes first.\r
-                */\r
-               cl_spinlock_acquire(p_event_wheel->p_external_lock);\r
-\r
-       cl_spinlock_acquire(&p_event_wheel->lock);\r
-\r
-       p_list_item = cl_qlist_head(&p_event_wheel->events_wheel);\r
-       if (p_list_item == cl_qlist_end(&p_event_wheel->events_wheel))\r
-               /* the list is empty - nothing to do */\r
-               goto Exit;\r
-\r
-       /* we found such an item.  get the p_event */\r
-       p_event =\r
-           PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t, list_item);\r
-\r
-       while (p_event->aging_time <= current_time) {\r
-               /* this object has aged - invoke it's callback */\r
-               if (p_event->pfn_aged_callback)\r
-                       next_aging_time =\r
-                           p_event->pfn_aged_callback(p_event->key,\r
-                                                      p_event->num_regs,\r
-                                                      p_event->context);\r
-               else\r
-                       next_aging_time = 0;\r
-\r
-               /* point to the next object in the wheel */\r
-               p_list_next_item = cl_qlist_next(p_list_item);\r
-\r
-               /* We need to retire the event if the next aging time passed */\r
-               if (next_aging_time < current_time) {\r
-                       /* remove it from the map */\r
-                       cl_qmap_remove_item(&p_event_wheel->events_map,\r
-                                           &(p_event->map_item));\r
-\r
-                       /* pop p_event from the wheel */\r
-                       cl_qlist_remove_head(&p_event_wheel->events_wheel);\r
-\r
-                       /* delete the event info object - allocated by cl_event_wheel_reg */\r
-                       free(p_event);\r
-               } else {\r
-                       /* update the required aging time */\r
-                       p_event->aging_time = next_aging_time;\r
-                       p_event->num_regs++;\r
-\r
-                       /* do not remove from the map  - but remove from the list head and\r
-                          place in the correct position */\r
-\r
-                       /* pop p_event from the wheel */\r
-                       cl_qlist_remove_head(&p_event_wheel->events_wheel);\r
-\r
-                       /* find the event that ages just before */\r
-                       p_prev_event_list_item =\r
-                           cl_qlist_find_from_tail(&p_event_wheel->\r
-                                                   events_wheel,\r
-                                                   __event_will_age_before,\r
-                                                   &p_event->aging_time);\r
-\r
-                       /* insert just after */\r
-                       cl_qlist_insert_next(&p_event_wheel->events_wheel,\r
-                                            p_prev_event_list_item,\r
-                                            &p_event->list_item);\r
-\r
-                       /* as we have modified the list - restart from first item: */\r
-                       p_list_next_item =\r
-                           cl_qlist_head(&p_event_wheel->events_wheel);\r
-               }\r
-\r
-               /* advance to next event */\r
-               p_list_item = p_list_next_item;\r
-               if (p_list_item == cl_qlist_end(&p_event_wheel->events_wheel))\r
-                       /* the list is empty - nothing to do */\r
-                       break;\r
-\r
-               /* get the p_event */\r
-               p_event =\r
-                   PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,\r
-                                 list_item);\r
-       }\r
-\r
-       /* We need to restart the timer only if the list is not empty now */\r
-       if (p_list_item != cl_qlist_end(&p_event_wheel->events_wheel)) {\r
-               /* get the p_event */\r
-               p_event =\r
-                   PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,\r
-                                 list_item);\r
-\r
-               /* start the timer to the timeout [msec] */\r
-               new_timeout =\r
-                   (uint32_t) (((p_event->aging_time - current_time) / 1000) +\r
-                               0.5);\r
-               CL_DBG("__cl_event_wheel_callback: Restart timer in: "\r
-                      "%u [msec]\n", new_timeout);\r
-               cl_status = cl_timer_start(&p_event_wheel->timer, new_timeout);\r
-               if (cl_status != CL_SUCCESS) {\r
-                       CL_DBG("__cl_event_wheel_callback : ERR 6100: "\r
-                              "Failed to start timer\n");\r
-               }\r
-       }\r
-\r
-       /* release the lock */\r
-Exit:\r
-       cl_spinlock_release(&p_event_wheel->lock);\r
-       if (NULL != p_event_wheel->p_external_lock)\r
-               cl_spinlock_release(p_event_wheel->p_external_lock);\r
-}\r
-\r
-/*\r
- * Construct and Initialize\r
- */\r
-void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel)\r
-{\r
-       cl_spinlock_construct(&(p_event_wheel->lock));\r
-       cl_timer_construct(&(p_event_wheel->timer));\r
-}\r
-\r
-cl_status_t cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel)\r
-{\r
-       cl_status_t cl_status = CL_SUCCESS;\r
-\r
-       /* initialize */\r
-       p_event_wheel->p_external_lock = NULL;\r
-       p_event_wheel->closing = FALSE;\r
-       cl_status = cl_spinlock_init(&(p_event_wheel->lock));\r
-       if (cl_status != CL_SUCCESS)\r
-               return cl_status;\r
-       cl_qlist_init(&p_event_wheel->events_wheel);\r
-       cl_qmap_init(&p_event_wheel->events_map);\r
-\r
-       /* init the timer with timeout */\r
-       cl_status = cl_timer_init(&p_event_wheel->timer, __cl_event_wheel_callback, p_event_wheel);     /* cb context */\r
-\r
-       return cl_status;\r
-}\r
-\r
-cl_status_t cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,\r
-                                  IN cl_spinlock_t * p_external_lock)\r
-{\r
-       cl_status_t cl_status;\r
-\r
-       cl_status = cl_event_wheel_init(p_event_wheel);\r
-       if (CL_SUCCESS != cl_status)\r
-               return cl_status;\r
-\r
-       p_event_wheel->p_external_lock = p_external_lock;\r
-       return cl_status;\r
-}\r
-\r
-void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-       cl_event_wheel_reg_info_t *p_event;\r
-\r
-       p_list_item = cl_qlist_head(&p_event_wheel->events_wheel);\r
-\r
-       while (p_list_item != cl_qlist_end(&p_event_wheel->events_wheel)) {\r
-               p_event =\r
-                   PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,\r
-                                 list_item);\r
-               CL_DBG("cl_event_wheel_dump: Found event key:<0x%"\r
-                      PRIx64 ">, aging time:%" PRIu64 "\n",\r
-                      p_event->key, p_event->aging_time);\r
-               p_list_item = cl_qlist_next(p_list_item);\r
-       }\r
-}\r
-\r
-void cl_event_wheel_destroy(IN cl_event_wheel_t * const p_event_wheel)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-       cl_map_item_t *p_map_item;\r
-       cl_event_wheel_reg_info_t *p_event;\r
-\r
-       /* we need to get a lock */\r
-       cl_spinlock_acquire(&p_event_wheel->lock);\r
-\r
-       cl_event_wheel_dump(p_event_wheel);\r
-\r
-       /* go over all the items in the list and remove them */\r
-       p_list_item = cl_qlist_remove_head(&p_event_wheel->events_wheel);\r
-       while (p_list_item != cl_qlist_end(&p_event_wheel->events_wheel)) {\r
-               p_event =\r
-                   PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,\r
-                                 list_item);\r
-\r
-               CL_DBG("cl_event_wheel_destroy: Found outstanding event"\r
-                      " key:<0x%" PRIx64 ">\n", p_event->key);\r
-\r
-               /* remove it from the map */\r
-               p_map_item = &(p_event->map_item);\r
-               cl_qmap_remove_item(&p_event_wheel->events_map, p_map_item);\r
-               free(p_event);  /* allocated by cl_event_wheel_reg */\r
-               p_list_item =\r
-                   cl_qlist_remove_head(&p_event_wheel->events_wheel);\r
-       }\r
-\r
-       /* destroy the timer */\r
-       cl_timer_destroy(&p_event_wheel->timer);\r
-\r
-       /* destroy the lock (this should be done without releasing - we don't want\r
-          any other run to grab the lock at this point. */\r
-       cl_spinlock_release(&p_event_wheel->lock);\r
-       cl_spinlock_destroy(&(p_event_wheel->lock));\r
-}\r
-\r
-cl_status_t cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,\r
-                              IN const uint64_t key,\r
-                              IN const uint64_t aging_time_usec,\r
-                              IN cl_pfn_event_aged_cb_t pfn_callback,\r
-                              IN void *const context)\r
-{\r
-       cl_event_wheel_reg_info_t *p_event;\r
-       uint64_t timeout;\r
-       uint32_t to;\r
-       cl_status_t cl_status = CL_SUCCESS;\r
-       cl_list_item_t *prev_event_list_item;\r
-       cl_map_item_t *p_map_item;\r
-\r
-       /* Get the lock on the manager */\r
-       cl_spinlock_acquire(&(p_event_wheel->lock));\r
-\r
-       cl_event_wheel_dump(p_event_wheel);\r
-\r
-       /* Make sure such a key does not exists */\r
-       p_map_item = cl_qmap_get(&p_event_wheel->events_map, key);\r
-       if (p_map_item != cl_qmap_end(&p_event_wheel->events_map)) {\r
-               CL_DBG("cl_event_wheel_reg: Already exists key:0x%"\r
-                      PRIx64 "\n", key);\r
-\r
-               /* already there - remove it from the list as it is getting a new time */\r
-               p_event =\r
-                   PARENT_STRUCT(p_map_item, cl_event_wheel_reg_info_t,\r
-                                 map_item);\r
-\r
-               /* remove the item from the qlist */\r
-               cl_qlist_remove_item(&p_event_wheel->events_wheel,\r
-                                    &p_event->list_item);\r
-               /* and the qmap */\r
-               cl_qmap_remove_item(&p_event_wheel->events_map,\r
-                                   &p_event->map_item);\r
-       } else {\r
-               /* make a new one */\r
-               p_event = (cl_event_wheel_reg_info_t *)\r
-                   malloc(sizeof(cl_event_wheel_reg_info_t));\r
-               p_event->num_regs = 0;\r
-       }\r
-\r
-       p_event->key = key;\r
-       p_event->aging_time = aging_time_usec;\r
-       p_event->pfn_aged_callback = pfn_callback;\r
-       p_event->context = context;\r
-       p_event->num_regs++;\r
-\r
-       CL_DBG("cl_event_wheel_reg: Registering event key:0x%" PRIx64\r
-              " aging in %u [msec]\n", p_event->key,\r
-              (uint32_t) ((p_event->aging_time - cl_get_time_stamp()) / 1000));\r
-\r
-       /* If the list is empty - need to start the timer */\r
-       if (cl_is_qlist_empty(&p_event_wheel->events_wheel)) {\r
-               /* Edward Bortnikov 03/29/2003\r
-                * ++TBD Consider moving the timer manipulation behind the list manipulation.\r
-                */\r
-\r
-               /* calculate the new timeout */\r
-               timeout =\r
-                   (p_event->aging_time - cl_get_time_stamp() + 500) / 1000;\r
-\r
-               /* stop the timer if it is running */\r
-\r
-               /* Edward Bortnikov 03/29/2003\r
-                * Don't call cl_timer_stop() because it spins forever.\r
-                * cl_timer_start() will invoke cl_timer_stop() by itself.\r
-                *\r
-                * The problematic scenario is when __cl_event_wheel_callback()\r
-                * is in race condition with this code. It sets timer.in_timer_cb\r
-                * to TRUE and then blocks on p_event_wheel->lock. Following this,\r
-                * the call to cl_timer_stop() hangs. Following this, the whole system\r
-                * enters into a deadlock.\r
-                *\r
-                * cl_timer_stop(&p_event_wheel->timer);\r
-                */\r
-\r
-               /* The timeout for the cl_timer_start should be given as uint32_t.\r
-                  if there is an overflow - warn about it. */\r
-               to = (uint32_t) timeout;\r
-               if (timeout > (uint32_t) timeout) {\r
-                       to = 0xffffffff;        /* max 32 bit timer */\r
-                       CL_DBG("cl_event_wheel_reg: timeout requested is "\r
-                              "too large. Using timeout: %u\n", to);\r
-               }\r
-\r
-               /* start the timer to the timeout [msec] */\r
-               cl_status = cl_timer_start(&p_event_wheel->timer, to);\r
-               if (cl_status != CL_SUCCESS) {\r
-                       CL_DBG("cl_event_wheel_reg : ERR 6103: "\r
-                              "Failed to start timer\n");\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* insert the object to the qlist and the qmap */\r
-\r
-       /* BUT WE MUST INSERT IT IN A SORTED MANNER */\r
-       prev_event_list_item =\r
-           cl_qlist_find_from_tail(&p_event_wheel->events_wheel,\r
-                                   __event_will_age_before,\r
-                                   &p_event->aging_time);\r
-\r
-       cl_qlist_insert_next(&p_event_wheel->events_wheel,\r
-                            prev_event_list_item, &p_event->list_item);\r
-\r
-       cl_qmap_insert(&p_event_wheel->events_map, key, &(p_event->map_item));\r
-\r
-Exit:\r
-       cl_spinlock_release(&p_event_wheel->lock);\r
-\r
-       return cl_status;\r
-}\r
-\r
-void cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel,\r
-                         IN uint64_t key)\r
-{\r
-       cl_event_wheel_reg_info_t *p_event;\r
-       cl_map_item_t *p_map_item;\r
-\r
-       CL_DBG("cl_event_wheel_unreg: " "Removing key:0x%" PRIx64 "\n", key);\r
-\r
-       cl_spinlock_acquire(&p_event_wheel->lock);\r
-       p_map_item = cl_qmap_get(&p_event_wheel->events_map, key);\r
-       if (p_map_item != cl_qmap_end(&p_event_wheel->events_map)) {\r
-               /* we found such an item. */\r
-               p_event =\r
-                   PARENT_STRUCT(p_map_item, cl_event_wheel_reg_info_t,\r
-                                 map_item);\r
-\r
-               /* remove the item from the qlist */\r
-               cl_qlist_remove_item(&p_event_wheel->events_wheel,\r
-                                    &(p_event->list_item));\r
-               /* remove the item from the qmap */\r
-               cl_qmap_remove_item(&p_event_wheel->events_map,\r
-                                   &(p_event->map_item));\r
-\r
-               CL_DBG("cl_event_wheel_unreg: Removed key:0x%" PRIx64 "\n",\r
-                      key);\r
-\r
-               /* free the item */\r
-               free(p_event);\r
-       } else {\r
-               CL_DBG("cl_event_wheel_unreg: did not find key:0x%" PRIx64\r
-                      "\n", key);\r
-       }\r
-\r
-       cl_spinlock_release(&p_event_wheel->lock);\r
-}\r
-\r
-uint32_t cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,\r
-                                IN uint64_t key)\r
-{\r
-\r
-       cl_event_wheel_reg_info_t *p_event;\r
-       cl_map_item_t *p_map_item;\r
-       uint32_t num_regs = 0;\r
-\r
-       /* try to find the key in the map */\r
-       CL_DBG("cl_event_wheel_num_regs: Looking for key:0x%" PRIx64 "\n", key);\r
-\r
-       cl_spinlock_acquire(&p_event_wheel->lock);\r
-       p_map_item = cl_qmap_get(&p_event_wheel->events_map, key);\r
-       if (p_map_item != cl_qmap_end(&p_event_wheel->events_map)) {\r
-               /* ok so we can simply return it's num_regs */\r
-               p_event =\r
-                   PARENT_STRUCT(p_map_item, cl_event_wheel_reg_info_t,\r
-                                 map_item);\r
-               num_regs = p_event->num_regs;\r
-       }\r
-\r
-       cl_spinlock_release(&p_event_wheel->lock);\r
-       return (num_regs);\r
-}\r
-\r
-#ifdef __CL_EVENT_WHEEL_TEST__\r
-\r
-/* Dump out the complete state of the event wheel */\r
-void __cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-       cl_map_item_t *p_map_item;\r
-       cl_event_wheel_reg_info_t *p_event;\r
-\r
-       printf("************** Event Wheel Dump ***********************\n");\r
-       printf("Event Wheel List has %u items:\n",\r
-              cl_qlist_count(&p_event_wheel->events_wheel));\r
-\r
-       p_list_item = cl_qlist_head(&p_event_wheel->events_wheel);\r
-       while (p_list_item != cl_qlist_end(&p_event_wheel->events_wheel)) {\r
-               p_event =\r
-                   PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,\r
-                                 list_item);\r
-               printf("Event key:0x%" PRIx64 " Context:%s NumRegs:%u\n",\r
-                      p_event->key, (char *)p_event->context,\r
-                      p_event->num_regs);\r
-\r
-               /* next */\r
-               p_list_item = cl_qlist_next(p_list_item);\r
-       }\r
-\r
-       printf("Event Map has %u items:\n",\r
-              cl_qmap_count(&p_event_wheel->events_map));\r
-\r
-       p_map_item = cl_qmap_head(&p_event_wheel->events_map);\r
-       while (p_map_item != cl_qmap_end(&p_event_wheel->events_map)) {\r
-               p_event =\r
-                   PARENT_STRUCT(p_map_item, cl_event_wheel_reg_info_t,\r
-                                 map_item);\r
-               printf("Event key:0x%" PRIx64 " Context:%s NumRegs:%u\n",\r
-                      p_event->key, (char *)p_event->context,\r
-                      p_event->num_regs);\r
-\r
-               /* next */\r
-               p_map_item = cl_qmap_next(p_map_item);\r
-       }\r
-\r
-}\r
-\r
-/* The callback for aging event */\r
-/* We assume we pass a text context */\r
-void __test_event_aging(uint64_t key, void *context)\r
-{\r
-       printf("*****************************************************\n");\r
-       printf("Aged key: 0x%" PRIx64 " Context:%s\n", key, (char *)context);\r
-}\r
-\r
-int main()\r
-{\r
-       cl_event_wheel_t event_wheel;\r
-       /*  uint64_t key; */\r
-\r
-       /* construct */\r
-       cl_event_wheel_construct(&event_wheel);\r
-\r
-       /* init */\r
-       cl_event_wheel_init(&event_wheel);\r
-\r
-       /* Start Playing */\r
-       cl_event_wheel_reg(&event_wheel, 1,     /*  key */\r
-                          cl_get_time_stamp() + 3000000,       /*  3 sec lifetime */\r
-                          __test_event_aging,  /*  cb */\r
-                          "The first Aging Event");\r
-\r
-       cl_event_wheel_reg(&event_wheel, 2,     /*  key */\r
-                          cl_get_time_stamp() + 3000000,       /*  3 sec lifetime */\r
-                          __test_event_aging,  /*  cb */\r
-                          "The Second Aging Event");\r
-\r
-       cl_event_wheel_reg(&event_wheel, 3,     /*  key */\r
-                          cl_get_time_stamp() + 3500000,       /*  3 sec lifetime */\r
-                          __test_event_aging,  /*  cb */\r
-                          "The Third Aging Event");\r
-\r
-       __cl_event_wheel_dump(&event_wheel);\r
-\r
-       sleep(2);\r
-       cl_event_wheel_reg(&event_wheel, 2,     /*  key */\r
-                          cl_get_time_stamp() + 8000000,       /*  3 sec lifetime */\r
-                          __test_event_aging,  /*  cb */\r
-                          "The Second Aging Event Moved");\r
-\r
-       __cl_event_wheel_dump(&event_wheel);\r
-\r
-       sleep(1);\r
-       /* remove the third event */\r
-       cl_event_wheel_unreg(&event_wheel, 3);  /*  key */\r
-\r
-       /* get the number of registrations for the keys */\r
-       printf("Event 1 Registered: %u\n",\r
-              cl_event_wheel_num_regs(&event_wheel, 1));\r
-       printf("Event 2 Registered: %u\n",\r
-              cl_event_wheel_num_regs(&event_wheel, 2));\r
-\r
-       sleep(5);\r
-       /* destroy */\r
-       cl_event_wheel_destroy(&event_wheel);\r
-\r
-       return (0);\r
-}\r
-\r
-#endif                         /* __CL_EVENT_WHEEL_TEST__ */\r
diff --git a/branches/opensm_3/user/config.h b/branches/opensm_3/user/config.h
deleted file mode 100644 (file)
index 6798bf7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Windows-specific definitions\r
- *\r
- * Environment:\r
- *     Windows\r
- *\r
- * $Revision: $\r
- */\r
-\r
-#ifndef _CONFIG_h_\r
-#define _CONFIG_h_\r
-\r
-#include <opensm/osm_config.h>\r
-#include <vendor/winosm_common.h>\r
-\r
-#endif /*_CONFIG_h_ */\r
-\r
diff --git a/branches/opensm_3/user/dirs b/branches/opensm_3/user/dirs
deleted file mode 100644 (file)
index e08ed5e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-DIRS=\\r
-   libvendor \\r
-   opensm \\r
-   osmtest \\r
-   ibtrapgen\r
-\r
diff --git a/branches/opensm_3/user/doc/OpenSM_PKey_Mgr.txt b/branches/opensm_3/user/doc/OpenSM_PKey_Mgr.txt
deleted file mode 100644 (file)
index e0706e0..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-OpenSM Partition Management\r
----------------------------\r
-\r
-Roadmap:\r
-Phase 1 - provide partition management at the EndPort (HCA, Router and Switch\r
-          Port 0) level with no routing affects.\r
-Phase 2 - routing engine should take partitions into account.\r
-\r
-Phase 1 functionality:\r
-\r
-Supported Policy:\r
-\r
-1. EndPort partition groups are to be defined by listing the\r
-   PortGUIDs as full and limited members.\r
-\r
-2. Each partition group might be assigned an explicit P_Key (only the 15\r
-   LSB bits are valid) or the SM should assign it randomly.\r
-\r
-3. A flag should control the generation of IPoIB broadcast group for\r
-   that partition. Extra optional MGIDs can be provided to be setup (on\r
-   top of the IPoIB broadcast group).\r
-\r
-4. A global flag "Disconnect Unconfigured EndPorts": If TRUE prevents\r
-   EndPorts that are not explicitly defined as part of any partition\r
-   (thus "unconfigured") to communicate with any other EndPort. Otherwise, it\r
-   will let these EndPorts send packets to all other EndPorts.\r
-\r
-Functionality:\r
-\r
-1. The policy should be updated:\r
-   - during SM bringup\r
-   - after kill -HUP\r
-   - through SNMP (once it is supported)\r
-\r
-2. Partition tables will be updated on full sweep (new port/trap etc).\r
-   As a first step, the policy feasibility should be\r
-   verified. Feasibility could be limited by the EndPorts supports for\r
-   number of partitions, etc. Unrealizable policy should be reported\r
-   and extra rules ignored after providing error messages.\r
-\r
-3. Each EndPort will be assigned P_Keys as follows:\r
-\r
-   a. Default partition group limited membership as defined by rule #4 below.\r
-     (only the SM port will get 0xffff).\r
-\r
-   b. P_Keys for all partition groups it is part of as defined in\r
-      the policy.\r
-\r
-   c. P_Key update will preserve index for the existing P_Keys on the\r
-      port. If port has limited resources that will require reuse of,\r
-      on index a message will be provided and some of the settings will be\r
-      ommitted. P_Key indexes will not change under any circumstances.\r
-\r
-4. Each Switch Leaf Port (a switch port that is connected to an\r
-   EndPort) should be configured according to the same rules that\r
-   apply to the EndPort connected to that switch port.\r
-   This actually enables unauthorized port isolation (with future\r
-   usage of M_Key and ProtectBits).\r
-\r
-5. Policy entries matching a non EndPort will be flagged as\r
-   erroneous in the log file and ignored.\r
-\r
-6. At the end of the P_Key setting phase, a check for successful\r
-   setting should be made.\r
-   Errors should be clearly logged and cause a new sweep.\r
-\r
-7. Each partition that is marked to support IPoIB should define a\r
-   broadcast MGRP. If the partition does not support IPoIB, it should\r
-   define a dummy MGRP with parameters blocking IPoIB drivers from\r
-   registering to it.\r
-\r
-Phase 2 functionality:\r
-\r
-The partition policy should be considered during the routing such that\r
-links are associated with particular partition or a set of\r
-partitions. Policy should be enhanced to provide hints for how to do\r
-that (correlating to QoS too). The exact algorithm is TBD.\r
-\r
diff --git a/branches/opensm_3/user/doc/OpenSM_RN.pdf b/branches/opensm_3/user/doc/OpenSM_RN.pdf
deleted file mode 100644 (file)
index 700924f..0000000
Binary files a/branches/opensm_3/user/doc/OpenSM_RN.pdf and /dev/null differ
diff --git a/branches/opensm_3/user/doc/OpenSM_UM.pdf b/branches/opensm_3/user/doc/OpenSM_UM.pdf
deleted file mode 100644 (file)
index ae32826..0000000
Binary files a/branches/opensm_3/user/doc/OpenSM_UM.pdf and /dev/null differ
diff --git a/branches/opensm_3/user/doc/QoS_management_in_OpenSM.txt b/branches/opensm_3/user/doc/QoS_management_in_OpenSM.txt
deleted file mode 100644 (file)
index fef8a62..0000000
+++ /dev/null
@@ -1,492 +0,0 @@
-\r
-                    QoS Management in OpenSM\r
-\r
-==============================================================================\r
- Table of contents\r
-==============================================================================\r
-\r
-1. Overview\r
-2. Full QoS Policy File\r
-3. Simplified QoS Policy Definition\r
-4. Policy File Syntax Guidelines\r
-5. Examples of Full Policy File\r
-6. Simplified QoS Policy - Details and Examples\r
-7. SL2VL Mapping and VL Arbitration\r
-\r
-\r
-==============================================================================\r
- 1. Overview\r
-==============================================================================\r
-\r
-When QoS in OpenSM is enabled (-Q or --qos), OpenSM looks for QoS Policy file.\r
-The default name of OpenSM QoS policy file is\r
-/usr/local/etc/opensm/qos-policy.conf. The default may be changed by using -Y\r
-or --qos_policy_file option with OpenSM.\r
-\r
-During fabric initialization and at every heavy sweep OpenSM parses the QoS\r
-policy file, applies its settings to the discovered fabric elements, and\r
-enforces the provided policy on client requests. The overall flow for such\r
-requests is:\r
- - The request is matched against the defined matching rules such that the\r
-   QoS Level definition is found.\r
- - Given the QoS Level, path(s) search is performed with the given\r
-   restrictions imposed by that level.\r
-\r
-There are two ways to define QoS policy:\r
- - Full policy, where the policy file syntax provides an administrator\r
-   various ways to match PathRecord/MultiPathRecord (PR/MPR) request and\r
-   enforce various QoS constraints on the requested PR/MPR\r
- - Simplified QoS policy definition, where an administrator would be able to\r
-   match PR/MPR requests by various ULPs and applications running on top of\r
-   these ULPs.\r
-\r
-While the full policy syntax is very flexible, in many cases the simplified\r
-policy definition would be sufficient.\r
-\r
-\r
-==============================================================================\r
- 2. Full QoS Policy File\r
-==============================================================================\r
-\r
-QoS policy file has the following sections:\r
-\r
-I) Port Groups (denoted by port-groups).\r
-This section defines zero or more port groups that can be referred later by\r
-matching rules (see below). Port group lists ports by:\r
-  - Port GUID\r
-  - Port name, which is a combination of NodeDescription and IB port number\r
-  - PKey, which means that all the ports in the subnet that belong to\r
-    partition with a given PKey belong to this port group\r
-  - Partition name, which means that all the ports in the subnet that belong\r
-    to partition with a given name belong to this port group\r
-  - Node type, where possible node types are: CA, SWITCH, ROUTER, ALL, and\r
-    SELF (SM's port).\r
-\r
-II) QoS Setup (denoted by qos-setup).\r
-This section describes how to set up SL2VL and VL Arbitration tables on\r
-various nodes in the fabric.\r
-However, this is not supported in OpenSM currently.\r
-SL2VL and VLArb tables should be configured in the OpenSM options file\r
-(default location - /usr/local/etc/opensm/opensm.conf).\r
-\r
-III) QoS Levels (denoted by qos-levels).\r
-Each QoS Level defines Service Level (SL) and a few optional fields:\r
-  - MTU limit\r
-  - Rate limit\r
-  - PKey\r
-  - Packet lifetime\r
-When path(s) search is performed, it is done with regards to restriction that\r
-these QoS Level parameters impose.\r
-One QoS level that is mandatory to define is a DEFAULT QoS level. It is\r
-applied to a PR/MPR query that does not match any existing match rule.\r
-Similar to any other QoS Level, it can also be explicitly referred by any\r
-match rule.\r
-\r
-IV) QoS Matching Rules (denoted by qos-match-rules).\r
-Each PathRecord/MultiPathRecord query that OpenSM receives is matched against\r
-the set of matching rules. Rules are scanned in order of appearance in the QoS\r
-policy file such as the first match takes precedence.\r
-Each rule has a name of QoS level that will be applied to the matching query.\r
-A default QoS level is applied to a query that did not match any rule.\r
-Queries can be matched by:\r
- - Source port group (whether a source port is a member of a specified group)\r
- - Destination port group (same as above, only for destination port)\r
- - PKey\r
- - QoS class\r
- - Service ID\r
-To match a certain matching rule, PR/MPR query has to match ALL the rule's\r
-criteria. However, not all the fields of the PR/MPR query have to appear in\r
-the matching rule.\r
-For instance, if the rule has a single criterion - Service ID, it will match\r
-any query that has this Service ID, disregarding rest of the query fields.\r
-However, if a certain query has only Service ID (which means that this is the\r
-only bit in the PR/MPR component mask that is on), it will not match any rule\r
-that has other matching criteria besides Service ID.\r
-\r
-\r
-==============================================================================\r
- 3. Simplified QoS Policy Definition\r
-==============================================================================\r
-\r
-Simplified QoS policy definition comprises of a single section denoted by\r
-qos-ulps. Similar to the full QoS policy, it has a list of match rules and\r
-their QoS Level, but in this case a match rule has only one criterion - its\r
-goal is to match a certain ULP (or a certain application on top of this ULP)\r
-PR/MPR request, and QoS Level has only one constraint - Service Level (SL).\r
-The simplified policy section may appear in the policy file in combine with\r
-the full policy, or as a stand-alone policy definition.\r
-See more details and list of match rule criteria below.\r
-\r
-\r
-==============================================================================\r
- 4. Policy File Syntax Guidelines\r
-==============================================================================\r
-\r
-- Empty lines are ignored.\r
-- Leading and trailing blanks, as well as empty lines, are ignored, so\r
-  the indentation in the example is just for better readability.\r
-- Comments are started with the pound sign (#) and terminated by EOL.\r
-- Any keyword should be the first non-blank in the line, unless it's a\r
-  comment.\r
-- Keywords that denote section/subsection start have matching closing\r
-  keywords.\r
-- Having a QoS Level named "DEFAULT" is a must - it is applied to PR/MPR\r
-  requests that didn't match any of the matching rules.\r
-- Any section/subsection of the policy file is optional.\r
-\r
-\r
-==============================================================================\r
- 5. Examples of Full Policy File\r
-==============================================================================\r
-\r
-As mentioned earlier, any section of the policy file is optional, and\r
-the only mandatory part of the policy file is a default QoS Level.\r
-Here's an example of the shortest policy file:\r
-\r
-    qos-levels\r
-        qos-level\r
-            name: DEFAULT\r
-            sl: 0\r
-        end-qos-level\r
-    end-qos-levels\r
-\r
-Port groups section is missing because there are no match rules, which means\r
-that port groups are not referred anywhere, and there is no need defining\r
-them. And since this policy file doesn't have any matching rules, PR/MPR query\r
-won't match any rule, and OpenSM will enforce default QoS level.\r
-Essentially, the above example is equivalent to not having QoS policy file\r
-at all.\r
-\r
-The following example shows all the possible options and keywords in the\r
-policy file and their syntax:\r
-\r
-    #\r
-    # See the comments in the following example.\r
-    # They explain different keywords and their meaning.\r
-    #\r
-    port-groups\r
-\r
-        port-group # using port GUIDs\r
-            name: Storage\r
-            # "use" is just a description that is used for logging\r
-            #  Other than that, it is just a comment\r
-            use: SRP Targets\r
-            port-guid: 0x10000000000001, 0x10000000000005-0x1000000000FFFA\r
-            port-guid: 0x1000000000FFFF\r
-        end-port-group\r
-\r
-        port-group\r
-            name: Virtual Servers\r
-            # The syntax of the port name is as follows:\r
-            #   "node_description/Pnum".\r
-            # node_description is compared to the NodeDescription of the node,\r
-            # and "Pnum" is a port number on that node.\r
-            port-name: vs1 HCA-1/P1, vs2 HCA-1/P1\r
-        end-port-group\r
-\r
-        # using partitions defined in the partition policy\r
-        port-group\r
-            name: Partitions\r
-            partition: Part1\r
-            pkey: 0x1234\r
-        end-port-group\r
-\r
-        # using node types: CA, ROUTER, SWITCH, SELF (for node that runs SM)\r
-        # or ALL (for all the nodes in the subnet)\r
-        port-group\r
-            name: CAs and SM\r
-            node-type: CA, SELF\r
-        end-port-group\r
-\r
-    end-port-groups\r
-\r
-    qos-setup\r
-        # This section of the policy file describes how to set up SL2VL and VL\r
-        # Arbitration tables on various nodes in the fabric.\r
-        # However, this is not supported in OpenSM currently - the section is\r
-        # parsed and ignored. SL2VL and VLArb tables should be configured in the\r
-        # OpenSM options file (by default - /usr/local/etc/opensm/opensm.conf).\r
-    end-qos-setup\r
-\r
-    qos-levels\r
-\r
-        # Having a QoS Level named "DEFAULT" is a must - it is applied to\r
-        # PR/MPR requests that didn't match any of the matching rules.\r
-        qos-level\r
-            name: DEFAULT\r
-            use: default QoS Level\r
-            sl: 0\r
-        end-qos-level\r
-\r
-        # the whole set: SL, MTU-Limit, Rate-Limit, PKey, Packet Lifetime\r
-        qos-level\r
-            name: WholeSet\r
-            sl: 1\r
-            mtu-limit: 4\r
-            rate-limit: 5\r
-            pkey: 0x1234\r
-            packet-life: 8\r
-        end-qos-level\r
-\r
-    end-qos-levels\r
-\r
-    # Match rules are scanned in order of their apperance in the policy file.\r
-    # First matched rule takes precedence.\r
-    qos-match-rules\r
-\r
-        # matching by single criteria: QoS class\r
-        qos-match-rule\r
-            use: by QoS class\r
-            qos-class: 7-9,11\r
-            # Name of qos-level to apply to the matching PR/MPR\r
-            qos-level-name: WholeSet\r
-        end-qos-match-rule\r
-\r
-        # show matching by destination group and service id\r
-        qos-match-rule\r
-            use: Storage targets\r
-            destination: Storage\r
-            service-id: 0x10000000000001, 0x10000000000008-0x10000000000FFF\r
-            qos-level-name: WholeSet\r
-        end-qos-match-rule\r
-\r
-        qos-match-rule\r
-            source: Storage\r
-            use: match by source group only\r
-            qos-level-name: DEFAULT\r
-        end-qos-match-rule\r
-\r
-        qos-match-rule\r
-            use: match by all parameters\r
-            qos-class: 7-9,11\r
-            source: Virtual Servers\r
-            destination: Storage\r
-            service-id: 0x0000000000010000-0x000000000001FFFF\r
-            pkey: 0x0F00-0x0FFF\r
-            qos-level-name: WholeSet\r
-        end-qos-match-rule\r
-\r
-    end-qos-match-rules\r
-\r
-\r
-==============================================================================\r
- 6. Simplified QoS Policy - Details and Examples\r
-==============================================================================\r
-\r
-Simplified QoS policy match rules are tailored for matching ULPs (or some\r
-application on top of a ULP) PR/MPR requests. This section has a list of\r
-per-ULP (or per-application) match rules and the SL that should be enforced\r
-on the matched PR/MPR query.\r
-\r
-Match rules include:\r
- - Default match rule that is applied to PR/MPR query that didn't match any\r
-   of the other match rules\r
- - SDP\r
- - SDP application with a specific target TCP/IP port range\r
- - SRP with a specific target IB port GUID\r
- - RDS\r
- - iSER\r
- - iSER application with a specific target TCP/IP port range\r
- - IPoIB with a default PKey\r
- - IPoIB with a specific PKey\r
- - any ULP/application with a specific Service ID in the PR/MPR query\r
- - any ULP/application with a specific PKey in the PR/MPR query\r
- - any ULP/application with a specific target IB port GUID in the PR/MPR query\r
-\r
-Since any section of the policy file is optional, as long as basic rules of\r
-the file are kept (such as no referring to nonexisting port group, having\r
-default QoS Level, etc), the simplified policy section (qos-ulps) can serve\r
-as a complete QoS policy file.\r
-The shortest policy file in this case would be as follows:\r
-\r
-    qos-ulps\r
-        default  : 0 #default SL\r
-    end-qos-ulps\r
-\r
-It is equivalent to the previous example of the shortest policy file, and it\r
-is also equivalent to not having policy file at all.\r
-\r
-Below is an example of simplified QoS policy with all the possible keywords:\r
-\r
-    qos-ulps\r
-        default                       : 0 # default SL\r
-        sdp, port-num 30000           : 0 # SL for application running on top\r
-                                          # of SDP when a destination\r
-                                          # TCP/IPport is 30000\r
-        sdp, port-num 10000-20000     : 0\r
-        sdp                           : 1 # default SL for any other\r
-                                          # application running on top of SDP\r
-        rds                           : 2 # SL for RDS traffic\r
-        iser, port-num 900            : 0 # SL for iSER with a specific target\r
-                                          # port\r
-        iser                          : 3 # default SL for iSER\r
-        ipoib, pkey 0x0001            : 0 # SL for IPoIB on partition with\r
-                                          # pkey 0x0001\r
-        ipoib                         : 4 # default IPoIB partition,\r
-                                          # pkey=0x7FFF\r
-        any, service-id 0x6234        : 6 # match any PR/MPR query with a\r
-                                          # specific Service ID\r
-        any, pkey 0x0ABC              : 6 # match any PR/MPR query with a\r
-                                          # specific PKey\r
-        srp, target-port-guid 0x1234  : 5 # SRP when SRP Target is located on\r
-                                          # a specified IB port GUID\r
-        any, target-port-guid 0x0ABC-0xFFFFF : 6 # match any PR/MPR query with\r
-                                          # a specific target port GUID\r
-    end-qos-ulps\r
-\r
-\r
-Similar to the full policy definition, matching of PR/MPR queries is done in\r
-order of appearance in the QoS policy file such as the first match takes\r
-precedence, except for the "default" rule, which is applied only if the query\r
-didn't match any other rule.\r
-\r
-All other sections of the QoS policy file take precedence over the qos-ulps\r
-section. That is, if a policy file has both qos-match-rules and qos-ulps\r
-sections, then any query is matched first against the rules in the\r
-qos-match-rules section, and only if there was no match, the query is matched\r
-against the rules in qos-ulps section.\r
-\r
-Note that some of these match rules may overlap, so in order to use the\r
-simplified QoS definition effectively, it is important to understand how each\r
-of the ULPs is matched:\r
-\r
-6.1  IPoIB\r
-IPoIB query is matched by PKey. Default PKey for IPoIB partition is 0x7fff, so\r
-the following three match rules are equivalent:\r
-\r
-    ipoib              : <SL>\r
-    ipoib, pkey 0x7fff : <SL>\r
-    any,   pkey 0x7fff : <SL>\r
-\r
-6.2  SDP\r
-SDP PR query is matched by Service ID. The Service-ID for SDP is\r
-0x000000000001PPPP, where PPPP are 4 hex digits holding the remote TCP/IP Port\r
-Number to connect to. The following two match rules are equivalent:\r
-\r
-    sdp                                                   : <SL>\r
-    any, service-id 0x0000000000010000-0x000000000001ffff : <SL>\r
-\r
-6.3  RDS\r
-Similar to SDP, RDS PR query is matched by Service ID. The Service ID for RDS\r
-is 0x000000000106PPPP, where PPPP are 4 hex digits holding the remote TCP/IP\r
-Port Number to connect to. Default port number for RDS is 0x48CA, which makes\r
-a default Service-ID 0x00000000010648CA. The following two match rules are\r
-equivalent:\r
-\r
-    rds                                : <SL>\r
-    any, service-id 0x00000000010648CA : <SL>\r
-\r
-6.4  iSER\r
-Similar to RDS, iSER query is matched by Service ID, where the the Service ID\r
-is also 0x000000000106PPPP. Default port number for iSER is 0x0CBC, which makes\r
-a default Service-ID 0x0000000001060CBC. The following two match rules are\r
-equivalent:\r
-\r
-    iser                               : <SL>\r
-    any, service-id 0x0000000001060CBC : <SL>\r
-\r
-6.5  SRP\r
-Service ID for SRP varies from storage vendor to vendor, thus SRP query is\r
-matched by the target IB port GUID. The following two match rules are\r
-equivalent:\r
-\r
-    srp, target-port-guid 0x1234  : <SL>\r
-    any, target-port-guid 0x1234  : <SL>\r
-\r
-Note that any of the above ULPs might contain target port GUID in the PR\r
-query, so in order for these queries not to be recognized by the QoS manager\r
-as SRP, the SRP match rule (or any match rule that refers to the target port\r
-guid only) should be placed at the end of the qos-ulps match rules.\r
-\r
-6.6  MPI\r
-SL for MPI is manually configured by MPI admin. OpenSM is not forcing any SL\r
-on the MPI traffic, and that's why it is the only ULP that did not appear in\r
-the qos-ulps section.\r
-\r
-\r
-==============================================================================\r
- 7. SL2VL Mapping and VL Arbitration\r
-==============================================================================\r
-\r
-OpenSM cached options file has a set of QoS related configuration parameters,\r
-that are used to configure SL2VL mapping and VL arbitration on IB ports.\r
-These parameters are:\r
- - Max VLs: the maximum number of VLs that will be on the subnet.\r
- - High limit: the limit of High Priority component of VL Arbitration\r
-   table (IBA 7.6.9).\r
- - VLArb low table: Low priority VL Arbitration table (IBA 7.6.9) template.\r
- - VLArb high table: High priority VL Arbitration table (IBA 7.6.9) template.\r
- - SL2VL: SL2VL Mapping table (IBA 7.6.6) template. It is a list of VLs\r
-   corresponding to SLs 0-15 (Note that VL15 used here means drop this SL).\r
-\r
-There are separate QoS configuration parameters sets for various target types:\r
-CAs, routers, switch external ports, and switch's enhanced port 0. The names\r
-of such parameters are prefixed by "qos_<type>_" string. Here is a full list\r
-of the currently supported sets:\r
-\r
-    qos_ca_  - QoS configuration parameters set for CAs.\r
-    qos_rtr_ - parameters set for routers.\r
-    qos_sw0_ - parameters set for switches' port 0.\r
-    qos_swe_ - parameters set for switches' external ports.\r
-\r
-Here's the example of typical default values for CAs and switches' external\r
-ports (hard-coded in OpenSM initialization):\r
-\r
-    qos_ca_max_vls 15\r
-    qos_ca_high_limit 0\r
-    qos_ca_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0\r
-    qos_ca_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4\r
-    qos_ca_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-    qos_swe_max_vls 15\r
-    qos_swe_high_limit 0\r
-    qos_swe_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0\r
-    qos_swe_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4\r
-    qos_swe_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-VL arbitration tables (both high and low) are lists of VL/Weight pairs.\r
-Each list entry contains a VL number (values from 0-14), and a weighting value\r
-(values 0-255), indicating the number of 64 byte units (credits) which may be\r
-transmitted from that VL when its turn in the arbitration occurs. A weight\r
-of 0 indicates that this entry should be skipped. If a list entry is\r
-programmed for VL15 or for a VL that is not supported or is not currently\r
-configured by the port, the port may either skip that entry or send from any\r
-supported VL for that entry.\r
-\r
-Note, that the same VLs may be listed multiple times in the High or Low\r
-priority arbitration tables, and, further, it can be listed in both tables.\r
-\r
-The limit of high-priority VLArb table (qos_<type>_high_limit) indicates the\r
-number of high-priority packets that can be transmitted without an opportunity\r
-to send a low-priority packet. Specifically, the number of bytes that can be\r
-sent is high_limit times 4K bytes.\r
-\r
-A high_limit value of 255 indicates that the byte limit is unbounded.\r
-Note: if the 255 value is used, the low priority VLs may be starved.\r
-A value of 0 indicates that only a single packet from the high-priority table\r
-may be sent before an opportunity is given to the low-priority table.\r
-\r
-Keep in mind that ports usually transmit packets of size equal to MTU.\r
-For instance, for 4KB MTU a single packet will require 64 credits, so in order\r
-to achieve effective VL arbitration for packets of 4KB MTU, the weighting\r
-values for each VL should be multiples of 64.\r
-\r
-Below is an example of SL2VL and VL Arbitration configuration on subnet:\r
-\r
-    qos_ca_max_vls 15\r
-    qos_ca_high_limit 6\r
-    qos_ca_vlarb_high 0:4\r
-    qos_ca_vlarb_low 0:0,1:64,2:128,3:192,4:0,5:64,6:64,7:64\r
-    qos_ca_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-    qos_swe_max_vls 15\r
-    qos_swe_high_limit 6\r
-    qos_swe_vlarb_high 0:4\r
-    qos_swe_vlarb_low 0:0,1:64,2:128,3:192,4:0,5:64,6:64,7:64\r
-    qos_swe_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-In this example, there are 8 VLs configured on subnet: VL0 to VL7. VL0 is\r
-defined as a high priority VL, and it is limited to 6 x 4KB = 24KB in a single\r
-transmission burst. Such configuration would suilt VL that needs low latency\r
-and uses small MTU when transmitting packets. Rest of VLs are defined as low\r
-priority VLs with different weights, while VL4 is effectively turned off.\r
diff --git a/branches/opensm_3/user/doc/current-routing.txt b/branches/opensm_3/user/doc/current-routing.txt
deleted file mode 100644 (file)
index b767518..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-Current OpenSM Routing\r
-7/9/07\r
-\r
-OpenSM offers five routing engines:\r
-\r
-1.  Min Hop Algorithm - based on the minimum hops to each node where the\r
-path length is optimized.\r
-\r
-2.  UPDN Unicast routing algorithm - also based on the minimum hops to each\r
-node, but it is constrained to ranking rules. This algorithm should be chosen\r
-if the subnet is not a pure Fat Tree, and deadlock may occur due to a\r
-loop in the subnet.\r
-\r
-3.  Fat-tree Unicast routing algorithm - this algorithm optimizes routing\r
-of fat-trees for congestion-free "shift" communication pattern.\r
-It should be chosen if a subnet is a symmetrical fat-tree.\r
-Similar to UPDN routing, Fat-tree routing is credit-loop-free.\r
-\r
-4. LASH unicast routing algorithm - uses Infiniband virtual layers\r
-(SL) to provide deadlock-free shortest-path routing while also\r
-distributing the paths between layers. LASH is an alternative\r
-deadlock-free topology-agnostic routing algorithm to the non-minimal\r
-UPDN algorithm avoiding the use of a potentially congested root node.\r
-\r
-5. DOR Unicast routing algorithm - based on the Min Hop algorithm, but\r
-avoids port equalization except for redundant links between the same\r
-two switches.  This provides deadlock free routes for hypercubes when\r
-the fabric is cabled as a hypercube and for meshes when cabled as a\r
-mesh (see details below).\r
-\r
-OpenSM provides an optional unicast routing cache (enabled by -A or\r
---ucast_cache options). When enabled, unicast routing cache prevents\r
-routing recalculation (which is a heavy task in a large cluster) when\r
-there was no topology change detected during the heavy sweep, or when\r
-the topology change does not require new routing calculation, e.g. when\r
-one or more CAs/RTRs/leaf switches going down, or one or more of these\r
-nodes coming back after being down.\r
-A very common case that is handled by the unicast routing cache is host\r
-reboot, which otherwise would cause two full routing recalculations: one\r
-when the host goes down, and the other when the host comes back online.\r
-\r
-OpenSM also supports a file method which can load routes from a table. See\r
-modular-routing.txt for more information on this.\r
-\r
-The basic routing algorithm is comprised of two stages:\r
-1. MinHop matrix calculation\r
-   How many hops are required to get from each port to each LID ?\r
-   The algorithm to fill these tables is different if you run standard\r
-(min hop) or Up/Down.\r
-   For standard routing, a "relaxation" algorithm is used to propagate\r
-min hop from every destination LID through neighbor switches\r
-   For Up/Down routing, a BFS from every target is used. The BFS tracks link\r
-direction (up or down) and avoid steps that will perform up after a down\r
-step was used.\r
-\r
-2. Once MinHop matrices exist, each switch is visited and for each target LID,\r
-a decision is made as to what port should be used to get to that LID.\r
-   This step is common to standard and Up/Down routing. Each port has a\r
-counter counting the number of target LIDs going through it.\r
-   When there are multiple alternative ports with same MinHop to a LID,\r
-the one with less previously assigned ports is selected.\r
-   If LMC > 0, more checks are added: Within each group of LIDs assigned to\r
-same target port,\r
-   a. use only ports which have same MinHop\r
-   b. first prefer the ones that go to different systemImageGuid (then\r
-the previous LID of the same LMC group)\r
-   c. if none - prefer those which go through another NodeGuid\r
-   d. fall back to the number of paths method (if all go to same node).\r
-\r
-\r
-Effect of Topology Changes\r
-\r
-OpenSM will preserve existing routing in any case where there is no change in\r
-the fabric switches unless the -r (--reassign_lids) option is specified.\r
-\r
--r\r
---reassign_lids\r
-          This option causes OpenSM to reassign LIDs to all\r
-          end nodes. Specifying -r on a running subnet\r
-          may disrupt subnet traffic.\r
-          Without -r, OpenSM attempts to preserve existing\r
-          LID assignments resolving multiple use of same LID.\r
-\r
-If a link is added or removed, OpenSM does not recalculate\r
-the routes that do not have to change. A route has to change\r
-if the port is no longer UP or no longer the MinHop. When routing changes\r
-are performed, the same algorithm for balancing the routes is invoked.\r
-\r
-In the case of using the file based routing, any topology changes are\r
-currently ignored The 'file' routing engine just loads the LFTs from the file\r
-specified, with no reaction to real topology. Obviously, this will not be able\r
-to recheck LIDs (by GUID) for disconnected nodes, and LFTs for non-existent\r
-switches will be skipped. Multicast is not affected by 'file' routing engine\r
-(this uses min hop tables).\r
-\r
-\r
-Min Hop Algorithm\r
------------------\r
-\r
-The Min Hop algorithm is invoked by default if no routing algorithm is\r
-specified.  It can also be invoked by specifying '-R minhop'.\r
-\r
-The Min Hop algorithm is divided into two stages: computation of\r
-min-hop tables on every switch and LFT output port assignment. Link\r
-subscription is also equalized with the ability to override based on\r
-port GUID. The latter is supplied by:\r
-\r
--i <equalize-ignore-guids-file>\r
--ignore-guids <equalize-ignore-guids-file>\r
-          This option provides the means to define a set of ports\r
-          (by guids) that will be ignored by the link load\r
-          equalization algorithm.\r
-\r
-LMC awareness routes based on (remote) system or switch basis.\r
-\r
-\r
-UPDN Routing Algorithm\r
-----------------------\r
-\r
-Purpose of UPDN Algorithm\r
-\r
-The UPDN algorithm is designed to prevent deadlocks from occurring in loops\r
-of the subnet. A loop-deadlock is a situation in which it is no longer\r
-possible to send data between any two hosts connected through the loop. As\r
-such, the UPDN routing algorithm should be used if the subnet is not a pure\r
-Fat Tree, and one of its loops may experience a deadlock (due, for example,\r
-to high pressure).\r
-\r
-The UPDN algorithm is based on the following main stages:\r
-\r
-1.  Auto-detect root nodes - based on the CA hop length from any switch in\r
-the subnet, a statistical histogram is built for each switch (hop num vs\r
-number of occurrences). If the histogram reflects a specific column (higher\r
-than others) for a certain node, then it is marked as a root node. Since\r
-the algorithm is statistical, it may not find any root nodes. The list of\r
-the root nodes found by this auto-detect stage is used by the ranking\r
-process stage.\r
-\r
-    Note 1: The user can override the node list manually.\r
-    Note 2: If this stage cannot find any root nodes, and the user did not\r
-            specify a guid list file, OpenSM defaults back to the Min Hop\r
-            routing algorithm.\r
-\r
-2.  Ranking process - All root switch nodes (found in stage 1) are assigned\r
-a rank of 0. Using the BFS algorithm, the rest of the switch nodes in the\r
-subnet are ranked incrementally. This ranking aids in the process of enforcing\r
-rules that ensure loop-free paths.\r
-\r
-3.  Min Hop Table setting - after ranking is done, a BFS algorithm is run from\r
-each (CA or switch) node in the subnet. During the BFS process, the FDB table\r
-of each switch node traversed by BFS is updated, in reference to the starting\r
-node, based on the ranking rules and guid values.\r
-\r
-At the end of the process, the updated FDB tables ensure loop-free paths\r
-through the subnet.\r
-\r
-Note: Up/Down routing does not allow LID routing communication between\r
-switches that are located inside spine "switch systems".\r
-The reason is that there is no way to allow a LID route between them\r
-that does not break the Up/Down rule.\r
-One ramification of this is that you cannot run SM on switches other\r
-than the leaf switches of the fabric.\r
-\r
-\r
-UPDN Algorithm Usage\r
-\r
-Activation through OpenSM\r
-\r
-Use '-R updn' option (instead of old '-u') to activate the UPDN algorithm.\r
-Use `-a <guid_list_file>' for adding an UPDN guid file that contains the\r
-root nodes for ranking.\r
-If the `-a' option is not used, OpenSM uses its auto-detect root nodes\r
-algorithm.\r
-\r
-Notes on the guid list file:\r
-1.   A valid guid file specifies one guid in each line. Lines with an invalid\r
-format will be discarded.\r
-2.   The user should specify the root switch guids. However, it is also\r
-possible to specify CA guids; OpenSM will use the guid of the switch (if\r
-it exists) that connects the CA to the subnet as a root node.\r
-\r
-\r
-To learn more about deadlock-free routing, see the article\r
-"Deadlock Free Message Routing in Multiprocessor Interconnection Networks"\r
-by William J Dally and Charles L Seitz (1985).\r
-\r
-\r
-Fat-tree Routing Algorithm\r
---------------------------\r
-\r
-Purpose:\r
-\r
-The fat-tree algorithm optimizes routing for "shift" communication pattern.\r
-It should be chosen if a subnet is a symmetrical or almost symmetrical\r
-fat-tree of various types.\r
-It supports not just K-ary-N-Trees, by handling for non-constant K,\r
-cases where not all leafs (CAs) are present, any Constant\r
-Bisectional Ratio (CBB) ratio.  As in UPDN, fat-tree also prevents\r
-credit-loop-deadlocks.\r
-\r
-If the root guid file is not provided ('-a' or '--root_guid_file' options),\r
-the topology has to be pure fat-tree that complies with the following rules:\r
-  - Tree rank should be between two and eight (inclusively)\r
-  - Switches of the same rank should have the same number\r
-    of UP-going port groups*, unless they are root switches,\r
-    in which case the shouldn't have UP-going ports at all.\r
-  - Switches of the same rank should have the same number\r
-    of DOWN-going port groups, unless they are leaf switches.\r
-  - Switches of the same rank should have the same number\r
-    of ports in each UP-going port group.\r
-  - Switches of the same rank should have the same number\r
-    of ports in each DOWN-going port group.\r
-  - All the CAs have to be at the same tree level (rank).\r
-\r
-If the root guid file is provided, the topology doesn't have to be pure\r
-fat-tree, and it should only comply with the following rules:\r
-  - Tree rank should be between two and eight (inclusively)\r
-  - All the Compute Nodes** have to be at the same tree level (rank).\r
-    Note that non-compute node CAs are allowed here to be at different\r
-    tree ranks.\r
-\r
-* ports that are connected to the same remote switch are referenced as\r
-'port group'.\r
-** list of compute nodes (CNs) can be specified by '-u' or '--cn_guid_file'\r
-OpenSM options.\r
-\r
-Note that although fat-tree algorithm supports trees with non-integer CBB\r
-ratio, the routing will not be as balanced as in case of integer CBB ratio.\r
-In addition to this, although the algorithm allows leaf switches to have any\r
-number of CAs, the closer the tree is to be fully populated, the more effective\r
-the "shift" communication pattern will be.\r
-In general, even if the root list is provided, the closer the topology to a\r
-pure and symmetrical fat-tree, the more optimal the routing will be.\r
-\r
-The algorithm also dumps compute node ordering file (opensm-ftree-ca-order.dump)\r
-in the same directory where the OpenSM log resides. This ordering file provides\r
-the CN order that may be used to create efficient communication pattern, that\r
-will match the routing tables.\r
-\r
-Routing between non-CN nodes\r
-\r
-\r
-The use of the cn_guid_file option allows non-CN nodes to be located on different levels in the fat tree.\r
-In such case, it is not guaranteed that the Fat Tree algorithm will route between two non-CN nodes.\r
-In the scheme below, N1, N2 and N3 are non-CN nodes. Although all the CN have routes to and from them,\r
-there will not necessarily be a route between N1,N2 and N3.\r
-Such routes would require to use at least one of the Switch the wrong way around\r
-(In fact, go out of one of the top Switch through a downgoing port while we are supposed to go up).\r
-\r
-  Spine1   Spine2    Spine 3\r
-   / \     /  |  \    /   \\r
-  /   \   /   |   \  /     \\r
- N1  Switch   N2  Switch    N3\r
-      /|\          /|\\r
-     / | \        / | \\r
-    Going down to compute nodes\r
-\r
-To solve this problem, a list of non-CN nodes can be specified by \'-G\' or \'--io_guid_file\' option.\r
-Theses nodes will be allowed to use switches the wrong way around a specific number of times (specified by \'-H\' or \'--max_reverse_hops\'.\r
-With the proper max_reverse_hops and io_guid_file values, you can ensure full connectivity in the Fat Tree.\r
-\r
-In the scheme above, with a max_reverse_hop of 1, routes will be instanciated between N1<->N2 and N2<->N3.\r
-With a max_reverse_hops value of 2, N1,N2 and N3 will all have routes between them.\r
-\r
-Please note that using max_reverse_hops creates routes that use the switch in a counter-stream way.\r
-This option should never be used to connect nodes with high bandwidth traffic between them ! It should only be used\r
-to allow connectivity for HA purposes or similar.\r
-Also having routes the other way around can in theory cause credit loops.\r
-\r
-Use these options with extreme care !\r
-\r
-\r
-Usage:\r
-\r
-Activation through OpenSM\r
-\r
-Use '-R ftree' option to activate the fat-tree algorithm.\r
-\r
-Note: LMC > 0 is not supported by fat-tree routing. If this is\r
-specified, the default routing algorithm is invoked instead.\r
-\r
-\r
-LASH Routing Algorithm\r
-----------------------\r
-\r
-LASH is an acronym for LAyered SHortest Path Routing. It is a\r
-deterministic shortest path routing algorithm that enables topology\r
-agnostic deadlock-free routing within communication networks.\r
-\r
-When computing the routing function, LASH analyzes the network\r
-topology for the shortest-path routes between all pairs of sources /\r
-destinations and groups these paths into virtual layers in such a way\r
-as to avoid deadlock.\r
-\r
-Note LASH analyzes routes and ensures deadlock freedom between switch\r
-pairs. The link from HCA between and switch does not need virtual\r
-layers as deadlock will not arise between switch and HCA.\r
-\r
-In more detail, the algorithm works as follows:\r
-\r
-1) LASH determines the shortest-path between all pairs of source /\r
-destination switches. Note, LASH ensures the same SL is used for all\r
-SRC/DST - DST/SRC pairs and there is no guarantee that the return\r
-path for a given DST/SRC will be the reverse of the route SRC/DST.\r
-\r
-2) LASH then begins an SL assignment process where a route is assigned\r
-to a layer (SL) if the addition of that route does not cause deadlock\r
-within that layer. This is achieved by maintaining and analysing a\r
-channel dependency graph for each layer. Once the potential addition\r
-of a path could lead to deadlock, LASH opens a new layer and continues\r
-the process.\r
-\r
-3) Once this stage has been completed, it is highly likely that the\r
-first layers processed will contain more paths than the latter ones.\r
-To better balance the use of layers, LASH moves paths from one layer\r
-to another so that the number of paths in each layer averages out.\r
-\r
-Note, the implementation of LASH in opensm attempts to use as few layers\r
-as possible. This number can be less than the number of actual layers\r
-available.\r
-\r
-In general LASH is a very flexible algorithm. It can, for example,\r
-reduce to Dimension Order Routing in certain topologies, it is topology\r
-agnostic and fares well in the face of faults.\r
-\r
-It has been shown that for both regular and irregular topologies, LASH\r
-outperforms Up/Down. The reason for this is that LASH distributes the\r
-traffic more evenly through a network, avoiding the bottleneck issues\r
-related to a root node and always routes shortest-path.\r
-\r
-The algorithm was developed by Simula Research Laboratory.\r
-\r
-To learn more about LASH and the flexibility behind it, the requirement\r
-for layers, performance comparisons to other algorithms, see the\r
-following articles:\r
-\r
-"Layered Routing in Irregular Networks", Lysne et al, IEEE\r
-Transactions on Parallel and Distributed Systems, VOL.16, No12,\r
-December 2005.\r
-\r
-"Routing for the ASI Fabric Manager", Solheim et al. IEEE\r
-Communications Magazine, Vol.44, No.7, July 2006.\r
-\r
-"Layered Shortest Path (LASH) Routing in Irregular System Area\r
-Networks", Skeie et al. IEEE Computer Society Communication\r
-Architecture for Clusters 2002.\r
-\r
-\r
-Use '-R lash -Q ' option to activate the LASH algorithm.\r
-\r
-Note: QoS support has to be turned on in order that SL/VL mappings are\r
-used.\r
-\r
-Note: LMC > 0 is not supported by the LASH routing. If this is\r
-specified, the default routing algorithm is invoked instead.\r
-\r
-For open regular cartesian meshes the DOR algorithm is the ideal\r
-routing algorithm. For toroidal meshes on the other hand there\r
-are routing loops that can cause deadlocks. LASH can be used to\r
-route these cases. The performance of LASH can be improved by\r
-preconditioning the mesh in cases where there are multiple links\r
-connecting switches and also in cases where the switches are not\r
-cabled consistently. An option exists for LASH to do this. To\r
-invoke this use '-R lash -Q --do_mesh_analysis'. This will\r
-add an additional phase that analyses the mesh to try to determine\r
-the dimension and size of a mesh. If it determines that the mesh\r
-looks like an open or closed cartesian mesh it reorders the ports\r
-in dimension order before the rest of the LASH algorithm runs.\r
-\r
-DOR Routing Algorithm\r
----------------------\r
-\r
-The Dimension Order Routing algorithm is based on the Min Hop\r
-algorithm and so uses shortest paths.  Instead of spreading traffic\r
-out across different paths with the same shortest distance, it chooses\r
-among the available shortest paths based on an ordering of dimensions.\r
-Each port must be consistently cabled to represent a hypercube\r
-dimension or a mesh dimension.  Paths are grown from a destination\r
-back to a source using the lowest dimension (port) of available paths\r
-at each step.  This provides the ordering necessary to avoid deadlock.\r
-When there are multiple links between any two switches, they still\r
-represent only one dimension and traffic is balanced across them\r
-unless port equalization is turned off.  In the case of hypercubes,\r
-the same port must be used throughout the fabric to represent the\r
-hypercube dimension and match on both ends of the cable.  In the case\r
-of meshes, the dimension should consistently use the same pair of\r
-ports, one port on one end of the cable, and the other port on the\r
-other end, continuing along the mesh dimension.\r
-\r
-Use '-R dor' option to activate the DOR algorithm.\r
diff --git a/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt b/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt
deleted file mode 100644 (file)
index fb27b27..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-                        OpenSM Release Notes 3.3\r
-                       =============================\r
-\r
-Version: OpenSM 3.3.x\r
-Repo:    git://git.openfabrics.org/~sashak/management.git\r
-Date:    Dec 2009\r
-\r
-1 Overview\r
-----------\r
-This document describes the contents of the OpenSM 3.3 release.\r
-OpenSM is an InfiniBand compliant Subnet Manager and Administration,\r
-and runs on top of OpenIB. The OpenSM version for this release\r
-is opensm-3.3.6.\r
-\r
-This document includes the following sections:\r
-1 This Overview section (describing new features and software\r
-  dependencies)\r
-2 Known Issues And Limitations\r
-3 Unsupported IB compliance statements\r
-4 Bug Fixes\r
-5 Main Verification Flows\r
-6 Qualified Software Stacks and Devices\r
-\r
-1.1 Major New Features\r
-\r
-* Mesh Analysis for LASH routing algorithm.\r
-  The performance of LASH can be improved by preconditioning the mesh in\r
-  cases where there are multiple links connecting switches and also in\r
-  cases where the switches are not cabled consistently.\r
-  Activated with --do_mesh_analysis command line and config file option.\r
-\r
-* Reloadable OpenSM configuration (preliminary implemented)\r
-  This is possible now to reload OpenSM configuration parameters on the\r
-  fly without restarting.\r
-\r
-* Routing paths sorted balancing (for UpDown and MinHops)\r
-  This sorts the port order in which routing paths balancing is performed\r
-  by OpenSM. Helps to improve performance dramatically (40-50%) for most\r
-  popular application communication patterns.\r
-  To overwrite this behavior use --guid_routing_order_file command line\r
-  option.\r
-\r
-* Weighted Lid Matrices calculation (for UpDown, MinHop and DOR).\r
-  This low level routing fine-tuning feature provides the means to\r
-  define a weighting factor per port for customizing the least weight\r
-  hops for the routing. Custom weights are provided using file specified\r
-  with '--hop_weights_file' command line option.\r
-\r
-* I/O nodes connectivity (for FatTree).\r
-  This provides possibility to define the set of I/O nodes for the\r
-  Fat-Tree routing algorithm. I/O nodes are non-CN nodes allowed to use\r
-  up to N (specified using --max_reverse_hops) switches the wrong way\r
-  around to improve connectivity. I/O nodes list is provided using file\r
-  and --io_guid_file command line option.\r
-\r
-* MGID to MLID compression - infrastructure for many MGIDs to single MLID\r
-  compression. This becomes helpful when number of multicast groups\r
-  exceeds subnet's MLID routing capability (normally 1024 groups). In such\r
-  cases many multicast groups (MGID) can be routed using same MLID value.\r
-\r
-* Many code improvements, optimizations and cleanups.\r
-\r
-* Windows support (early stage).\r
-\r
-1.2 Minor New Features:\r
-\r
-cde0c0d opensm: Convert remaining helper routines for GID printing format\r
-bc5743c opensm: Add support for MaxCreditHint and LinkRoundTripLatency to\r
-       osm_dump_port_info\r
-6cd34ab opensm: Add Dell to known vendor list\r
-003d6bd opensm: Add more info for traps 144 and 256-259 in osm_dump_notice\r
-5b0c5de opensm/osm_ucat_ftree.c Enhance min hops counters usage\r
-0715b92 ib_types.h: Add ib_switch_info_get_state_opt_sl2vlmapping routine\r
-2ddba79 opensm: Remove some __ and __osm_ prefixes\r
-ea0691f opensm/iba/ib_types.h: Add PortXmit/RcvDataSL PerfMgt attributes\r
-9c79be5 ib_types.h: Adding BKEY violation trap (259)\r
-c608ea6 opensm: Add and utilize ib_gid_is_notzero routine\r
-b639e64 opensm: Handle trap repress on trap 144 generation\r
-b034205 Add pkey table support to osm_get_all_port_attr\r
-876605b opensm/ib_types.h: Add attribute ID for PortCountersExtended\r
-aae3bbc opensm: PortInfo requests for discovered switches\r
-0147b09 opensm/osm_lid_mgr: use single array for used_lids\r
-a9225b0 opensm/Makefile.am: remove osm_build_id.h junk file generation\r
-8e3a57d opensm/osm_console.c: Add list of SMs to status command\r
-3d664b9 opensm/osm_console.c : Added dump_portguid function to console to\r
-       generate a list of port guids matching one or more regexps\r
-85b35bc opensm/osm_helper.c: print port number as decimal\r
-8674cb7 opensm: sort port order for routing by switch loads\r
-80c0d48 opensm: rescan config file even in standby\r
-8b7aa5e opensm/osm_subnet.c enable log_max_size opt update\r
-8558ee5 opensm/include/iba/ib_types.h: Add xmit_wait for PortCounters\r
-ecde2f7 opensm/osm_subnet.c support subnet configuration rescan and update\r
-58c45e4 opensm/osm_log.c save log_max_size in subnet opt in MB\r
-cf88e93 opensm: Add new partition keyword for all hca, switches and routers\r
-4bfd4e0 opensm: remove libibcommon build dependencies\r
-3718fc4 opensm/event_plugin: link opensm with -rdynamic flag\r
-587ce14 opensm/osm_inform.c report IB traps to plugin\r
-ced5a6e opensm/opensm/osm_console.c: move reporting of plugins to "status"\r
-       command.\r
-696aca2 opensm: Add configurable retries for transactions\r
-0d932ff opensm/osm_sa_mcmember_record.c: optimization in zero mgid comparison\r
-254c2ef opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, set init\r
-       failure on PKeyTable and QoS initialization failure\r
-83bd10a opensm: Reduce heap consumption by multicast routing tables (MFTs)\r
-cd33bc5 opensm: Add some additional HP vendor IDs/OUIs\r
-f78ec3a opensm/osm_mcast_tbl.(h c): Make max_mlid_ho be maximum MLID configured\r
-2d13530 opensm: Add infrastructure support for PortInfo\r
-       IsMulticastPkeyTrapSuppressionSupported\r
-3ace760 opensm: Reduce heap consumption by unicast routing tables (LFTs)\r
-eec568e osmtest: Add SA get PathRecord stress test\r
-aabc476 opensm: Add infrastructure support for more newly allocated PortInfo\r
-       CapabilityMask bits\r
-c83c331 opensm: improve multicast re-routing requests processing\r
-46db92f opensm: Parallelize (Stripe) MFT sets across switches\r
-00c6a6e opensm: Parallelize (Stripe) LFT sets across switches\r
-e21c651 opensm/osm_base.h: Add new SA ClassPortInfo:CapabilityMask2 bit\r
-       allocations\r
-09056b1 opensm/ib_types.h: Add CounterSelect2 field to PortCounters attribute\r
-6a63003 opensm: Add ability to configure SMSL\r
-25f071f opensm/lash: Set minimum VL for LASH to use\r
-622d853 opensm/osm_ucast_ftree.cd: Added support for same level links\r
-8146ba7 opensm: Add new Sun vendor ID\r
-1d7dd18 opensm/osm_ucast_ftree.c: Enhanced Fat-Tree algorithm\r
-e07a2f1 Add LMC support to DOR routing\r
-1acfe8a opensm: Add SuperMicro to list of recognized vendors\r
-f02f40e opensm: implement 'connect_roots' option in fat-tree routing\r
-748d41e opensm SA DB dump/restore: added option to dump SA DB on every sweep\r
-b03a95e complib/cl_fleximap: add cl_fmap_match() function\r
-b7a8a87 opensm/include/iba/ib_types.h: adding Congestion Control definitions\r
-fa356f8 opensm: Add support for optimized SLtoVLMappingTable programming\r
-8aaae91 Dimension port order file support\r
-7662eec opensm: Add option to specify prefix to syslog messages\r
-2382cf3 opensm: Add update_desc command to opensm console\r
-\r
-1.3 Library API Changes\r
-\r
-  None\r
-\r
-1.4 Software Dependencies\r
-\r
-OpenSM depends on the installation of libibumad package (distributed as\r
-part of OFA IB management together with OpenSM) and IB stack presence,\r
-in particular libibumad uses user_mad kernel interface ('ib_umad' kernel\r
-module). The qualified driver versions are provided in Table 2,\r
-"Qualified IB Stacks".\r
-\r
-Also, building of QoS manager policy file parser requires flex, and either\r
-bison or byacc installed.\r
-\r
-1.5 Supported Devices Firmware\r
-\r
-The main task of OpenSM is to initialize InfiniBand devices. The\r
-qualified devices and their corresponding firmware versions\r
-are listed in Table 3.\r
-\r
-2 Known Issues And Limitations\r
-------------------------------\r
-\r
-* No Service / Key associations:\r
-  There is no way to manage Service access by Keys.\r
-\r
-* No SM to SM SMDB synchronization:\r
-  Puts the burden of re-registering services, multicast groups, and\r
-  inform-info on the client application (or IB access layer core).\r
-\r
-3 Unsupported IB Compliance Statements\r
---------------------------------------\r
-The following section lists all the IB compliance statements which\r
-OpenSM does not support. Please refer to the IB specification for detailed\r
-information regarding each compliance statement.\r
-\r
-* C14-22 (Authentication):\r
-  M_Key M_KeyProtectBits and M_KeyLeasePeriod shall be set in one\r
-  SubnSet method. As a work-around, an OpenSM option is provided for\r
-  defining the protect bits.\r
-\r
-* C14-67 (Authentication):\r
-  On SubnGet(SMInfo) and SubnSet(SMInfo) - if M_Key is not zero then\r
-  the SM shall generate a SubnGetResp if the M_Key matches, or\r
-  silently drop the packet if M_Key does not match.\r
-\r
-* C15-0.1.23.4 (Authentication):\r
-  InformInfoRecords shall always be provided with the QPN set to 0,\r
-  except for the case of a trusted request, in which case the actual\r
-  subscriber QPN shall be returned.\r
-\r
-* o13-17.1.2 (Event-FWD):\r
-  If no permission to forward, the subscription should be removed and\r
-  no further forwarding should occur.\r
-\r
-* C14-24.1.1.5 and C14-62.1.1.22 (Initialization):\r
-  GUIDInfo - SM should enable assigning Port GUIDInfo.\r
-\r
-* C14-44 (Initialization):\r
-  If the SM discovers that it is missing an M_Key to update CA/RT/SW,\r
-  it should notify the higher level.\r
-\r
-* C14-62.1.1.12 (Initialization):\r
-  PortInfo:M_Key - Set the M_Key to a node based random value.\r
-\r
-* C14-62.1.1.13 (Initialization):\r
-  PortInfo:M_KeyProtectBits - set according to an optional policy.\r
-\r
-* C14-62.1.1.24 (Initialization):\r
-  SwitchInfo:DefaultPort - should be configured for random FDB.\r
-\r
-* C14-62.1.1.32 (Initialization):\r
-  RandomForwardingTable should be configured.\r
-\r
-* o15-0.1.12 (Multicast):\r
-  If the JoinState is SendOnlyNonMember = 1 (only), then the endport\r
-  should join as sender only.\r
-\r
-* o15-0.1.8 (Multicast):\r
-  If a request for creating an MCG with fields that cannot be met,\r
-  return ERR_REQ_INVALID (currently ignores SL and FlowLabelTClass).\r
-\r
-* C15-0.1.8.6 (SA-Query):\r
-  Respond to SubnAdmGetTraceTable - this is an optional attribute.\r
-\r
-* C15-0.1.13 Services:\r
-  Reject ServiceRecord create, modify or delete if the given\r
-  ServiceP_Key does not match the one included in the ServiceGID port\r
-  and the port that sent the request.\r
-\r
-* C15-0.1.14 (Services):\r
-  Provide means to associate service name and ServiceKeys.\r
-\r
-4 Bug Fixes\r
------------\r
-\r
-4.1 Major Bug Fixes\r
-\r
-18990fa opensm: set IS_SM bit during opensm init\r
-3551389 fix local port smlid in osm_send_trap144()\r
-a6de48d opensm/osm_link_mgr.c initialize SMSL\r
-82df467 opensm/osm_req.c: Shouldn't reveal port's MKey on Trap method\r
-45ebff9 opensm/osm_console_io.h: Modify osm_console_exit so only the\r
-       connection is killed, not the socket\r
-d10660a opensm/osm_req.c: In osm_send_trap144, set producer type according\r
-       to node type\r
-8a2d2dd opensm/osm_node_info_rcv.c: create physp for the newly discovered\r
-       port of the known node\r
-39b241f opensm/lid_mgr: fix duplicated lid assignment\r
-b44c398 opensm: invalidate routing cache when entering master state\r
-595f2e3 opensm: update LFTs when entering master\r
-8406c65 opensm: fix port chooser\r
-fa90512 opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM\r
-7ec9f7c opensm: discard multicast SA PR with wildcard DGID\r
-5cdb53f opensm/osm_sa_node_record.c use comp mask to match by LID or GUID\r
-55f9772 opensm: Return single PathRecord for SubnAdmGet with DGID/SGID wild\r
-       carded\r
-5ec0b5f opensm: compress IPV6 SNM groups to use a single MLID\r
-26e7e83 opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs\r
-fedc419 opensm: Multicast root switch calculation\r
-\r
-4.2 Other Bug Fixes\r
-\r
-4911e0b performance-manager-HOWTO.txt: Indicate master state\r
-86ccaa4 opensm/osm_pkey_mgr.c: Fix pkey endian in log message\r
-b79b079 opensm.8.in: Add mention of backing documentation for QoS policy\r
-       file and performance manager\r
-b4d92af opensm/osm_perfmgr.c: Eliminate duplicated error number\r
-a10b57a opensm/osm_ucast_ftree.c: lids are always handled in host order\r
-44273a2 opensm/osm_ucast_ftree.c: fixing bug in indexing\r
-5cd98f7 Fix further bugs around console closure and clean up code.\r
-6b34339 opensm/osm_opensm.c: add newline to log message\r
-68c241c send trap144 when local priority is higher than master priority\r
-6462999 opensm/osm_inform.c: In __osm_send_report, make sure p_report_madw\r
-       valid before using\r
-9b8561a opensm/console: Fixed osm_console poll to handle POLLHUP\r
-91d0700 osm_vendor_ibumad.c: In clear_madw, fix tid endian in message\r
-5a5136b osm_switch.h : Fixed wrong comment about return value of\r
-       osm_switch_set_hops\r
-c1ec8c0 osm_ucast_ftree.c: Removed useless initialization on switch indexes\r
-418d01f opensm/osm_helper.c: use single buffer in osm_dump_dr_smp()\r
-2c9153c opensm/osm_helper.c: consolidate dr path printing code\r
-048c447 opensm/osm_helper.c: return then log is inactive\r
-dd3ef0c opensm: Return error status when cl_disp_register fails\r
-0143bf7 opensm/osm_perfmgr.c: Improve assert in osm_pc_rcv_process\r
-6622504 osm_perfmgr.c: In osm_perfmgr_shutdown, add missing cl_disp_unregister\r
-7b66dee opensm: remove unneeded anymore physp initializations\r
-f11274a opensm/partition-config.txt: Update for defmember feature\r
-d240e7d opensm/osm_sm_state_mgr.c: Remove unneeded return statement\r
-898fb8c opensm: Improve some snprintf uses\r
-6820e63 opensm/osm_sa_link_record.c: improve get_base_lid()\r
-64c8d31 opensm: initialize all switch ports\r
-555fae8 opensm/sweep: add log message before lid assignment\r
-8e22307 opensm/console: Enhance perfmgr print_counters for better nodenames\r
-b9721a1 opensm/osm_console.c: Improve perfmgr print_counters error message\r
-4d8dc72 opensm/osm_inform.c: Fix sense of zero GID compare in __match_inf_rec\r
-a98dd82 opensm/main.c: remove enable_stack_dump() call\r
-db6d51e opensm/osm_subnet: fix crash in qos string config parameters reloading\r
-e5111c8 opensm: proper config file rescan\r
-e5295b2 opensm: pre-scan command line for config file option\r
-e2f549e opensm/osm_console.c: Eliminate some extraneous parentheses\r
-0a265dc opensm/console: dump_portguid - don't duplicate matched guids\r
-540fefb opensm/console: dump_portguid command fixes\r
-d96202c opensm/osm_console.c: Add missing command in help_perfmgr\r
-ae1bd3c opensm/osm_helper.c: Add port counters to __osm_disp_msg_str\r
-1d38b31 opensm/osm_ucast_mgr.c: Add error numbers for some OSM_LOG prin\r
-156c749 opensm: fix structure definition for trap 257-258\r
-5c09f4a opensm/osm_state_mgr.c: small bug in scanning lid table\r
-72a2fa2 opensm/osm_sa.c: fixing SA MAD dump\r
-539a4d3 opensm/osm_ucast_ftree.c Fixed bad init value for down port index\r
-6690833 opensm/ftree: simplify root guids setup.\r
-90e3291 opensm/ftree: cleanup ftree_sw_tbl_element_t use\r
-c07d245 opensm/qos_config: no invalid option message on default values\r
-b382ad8 opensm: avoid memory leaks on config parameters reloading\r
-45f57ce opensm/osm_ucast_ftree.c: Fixed bug on index port incrementation\r
-3d618aa opensm/osm_subnet.c: break matching when config parameter already found\r
-44d98e3 opensm/osm_subnet.c: clean_val() remove trailing quotation\r
-173010a opensm/doc/perf-manager-arch.txt: Fix some commentary typos\r
-83bf6c5 opensm/osm_subnet.c fix parse functions for big endian machines\r
-6b9a1e9 opensm/PerfMgr: Primarily fix enhanced switch port 0 perf manager\r
-       operation\r
-4f79a17 opensm/osm_perfmgr.c: In osm_perfmgr_init, eliminate memory leak\r
-       on error\r
-22da81f opensm/osm_ucast_ftree.c: fix full topology dump\r
-aa25fcb opensm/osm_port_info_rcv.c: don't clear sw->need_update if port 0\r
-       is active\r
-003bd4b opensm/osm_subnet.c Fix memory leak for QOS string parameters.\r
-9cbbab2 opensm/opensm.spec: fix event plugin config options\r
-996e8f6 OpenSM: update osmeventplugin example for the new TRAP event.\r
-67f4c07 opensm/lash: simplify some memory allocations\r
-3e6bcdb opensm/lash: fix memory leaks\r
-3ff97b9 opensm/vendor: save some stack memory\r
-ccc7621 opensm/osm_ucast_ftree.c: fixing errors in comments\r
-1a802b3 Corrected incoherency in __osm_ftree_fabric_route_to_non_cns comments\r
-85a7e54 opensm/osm_sm.c: fix MC group creation in race condition\r
-aad1af2 opensm/osm_trap_rcv.c: Improvements in log_trap_info()\r
-f619d67 opensm/osm_trap_rcv.c: Minor reorganization of trap_rcv_process_request\r
-084335b opensm/link_mgr: verify port's lid\r
-d525931 opensm/osm_vendor_ibumad: Use OSM_UMAD_MAX_AGENTS rather than\r
-       UMAD_CA_MAX_AGENTS\r
-f342c62 opensm/osm_sa.c: don't ignore failure in osm_mgrp_add_port()\r
-587fda4 osmtest/osmt_multicast.c: fix strict aliasing breakage warning\r
-6931f3e opensm: make subnet's max mlid update implementation independent\r
-30f1acd osm_ucast_ftree.c missing reset of ca_ports\r
-ac04779 opensm: fix LFT allocation size\r
-a7838d0 opensm/osm_ucast_cache: reduce OSM_LOG_INFO debug printouts\r
-c027335 opensm/osm_ucast_updn.c: Further reduction in cas_per_sw allocation\r
-e8ee292 opensm/opensm/osm_subnet.c: adjust buffer to ensure a '\n' is printed\r
-84d9830 opensm/osm_ucast_updn.c: Reduce temporary allocation of cas_per_sw\r
-347ad64 opensm/ib_types.h: Mask off client rereg bit in set_client_rereg\r
-c2ab189 opensm/osm_state_mgr.c: in cleanup_switch() check only relevant\r
-       LFT part\r
-40c93d3 use transportable constant attributes\r
-c8fa71a osmtest -code cleanup - use strncasecmp()\r
-770704a opensm/osm_mcast_mgr.c: In mcast_mgr_set_mft_block, fix node GUID\r
-       in log message\r
-3d20f82 opensm/osm_sa_path_record.c: separate router guid resolution code\r
-27ea3c8 opensm: fix gcc-4.4.1 warnings\r
-c88bfd3 opensm/osm_lid_mgr.c: Fix typo in OSM_LOG message\r
-a9ea08c opensm/osm_mesh.c: Add dump_mesh routine at OSM_LOG_DEBUG level\r
-bc2a61e C++ style coding does not compile\r
-6647600 opensm: remove meanless 'const' keywords in APIs\r
-323a74f opensm/osm_qos_parser_y.y: fix endless loop\r
-0121a81 opensm: fix endless looping in mcast_mgr\r
-696c022 opensm: fix some obvious -Wsign-compare warnings\r
-b91e3c3 opensm/osm_get_port_by_lid(): don't bother with lmc\r
-ca582df opensm/osm_get_port_by_lid(): speedup a port lookup\r
-fd846ee opensm/osm_mesh.c: simplify compare_switches() function\r
-fe20080 osm_sa.c - void * arithmetic causes problems\r
-220130f osm_helper.c use explicit value for struct init\r
-0168ece use standard varargs syntax in macro OSM_LOG()\r
-180b335 update functions to match .h prototypes\r
-9240ef4 opensm/osm_ucast_lash: fix use after free bug\r
-6f1a21a opensm: osm_get_port_by_lid() helper\r
-c9e2818 opensm/osm_sa_path_record.c: validate multicast membership\r
-225dcf5 opensm/osm_mesh.c: Remove edges in lash matrix\r
-4dd928b opensm/osm_sa_mcmember_record.c: clean uninitialized variable use\r
-c48f0bc opensm/osm_perfmgr_db.c: Fix memory leak of db nodes\r
-82d3585 opensm/osm_notice.c: move logging code to separate function\r
-9557f60 opensm/osm_inform.c: For traps 64-67, use GID from DataDetails in\r
-       log message\r
-e2e78d9 opensm/opensm.8.in: Indicate default rule for Default partition\r
-08c5beb opensm/osm_sa_node_record.c: dump NodeInfo with debug verbosity\r
-1fe88f0 opensm/multicast: merge mcm_port and mcm_info\r
-ba75747 opensm/multicast: consolidate port addition/removing code\r
-5e61ab8 opensm: port object reference in mcm ports list\r
-5c5dacf opensm: fix uninitialized return value in osm_sm_mcgrp_leave()\r
-7cfe18d osm_ucast_ftree.c: Removed reverse_hop parameters from\r
-       fabric_route_upgoing_by_going_down\r
-aa7fb47 opensm/multicast: kill mc group to_be_deleted flag\r
-a4910fe opensm/osm_mcast_mgr.c: multicast routing by mlid - renaming\r
-1d14060 opensm/multicast: remove change id tracking\r
-5a84951 opensm: use mgrp pointer as osm_sm_mcgrp_join/leave() parameter\r
-d8e3ff5 opensm: use mgrp pointer in port mcm_info\r
-0631cd3 opensm doc: Indicated limited (rather than partial) partition\r
-       membership\r
-1010535 opensm/osm_ucast_lash.c: In lash_core, return status -1 for all errors\r
-942e20f opensm/osm_helper.c: Add SM priority changed into trap 144 description\r
-2372999 opensm/osm_ucast_mgr: better lft setup\r
-e268b32 opensm/osm_helper.c: Only change method when > rather than >=\r
-9309e8c complib/cl_event.c: change nanosec var type long\r
-d93b126 opensm/complib: account for nsec overflow in timeout values\r
-ef4c8ac opensm/osm_qos_policy.c: matching PR query to QoS level with pkey\r
-c93b58b opensm: fixing some data types in osm_req_get/set\r
-2b89177 opensm/libvendor/osm_vendor_ibumad.c: Handle umad_alloc failure in\r
-       osm_vendor_get\r
-2cba163 opensm/osm_helper.c: In osm_dump_dr_smp, fix endian of status\r
-47397e3 opensm/osm_sm_mad_ctrl.c: Fix endian of status in error message\r
-e83b7ca opensm/osm_mesh.c: Reorder switches for lash\r
-9256239 opensm/osm_trap_rcv.c: Validate trap is 144 before checking for\r
-       NodeDescription changed\r
-011d9ca opensm/osm_ucast_lash.c: Handle calloc failure in generate_cdg_for_sp\r
-59964d7 opensm: fixing handling of opt.max_wire_smps\r
-f4e3cd0 opensm/osm_ucast_lash.c: Directly call calloc/free rather than\r
-       create/delete_cdg\r
-5a208bd opensm/osm_ucast_lash.c: Added error numbers to some error log messages\r
-3b80d10 opensm/osm_helper.c: fix printing trap 258 details\r
-f682fe0 opensm: do not configure MFTs when mcast support is disabled\r
-cc42095 opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, indicate\r
-       failed attribute\r
-aebf215 opensm/osm_ucast_lash.c: Remove osm_mesh_node_delete call from\r
-       switch_delete\r
-1ef4694 opensm/osm_path.h: In osm_dr_path_init, only copy needed part of path\r
-c594a2d opensm: osm_dr_path_extend can fail due to invalid hop count\r
-46e5668 opensm/osm_lash: Fix use after free problem in osm_mesh_node_delete\r
-81841dc opensm/osm_ucast_lash.c: Handle malloc failures better\r
-2801203 opensm: remove extra "0x" from debug message.\r
-88821d2 opensm/main.c: Display SMSL when specified\r
-f814dcd opensm/osm_subnet.c: Format lash_start_vl consistent with other\r
-       uint8 items\r
-66669c9 opensm/main.c: Display LASH start VL when specified\r
-31bb0a7 opensm/osm_mcst_mgr.c: check number of switches only once\r
-75e672c opensm: find MC group by MGID using fleximap\r
-2b7260d Clarify the syntax of the hop_weights_file\r
-e6f0070 opensm/osm_mesh.c: Improve VL utilization\r
-27497a0 opensm/osm_ucast_ftree.c Fix assert comparing number of CAs to CN ports\r
-3b98131 opensm/osm_qos_policy.c: Use proper size in malloc in\r
-       osm_qos_policy_vlarb_scope_create\r
-e6f367d opensm/osm_ucast_ftree.c: Made error numbers unique in some log\r
-       messages\r
-83261a8 osm_ucast_ftree.c Count number of hops instead of calculating it\r
-7bdf4ff opensm/osm_sa_(path multipath)_record.c: Fix typo in a couple of\r
-       log messages\r
-0f8ed87 opensm/osm_ucast_mgr.c: Add error numbers to some error log messages\r
-0b5ccb4 complib/Makefile.am: prevent file duplications\r
-e0b8ec9 opensm/osm_sminfo_rcv.c: clean type of smi_rcv_process_get_sm()\r
-4d01005 opensm: sweep component processors return status value\r
-6ad8d78 opensm/libvendor/osm_vendor_(ibumad mlx)_sa.c: Handle malloc\r
-       failure in __osmv_send_sa_req\r
-cf97ebf opensm/osm_ucast_lash.(h c): Replace memory allocation by array\r
-957461c opensm/osm_sa.c add attribute and component mask to error message\r
-5d339a1 osm_dump.c dump port if lft is set up\r
-518083d osm_port.c: check if op_vls = 0 before max_op_vls comparison\r
-b6964cb opensm/osm_port.c: Change log level of Invalid OP_VLS 0 message\r
-       to VERBOSE\r
-b27568c opensm/PerfMgr: Reduce host name length\r
-bc495c0 opensm/osm_lid_mgr.c bug in opensm LID assignment\r
-5a466fd opensm/osm_perfmgr_db.c: Remove unneeded initialization in\r
-       perfmgr_db_print_by_name\r
-57cf328 opensm/osm_ucast_ftree.c Increase the size of the hop table\r
-8323cf1 opensm/PerfMgr: Remove some underbars from internal names\r
-65b1c15 opensm: Changes to spec and make files for updated release notes\r
-cd226c7 OpenSM: include/vendor/osm_vendor.h - Replaced #elif with no\r
-       condition by #else\r
-9f8bd4a management: Fixed custom_release in SPEC files\r
-c0b8207 opensm/PerfMgr: Change redir_tbl_size to num_ports for better clarity\r
-596bb08 opensm/osm_sa.c: check for SA DB file only if requested\r
-2f2bd4e opensm SA DB dump/restore: load SA DB only once\r
-4abcbf2 opensm: Added print_desc to various log messages\r
-5e3d235 opensm/osm_vendor_ibumad.c: Move error info into single message\r
-8e5ca10 opensm/libvendor//osm_vendor_ibumad_sa.c: uninitialized fields\r
-d13c2b6 opensm/osm_sm_mad_ctrl.c Changes to some error messages\r
-f79d315 opensm/osm_sm_mad_ctrl.c: Add missing call to return mad to mad pool\r
-150a9b1 opensm/osm_sa_mcmember_record.c: print mcast join/create failures in\r
-       VERBOSE instead of DEBUG level\r
-9b7882a opensm/osm_vendor_ibumad.c: Change LID format to decimal in log message\r
-5256c43 opensm/osm_vendor_mlx: fix compilation error\r
-93db10d opensm/osm_vendor_mlx_txn.c: eliminate bunch of compilation warnings\r
-156fdc1 opensm/osm_helper.c Log format changes\r
-7a55434 opensm/osm_ucast_ftree.c Changed log level\r
-a1694de opensm/osm_state_mgr.c Added more info to some error messages\r
-fdec20a opensm/osm_trap_rcv.c: Eliminate heavy sweep on receipt of trap 145\r
-13a32a7 opensm - standardize on a single Windows #define - take #2\r
-b236a10 opensm/osm_db_files.c: kill useless malloc() castings\r
-4ba0c26 opensm/osm_db_files.c: add '/' path delimited\r
-e3b98a5 opensm/osm_sm_mad_ctrl.c: Fix qp0_mads_accounting\r
-dbbe5b3 opensm/osm_subnet.c: fixing bug in dumping options file\r
-f22856a opensm/osm_ucast_mgr.c: fix memory leak\r
-0d5f0b6 opensm: osm_get_mgrp_by_mgid() helper\r
-e3c044a osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator\r
-3dda2dc opensm/osm_sa_member_record.c: mlid independent MGID generator\r
-1f95a3c opensm/osm_sa_mcmember_record.c: move mgid allocation code\r
-b78add1 complib: replace intn_t types by C99 intptr_t\r
-a864fd3 osmtest/osmt_mtl_regular_qp.c: cleaning uintn_t use\r
-9e01318 opensm/osm_console.c: make const functions\r
-f8c4c3e opensm/osm_mgrp_new(): add subnet db insertion\r
-80da047 complib/fleximap: make compar callback to return int\r
-bf7fe2d opensm: cleanup intn_t uses\r
-0862bba opensm/main.c: opensm cannot be killed while asking for port guid\r
-2b70193 opensm/complib: bug in cl_list_insert_array_head/tail functions\r
-4764199 opensm - use C99 transportable data type for pointer storage\r
-a9c326c opensm/osm_state_mgr.c: do not probe remote side of port 0\r
-4945706 opensm/osm_mcast_mgr.c: fix return value on alloc_mfts() failures\r
-8312a24 OpenSM: Fix unused variable compiler warning.\r
-ab8f0a3 opensm/partition: keep multicast group pointer\r
-a817430 opensm: Only clear SMP beyond end of PortInfo attribute\r
-52fb6f2 opensm/osm_switch.h: Remove dead osm_switch_get_physp_ptr routine\r
-aa6d932 opensm/osm_mcast_tbl.c: In osm_mcast_tbl_clear_mlid, use memset to\r
-       clear port mask entry\r
-2ad846b opensm/osm_trap_rcv.c: use source_lid and port_num for logging\r
-b9d7756 opensm/osm_mcast_tbl: Fix size of port mask table array\r
-11c0a9b opensm/main.c: Use strtoul rather than strtol for parsing transaction\r
-       timeout\r
-0608af9 opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, revert setting\r
-       of init failure on QoS initialization failures\r
-c6b4d4a opensm/osm_vendor_ibumad.c: Add transaction ID to osm_vendor_send\r
-       log message\r
-520af84 opensm/osm_sa_path_record.c: don't set dgid pointer for local subnet\r
-4a878fb opensm/osm_mcast_mgr.c: fix osm_mcast_mgr_compute_max_hops for\r
-       managed switch\r
-\r
-* Other less critical or visible bugs were also fixed.\r
-\r
-5 Main Verification Flows\r
--------------------------\r
-\r
-OpenSM verification is run using the following activities:\r
-* osmtest - a stand-alone program\r
-* ibmgtsim (IB management simulator) based - a set of flows that\r
-  simulate clusters, inject errors and verify OpenSM capability to\r
-  respond and bring up the network correctly.\r
-* small cluster regression testing - where the SM is used on back to\r
-  back or single switch configurations. The regression includes\r
-  multiple OpenSM dedicated tests.\r
-* cluster testing - when we run OpenSM to setup a large cluster, perform\r
-  hand-off, reboots and reconnects, verify routing correctness and SA\r
-  responsiveness at the ULP level (IPoIB and SDP).\r
-\r
-5.1 osmtest\r
-\r
-osmtest is an automated verification tool used for OpenSM\r
-testing. Its verification flows are described by list below.\r
-\r
-* Inventory File: Obtain and verify all port info, node info, link and path\r
-  records parameters.\r
-\r
-* Service Record:\r
-   - Register new service\r
-   - Register another service (with a lease period)\r
-   - Register another service (with service p_key set to zero)\r
-   - Get all services by name\r
-   - Delete the first service\r
-   - Delete the third service\r
-   - Added bad flows of get/delete  non valid service\r
-   - Add / Get same service with different data\r
-   - Add / Get / Delete by different component  mask values (services\r
-     by Name & Key / Name & Data / Name & Id / Id only )\r
-\r
-* Multicast Member Record:\r
-   - Query of existing Groups (IPoIB)\r
-   - BAD Join with insufficient comp mask (o15.0.1.3)\r
-   - Create given MGID=0 (o15.0.1.4)\r
-   - Create given MGID=0xFF12A01C,FE800000,00000000,12345678 (o15.0.1.4)\r
-   - Create BAD MGID=0xFA. (o15.0.1.6)\r
-   - Create BAD MGID=0xFF12A01B w/ link-local not set (o15.0.1.6)\r
-   - New MGID with invalid join state (o15.0.1.9)\r
-   - Retry of existing MGID - See JoinState update (o15.0.1.11)\r
-   - BAD RATE when connecting to existing MGID (o15.0.1.13)\r
-   - Partial JoinState delete request - removing FullMember (o15.0.1.14)\r
-   - Full Delete of a group (o15.0.1.14)\r
-   - Verify Delete by trying to Join deleted group (o15.0.1.14)\r
-   - BAD Delete of IPoIB membership (no prev join) (o15.0.1.15)\r
-\r
-* GUIDInfo Record:\r
-   - All GUIDInfoRecords in subnet are obtained\r
-\r
-* MultiPathRecord:\r
-   - Perform some compliant and noncompliant MultiPathRecord requests\r
-   - Validation is via status in responses and IB analyzer\r
-\r
-* PKeyTableRecord:\r
-  - Perform some compliant and noncompliant PKeyTableRecord queries\r
-  - Validation is via status in responses and IB analyzer\r
-\r
-* LinearForwardingTableRecord:\r
-  - Perform some compliant and noncompliant LinearForwardingTableRecord queries\r
-  - Validation is via status in responses and IB analyzer\r
-\r
-* Event Forwarding: Register for trap forwarding using reports\r
-   - Send a trap and wait for report\r
-   - Unregister non-existing\r
-\r
-* Trap 64/65 Flow: Register to Trap 64-65, create traps (by\r
-  disconnecting/connecting ports) and wait for report, then unregister.\r
-\r
-* Stress Test: send PortInfoRecord queries, both single and RMPP and\r
-  check for the rate of responses as well as their validity.\r
-\r
-\r
-5.2 IB Management Simulator OpenSM Test Flows:\r
-\r
-The simulator provides ability to simulate the SM handling of virtual\r
-topologies that are not limited to actual lab equipment availability.\r
-OpenSM was simulated to bring up clusters of up to 10,000 nodes. Daily\r
-regressions use smaller (16 and 128 nodes clusters).\r
-\r
-The following test flows are run on the IB management simulator:\r
-\r
-* Stability:\r
-  Up to 12 links from the fabric are randomly selected to drop packets\r
-  at drop rates up to 90%. The SM is required to succeed in bringing the\r
-  fabric up. The resulting routing is verified to be correct as well.\r
-\r
-* LID Manager:\r
-  Using LMC = 2 the fabric is initialized with LIDs. Faults such as\r
-  zero LID, Duplicated LID, non-aligned (to LMC) LIDs are\r
-  randomly assigned to various nodes and other errors are randomly\r
-  output to the guid2lid cache file. The SM sweep is run 5 times and\r
-  after each iteration a complete verification is made to ensure that all\r
-  LIDs that could possibly be maintained are kept, as well as that all nodes\r
-  were assigned a legal LID range.\r
-\r
-* Multicast Routing:\r
-  Nodes randomly join the 0xc000 group and eventually the\r
-  resulting routing is verified for completeness and adherence to\r
-  Up/Down routing rules.\r
-\r
-* osmtest:\r
-  The complete osmtest flow as described in the previous table is run on\r
-  the simulated fabrics.\r
-\r
-* Stress Test:\r
-  This flow merges fabric, LID and stability issues with continuous\r
-  PathRecord, ServiceRecord and Multicast Join/Leave activity to\r
-  stress the SM/SA during continuous sweeps. InformInfo Set/Delete/Get\r
-  were added to the test such both existing and non existing nodes\r
-  perform them in random order.\r
-\r
-5.3 OpenSM Regression\r
-\r
-Using a back-to-back or single switch connection, the following set of\r
-tests is run nightly on the stacks described in table 2. The included\r
-tests are:\r
-\r
-* Stress Testing: Flood the SA with queries from multiple channel\r
-  adapters to check the robustness of the entire stack up to the SA.\r
-\r
-* Dynamic Changes: Dynamic Topology changes, through randomly\r
-  dropping SMP packets, used to test OpenSM adaptation to an unstable\r
-  network & verify DB correctness.\r
-\r
-* Trap Injection: This flow injects traps to the SM and verifies that it\r
-  handles them gracefully.\r
-\r
-* SA Query Test: This test exhaustively checks the SA responses to all\r
-  possible single component mask. To do that the test examines the\r
-  entire set of records the SA can provide, classifies them by their\r
-  field values and then selects every field (using component mask and a\r
-  value) and verifies that the response matches the expected set of records.\r
-  A random selection using multiple component mask bits is also performed.\r
-\r
-5.4 Cluster testing:\r
-\r
-Cluster testing is usually run before a distribution release. It\r
-involves real hardware setups of 16 to 32 nodes (or more if a beta site\r
-is available). Each test is validated by running all-to-all ping through the IB\r
-interface. The test procedure includes:\r
-\r
-* Cluster bringup\r
-\r
-* Hand-off between 2 or 3 SM's while performing:\r
-  - Node reboots\r
-  - Switch power cycles (disconnecting the SM's)\r
-\r
-* Unresponsive port detection and recovery\r
-\r
-* osmtest from multiple nodes\r
-\r
-* Trap injection and recovery\r
-\r
-\r
-6 Qualified Software Stacks and Devices\r
----------------------------------------\r
-\r
-OpenSM Compatibility\r
---------------------\r
-Note that OpenSM version 3.2.1 and earlier used a value of 1 in host\r
-byte order for the default SM_Key, so there is a compatibility issue\r
-with these earlier versions of OpenSM when the 3.2.2 or later version\r
-is running on a little endian machine. This affects SM handover as well\r
-as SA queries (saquery tool in infiniband-diags).\r
-\r
-\r
-Table 2 - Qualified IB Stacks\r
-=============================\r
-\r
-Stack                                    | Version\r
------------------------------------------|--------------------------\r
-The main stream Linux kernel             |   2.6.x\r
-OFED                                     |   1.5,1.5.x\r
-OFED                                     |   1.4\r
-OFED                                     |   1.3\r
-OFED                                     |   1.2\r
-OFED                                     |   1.1\r
-OFED                                     |   1.0\r
-\r
-Table 3 - Qualified Devices and Corresponding Firmware\r
-======================================================\r
-\r
-Mellanox\r
-Device                              |   FW versions\r
-------------------------------------|-------------------------------\r
-InfiniScale                         | fw-43132  5.2.000 (and later)\r
-InfiniScale III                     | fw-47396  0.5.000 (and later)\r
-InfiniScale IV                      | fw-48436  7.1.000 (and later)\r
-InfiniHost                          | fw-23108  3.5.000 (and later)\r
-InfiniHost III Lx                   | fw-25204  1.2.000 (and later)\r
-InfiniHost III Ex (InfiniHost Mode) | fw-25208  4.8.200 (and later)\r
-InfiniHost III Ex (MemFree Mode)    | fw-25218  5.3.000 (and later)\r
-ConnectX IB                         | fw-25408  2.3.000 (and later)\r
-\r
-QLogic/PathScale\r
-Device  |   Note\r
---------|-----------------------------------------------------------\r
-iPath   | QHT6040 (PathScale InfiniPath HT-460)\r
-iPath   | QHT6140 (PathScale InfiniPath HT-465)\r
-iPath   | QLE6140 (PathScale InfiniPath PE-880)\r
-iPath   | QLE7240\r
-iPath   | QLE7280\r
-\r
-Note 1: OpenSM does not run on an IBM Galaxy (eHCA) as it does not expose\r
-QP0 and QP1. However, it does support it as a device on the subnet.\r
-\r
-Note 2: QoS firmware and Mellanox devices\r
-\r
-HCAs: QoS supported by ConnectX. QoS-enabled FW release is 2_5_000 and\r
-later.\r
-\r
-Switches: QoS supported by InfiniScale III\r
-Any InfiniScale III FW that is supported by OpenSM supports QoS.\r
diff --git a/branches/opensm_3/user/doc/partition-config.txt b/branches/opensm_3/user/doc/partition-config.txt
deleted file mode 100644 (file)
index 50e40de..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-OpenSM Partition configuration\r
-===============================\r
-\r
-The default name of OpenSM partitions configuration file is\r
-'/etc/opensm/partitions.conf'. The default may be changed by\r
-using the --Pconfig (-P) option with OpenSM.\r
-\r
-The default partition will be created by OpenSM unconditionally even\r
-when partition configuration file does not exist or cannot be accessed.\r
-\r
-The default partition has P_Key value 0x7fff. OpenSM's port will always\r
-have full membership in default partition. All other end ports will have\r
-full membership if the partition configuration file is not found or cannot\r
-be accessed, or limited membership if the file exists and can be accessed\r
-but there is no rule for the Default partition.\r
-\r
-Effectively, this amounts to the same as if one of the following rules\r
-below appear in the partition configuration file:\r
-In the case of no rule for the Default partition:\r
-Default=0x7fff : ALL=limited, SELF=full ;\r
-In the case of no partition configuration file or file cannot be accessed:\r
-Default=0x7fff : ALL=full ;\r
-\r
-\r
-File Format\r
-===========\r
-\r
-Comments:\r
---------\r
-\r
-Line content followed after '#' character is comment and ignored by\r
-parser.\r
-\r
-\r
-General file format:\r
--------------------\r
-\r
-<Partition Definition>:<PortGUIDs list> ;\r
-\r
-\r
-Partition Definition:\r
---------------------\r
-\r
-[PartitionName][=PKey][,flag[=value]][,defmember=full|limited]\r
-\r
-PartitionName - string, to be used with logging. When omitted\r
-                empty string will be used.\r
-PKey          - P_Key value for this partition. Only low 15 bits will\r
-                be used. When omitted will be autogenerated.\r
-flag          - used to indicate IPoIB capability of this partition.\r
-defmember=full|limited - specifies default membership for port guid\r
-                list. Default is limited.\r
-\r
-Currently recognized flags are:\r
-\r
-ipoib       - indicates that this partition may be used for IPoIB, as\r
-              result IPoIB capable MC group will be created.\r
-rate=<val>  - specifies rate for this IPoIB MC group (default is 3 (10GBps))\r
-mtu=<val>   - specifies MTU for this IPoIB MC group (default is 4 (2048))\r
-sl=<val>    - specifies SL for this IPoIB MC group (default is 0)\r
-scope=<val> - specifies scope for this IPoIB MC group (default is 2 (link\r
-local))\r
-\r
-Note that values for 'rate', 'mtu'. and 'scope' should be specified as defined\r
-in the IBTA specification (for example mtu=4 for 2048).\r
-\r
-\r
-PortGUIDs list:\r
---------------\r
-\r
-[PortGUID[=full|=limited]] [,PortGUID[=full|=limited]] [,PortGUID] ...\r
-\r
-PortGUID     - GUID of partition member EndPort. Hexadecimal numbers\r
-               should start from 0x, decimal numbers are accepted too.\r
-full or      - indicates full or limited membership for this port. When\r
-  limited      omitted (or unrecognized) limited membership is assumed.\r
-\r
-There are two useful keywords for PortGUID definition:\r
-\r
-- 'ALL' means all end ports in this subnet.\r
-- 'ALL_CAS' means all Channel Adapter end ports in this subnet.\r
-- 'ALL_SWITCHES' means all Switch end ports in this subnet.\r
-- 'ALL_ROUTERS' means all Router end ports in this subnet.\r
-- 'SELF' means subnet manager's port.\r
-\r
-Empty list means no ports in this partition.\r
-\r
-\r
-Notes:\r
------\r
-\r
-White spaces are permitted between delimiters ('=', ',',':',';').\r
-\r
-The Line can be wrapped after ':' followed after Partition Definition and\r
-between.\r
-\r
-PartitionName does not need to be unique, PKey does need to be unique.\r
-If PKey is repeated then those partition configurations will be merged\r
-and first PartitionName will be used (see also next note).\r
-\r
-It is possible to split partition configuration in more than one\r
-definition, but then PKey should be explicitly specified (otherwise\r
-different PKey values will be generated for those definitions).\r
-\r
-\r
-Examples:\r
---------\r
-\r
-Default=0x7fff : ALL, SELF=full ;\r
-Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ;\r
-\r
-NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;\r
-\r
-YetAnotherOne = 0x300 : SELF=full ;\r
-YetAnotherOne = 0x300 : ALL=limited ;\r
-\r
-ShareIO = 0x80 , defmember=full : 0x123451, 0x123452; # 0x123453, 0x123454 will be limited\r
-ShareIO = 0x80 : 0x123453, 0x123454, 0x123455=full; # 0x123456, 0x123457 will be limited\r
-ShareIO = 0x80 : defmember=limited : 0x123456, 0x123457, 0x123458=full;\r
-ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a;\r
-ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d;\r
-\r
-\r
-Note:\r
-----\r
-\r
-The following rule is equivalent to how OpenSM used to run prior to the\r
-partition manager:\r
-\r
-Default=0x7fff,ipoib:ALL=full;\r
-\r
diff --git a/branches/opensm_3/user/doc/perf-manager-arch.txt b/branches/opensm_3/user/doc/perf-manager-arch.txt
deleted file mode 100644 (file)
index 2fc1fd2..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-Performance Manager\r
-2/12/07\r
-\r
-This document will describe an architecture and a phased plan\r
-for an OpenFabrics OpenIB performance manager.\r
-\r
-Currently, there is no open source performance manager, only\r
-a perfquery diagnostic tool which some have scripted into a\r
-"poor man's" performance manager.\r
-\r
-The primary responsibilities of the performance manager are to:\r
-1. Monitor subnet topology\r
-2. Based on subnet topology, monitor performance and error counters.\r
-   Also, possibly monitor counters related to congestion.\r
-3. Perform data reduction (various calculations (rates, histograms, etc.))\r
-   on counters obtained\r
-4. Log performance data and indicate "interesting" related events\r
-\r
-\r
-Performance Manager Components\r
-1. Determine subnet topology\r
-   Performance manager can determine the subnet topology by subscribing\r
-   for GID in and out of service events. Upon receipt of a GID in service\r
-   event, use GID to query SA for corresponding LID by using SubnAdmGet\r
-   NodeRecord with PortGUID specified. It would utilize the LID and NumPorts\r
-   returned and add this to the monitoring list. Note that the monitoring\r
-   list can be extended to be distributed with the manager "balancing" the\r
-   assignments of new GIDs to the set of known monitors. For GID out of\r
-   service events, the GID is removed from the monitoring list.\r
-\r
-2. Monitoring\r
-   Counters to be monitored include performance counters (data octets and\r
-   packets both receive and transmit) and error counters. These are all in\r
-   the mandatory PortCounters attribute. Future support will include the\r
-   optional 64 bit counters, PortExtendedCounters (as this is only known\r
-   to be supported on one IB device currently). Also, one congestion\r
-   counter (PortXmitWait) will also be monitored (on switch ports) initially.\r
-\r
-   Polling rather than sampling will be used as the monitoring technique. The\r
-   polling rate configurable from 1-65535 seconds (default TBD)\r
-   Note that with 32 bit counters, on 4x SDR links, byte counts can max out in\r
-   16 seconds and on 4x DDR links in 8 seconds. The polling rate needs to\r
-   deal with this as accurate byte and packet rates are desired. Since IB\r
-   counters are sticky, the counters need to be reset when they get "close"\r
-   to max'ing out. This will result in some inaccuracy. When counters are\r
-   reset, the time of the reset will be tracked in the monitor and will be\r
-   queryable. Note that when the 64 bit counters are supported more generally,\r
-   the polling rate can be reduced.\r
-\r
-   The performance manager will support parallel queries. The level of\r
-   parallelism is configurable with a default of 64 queries outstanding\r
-   at one time.\r
-\r
-   Configuration and dynamic adjustment of any performance manager "knobs"\r
-   will be supported.\r
-\r
-   Also, there will be a console interface to obtain performance data.\r
-   It will be able to reset counters, report on specific nodes or\r
-   node types of interest (CAs only, switches only, all, ...). The\r
-   specifics are TBD.\r
-\r
-3. Data Reduction\r
-   For errors, rate rather than raw value will be calculated. Error\r
-   event is only indicated when rate exceeds a threshold.\r
-   For packet and byte counters, small changes will be aggregated\r
-   and only significant changes are updated.\r
-   Aggregated histograms (per node, all nodes (this is TBD))) for each\r
-   counter will be provided. Actual counters will also be written to files.\r
-   NodeGUID will be used to identify node. File formats are TBD. One\r
-   format to be supported might be CSV.\r
-\r
-4. Logging\r
-   "Interesting" events determined by the performance manager will be\r
-   logged as well as the performance data itself. Significant events\r
-   will be logged to syslog. There are some interesting scalability\r
-   issues relative to logging especially for the distributed model.\r
-\r
-   Events will be based on rates which are configured as thresholds.\r
-   There will be configurable thresholds for the error counters with\r
-   reasonable defaults. Correlation of PerfManager and SM events is\r
-   interesting but not a mandatory requirement.\r
-\r
-\r
-Performance Manager Scalability\r
-Clearly as the polling rate goes up, the number of nodes which can be\r
-monitored from a single performance management node decreases. There is\r
-some evidence that a single dedicated management node may not be able to\r
-monitor the largest clusters at a rapid rate.\r
-\r
-There are numerous PerfManager models which can be supported:\r
-1. Integrated as thread(s) with OpenSM (run only when SM is master)\r
-2. Standby SM\r
-3. Standalone PerfManager (not running with master or standby SM)\r
-4. Distributed PerfManager (most scalable approach)\r
-\r
-Note that these models are in order of implementation complexity and\r
-hence "schedule".\r
-\r
-The simplest model is to run the PerfManager with the master SM. This has\r
-the least scalability but is the simplest model. Note that in this model\r
-the topology can be obtained without the GID in and out of service events\r
-but this is needed for any of the other models to be supported.\r
-\r
-The next model is to run the PerfManager with a standby SM. Standbys are not\r
-doing much currently (polling the master) so there is much idle CPU.\r
-The downside of this approach is that if the standby takes over as master,\r
-the PerfManager would need to be moved (or is becomes model 1).\r
-\r
-A totally separate standlone PerfManager would allow for a deployment\r
-model which eliminates the downside of model 2 (standby SM). It could\r
-still be built in a similar manner with model 2 with unneeded functions\r
-(SM and SA) not included. The advantage of this model is that it could\r
-be more readily usable with a vendor specific SM (switch based or otherwise).\r
-Vendor specific SMs usually come with a built-in performance manager and\r
-this assumes that there would be a way to disable that performance manager.\r
-Model 2 can act like model 3 if a disable SM feature is supported in OpenSM\r
-(command line/console). This will take the SM to not active.\r
-\r
-The most scalable model is a distributed PerfManager. One approach to\r
-distribution is a hierarchial model where there is a PerfManager at the\r
-top level with a number of PerfMonitors which are responsible for some\r
-portion of the subnet.\r
-\r
-The separation of PerfManager from OpenSM brings up the following additional\r
-issues:\r
-1. What communication is needed between OpenSM and the PerfManager ?\r
-2. Integration of interesting events with OpenSM log\r
-(Does performance manager assume OpenSM ? Does it need to work with vendor\r
-SMs ?)\r
-\r
-Hierarchial distribution brings up some additional issues:\r
-1. How is the hierarchy determined ?\r
-2. How do the PerfManager and PerfMonitors find each other ?\r
-3. How is the subnet divided amongst the PerfMonitors\r
-4. Communication amongst the PerfManager and the PerfMonitors\r
-(including communication failures)\r
-\r
-In terms of inter manager communication, there seem to be several\r
-choices:\r
-1. Use vendor specific MADs (which can be RMPP'd) and build on top of\r
-this\r
-2. Use RC QP communication and build on top of this\r
-3. Use IPoIB which is much more powerful as sockets can then be utilized\r
-\r
-RC QP communication improves on the lower performance of the vendor\r
-specific MAD approach but is not as powerful as the socket based approach.\r
-\r
-The only downside of IPoIB is that it requires multicast to be functioning.\r
-It seems reasonable to require IPoIB across the management nodes. This\r
-can either be a separate IPoIB subnet or a shared one with other endnodes\r
-on the subnet. (If this communication is built on top of sockets, it\r
-can be any IP subnet amongst the manager nodes).\r
-\r
-The first implementation phase will address models 1-3. Model 3 is optional\r
-as it is similar to models 1 and 2 and may be not be needed.\r
-\r
-Model 4 will be addressed in a subsequent implementation phase (and a future\r
-version of this document). Model 4 can be built on the basis of models 1 and\r
-2 where some SM, not necessarily master, is the PerfManager and the rest are\r
-PerfMonitors.\r
-\r
-\r
-Performance Manager Partition Membership\r
-Note that as the performance manager needs to talk via GSI to the PMAs\r
-in all the end nodes and GSI utilizes PKey sharing, partition membership\r
-if invoked must account for this.\r
-\r
-The most straightforward deployment of the performance manager is\r
-to have it be a member of the full default partition (P_Key 0xFFFF).\r
-\r
-\r
-Performance Manager Redundancy\r
-TBD (future version of this document)\r
-\r
-\r
-Congestion Management\r
-TBD (future version of this document)\r
-\r
-\r
-QoS Management\r
-TBD (future version of this document)\r
diff --git a/branches/opensm_3/user/doc/performance-manager-HOWTO.txt b/branches/opensm_3/user/doc/performance-manager-HOWTO.txt
deleted file mode 100644 (file)
index 078e8b4..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-OpenSM Performance manager HOWTO\r
-================================\r
-\r
-Introduction\r
-============\r
-\r
-OpenSM now includes a performance manager which collects Port counters from\r
-the subnet and stores them internally in OpenSM.\r
-\r
-Some of the features of the performance manager are:\r
-\r
-       1) Collect port data and error counters per v1.2 spec and store in\r
-          64 bit internal counts.\r
-       2) Automatic reset of counters when they reach approximatly 3/4 full.\r
-          (While not guarenteeing that counts will not be missed this does\r
-          keep counts incrementing as best as possible given the current\r
-          hardware limitations.)\r
-       3) Basic warnings in the OpenSM log on "critical" errors like symbol\r
-          errors.\r
-       4) Automatically detects "outside" resets of counters and adjusts to\r
-          continue collecting data.\r
-       5) Can be run when OpenSM is in standby or inactive states in\r
-          addition to master state.\r
-\r
-Known issues are:\r
-\r
-       1) Data counters will be lost on high data rate links.  Sweeping the\r
-          fabric fast enough for even a DDR link is not practical.\r
-       2) Default partition support only.\r
-\r
-\r
-Setup and Usage\r
-===============\r
-\r
-Using the Performance Manager consists of 3 steps:\r
-\r
-       1) compiling in support for the perfmgr (Optionally: the console\r
-          socket as well)\r
-       2) enabling the perfmgr and console in opensm.conf\r
-       3) retrieving data which has been collected.\r
-          3a) using console to "dump data"\r
-          3b) using a plugin module to store the data to your own\r
-              "database"\r
-\r
-Step 1: Compile in support for the Performance Manager\r
-------------------------------------------------------\r
-\r
-Because of the performance manager's experimental status, it is not enabled at\r
-compile time by default.  (This will hopefully soon change as more people use\r
-it and confirm that it does not break things...  ;-)  The configure option is\r
-"--enable-perf-mgr".\r
-\r
-At this time it is really best to enable the console socket option as well.\r
-OpenSM can be run in an "interactive" mode.  But with the console socket option\r
-turned on one can also make a connection to a running OpenSM.  The console\r
-option is "--enable-console-socket".  This option requires the use of\r
-tcp_wrappers to ensure security.  Please be aware of your configuration for\r
-tcp_wrappers as the commands presented in the console can affect the operation\r
-of your subnet.\r
-\r
-The following configure line includes turning on the performance manager as\r
-well as the console:\r
-\r
-       ./configure --enable-perf-mgr --enable-console-socket\r
-\r
-\r
-Step 2: Enable the perfmgr and console in opensm.conf\r
------------------------------------------------------\r
-\r
-Turning the Perfmorance Manager on is pretty easy, set the following options in\r
-the opensm.conf config file.  (Default location is\r
-/usr/local/etc/opensm/opensm.conf)\r
-\r
-       # Turn it all on.\r
-       perfmgr TRUE\r
-\r
-       # sweep time in seconds\r
-       perfmgr_sweep_time_s 180\r
-\r
-       # Dump file to dump the events to\r
-       event_db_dump_file /var/log/opensm_port_counters.log\r
-\r
-Also enable the console socket and configure the port for it to listen to if\r
-desired.\r
-\r
-       # console [off|local|socket]\r
-       console socket\r
-\r
-       # Telnet port for console (default 10000)\r
-       console_port 10000\r
-\r
-As noted above you also need to set up tcp_wrappers to prevent unauthorized\r
-users from connecting to the console.[*]\r
-\r
-       [*] As an alternate you can use the loopback mode but I noticed when\r
-       writing this (OpenSM v3.1.10; OFED 1.3) that there are some bugs in\r
-       specifying the loopback mode in the opensm.conf file.  Look for this to\r
-       be fixed in newer versions.\r
-\r
-       [**] Also you could use "local" but this is only useful if you run\r
-       OpenSM in the foreground of a terminal.  As OpenSM is usually started\r
-       as a daemon I left this out as an option.\r
-\r
-Step 3: retrieve data which has been collected\r
-----------------------------------------------\r
-\r
-Step 3a: Using console dump function\r
-------------------------------------\r
-\r
-The console command "perfmgr dump_counters" will dump counters to the file\r
-specified in the opensm.conf file.  In the example above\r
-"/var/log/opensm_port_counters.log"\r
-\r
-Example output is below:\r
-\r
-<snip>\r
-"SW1 wopr ISR9024D (MLX4 FW)" 0x8f10400411f56 port 1 (Since Mon May 12 13:27:14 2008)\r
-     symbol_err_cnt       : 0\r
-     link_err_recover     : 0\r
-     link_downed          : 0\r
-     rcv_err              : 0\r
-     rcv_rem_phys_err     : 0\r
-     rcv_switch_relay_err : 2\r
-     xmit_discards        : 0\r
-     xmit_constraint_err  : 0\r
-     rcv_constraint_err   : 0\r
-     link_integrity_err   : 0\r
-     buf_overrun_err      : 0\r
-     vl15_dropped         : 0\r
-     xmit_data            : 470435\r
-     rcv_data             : 405956\r
-     xmit_pkts            : 8954\r
-     rcv_pkts             : 6900\r
-     unicast_xmit_pkts    : 0\r
-     unicast_rcv_pkts     : 0\r
-     multicast_xmit_pkts  : 0\r
-     multicast_rcv_pkts   : 0\r
-</snip>\r
-\r
-\r
-Step 3b: Using a plugin module\r
-------------------------------\r
-\r
-If you want a more automated method of retrieving the data OpenSM provides a\r
-plugin interface to extend OpenSM.  The header file is osm_event_plugin.h.\r
-The functions you register with this interface will be called when data is\r
-collected.  You can then use that data as appropriate.\r
-\r
-An example plugin can be configured at compile time using the\r
-"--enable-default-event-plugin" option on the configure line.  This plugin is\r
-very simple.  It logs "events" received from the performance manager to a log\r
-file.  I don't recommend using this directly but rather use it as a template to\r
-create your own plugin.\r
-\r
diff --git a/branches/opensm_3/user/doc/qos-config.txt b/branches/opensm_3/user/doc/qos-config.txt
deleted file mode 100644 (file)
index b71bf1d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-Trivial low level QoS configuration proposition\r
-===============================================\r
-\r
-Basically there is a set of QoS related low-level configuration parameters.\r
-All these parameter names are prefixed by "qos_" string. Here is a full\r
-list of these parameters:\r
-\r
-  qos_max_vls    - The maximum number of VLs that will be on the subnet\r
-  qos_high_limit - The limit of High Priority component of VL Arbitration\r
-                   table (IBA 7.6.9)\r
-  qos_vlarb_low  - Low priority VL Arbitration table (IBA 7.6.9) template\r
-  qos_vlarb_high - High priority VL Arbitration table (IBA 7.6.9) template\r
-                   Both VL arbitration templates are pairs of VL and weight\r
-  qos_sl2vl      - SL2VL Mapping table (IBA 7.6.6) template. It is a list\r
-                   of VLs corresponding to SLs 0-15 (Note the VL15 used\r
-                   here means drop this SL)\r
-\r
-Typical default values (hard-coded in OpenSM initialization) are:\r
-\r
-  qos_max_vls 15\r
-  qos_high_limit 0\r
-  qos_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4\r
-  qos_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0\r
-  qos_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-The syntax is compatible with rest of OpenSM configuration options and\r
-values may be stored in OpenSM config file (cached options file).\r
-\r
-In addition to the above, we may define separate QoS configuration\r
-parameters sets for various target types. As targets, we currently support\r
-CAs, routers, switch external ports, and switch's enhanced port 0. The\r
-names of such specialized parameters are prefixed by "qos_<type>_"\r
-string. Here is a full list of the currently supported sets:\r
-\r
-  qos_ca_  - QoS configuration parameters set for CAs.\r
-  qos_rtr_ - parameters set for routers.\r
-  qos_sw0_ - parameters set for switches' port 0.\r
-  qos_swe_ - parameters set for switches' external ports.\r
-\r
-Examples:\r
-\r
-  qos_sw0_max_vls 2\r
-  qos_ca_sl2vl 0,1,2,3,5,5,5,12,12,0,\r
-  qos_swe_high_limit 0\r
diff --git a/branches/opensm_3/user/ibtrapgen/Makefile b/branches/opensm_3/user/ibtrapgen/Makefile
deleted file mode 100644 (file)
index a0c0627..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#\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 OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\..\inc\openib.def\r
diff --git a/branches/opensm_3/user/ibtrapgen/SOURCES b/branches/opensm_3/user/ibtrapgen/SOURCES
deleted file mode 100644 (file)
index b479a70..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-!if $(FREEBUILD)\r
-TARGETNAME=ibtrapgen\r
-!else\r
-TARGETNAME=ibtrapgend\r
-!endif\r
-\r
-!if !defined(WINIBHOME)\r
-WINIBHOME=..\..\..\..\r
-!endif\r
-\r
-LIBPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-\r
-!if defined(OSM_TARGET)\r
-TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)\r
-!else\r
-TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-!endif\r
-\r
-!INCLUDE ..\mad-vendor.inc\r
-\r
-TARGETTYPE=PROGRAM\r
-UMTYPE=console\r
-USE_MSVCRT=1\r
-OVR_DIR=..\addon\r
-\r
-\r
-SOURCES=\\r
-       main.c \\r
-       ibtrapgen.c \\r
-       osm_files.c\r
-\r
-\r
-OSM_HOME=..\r
-\r
-TARGETLIBS=\\r
-       $(SDK_LIB_PATH)\kernel32.lib \\r
-       $(SDK_LIB_PATH)\ws2_32.lib \\r
-!if $(FREEBUILD)\r
-       $(VENDOR_LIBS) \\r
-       $(LIBPATH)\*\ibal.lib \\r
-       $(LIBPATH)\*\complib.lib\r
-!else\r
-       $(VENDOR_LIBSD) \\r
-       $(LIBPATH)\*\ibald.lib \\r
-       $(LIBPATH)\*\complibd.lib\r
-!endif\r
-\r
-INCLUDES= \\r
-       $(WINIBHOME)\inc; \\r
-       $(WINIBHOME)\inc\user; \\r
-       $(WINIBHOME)\inc\user\linux; \\r
-       $(VENDOR_INC); \\r
-       $(OSM_HOME); \\r
-       $(OSM_HOME)\include;\r
-\r
-# Could be any special flag needed for this project \r
-USER_C_FLAGS=$(USER_C_FLAGS) /MD\r
-\r
-#Add preproccessor definitions\r
-C_DEFINES=$(C_DEFINES) -D__WIN__ -D$(VENDOR_IF) -DHAVE_CONFIG_H\r
-\r
-!if !$(FREEBUILD)\r
-#C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG\r
-C_DEFINES=$(C_DEFINES) \r
-!endif\r
-\r
-LINKER_FLAGS= $(LINKER_FLAGS)\r
-\r
-MSC_WARNING_LEVEL= /W3 /wd4090\r
-\r
diff --git a/branches/opensm_3/user/ibtrapgen/ibtrapgen.c b/branches/opensm_3/user/ibtrapgen/ibtrapgen.c
deleted file mode 100644 (file)
index e124474..0000000
+++ /dev/null
@@ -1,441 +0,0 @@
-/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-  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.2 $
- */
-
-#include <complib/cl_qmap.h>
-#include <opensm/osm_log.h>
-#include <complib/cl_debug.h>
-#include <vendor/osm_vendor_api.h>
-#include <vendor/osm_vendor_sa_api.h>
-#include <opensm/osm_mad_pool.h>
-#include <opensm/osm_helper.h>
-#include "ibtrapgen.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,FALSE );
-  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 );
-  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 );
-
-  CL_ASSERT( p_madw );
-
-  OSM_LOG( p_ibtrapgen->p_log, OSM_LOG_VERBOSE,
-           "Got callback trans_id %64I\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 );
-
-  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%016" 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 );
-
-  /*
-   * 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_INFO,
-            "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_LID;
-  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 );
-
-  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",cl_ntoh16(p_ibtrapgen->p_opt->sm_lid));
-  mad_addr.dest_lid = (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/branches/opensm_3/user/ibtrapgen/ibtrapgen.h b/branches/opensm_3/user/ibtrapgen/ibtrapgen.h
deleted file mode 100644 (file)
index 6fe5486..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-  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/branches/opensm_3/user/ibtrapgen/main.c b/branches/opensm_3/user/ibtrapgen/main.c
deleted file mode 100644 (file)
index f7f1de7..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-  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;
-}
-void OsmReportState(IN const char *p_str)
-{
-}
-/**********************************************************************
- **********************************************************************/
-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/branches/opensm_3/user/ibtrapgen/osm_files.c b/branches/opensm_3/user/ibtrapgen/osm_files.c
deleted file mode 100644 (file)
index 9506554..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-\r
-/* Supply required OpenSM src files - easier to maintain/diff these files\r
- * against OFE/openSM source.\r
- */\r
-\r
-#include <..\opensm\osm_mad_pool.c>\r
-#include <..\opensm\osm_log.c>\r
-#include <..\opensm\osm_helper.c>\r
-\r
diff --git a/branches/opensm_3/user/ibtrapgen/vendor-ibal.inc b/branches/opensm_3/user/ibtrapgen/vendor-ibal.inc
deleted file mode 100644 (file)
index 303cdd4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-\r
-!INCLUDE ..\opensm\vendor-ibal.inc\r
diff --git a/branches/opensm_3/user/ibtrapgen/vendor-umad.inc b/branches/opensm_3/user/ibtrapgen/vendor-umad.inc
deleted file mode 100644 (file)
index d106d80..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-\r
-!INCLUDE ..\opensm\vendor-umad.inc\r
diff --git a/branches/opensm_3/user/include/complib/cl_dispatcher.h b/branches/opensm_3/user/include/complib/cl_dispatcher.h
deleted file mode 100644 (file)
index 0840f62..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of dispatcher abstraction.\r
- */\r
-\r
-#ifndef _CL_DISPATCHER_H_\r
-#define _CL_DISPATCHER_H_\r
-\r
-#include <complib/cl_atomic.h>\r
-#include <complib/cl_threadpool.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_qpool.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <complib/cl_ptr_vector.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* Component Library/Dispatcher\r
-* NAME\r
-*      Dispatcher\r
-*\r
-* DESCRIPTION\r
-*      The Dispatcher provides a facility for message routing to\r
-*      asynchronous worker threads.\r
-*\r
-*      The Dispatcher functions operate on a cl_dispatcher_t structure\r
-*      which should be treated as opaque and should be manipulated\r
-*      only through the provided functions.\r
-*\r
-* SEE ALSO\r
-*      Structures:\r
-*              cl_dispatcher_t\r
-*\r
-*      Initialization/Destruction:\r
-*              cl_disp_construct, cl_disp_init, cl_disp_shutdown, cl_disp_destroy\r
-*\r
-*      Manipulation:\r
-*              cl_disp_post, cl_disp_reset, cl_disp_wait_on\r
-*********/\r
-/****s* Component Library: Dispatcher/cl_disp_msgid_t\r
-* NAME\r
-*      cl_disp_msgid_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the type of dispatcher messages.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t cl_disp_msgid_t;\r
-/**********/\r
-\r
-/****s* Component Library: Dispatcher/CL_DISP_MSGID_NONE\r
-* NAME\r
-*      CL_DISP_MSGID_NONE\r
-*\r
-* DESCRIPTION\r
-*      Defines a message value that means "no message".\r
-*      This value is used during registration by Dispatcher clients\r
-*      that do not wish to receive messages.\r
-*\r
-*      No Dispatcher message is allowed to have this value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define CL_DISP_MSGID_NONE     0xFFFFFFFF\r
-/**********/\r
-\r
-/****s* Component Library: Dispatcher/CL_DISP_INVALID_HANDLE\r
-* NAME\r
-*      CL_DISP_INVALID_HANDLE\r
-*\r
-* DESCRIPTION\r
-*      Defines the value of an invalid Dispatcher registration handle.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define CL_DISP_INVALID_HANDLE ((cl_disp_reg_handle_t)0)\r
-/*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_pfn_msgrcv_cb_t\r
-* NAME\r
-*      cl_pfn_msgrcv_cb_t\r
-*\r
-* DESCRIPTION\r
-*      This typedef defines the prototype for client functions invoked\r
-*      by the Dispatcher.  The Dispatcher calls the corresponding\r
-*      client function when delivering a message to the client.\r
-*\r
-*      The client function must be reentrant if the user creates a\r
-*      Dispatcher with more than one worker thread.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void\r
- (*cl_pfn_msgrcv_cb_t) (IN void *context, IN void *p_data);\r
-/*\r
-* PARAMETERS\r
-*      context\r
-*              [in] Client specific context specified in a call to\r
-*              cl_disp_register\r
-*\r
-*      p_data\r
-*              [in] Pointer to the client specific data payload\r
-*              of this message.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      This typedef provides a function prototype reference for\r
-*      the function provided by Dispatcher clients as a parameter\r
-*      to the cl_disp_register function.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_register\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_pfn_msgdone_cb_t\r
-* NAME\r
-*      cl_pfn_msgdone_cb_t\r
-*\r
-* DESCRIPTION\r
-*      This typedef defines the prototype for client functions invoked\r
-*      by the Dispatcher.  The Dispatcher calls the corresponding\r
-*      client function after completing delivery of a message.\r
-*\r
-*      The client function must be reentrant if the user creates a\r
-*      Dispatcher with more than one worker thread.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void\r
- (*cl_pfn_msgdone_cb_t) (IN void *context, IN void *p_data);\r
-/*\r
-* PARAMETERS\r
-*      context\r
-*              [in] Client specific context specified in a call to\r
-*              cl_disp_post\r
-*\r
-*      p_data\r
-*              [in] Pointer to the client specific data payload\r
-*              of this message.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      This typedef provides a function prototype reference for\r
-*      the function provided by Dispatcher clients as a parameter\r
-*      to the cl_disp_post function.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_post\r
-*********/\r
-\r
-/****s* Component Library: Dispatcher/cl_dispatcher_t\r
-* NAME\r
-*      cl_dispatcher_t\r
-*\r
-* DESCRIPTION\r
-*      Dispatcher structure.\r
-*\r
-*      The Dispatcher is thread safe.\r
-*\r
-*      The cl_dispatcher_t structure should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _cl_dispatcher {\r
-       cl_spinlock_t lock;\r
-       cl_ptr_vector_t reg_vec;\r
-       cl_qlist_t reg_list;\r
-       cl_thread_pool_t worker_threads;\r
-       cl_qlist_t msg_fifo;\r
-       cl_qpool_t msg_pool;\r
-       uint64_t last_msg_queue_time_us;\r
-} cl_dispatcher_t;\r
-/*\r
-* FIELDS\r
-*      reg_vec\r
-*              Vector of registration info objects.  Indexed by message msg_id.\r
-*\r
-*      lock\r
-*              Spinlock to guard internal structures.\r
-*\r
-*      msg_fifo\r
-*              FIFO of messages being processed by the Dispatcher.  New\r
-*              messages are posted to the tail of the FIFO.  Worker threads\r
-*              pull messages from the front.\r
-*\r
-*      worker_threads\r
-*              Thread pool of worker threads to dispose of posted messages.\r
-*\r
-*      msg_pool\r
-*              Pool of message objects to be processed through the FIFO.\r
-*\r
-*      reg_count\r
-*              Count of the number of registrants.\r
-*\r
-*      state\r
-*              Indicates the state of the object.\r
-*\r
-*       last_msg_queue_time_us\r
-*               The time that the last message spent in the Q in usec\r
-*\r
-* SEE ALSO\r
-*      Dispatcher\r
-*********/\r
-\r
-/****s* Component Library: Dispatcher/cl_disp_reg_info_t\r
-* NAME\r
-*      cl_disp_reg_info_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the dispatcher registration object structure.\r
-*\r
-*      The cl_disp_reg_info_t structure is for internal use by the\r
-*      Dispatcher only.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _cl_disp_reg_info {\r
-       cl_list_item_t list_item;\r
-       cl_pfn_msgrcv_cb_t pfn_rcv_callback;\r
-       const void *context;\r
-       atomic32_t ref_cnt;\r
-       cl_disp_msgid_t msg_id;\r
-       cl_dispatcher_t *p_disp;\r
-} cl_disp_reg_info_t;\r
-/*\r
-* FIELDS\r
-*      pfn_rcv_callback\r
-*              Client's message receive callback.\r
-*\r
-*      context\r
-*              Client's context for message receive callback.\r
-*\r
-*      rcv_thread_count\r
-*              Number of threads currently in the receive callback.\r
-*\r
-*      msg_done_thread_count\r
-*              Number of threads currently in the message done callback.\r
-*\r
-*      state\r
-*              State of this registration object.\r
-*                      DISP_REGSTATE_INIT: initialized and inactive\r
-*                      DISP_REGSTATE_ACTIVE: in active use\r
-*                      DISP_REGSTATE_UNREGPEND: unregistration is pending\r
-*\r
-*      msg_id\r
-*              Dispatcher message msg_id value for this registration object.\r
-*\r
-*      p_disp\r
-*              Pointer to parent Dispatcher.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* Component Library: Dispatcher/cl_disp_msg_t\r
-* NAME\r
-*      cl_disp_msg_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the dispatcher message structure.\r
-*\r
-*      The cl_disp_msg_t structure is for internal use by the\r
-*      Dispatcher only.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _cl_disp_msg {\r
-       cl_pool_item_t item;\r
-       const void *p_data;\r
-       cl_disp_reg_info_t *p_src_reg;\r
-       cl_disp_reg_info_t *p_dest_reg;\r
-       cl_pfn_msgdone_cb_t pfn_xmt_callback;\r
-       uint64_t in_time;\r
-       const void *context;\r
-} cl_disp_msg_t;\r
-/*\r
-* FIELDS\r
-*      item\r
-*              List & Pool linkage.  Must be first element in the structure!!\r
-*\r
-*      msg_id\r
-*              The message's numberic ID value.\r
-*\r
-*      p_data\r
-*              Pointer to the data payload for this message.  The payload\r
-*              is opaque to the Dispatcher.\r
-*\r
-*      p_reg_info\r
-*              Pointer to the registration info of the sender.\r
-*\r
-*      pfn_xmt_callback\r
-*              Client's message done callback.\r
-*\r
-*       in_time\r
-*               The absolute time the message was inserted into the queue\r
-*\r
-*      context\r
-*              Client's message done callback context.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* Component Library: Dispatcher/cl_disp_reg_info_t\r
-* NAME\r
-*      cl_disp_reg_info_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the Dispatcher registration handle.  This handle\r
-*      should be treated as opaque by the client.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef const struct _cl_disp_reg_info *cl_disp_reg_handle_t;\r
-/**********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_construct\r
-* NAME\r
-*      cl_disp_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_disp_construct(IN cl_dispatcher_t * const p_disp);\r
-/*\r
-* PARAMETERS\r
-*      p_disp\r
-*              [in] Pointer to a Dispatcher.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling cl_disp_init and cl_disp_destroy.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_init, cl_disp_destroy\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_init\r
-* NAME\r
-*      cl_disp_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t\r
-cl_disp_init(IN cl_dispatcher_t * const p_disp,\r
-            IN const uint32_t thread_count, IN const char *const name);\r
-/*\r
-* PARAMETERS\r
-*      p_disp\r
-*              [in] Pointer to a Dispatcher.\r
-*\r
-*      thread_count\r
-*              [in] The number of worker threads to create in this Dispatcher.\r
-*              A value of 0 causes the Dispatcher to create one worker thread\r
-*              per CPU in the system.  When the Dispatcher is created with\r
-*              only one thread, the Dispatcher guarantees to deliver posted\r
-*              messages in order.  When the Dispatcher is created with more\r
-*              than one thread, messages may be delivered out of order.\r
-*\r
-*      name\r
-*              [in] Name to associate with the threads.  The name may be up to 16\r
-*              characters, including a terminating null character.  All threads\r
-*              created in the Dispatcher have the same name.\r
-*\r
-* RETURN VALUE\r
-*      CL_SUCCESS if the operation is successful.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_destoy, cl_disp_register, cl_disp_unregister,\r
-*      cl_disp_post\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_shutdown\r
-* NAME\r
-*      cl_disp_shutdown\r
-*\r
-* DESCRIPTION\r
-*      This function shutdown a Dispatcher object. So it unreg all messages and\r
-*  clears the fifo and waits for the threads to exit\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp);\r
-/*\r
-* PARAMETERS\r
-*      p_disp\r
-*              [in] Pointer to a Dispatcher.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      This function does not returns until all worker threads\r
-*      have exited client callback functions and been successfully\r
-*      shutdowned.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_construct, cl_disp_init\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_destroy\r
-* NAME\r
-*      cl_disp_destroy\r
-*\r
-* DESCRIPTION\r
-*      This function destroys a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_disp_destroy(IN cl_dispatcher_t * const p_disp);\r
-/*\r
-* PARAMETERS\r
-*      p_disp\r
-*              [in] Pointer to a Dispatcher.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_construct, cl_disp_init\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_register\r
-* NAME\r
-*      cl_disp_register\r
-*\r
-* DESCRIPTION\r
-*      This function registers a client with a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_disp_reg_handle_t\r
-cl_disp_register(IN cl_dispatcher_t * const p_disp,\r
-                IN const cl_disp_msgid_t msg_id,\r
-                IN cl_pfn_msgrcv_cb_t pfn_callback OPTIONAL,\r
-                IN const void *const context);\r
-/*\r
-* PARAMETERS\r
-*      p_disp\r
-*              [in] Pointer to a Dispatcher.\r
-*\r
-*      msg_id\r
-*              [in] Numberic message ID for which the client is registering.\r
-*              If the client does not wish to receive any messages,\r
-*              (a send-only client) then the caller should set this value\r
-*              to CL_DISP_MSGID_NONE.  For efficiency, numeric message msg_id\r
-*              values should start with 0 and should be contiguous, or nearly so.\r
-*\r
-*      pfn_callback\r
-*              [in] Message receive callback.  The Dispatcher calls this\r
-*              function after receiving a posted message with the\r
-*              appropriate message msg_id value.  Send-only clients may specify\r
-*              NULL for this value.\r
-*\r
-*      context\r
-*              [in] Client context value passed to the cl_pfn_msgrcv_cb_t\r
-*              function.\r
-*\r
-* RETURN VALUE\r
-*      On success a Dispatcher registration handle.\r
-*      CL_CL_DISP_INVALID_HANDLE otherwise.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_unregister, cl_disp_post\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_unregister\r
-* NAME\r
-*      cl_disp_unregister\r
-*\r
-* DESCRIPTION\r
-*      This function unregisters a client from a Dispatcher.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_disp_unregister(IN const cl_disp_reg_handle_t handle);\r
-/*\r
-* PARAMETERS\r
-*      handle\r
-*              [in] cl_disp_reg_handle_t value return by cl_disp_register.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      This function will not return until worker threads have exited\r
-*      the callback functions for this client.  Do not invoke this\r
-*      function from a callback.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher, cl_disp_register\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_post\r
-* NAME\r
-*      cl_disp_post\r
-*\r
-* DESCRIPTION\r
-*      This function posts a message to a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t\r
-cl_disp_post(IN const cl_disp_reg_handle_t handle,\r
-            IN const cl_disp_msgid_t msg_id,\r
-            IN const void *const p_data,\r
-            IN cl_pfn_msgdone_cb_t pfn_callback OPTIONAL,\r
-            IN const void *const context);\r
-/*\r
-* PARAMETERS\r
-*      handle\r
-*              [in] cl_disp_reg_handle_t value return by cl_disp_register.\r
-*\r
-*      msg_id\r
-*              [in] Numeric message msg_id value associated with this message.\r
-*\r
-*      p_data\r
-*              [in] Data payload for this message.\r
-*\r
-*      pfn_callback\r
-*              [in] Pointer to a cl_pfn_msgdone_cb_t function.\r
-*              The Dispatcher calls this function after the message has been\r
-*              processed by the recipient.\r
-*              The caller may pass NULL for this value, which indicates no\r
-*              message done callback is necessary.\r
-*\r
-*      context\r
-*              [in] Client context value passed to the cl_pfn_msgdone_cb_t\r
-*              function.\r
-*\r
-* RETURN VALUE\r
-*      CL_SUCCESS if the message was successfully queued in the Dispatcher.\r
-*\r
-* NOTES\r
-*      The caller must not modify the memory pointed to by p_data until\r
-*      the Dispatcher call the pfn_callback function.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher\r
-*********/\r
-\r
-/****f* Component Library: Dispatcher/cl_disp_get_queue_status\r
-* NAME\r
-*      cl_disp_get_queue_status\r
-*\r
-* DESCRIPTION\r
-*      This function posts a message to a Dispatcher object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void\r
-cl_disp_get_queue_status(IN const cl_disp_reg_handle_t handle,\r
-                        OUT uint32_t * p_num_queued_msgs,\r
-                        OUT uint64_t * p_last_msg_queue_time_ms);\r
-/*\r
-* PARAMETERS\r
-*   handle\r
-*     [in] cl_disp_reg_handle_t value return by cl_disp_register.\r
-*\r
-*   p_last_msg_queue_time_ms\r
-*     [out] pointer to a variable to hold the time the last popped up message\r
-*           spent in the queue\r
-*\r
-*   p_num_queued_msgs\r
-*     [out] number of messages in the queue\r
-*\r
-* RETURN VALUE\r
-*      Thr time the last popped up message stayed in the queue, in msec\r
-*\r
-* NOTES\r
-*      Extarnel Locking is not required.\r
-*\r
-* SEE ALSO\r
-*      Dispatcher\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* !defined(_CL_DISPATCHER_H_) */\r
diff --git a/branches/opensm_3/user/include/complib/cl_event_wheel.h b/branches/opensm_3/user/include/complib/cl_event_wheel.h
deleted file mode 100644 (file)
index abc5ed0..0000000
+++ /dev/null
@@ -1,457 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of event wheel abstraction.\r
- */\r
-\r
-#ifndef _CL_EVENT_WHEEL_H_\r
-#define _CL_EVENT_WHEEL_H_\r
-\r
-#include <complib/cl_atomic.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_timer.h>\r
-#include <complib/cl_spinlock.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* Component Library/Event_Wheel\r
-* NAME\r
-*      Event_Wheel\r
-*\r
-* DESCRIPTION\r
-*      The Event_Wheel provides a facility for registering delayed events\r
-*      and getting called once they timeout.\r
-*\r
-*      The Event_Wheel functions operate on a cl_event_wheel_t structure\r
-*      which should be treated as opaque and should be manipulated\r
-*      only through the provided functions.\r
-*\r
-* SEE ALSO\r
-*      Structures:\r
-*              cl_event_wheel_t\r
-*\r
-*      Initialization/Destruction:\r
-*              cl_event_wheel_construct, cl_event_wheel_init, cl_event_wheel_destroy\r
-*\r
-*      Manipulation:\r
-*              cl_event_wheel_reg, cl_event_wheel_unreg\r
-*\r
-*********/\r
-/****f* Component Library: Event_Wheel/cl_pfn_event_aged_cb_t\r
-* NAME\r
-*      cl_pfn_event_aged_cb_t\r
-*\r
-* DESCRIPTION\r
-*      This typedef defines the prototype for client functions invoked\r
-*      by the Event_Wheel.  The Event_Wheel calls the corresponding\r
-*      client function when the specific item has aged.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint64_t\r
-    (*cl_pfn_event_aged_cb_t) (IN uint64_t key,\r
-                              IN uint32_t num_regs, IN void *context);\r
-/*\r
-* PARAMETERS\r
-*  key\r
-*     [in] The key used for registering the item in the call to\r
-*     cl_event_wheel_reg\r
-*\r
-*  num_regs\r
-*     [in] The number of times this event was registered (pushed in time).\r
-*\r
-*      context\r
-*              [in] Client specific context specified in a call to\r
-*              cl_event_wheel_reg\r
-*\r
-* RETURN VALUE\r
-*      This function returns the abosolute time the event should fire in [usec].\r
-*  If lower then current time means the event should be unregistered\r
-*  immediatly.\r
-*\r
-* NOTES\r
-*      This typedef provides a function prototype reference for\r
-*      the function provided by Event_Wheel clients as a parameter\r
-*      to the cl_event_wheel_reg function.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_reg\r
-*********/\r
-\r
-/****s* Component Library: Event_Wheel/cl_event_wheel_t\r
-* NAME\r
-*      cl_event_wheel_t\r
-*\r
-* DESCRIPTION\r
-*      Event_Wheel structure.\r
-*\r
-*      The Event_Wheel is thread safe.\r
-*\r
-*      The cl_event_wheel_t structure should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _cl_event_wheel {\r
-       cl_spinlock_t lock;\r
-       cl_spinlock_t *p_external_lock;\r
-\r
-       cl_qmap_t events_map;\r
-       boolean_t closing;\r
-       cl_qlist_t events_wheel;\r
-       cl_timer_t timer;\r
-} cl_event_wheel_t;\r
-/*\r
-* FIELDS\r
-*      lock\r
-*              Spinlock to guard internal structures.\r
-*\r
-*       p_external_lock\r
-*               Reference to external spinlock to guard internal structures\r
-*               if the event wheel is part of a larger object protected by its own lock\r
-*\r
-*      events_map\r
-*              A Map holding all registered event items by their key.\r
-*\r
-*  closing\r
-*     A flag indicating the event wheel is closing. This means that\r
-*     callbacks that are called when closing == TRUE should just be ignored.\r
-*\r
-*      events_wheel\r
-*              A list of the events sorted by expiration time.\r
-*\r
-*      timer\r
-*              The timer scheduling event time propagation.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel\r
-*********/\r
-\r
-/****s* Component Library: Event_Wheel/cl_event_wheel_reg_info_t\r
-* NAME\r
-*      cl_event_wheel_reg_info_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the event_wheel registration object structure.\r
-*\r
-*      The cl_event_wheel_reg_info_t structure is for internal use by the\r
-*      Event_Wheel only.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _cl_event_wheel_reg_info {\r
-       cl_map_item_t map_item;\r
-       cl_list_item_t list_item;\r
-       uint64_t key;\r
-       cl_pfn_event_aged_cb_t pfn_aged_callback;\r
-       uint64_t aging_time;\r
-       uint32_t num_regs;\r
-       void *context;\r
-       cl_event_wheel_t *p_event_wheel;\r
-} cl_event_wheel_reg_info_t;\r
-/*\r
-* FIELDS\r
-*  map_item\r
-*     The map item of this event\r
-*\r
-*  list_item\r
-*     The sorted by aging time list item\r
-*\r
-*  key\r
-*     The key by which one can find the event\r
-*\r
-*      pfn_aged_callback\r
-*              The clients Event-Aged callback\r
-*\r
-*  aging_time\r
-*     The delta time [msec] for which the event should age.\r
-*\r
-*  num_regs\r
-*     The number of times the same event (key) was registered\r
-*\r
-*      context\r
-*              Client's context for event-aged callback.\r
-*\r
-*      p_event_wheel\r
-*              Pointer to this event wheel object\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_construct\r
-* NAME\r
-*      cl_event_wheel_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a Event_Wheel object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling cl_event_wheel_init and cl_event_wheel_destroy.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_init, cl_event_wheel_destroy\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_init\r
-* NAME\r
-*      cl_event_wheel_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes a Event_Wheel object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t\r
-cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-* RETURN VALUE\r
-*      CL_SUCCESS if the operation is successful.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_destoy, cl_event_wheel_reg, cl_event_wheel_unreg\r
-*\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_init\r
-* NAME\r
-*      cl_event_wheel_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes a Event_Wheel object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t\r
-cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,\r
-                      IN cl_spinlock_t * p_external_lock);\r
-\r
-/*\r
-* PARAMETERS\r
-*  p_event_wheel\r
-*     [in] Pointer to a Event_Wheel.\r
-*\r
-*  p_external_lock\r
-*     [in] Reference to external spinlock to guard internal structures\r
-*          if the event wheel is part of a larger object protected by its own lock\r
-*\r
-* RETURN VALUE\r
-*      CL_SUCCESS if the operation is successful.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_destoy, cl_event_wheel_reg, cl_event_wheel_unreg\r
-*\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_destroy\r
-* NAME\r
-*      cl_event_wheel_destroy\r
-*\r
-* DESCRIPTION\r
-*      This function destroys a Event_Wheel object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_event_wheel_destroy(IN cl_event_wheel_t * const p_event_wheel);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      This function does not returns until all client callback functions\r
-*  been successfully finished.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_construct, cl_event_wheel_init\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_dump\r
-* NAME\r
-*      cl_event_wheel_dump\r
-*\r
-* DESCRIPTION\r
-*      This function dumps the details of an Event_Whell object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Note that this function should be called inside a lock of the event wheel!\r
-*  It doesn't aquire the lock by itself.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_construct, cl_event_wheel_init\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_reg\r
-* NAME\r
-*      cl_event_wheel_reg\r
-*\r
-* DESCRIPTION\r
-*      This function registers a client with a Event_Wheel object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t\r
-cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,\r
-                  IN const uint64_t key,\r
-                  IN const uint64_t aging_time_usec,\r
-                  IN cl_pfn_event_aged_cb_t pfn_callback,\r
-                  IN void *const context);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-*      key\r
-*              [in] The specifc Key by which events are registered.\r
-*\r
-*  aging_time_usec\r
-*     [in] The absolute time this event should age in usec\r
-*\r
-*      pfn_callback\r
-*              [in] Event Aging callback.  The Event_Wheel calls this\r
-*              function after the time the event has registed for has come.\r
-*\r
-*      context\r
-*              [in] Client context value passed to the cl_pfn_event_aged_cb_t\r
-*              function.\r
-*\r
-* RETURN VALUE\r
-*      On success a Event_Wheel CL_SUCCESS or CL_ERROR otherwise.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_unreg\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_unreg\r
-* NAME\r
-*      cl_event_wheel_unreg\r
-*\r
-* DESCRIPTION\r
-*      This function unregisters a client event from a Event_Wheel.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void\r
-cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel,\r
-                    IN uint64_t key);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-*      key\r
-*              [in] The key used for registering the event\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*  After the event has aged it is automatically removed from\r
-*  the event wheel. So it should only be invoked when the need arises\r
-*  to remove existing events before they age.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_reg\r
-*********/\r
-\r
-/****f* Component Library: Event_Wheel/cl_event_wheel_num_regs\r
-* NAME\r
-*      cl_event_wheel_num_regs\r
-*\r
-* DESCRIPTION\r
-*      This function returns the number of times an event was registered.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint32_t\r
-cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,\r
-                       IN uint64_t key);\r
-/*\r
-* PARAMETERS\r
-*      p_event_wheel\r
-*              [in] Pointer to a Event_Wheel.\r
-*\r
-*      key\r
-*              [in] The key used for registering the event\r
-*\r
-* RETURN VALUE\r
-*      The number of times the event was registered.\r
-*  0 if never registered or eventually aged.\r
-*\r
-* SEE ALSO\r
-*      Event_Wheel, cl_event_wheel_reg, cl_event_wheel_unreg\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* !defined(_CL_EVENT_WHEEL_H_) */\r
diff --git a/branches/opensm_3/user/include/iba/ib_cm_types.h b/branches/opensm_3/user/include/iba/ib_cm_types.h
deleted file mode 100644 (file)
index 29fa2bc..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*\r
- * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if !defined(__IB_CM_TYPES_H__)\r
-#define __IB_CM_TYPES_H__\r
-\r
-#ifndef __WIN__\r
-\r
-#include <iba/ib_types.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * Defines known Communication management class versions\r
- */\r
-#define IB_MCLASS_CM_VER_2                             2\r
-#define IB_MCLASS_CM_VER_1                             1\r
-/*\r
- *     Defines the size of user available data in communication management MADs\r
- */\r
-#define IB_REQ_PDATA_SIZE_VER2                         92\r
-#define IB_MRA_PDATA_SIZE_VER2                         222\r
-#define IB_REJ_PDATA_SIZE_VER2                         148\r
-#define IB_REP_PDATA_SIZE_VER2                         196\r
-#define IB_RTU_PDATA_SIZE_VER2                         224\r
-#define IB_LAP_PDATA_SIZE_VER2                         168\r
-#define IB_APR_PDATA_SIZE_VER2                         148\r
-#define IB_DREQ_PDATA_SIZE_VER2                                220\r
-#define IB_DREP_PDATA_SIZE_VER2                                224\r
-#define IB_SIDR_REQ_PDATA_SIZE_VER2                    216\r
-#define IB_SIDR_REP_PDATA_SIZE_VER2                    136\r
-#define IB_REQ_PDATA_SIZE_VER1                         92\r
-#define IB_MRA_PDATA_SIZE_VER1                         222\r
-#define IB_REJ_PDATA_SIZE_VER1                         148\r
-#define IB_REP_PDATA_SIZE_VER1                         204\r
-#define IB_RTU_PDATA_SIZE_VER1                         224\r
-#define IB_LAP_PDATA_SIZE_VER1                         168\r
-#define IB_APR_PDATA_SIZE_VER1                         151\r
-#define IB_DREQ_PDATA_SIZE_VER1                                220\r
-#define IB_DREP_PDATA_SIZE_VER1                                224\r
-#define IB_SIDR_REQ_PDATA_SIZE_VER1                    216\r
-#define IB_SIDR_REP_PDATA_SIZE_VER1                    140\r
-#define IB_ARI_SIZE                                    72      // redefine\r
-#define IB_APR_INFO_SIZE                               72\r
-/****d* Access Layer/ib_rej_status_t\r
-* NAME\r
-*      ib_rej_status_t\r
-*\r
-* DESCRIPTION\r
-*      Rejection reasons.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef ib_net16_t ib_rej_status_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_cm_rej, ib_cm_rej_rec_t\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_REJ_INSUF_QP                                        CL_HTON16(1)\r
-#define IB_REJ_INSUF_EEC                               CL_HTON16(2)\r
-#define IB_REJ_INSUF_RESOURCES                         CL_HTON16(3)\r
-#define IB_REJ_TIMEOUT                                 CL_HTON16(4)\r
-#define IB_REJ_UNSUPPORTED                             CL_HTON16(5)\r
-#define IB_REJ_INVALID_COMM_ID                         CL_HTON16(6)\r
-#define IB_REJ_INVALID_COMM_INSTANCE                   CL_HTON16(7)\r
-#define IB_REJ_INVALID_SID                             CL_HTON16(8)\r
-#define IB_REJ_INVALID_XPORT                           CL_HTON16(9)\r
-#define IB_REJ_STALE_CONN                              CL_HTON16(10)\r
-#define IB_REJ_RDC_NOT_EXIST                           CL_HTON16(11)\r
-#define IB_REJ_INVALID_GID                             CL_HTON16(12)\r
-#define IB_REJ_INVALID_LID                             CL_HTON16(13)\r
-#define IB_REJ_INVALID_SL                              CL_HTON16(14)\r
-#define IB_REJ_INVALID_TRAFFIC_CLASS                   CL_HTON16(15)\r
-#define IB_REJ_INVALID_HOP_LIMIT                       CL_HTON16(16)\r
-#define IB_REJ_INVALID_PKT_RATE                                CL_HTON16(17)\r
-#define IB_REJ_INVALID_ALT_GID                         CL_HTON16(18)\r
-#define IB_REJ_INVALID_ALT_LID                         CL_HTON16(19)\r
-#define IB_REJ_INVALID_ALT_SL                          CL_HTON16(20)\r
-#define IB_REJ_INVALID_ALT_TRAFFIC_CLASS               CL_HTON16(21)\r
-#define IB_REJ_INVALID_ALT_HOP_LIMIT                   CL_HTON16(22)\r
-#define IB_REJ_INVALID_ALT_PKT_RATE                    CL_HTON16(23)\r
-#define IB_REJ_PORT_REDIRECT                           CL_HTON16(24)\r
-#define IB_REJ_INVALID_MTU                             CL_HTON16(26)\r
-#define IB_REJ_INSUFFICIENT_RESP_RES                   CL_HTON16(27)\r
-#define IB_REJ_USER_DEFINED                            CL_HTON16(28)\r
-#define IB_REJ_INVALID_RNR_RETRY                       CL_HTON16(29)\r
-#define IB_REJ_DUPLICATE_LOCAL_COMM_ID                 CL_HTON16(30)\r
-#define IB_REJ_INVALID_CLASS_VER                       CL_HTON16(31)\r
-#define IB_REJ_INVALID_FLOW_LBL                                CL_HTON16(32)\r
-#define IB_REJ_INVALID_ALT_FLOW_LBL                    CL_HTON16(33)\r
-\r
-#define IB_REJ_SERVICE_HANDOFF                         CL_HTON16(65535)\r
-/******/\r
-\r
-/****d* Access Layer/ib_apr_status_t\r
-* NAME\r
-*      ib_apr_status_t\r
-*\r
-* DESCRIPTION\r
-*      Automatic path migration status information.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint8_t ib_apr_status_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_cm_apr, ib_cm_apr_rec_t\r
-*\r
-* SOURCE\r
- */\r
-#define IB_AP_SUCCESS                                  0\r
-#define IB_AP_INVALID_COMM_ID                          1\r
-#define IB_AP_UNSUPPORTED                              2\r
-#define IB_AP_REJECT                                   3\r
-#define IB_AP_REDIRECT                                 4\r
-#define IB_AP_IS_CURRENT                               5\r
-#define IB_AP_INVALID_QPN_EECN                         6\r
-#define IB_AP_INVALID_LID                              7\r
-#define IB_AP_INVALID_GID                              8\r
-#define IB_AP_INVALID_FLOW_LBL                         9\r
-#define IB_AP_INVALID_TCLASS                           10\r
-#define IB_AP_INVALID_HOP_LIMIT                                11\r
-#define IB_AP_INVALID_PKT_RATE                         12\r
-#define IB_AP_INVALID_SL                               13\r
-/******/\r
-\r
-/****d* Access Layer/ib_cm_cap_mask_t\r
-* NAME\r
-*      ib_cm_cap_mask_t\r
-*\r
-* DESCRIPTION\r
-*      Capability mask values in ClassPortInfo.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define IB_CM_RELIABLE_CONN_CAPABLE                    CL_HTON16(9)\r
-#define IB_CM_RELIABLE_DGRM_CAPABLE                    CL_HTON16(10)\r
-#define IB_CM_RDGRM_CAPABLE                            CL_HTON16(11)\r
-#define IB_CM_UNRELIABLE_CONN_CAPABLE                  CL_HTON16(12)\r
-#define IB_CM_SIDR_CAPABLE                             CL_HTON16(13)\r
-/*\r
-* SEE ALSO\r
-*      ib_cm_rep, ib_class_port_info_t\r
-*\r
-* SOURCE\r
-*\r
-*******/\r
-\r
-/*\r
- *     Service ID resolution status\r
- */\r
-typedef uint16_t ib_sidr_status_t;\r
-#define IB_SIDR_SUCCESS                                        0\r
-#define IB_SIDR_UNSUPPORTED                            1\r
-#define IB_SIDR_REJECT                                 2\r
-#define IB_SIDR_NO_QP                                  3\r
-#define IB_SIDR_REDIRECT                               4\r
-#define IB_SIDR_UNSUPPORTED_VER                                5\r
-\r
-END_C_DECLS\r
-#endif                         /* ndef __WIN__ */\r
-#endif                         /* __IB_CM_TYPES_H__ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_attrib_req.h b/branches/opensm_3/user/include/opensm/osm_attrib_req.h
deleted file mode 100644 (file)
index 0389eee..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_ATTRIB_REQ_H_\r
-#define _OSM_ATTRIB_REQ_H_\r
-\r
-#include <opensm/osm_path.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * Abstract:\r
- *     Declaration of the attribute request object.  This object\r
- *  encapsulates information needed by the generic request controller\r
- *  to request an attribute from a node.\r
- *     These objects are part of the OpenSM family of objects.\r
- */\r
-/****h* OpenSM/Attribute Request\r
-* NAME\r
-*      Attribute Request\r
-*\r
-* DESCRIPTION\r
-*      The Attribute Request structure encapsulates\r
-*   encapsulates information needed by the generic request controller\r
-*   to request an attribute from a node.\r
-*\r
-*      This structure allows direct access to member variables.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Attribute Request/osm_attrib_req_t\r
-* NAME\r
-*      osm_attrib_req_t\r
-*\r
-* DESCRIPTION\r
-*      Attribute request structure.\r
-*\r
-*      This structure allows direct access to member variables.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_attrib_req {\r
-       uint16_t attrib_id;\r
-       uint32_t attrib_mod;\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t path;\r
-       cl_disp_msgid_t err_msg;\r
-} osm_attrib_req_t;\r
-/*\r
-* FIELDS\r
-*      attrib_id\r
-*              Attribute ID for this request.\r
-*\r
-*      attrib_mod\r
-*              Attribute modifier for this request.\r
-*\r
-*      context\r
-*              Context to insert in outbound mad wrapper context.\r
-*\r
-*      path\r
-*              The directed route path to the node.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_ATTRIB_REQ_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_base.h b/branches/opensm_3/user/include/opensm/osm_base.h
deleted file mode 100644 (file)
index 6f34f84..0000000
+++ /dev/null
@@ -1,906 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Basic OpenSM definitions and structures.\r
- *     This object represents an OpenSM "base class".\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_BASE_H_\r
-#define _OSM_BASE_H_\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#ifdef __WIN__\r
-#include <vendor/winosm_common.h>\r
-#endif\r
-\r
-#include <complib/cl_types.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Constants\r
-* NAME\r
-*      Constants\r
-*\r
-* DESCRIPTION\r
-*      The following constants are used throughout the OpenSM.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****h* OpenSM/Base\r
-* NAME\r
-*      Base\r
-*\r
-* DESCRIPTION\r
-*      The Base object encapsulates basic information needed by the\r
-*      OpenSM to manage objects.  Each OpenSM object includes the\r
-*      Base object as the first member.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_M_KEY\r
-* NAME\r
-*      OSM_DEFAULT_M_KEY\r
-*\r
-* DESCRIPTION\r
-*      Managment key value used by the OpenSM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_M_KEY 0\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_SM_KEY\r
-* NAME\r
-*      OSM_DEFAULT_SM_KEY\r
-*\r
-* DESCRIPTION\r
-*      Subnet Manager key value used by the OpenSM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SM_KEY CL_HTON64(1)\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_SA_KEY\r
-* NAME\r
-*      OSM_DEFAULT_SA_KEY\r
-*\r
-* DESCRIPTION\r
-*      Subnet Adminstration key value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SA_KEY OSM_DEFAULT_SM_KEY\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_LMC\r
-* NAME\r
-*      OSM_DEFAULT_LMC\r
-*\r
-* DESCRIPTION\r
-*      Default LMC value used by the OpenSM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_LMC 0\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_MAX_OP_VLS\r
-* NAME\r
-*      OSM_DEFAULT_MAX_OP_VLS\r
-*\r
-* DESCRIPTION\r
-*      Default Maximal Operational VLs to be initialized on\r
-*  the link ports PortInfo by the OpenSM.\r
-*  Default value provides backward compatibility.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_MAX_OP_VLS 5\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_SL\r
-* NAME\r
-*      OSM_DEFAULT_SL\r
-*\r
-* DESCRIPTION\r
-*      Default SL value used by the OpenSM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SL 0\r
-/********/\r
-/****s* OpenSM: Base/OSM_DEFAULT_SM_PRIORITY\r
-* NAME\r
-*      OSM_DEFAULT_SM_PRIORITY\r
-*\r
-* DESCRIPTION\r
-*      Default SM priority value used by the OpenSM,\r
-*      as defined in the SMInfo attribute.  0 is the lowest priority.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SM_PRIORITY 0\r
-/********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_TMP_DIR\r
-* NAME\r
-*      OSM_DEFAULT_TMP_DIR\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default temporary directory for the log file,\r
-*  osm-subnet.lst, and other log files.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_TMP_DIR "%TEMP%\\"\r
-#else\r
-#define OSM_DEFAULT_TMP_DIR "/var/log/"\r
-#endif\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_CACHE_DIR\r
-* NAME\r
-*      OSM_DEFAULT_CACHE_DIR\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default cache directory for the db files.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_CACHE_DIR OPENSM_CONFIG_DIR\r
-#else\r
-#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm"\r
-#endif\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_LOG_FILE\r
-* NAME\r
-*      OSM_DEFAULT_LOG_FILE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default log file name\r
-*\r
-* SYNOPSIS\r
-*/\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_LOG_FILE OSM_DEFAULT_TMP_DIR "osm.log"\r
-#else\r
-#define OSM_DEFAULT_LOG_FILE "/var/log/opensm.log"\r
-#endif\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_DEFAULT_CONFIG_FILE\r
-* NAME\r
-*      OSM_DEFAULT_CONFIG_FILE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default OpenSM config file name\r
-*\r
-* SYNOPSIS\r
-*/\r
-#if defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE)\r
-#define OSM_DEFAULT_CONFIG_FILE HAVE_DEFAULT_OPENSM_CONFIG_FILE\r
-#elif defined (OPENSM_CONFIG_DIR)\r
-#define OSM_DEFAULT_CONFIG_FILE OPENSM_CONFIG_DIR "/opensm.conf"\r
-#else\r
-#define OSM_DEFAULT_CONFIG_FILE "/etc/opensm/opensm.conf"\r
-#endif\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_DEFAULT_PARTITION_CONFIG_FILE\r
-* NAME\r
-*      OSM_DEFAULT_PARTITION_CONFIG_FILE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default partition config file name\r
-*\r
-* SYNOPSIS\r
-*/\r
-#if defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE)\r
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE HAVE_DEFAULT_PARTITION_CONFIG_FILE\r
-#elif defined(OPENSM_CONFIG_DIR)\r
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "/partitions.conf"\r
-#else\r
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE "/etc/opensm/partitions.conf"\r
-#endif\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_POLICY_FILE\r
-* NAME\r
-*      OSM_DEFAULT_QOS_POLICY_FILE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default QoS policy file name\r
-*\r
-* SYNOPSIS\r
-*/\r
-#if defined(HAVE_DEFAULT_QOS_POLICY_FILE)\r
-#define OSM_DEFAULT_QOS_POLICY_FILE HAVE_DEFAULT_QOS_POLICY_FILE\r
-#elif defined(OPENSM_CONFIG_DIR)\r
-#define OSM_DEFAULT_QOS_POLICY_FILE OPENSM_CONFIG_DIR "/qos-policy.conf"\r
-#else\r
-#define OSM_DEFAULT_QOS_POLICY_FILE "/etc/opensm/qos-policy.conf"\r
-#endif\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_DEFAULT_PREFIX_ROUTES_FILE\r
-* NAME\r
-*      OSM_DEFAULT_PREFIX_ROUTES_FILE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default prefix routes file name\r
-*\r
-* SYNOPSIS\r
-*/\r
-#if defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE)\r
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE HAVE_DEFAULT_PREFIX_ROUTES_FILE\r
-#elif defined(OPENSM_CONFIG_DIR)\r
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "/prefix-routes.conf"\r
-#else\r
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE "/etc/opensm/prefix-routes.conf"\r
-#endif\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_DEFAULT_SWEEP_INTERVAL_SECS\r
-* NAME\r
-*      OSM_DEFAULT_SWEEP_INTERVAL_SECS\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default number of seconds between subnet sweeps.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SWEEP_INTERVAL_SECS 10\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC\r
-* NAME\r
-*      OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default transaction timeout in milliseconds.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC 200\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_SUBNET_TIMEOUT\r
-* NAME\r
-*      OSM_DEFAULT_SUBNET_TIMEOUT\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default subnet timeout.\r
-*      timeout time = 4us * 2^timeout.\r
-*  We use here ~1sec.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SUBNET_TIMEOUT 0x12\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_SWITCH_PACKET_LIFE\r
-* NAME\r
-*      OSM_DEFAULT_SWITCH_PACKET_LIFE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default max life time for a pcket on the switch.\r
-*      timeout time = 4us * 2^timeout.\r
-*  We use here the value of ~1sec\r
-*  A Value > 19dec disables this mechanism.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SWITCH_PACKET_LIFE 0x12\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_HEAD_OF_QUEUE_LIFE\r
-* NAME\r
-*      OSM_DEFAULT_HEAD_OF_QUEUE_LIFE\r
-*\r
-* DESCRIPTION\r
-*      Sets the time a packet can live in the head of the VL Queue\r
-*  We use here the value of ~1sec\r
-*  A Value > 19dec disables this mechanism.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_HEAD_OF_QUEUE_LIFE 0x12\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_LEAF_HEAD_OF_QUEUE_LIFE\r
-* NAME\r
-*      OSM_DEFAULT_LEAF_HEAD_OF_QUEUE_LIFE\r
-*\r
-* DESCRIPTION\r
-*      Sets the time a packet can live in the head of the VL Queue\r
-*  of a port that drives a CA port.\r
-*  We use here the value of ~256msec\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_LEAF_HEAD_OF_QUEUE_LIFE 0x10\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_VL_STALL_COUNT\r
-* NAME\r
-*      OSM_DEFAULT_LEAF_VL_COUNT\r
-*\r
-* DESCRIPTION\r
-*      Sets the number of consecutive head of queue life time drops that\r
-*  puts the VL into stalled state. In stalled state, the port is supposed\r
-*  to drop everything for 8*(head of queue lifetime)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_VL_STALL_COUNT 0x7\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_LEAF_VL_STALL_COUNT\r
-* NAME\r
-*      OSM_DEFAULT_LEAF_VL_STALL_COUNT\r
-*\r
-* DESCRIPTION\r
-*      Sets the number of consecutive head of queue life time drops that\r
-*  puts the VL into stalled state. In stalled state, the port is supposed\r
-*  to drop everything for 8*(head of queue lifetime). This value is for\r
-*  switch ports driving a CA port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_LEAF_VL_STALL_COUNT 0x7\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT\r
-* NAME\r
-*      OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default timeout for ignoring same trap.\r
-*      timeout time = 5000000us\r
-*  We use here ~5sec.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT 5000000\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_UNHEALTHY_TIMEOUT\r
-* NAME\r
-*      OSM_DEFAULT_UNHEALTHY_TIMEOUT\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default timeout for setting port as unhealthy.\r
-*      timeout time = 60000000us\r
-*  We use here ~60sec.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_UNHEALTHY_TIMEOUT 60000000\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_ERROR_THRESHOLD\r
-* NAME\r
-*      OSM_DEFAULT_ERROR_THRESHOLD\r
-*\r
-* DESCRIPTION\r
-*      Specifies default link error threshold to be set by SubnSet(PortInfo).\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_ERROR_THRESHOLD 0x08\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_SMP_MAX_ON_WIRE\r
-* NAME\r
-*      OSM_DEFAULT_SMP_MAX_ON_WIRE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default number of VL15 SMP MADs allowed on\r
-*      the wire at any one time.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_SMP_MAX_ON_WIRE 4\r
-/***********/\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_QP0_RCV_SIZE\r
-* NAME\r
-*      OSM_SM_DEFAULT_QP0_RCV_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default size (in MADs) of the QP0 receive queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_QP0_RCV_SIZE 256\r
-/***********/\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_QP0_SEND_SIZE\r
-* NAME\r
-*      OSM_SM_DEFAULT_QP0_SEND_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Specifies the default size (in MADs) of the QP0 send queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_QP0_SEND_SIZE 256\r
-/***********/\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_QP1_RCV_SIZE\r
-* NAME\r
-*   OSM_SM_DEFAULT_QP1_RCV_SIZE\r
-*\r
-* DESCRIPTION\r
-*   Specifies the default size (in MADs) of the QP1 receive queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_QP1_RCV_SIZE 256\r
-/***********/\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_QP1_SEND_SIZE\r
-* NAME\r
-*   OSM_SM_DEFAULT_QP1_SEND_SIZE\r
-*\r
-* DESCRIPTION\r
-*   Specifies the default size (in MADs) of the QP1 send queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_QP1_SEND_SIZE 256\r
-/****d* OpenSM: Base/OSM_PM_DEFAULT_QP1_RCV_SIZE\r
-* NAME\r
-*   OSM_PM_DEFAULT_QP1_RCV_SIZE\r
-*\r
-* DESCRIPTION\r
-*   Specifies the default size (in MADs) of the QP1 receive queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_PM_DEFAULT_QP1_RCV_SIZE 256\r
-/***********/\r
-/****d* OpenSM: Base/OSM_PM_DEFAULT_QP1_SEND_SIZE\r
-* NAME\r
-*   OSM_PM_DEFAULT_QP1_SEND_SIZE\r
-*\r
-* DESCRIPTION\r
-*   Specifies the default size (in MADs) of the QP1 send queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_PM_DEFAULT_QP1_SEND_SIZE 256\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_POLLING_TIMEOUT_MILLISECS\r
-* NAME\r
-*   OSM_SM_DEFAULT_POLLING_TIMEOUT_MILLISECS\r
-*\r
-* DESCRIPTION\r
-*   Specifies the polling timeout (in miliseconds) - the timeout\r
-*   between one poll to another.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_POLLING_TIMEOUT_MILLISECS 10000\r
-/**********/\r
-/****d* OpenSM: Base/OSM_SM_DEFAULT_POLLING_RETRY_NUMBER\r
-* NAME\r
-*   OSM_SM_DEFAULT_POLLING_RETRY_NUMBER\r
-*\r
-* DESCRIPTION\r
-*   Specifies the number of polling retries before the SM goes back\r
-*   to DISCOVERY stage. So the default total time for handoff is 40 sec.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SM_DEFAULT_POLLING_RETRY_NUMBER 4\r
-/**********/\r
-/****d* OpenSM: MC Member Record Receiver/OSM_DEFAULT_MGRP_MTU\r
-* Name\r
-*      OSM_DEFAULT_MGRP_MTU\r
-*\r
-* DESCRIPTION\r
-*      Default MTU used for new MGRP creation (2048 bytes)\r
-*  Note it includes the MTUSelector which is set to "Greater Than"\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_MGRP_MTU 0x04\r
-/***********/\r
-/****d* OpenSM: MC Member Record Receiver/OSM_DEFAULT_MGRP_RATE\r
-* Name\r
-*      OSM_DEFAULT_MGRP_RATE\r
-*\r
-* DESCRIPTION\r
-*      Default RATE used for new MGRP creation (10Gb/sec)\r
-*  Note it includes the RateSelector which is set to "Greater Than"\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_MGRP_RATE 0x03\r
-/***********/\r
-/****d* OpenSM: MC Member Record Receiver/OSM_DEFAULT_MGRP_SCOPE\r
-* Name\r
-*      OSM_DEFAULT_MGRP_SCOPE\r
-*\r
-* DESCRIPTION\r
-*      Default SCOPE used for new MGRP creation (link local)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_DEFAULT_MGRP_SCOPE IB_MC_SCOPE_LINK_LOCAL\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_MAX_VLS\r
- * Name\r
- *       OSM_DEFAULT_QOS_MAX_VLS\r
- *\r
- * DESCRIPTION\r
- *       Default Maximum VLs used by the OpenSM.\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DEFAULT_QOS_MAX_VLS 15\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_HIGH_LIMIT\r
- * Name\r
- *       OSM_DEFAULT_QOS_HIGH_LIMIT\r
- *\r
- * DESCRIPTION\r
- *       Default Limit of High Priority in VL Arbitration used by OpenSM.\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DEFAULT_QOS_HIGH_LIMIT 0\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_VLARB_HIGH\r
- * Name\r
- *       OSM_DEFAULT_QOS_VLARB_HIGH\r
- *\r
- * DESCRIPTION\r
- *       Default High Priority VL Arbitration table used by the OpenSM.\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DEFAULT_QOS_VLARB_HIGH "0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0"\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_VLARB_LOW\r
- * Name\r
- *       OSM_DEFAULT_QOS_VLARB_LOW\r
- *\r
- * DESCRIPTION\r
- *       Default Low Priority VL Arbitration table used by the OpenSM.\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DEFAULT_QOS_VLARB_LOW "0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4"\r
-/***********/\r
-/****d* OpenSM: Base/OSM_DEFAULT_QOS_SL2VL\r
- * Name\r
- *       OSM_DEFAULT_QOS_SL2VL\r
- *\r
- * DESCRIPTION\r
- *       Default QoS SL2VL Mapping Table used by the OpenSM.\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DEFAULT_QOS_SL2VL "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7"\r
-/***********/\r
-/****d* OpenSM: Base/OSM_NO_PATH\r
-* NAME\r
-*      OSM_NO_PATH\r
-*\r
-* DESCRIPTION\r
-*      Value indicating there is no path to the given LID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_NO_PATH                    0xFF\r
-/**********/\r
-/****d* OpenSM: Base/OSM_NODE_DESC_UNKNOWN\r
-* NAME\r
-*      OSM_NODE_DESC_UNKNOWN\r
-*\r
-* DESCRIPTION\r
-*      Value indicating the Node Description is not set and is "unknown"\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_NODE_DESC_UNKNOWN "<unknown>"\r
-/**********/\r
-/****d* OpenSM: Base/osm_thread_state_t\r
-* NAME\r
-*      osm_thread_state_t\r
-*\r
-* DESCRIPTION\r
-*      Enumerates the possible states of worker threads, such\r
-*      as the subnet sweeper.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osm_thread_state {\r
-       OSM_THREAD_STATE_NONE = 0,\r
-       OSM_THREAD_STATE_INIT,\r
-       OSM_THREAD_STATE_RUN,\r
-       OSM_THREAD_STATE_EXIT\r
-} osm_thread_state_t;\r
-/***********/\r
-\r
-/*\r
- * OSM_CAP are from IBA 1.2.1 Table 117 and Table 188\r
- */\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_TRAP_SUP\r
-* Name\r
-*      OSM_CAP_IS_SUBN_TRAP_SUP\r
-*\r
-* DESCRIPTION\r
-*      Management class generates Trap() MADs\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_SUBN_TRAP_SUP (1 << 0)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_GET_SET_NOTICE_SUP\r
-* Name\r
-*      OSM_CAP_IS_GET_SET_NOTICE_SUP\r
-*\r
-* DESCRIPTION\r
-*       Management class supports Get/Set(Notice)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP (1 << 1)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_SUBN_OPT_RECS_SUP\r
-* Name\r
-*      OSM_CAP_IS_SUBN_OPT_RECS_SUP\r
-*\r
-* DESCRIPTION\r
-*      Support all optional attributes except:\r
-*  MCMemberRecord, TraceRecord, MultiPathRecord\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_SUBN_OPT_RECS_SUP (1 << 8)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_UD_MCAST_SUP\r
-* Name\r
-*      OSM_CAP_IS_UD_MCAST_SUP\r
-*\r
-* DESCRIPTION\r
-*      Multicast is supported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_UD_MCAST_SUP (1 << 9)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_MULTIPATH_SUP\r
-* Name\r
-*      OSM_CAP_IS_MULTIPATH_SUP\r
-*\r
-* DESCRIPTION\r
-*      MultiPathRecord and TraceRecord are supported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_MULTIPATH_SUP (1 << 10)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_REINIT_SUP\r
-* Name\r
-*      OSM_CAP_IS_REINIT_SUP\r
-*\r
-* DESCRIPTION\r
-*      SM/SA supports re-initialization supported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_REINIT_SUP (1 << 11)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED\r
-* Name\r
-*      OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED\r
-*\r
-* DESCRIPTION\r
-*      SM/SA supports enhanced SA PortInfoRecord searches per 1.2 Errata:\r
-*  ClassPortInfo:CapabilityMask.IsPortInfoCapMaskMatchSupported is 1,\r
-*  then the AttributeModifier of the SubnAdmGet() and SubnAdmGetTable()\r
-*  methods affects the matching behavior on the PortInfo:CapabilityMask\r
-*  component. If the high-order bit (bit 31) of the AttributeModifier\r
-*  is set to 1, matching on the CapabilityMask component will not be an\r
-*  exact bitwise match as described in <ref to 15.4.4>.  Instead,\r
-*  matching will only be performed on those bits which are set to 1 in\r
-*  the PortInfo:CapabilityMask embedded in the query.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED (1 << 13)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP2_IS_QOS_SUPPORTED\r
-* Name\r
-*      OSM_CAP2_IS_QOS_SUPPORTED\r
-*\r
-* DESCRIPTION\r
-*      QoS is supported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP2_IS_QOS_SUPPORTED (1 << 1)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED\r
-* Name\r
-*      OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED\r
-*\r
-* DESCRIPTION\r
-*      Reverse path PKeys indicate in PathRecord responses\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP2_IS_REVERSE_PATH_PKEY_SUPPPORTED (1 << 2)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP2_IS_MCAST_TOP_SUPPORTED\r
-* Name\r
-*      OSM_CAP2_IS_MCAST_TOP_SUPPORTED\r
-*\r
-* DESCRIPTION\r
-*       SwitchInfo.MulticastFDBTop is supported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP2_IS_MCAST_TOP_SUPPORTED (1 << 3)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/OSM_CAP2_IS_HIERARCHY_SUPPORTED\r
-* Name\r
-*\r
-* DESCRIPTION\r
-*      Hierarchy info suppported\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_CAP2_IS_HIERARCHY_SUPPORTED (1 << 4)\r
-/***********/\r
-\r
-/****d* OpenSM: Base/osm_signal_t\r
-* NAME\r
-*      osm_signal_t\r
-*\r
-* DESCRIPTION\r
-*      Enumerates the possible signal codes used by the OSM managers\r
-*      This cannot be an enum type, since conversion to and from\r
-*      integral types is necessary when passing signals through\r
-*      the dispatcher.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_SIGNAL_NONE                                0\r
-#define OSM_SIGNAL_SWEEP                       1\r
-#define OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST   2\r
-#define OSM_SIGNAL_PERFMGR_SWEEP               3\r
-#define OSM_SIGNAL_MAX                         3\r
-\r
-typedef unsigned int osm_signal_t;\r
-/***********/\r
-\r
-/****d* OpenSM: Base/osm_sm_signal_t\r
-* NAME\r
-*      osm_sm_signal_t\r
-*\r
-* DESCRIPTION\r
-*      Enumerates the possible signals used by the OSM_SM_MGR\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osm_sm_signal {\r
-       OSM_SM_SIGNAL_NONE = 0,\r
-       OSM_SM_SIGNAL_DISCOVERY_COMPLETED,\r
-       OSM_SM_SIGNAL_POLLING_TIMEOUT,\r
-       OSM_SM_SIGNAL_DISCOVER,\r
-       OSM_SM_SIGNAL_DISABLE,\r
-       OSM_SM_SIGNAL_HANDOVER,\r
-       OSM_SM_SIGNAL_HANDOVER_SENT,\r
-       OSM_SM_SIGNAL_ACKNOWLEDGE,\r
-       OSM_SM_SIGNAL_STANDBY,\r
-       OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED,\r
-       OSM_SM_SIGNAL_WAIT_FOR_HANDOVER,\r
-       OSM_SM_SIGNAL_MAX\r
-} osm_sm_signal_t;\r
-/***********/\r
-\r
-/****s* OpenSM: Base/MAX_GUID_FILE_LINE_LENGTH\r
-* NAME\r
-*      MAX_GUID_FILE_LINE_LENGTH\r
-*\r
-* DESCRIPTION\r
-*      The maximum line number when reading guid file\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define MAX_GUID_FILE_LINE_LENGTH 120\r
-/**********/\r
-\r
-/****s* OpenSM: Base/VendorOUIs\r
-* NAME\r
-*      VendorOUIs\r
-*\r
-* DESCRIPTION\r
-*      Known device vendor ID and GUID OUIs\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_VENDOR_ID_INTEL         0x00D0B7\r
-#define OSM_VENDOR_ID_MELLANOX      0x0002C9\r
-#define OSM_VENDOR_ID_REDSWITCH     0x000617\r
-#define OSM_VENDOR_ID_SILVERSTORM   0x00066A\r
-#define OSM_VENDOR_ID_TOPSPIN       0x0005AD\r
-#define OSM_VENDOR_ID_FUJITSU       0x00E000\r
-#define OSM_VENDOR_ID_FUJITSU2      0x000B5D\r
-#define OSM_VENDOR_ID_VOLTAIRE      0x0008F1\r
-#define OSM_VENDOR_ID_YOTTAYOTTA    0x000453\r
-#define OSM_VENDOR_ID_PATHSCALE     0x001175\r
-#define OSM_VENDOR_ID_IBM           0x000255\r
-#define OSM_VENDOR_ID_DIVERGENET    0x00084E\r
-#define OSM_VENDOR_ID_FLEXTRONICS   0x000B8C\r
-#define OSM_VENDOR_ID_AGILENT       0x0030D3\r
-#define OSM_VENDOR_ID_OBSIDIAN      0x001777\r
-#define OSM_VENDOR_ID_BAYMICRO      0x000BC1\r
-#define OSM_VENDOR_ID_LSILOGIC      0x00A0B8\r
-#define OSM_VENDOR_ID_DDN           0x0001FF\r
-#define OSM_VENDOR_ID_PANTA         0x001393\r
-#define OSM_VENDOR_ID_HP            0x001708\r
-#define OSM_VENDOR_ID_RIOWORKS      0x005045\r
-#define OSM_VENDOR_ID_SUN           0x0003BA\r
-#define OSM_VENDOR_ID_SUN2          0x002128\r
-#define OSM_VENDOR_ID_3LEAFNTWKS    0x0016A1\r
-#define OSM_VENDOR_ID_XSIGO         0x001397\r
-#define OSM_VENDOR_ID_HP2           0x0018FE\r
-#define OSM_VENDOR_ID_DELL          0x00188B\r
-#define OSM_VENDOR_ID_SUPERMICRO    0x003048\r
-#define OSM_VENDOR_ID_HP3           0x0019BB\r
-#define OSM_VENDOR_ID_HP4           0x00237D\r
-\r
-/**********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_BASE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_config.h b/branches/opensm_3/user/include/opensm/osm_config.h
deleted file mode 100644 (file)
index 2b94098..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* include/opensm/osm_config.h.  Generated from osm_config.h.in by configure.  */\r
-/* include/osm_config.h.in\r
- *\r
- * Defines various OpenSM configuration parameters to be used by various\r
- * plugins and third party tools.\r
- *\r
- * NOTE: Defines used in header files MUST be included here to ensure plugin\r
- * compatibility.\r
- */\r
-\r
-#ifndef _OSM_CONFIG_H_\r
-#define _OSM_CONFIG_H_ 1\r
-\r
-/* define 1 if OpenSM build is in a debug mode */\r
-/* #undef OSM_DEBUG */\r
-\r
-/* Define as 1 if you want Dual Sided RMPP Support */\r
-#define DUAL_SIDED_RMPP 1\r
-\r
-/* Define as 1 if you want to enable a console on a socket connection */\r
-/* #undef ENABLE_OSM_CONSOLE_SOCKET */\r
-\r
-/* Define as 1 if you want to enable the event plugin */\r
-/* #undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN */\r
-\r
-/* Define as 1 if you want to enable the performance manager */\r
-/* #undef ENABLE_OSM_PERF_MGR */\r
-\r
-/* Define as 1 if you want to enable the performance manager profiling code */\r
-/* #undef ENABLE_OSM_PERF_MGR_PROFILE */\r
-\r
-/* Define OpenSM config directory */\r
-#define OPENSM_CONFIG_DIR "%ProgramFiles%\\OFED\\OpenSM"\r
-\r
-/* Define a default node name map file */\r
-#define HAVE_DEFAULT_NODENAME_MAP OPENSM_CONFIG_DIR "\\ib-node-name-map"\r
-\r
-/* Define a default OpenSM config file */\r
-#define HAVE_DEFAULT_OPENSM_CONFIG_FILE OPENSM_CONFIG_DIR "\\opensm.conf"\r
-\r
-/* Define a Partition config file */\r
-#define HAVE_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "\\partitions.conf"\r
-\r
-/* Define a Prefix Routes config file */\r
-#define HAVE_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "\\prefix-routes.conf"\r
-\r
-/* Define a QOS policy config file */\r
-#define HAVE_DEFAULT_QOS_POLICY_FILE OPENSM_CONFIG_DIR "\\qos-policy.conf"\r
-\r
-/* Define as 1 for vapi vendor */\r
-/* #undef OSM_VENDOR_INTF_MTL */\r
-\r
-/* Define as 1 for OpenIB vendor */\r
-#ifdef OSM_VENDOR_INTF_AL\r
-#undef OSM_VENDOR_INTF_OPENIB\r
-#else\r
-#define OSM_VENDOR_INTF_OPENIB 1\r
-#endif\r
-\r
-/* Define as 1 for sim vendor */\r
-/* #undef OSM_VENDOR_INTF_SIM */\r
-\r
-/* Define as 1 for ts vendor */\r
-/* #undef OSM_VENDOR_INTF_TS */\r
-\r
-/* Define as 1 if you want Vendor RMPP Support */\r
-#define VENDOR_RMPP_SUPPORT 1\r
-\r
-#endif /* _OSM_CONFIG_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_config.h.in b/branches/opensm_3/user/include/opensm/osm_config.h.in
deleted file mode 100644 (file)
index 3164568..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* include/osm_config.h.in\r
- *\r
- * Defines various OpenSM configuration parameters to be used by various\r
- * plugins and third party tools.\r
- *\r
- * NOTE: Defines used in header files MUST be included here to ensure plugin\r
- * compatibility.\r
- */\r
-\r
-#ifndef _OSM_CONFIG_H_\r
-#define _OSM_CONFIG_H_\r
-\r
-/* define 1 if OpenSM build is in a debug mode */\r
-#undef OSM_DEBUG\r
-\r
-/* Define as 1 if you want Dual Sided RMPP Support */\r
-#undef DUAL_SIDED_RMPP\r
-\r
-/* Define as 1 if you want to enable a console on a socket connection */\r
-#undef ENABLE_OSM_CONSOLE_SOCKET\r
-\r
-/* Define as 1 if you want to enable the event plugin */\r
-#undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN\r
-\r
-/* Define as 1 if you want to enable the performance manager */\r
-#undef ENABLE_OSM_PERF_MGR\r
-\r
-/* Define as 1 if you want to enable the performance manager profiling code */\r
-#undef ENABLE_OSM_PERF_MGR_PROFILE\r
-\r
-/* Define a default node name map file */\r
-#undef HAVE_DEFAULT_NODENAME_MAP\r
-\r
-/* Define a default OpenSM config file */\r
-#undef HAVE_DEFAULT_OPENSM_CONFIG_FILE\r
-\r
-/* Define a Partition config file */\r
-#undef HAVE_DEFAULT_PARTITION_CONFIG_FILE\r
-\r
-/* Define a Prefix Routes config file */\r
-#undef HAVE_DEFAULT_PREFIX_ROUTES_FILE\r
-\r
-/* Define a QOS policy config file */\r
-#undef HAVE_DEFAULT_QOS_POLICY_FILE\r
-\r
-/* Define OpenSM config directory */\r
-#undef OPENSM_CONFIG_DIR\r
-\r
-/* Define as 1 for vapi vendor */\r
-#undef OSM_VENDOR_INTF_MTL\r
-\r
-/* Define as 1 for OpenIB vendor */\r
-#undef OSM_VENDOR_INTF_OPENIB\r
-\r
-/* Define as 1 for sim vendor */\r
-#undef OSM_VENDOR_INTF_SIM\r
-\r
-/* Define as 1 for ts vendor */\r
-#undef OSM_VENDOR_INTF_TS\r
-\r
-/* Define as 1 if you want Vendor RMPP Support */\r
-#undef VENDOR_RMPP_SUPPORT\r
-\r
-#endif /* _OSM_CONFIG_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_console.h b/branches/opensm_3/user/include/opensm/osm_console.h
deleted file mode 100644 (file)
index 671c57d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*\r
- * Copyright (c) 2005-2007 Voltaire, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_CONSOLE_H_\r
-#define _OSM_CONSOLE_H_\r
-\r
-#include <opensm/osm_opensm.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-int osm_console(osm_opensm_t * p_osm);\r
-END_C_DECLS\r
-#endif                         /* _OSM_CONSOLE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_console_io.h b/branches/opensm_3/user/include/opensm/osm_console_io.h
deleted file mode 100644 (file)
index 39a64df..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*\r
- * Copyright (c) 2005-2007 Voltaire, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_console_t.\r
- *     This object represents the OpenSM Console object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_CONSOLE_IO_H_\r
-#define _OSM_CONSOLE_IO_H_\r
-\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#define OSM_DISABLE_CONSOLE      "off"\r
-#define OSM_LOCAL_CONSOLE        "local"\r
-#define OSM_REMOTE_CONSOLE       "socket"\r
-#define OSM_LOOPBACK_CONSOLE     "loopback"\r
-#define OSM_CONSOLE_NAME         "OSM Console"\r
-\r
-#define OSM_DEFAULT_CONSOLE      OSM_DISABLE_CONSOLE\r
-#define OSM_DEFAULT_CONSOLE_PORT 10000\r
-#define OSM_DAEMON_NAME          "opensm"\r
-\r
-#define OSM_COMMAND_PROMPT      "$ "\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-typedef struct osm_console {\r
-       int socket;\r
-       int in_fd;\r
-       int out_fd;\r
-       int authorized;\r
-       FILE *in;\r
-       FILE *out;\r
-       char client_type[32];\r
-       char client_ip[64];\r
-       char client_hn[128];\r
-} osm_console_t;\r
-\r
-void osm_console_prompt(FILE * out);\r
-int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_log);\r
-void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log);\r
-int is_console_enabled(osm_subn_opt_t *p_opt);\r
-\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log);\r
-int cio_close(osm_console_t * p_oct, osm_log_t * p_log);\r
-int is_authorized(osm_console_t * p_oct);\r
-#else\r
-#define cio_close(c, log)\r
-#endif\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_CONSOLE_IO_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_db.h b/branches/opensm_3/user/include/opensm/osm_db.h
deleted file mode 100644 (file)
index fd2d3c8..0000000
+++ /dev/null
@@ -1,424 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_DB_H_\r
-#define _OSM_DB_H_\r
-\r
-/*\r
- * Abstract:\r
- * Declaration of the DB interface.\r
- */\r
-\r
-#include <complib/cl_list.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Database\r
-* NAME\r
-*      Database\r
-*\r
-* DESCRIPTION\r
-*      The OpenSM database interface provide the means to restore persistent\r
-*  data, query, modify, delete and eventually commit it back to the\r
-*  persistent media.\r
-*\r
-*  The interface is defined such that it can is not "data dependent":\r
-*  All keys and data items are texts.\r
-*\r
-*      The DB implementation should be thread safe, thus callers do not need to\r
-*  provide serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Eitan Zahavi, Mellanox Technologies LTD\r
-*\r
-*********/\r
-/****s* OpenSM: Database/osm_db_domain_t\r
-* NAME\r
-*      osm_db_domain_t\r
-*\r
-* DESCRIPTION\r
-*      A domain of the database. Can be viewed as a database table.\r
-*\r
-*      The osm_db_domain_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_db_domain {\r
-       struct osm_db *p_db;\r
-       void *p_domain_imp;\r
-} osm_db_domain_t;\r
-/*\r
-* FIELDS\r
-*      p_db\r
-*              Pointer to the parent database object.\r
-*\r
-*      p_domain_imp\r
-*              Pointer to the db implementation object\r
-*\r
-* SEE ALSO\r
-* osm_db_t\r
-*********/\r
-\r
-/****s* OpenSM: Database/osm_db_t\r
-* NAME\r
-*      osm_db_t\r
-*\r
-* DESCRIPTION\r
-*      The main database object.\r
-*\r
-*      The osm_db_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_db {\r
-       void *p_db_imp;\r
-       osm_log_t *p_log;\r
-       cl_list_t domains;\r
-} osm_db_t;\r
-/*\r
-* FIELDS\r
-*      p_db_imp\r
-*              Pointer to the database implementation object\r
-*\r
-*      p_log\r
-*              Pointer to the OSM logging facility\r
-*\r
-*  domains\r
-*     List of initialize domains\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_construct\r
-* NAME\r
-*      osm_db_construct\r
-*\r
-* DESCRIPTION\r
-*      Construct a database.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_db_construct(IN osm_db_t * p_db);\r
-/*\r
-* PARAMETERS\r
-*      p_db\r
-*              [in] Pointer to the database object to construct\r
-*\r
-* RETURN VALUES\r
-*      NONE\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_init, osm_db_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_destroy\r
-* NAME\r
-*      osm_db_destroy\r
-*\r
-* DESCRIPTION\r
-*      Destroys the osm_db_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_db_destroy(IN osm_db_t * p_db);\r
-/*\r
-* PARAMETERS\r
-*      p_db\r
-*              [in] Pointer to osm_db_t structure to destroy\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_construct, osm_db_init\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_init\r
-* NAME\r
-*      osm_db_init\r
-*\r
-* DESCRIPTION\r
-*      Initializes the osm_db_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_db\r
-*              [in] Pointer to the database object to initialize\r
-*\r
-*      p_log\r
-*              [in] Pointer to the OSM logging facility\r
-*\r
-* RETURN VALUES\r
-*      0 on success 1 otherwise\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_construct, osm_db_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_domain_init\r
-* NAME\r
-*      osm_db_domain_init\r
-*\r
-* DESCRIPTION\r
-*      Initializes the osm_db_domain_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_db\r
-*              [in] Pointer to the database object to initialize\r
-*\r
-*      domain_name\r
-*              [in] a char array with the domain name.\r
-*\r
-* RETURN VALUES\r
-*      pointer to the new domain object or NULL if failed.\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_construct, osm_db_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_restore\r
-* NAME\r
-*      osm_db_restore\r
-*\r
-* DESCRIPTION\r
-*      Reads the entire domain from persistent storage - overrides all\r
-*  existing cached data (if any).\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_restore(IN osm_db_domain_t * p_domain);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_domain\r
-*              [in] Pointer to the database domain object to restore\r
-*                   from persistent db\r
-*\r
-* RETURN VALUES\r
-*      0 if successful 1 otherwize\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_clear, osm_db_store,\r
-*  osm_db_keys, osm_db_lookup, osm_db_update, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_clear\r
-* NAME\r
-*      osm_db_clear\r
-*\r
-* DESCRIPTION\r
-*      Clears the entire domain values from/in the cache\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_clear(IN osm_db_domain_t * p_domain);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_domain\r
-*              [in] Pointer to the database domain object to clear\r
-*\r
-* RETURN VALUES\r
-*      0 if successful 1 otherwize\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_store,\r
-*  osm_db_keys, osm_db_lookup, osm_db_update, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_store\r
-* NAME\r
-*      osm_db_store\r
-*\r
-* DESCRIPTION\r
-*      Store the domain cache back to the database (commit)\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_store(IN osm_db_domain_t * p_domain);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_domain\r
-*              [in] Pointer to the database domain object to restore from\r
-*                   persistent db\r
-*\r
-* RETURN VALUES\r
-*      0 if successful 1 otherwize\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_clear,\r
-*  osm_db_keys, osm_db_lookup, osm_db_update, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_keys\r
-* NAME\r
-*      osm_db_keys\r
-*\r
-* DESCRIPTION\r
-*      Retrive all keys of the domain\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list);\r
-/*\r
-* PARAMETERS\r
-*\r
-* p_domain\r
-*    [in] Pointer to the database domain object\r
-*\r
-* p_key_list\r
-*    [out] List of key values. It should be PRE constructed and initialized.\r
-*\r
-* RETURN VALUES\r
-*      0 if successful 1 otherwize\r
-*\r
-* NOTE: the caller needs to free and destruct the list,\r
-*       the keys returned are intrnal to the hash and should NOT be free'ed\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_clear, osm_db_store,\r
-*  osm_db_lookup, osm_db_update, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_lookup\r
-* NAME\r
-*      osm_db_lookup\r
-*\r
-* DESCRIPTION\r
-*      Lookup an entry in the domain by the given key\r
-*\r
-* SYNOPSIS\r
-*/\r
-/* lookup value by key */\r
-char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key);\r
-/*\r
-* PARAMETERS\r
-*\r
-*  p_domain\r
-*    [in] Pointer to the database domain object\r
-*\r
-*      key\r
-*              [in] The key to look for\r
-*\r
-* RETURN VALUES\r
-*  the value as char * or NULL if not found\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_clear, osm_db_store,\r
-*  osm_db_keys, osm_db_update, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_update\r
-* NAME\r
-*      osm_db_update\r
-*\r
-* DESCRIPTION\r
-*      Set the value of the given key\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val);\r
-/*\r
-* PARAMETERS\r
-*\r
-*  p_domain\r
-*    [in] Pointer to the database domain object\r
-*\r
-*      p_key\r
-*              [in] The key to update\r
-*\r
-*      p_val\r
-*              [in] The value to update\r
-*\r
-* RETURN VALUES\r
-*  0 on success\r
-*\r
-* NOTE: the value will be duplicated so can be free'ed\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_clear, osm_db_store,\r
-*  osm_db_keys, osm_db_lookup, osm_db_delete\r
-*********/\r
-\r
-/****f* OpenSM: Database/osm_db_delete\r
-* NAME\r
-*      osm_db_delete\r
-*\r
-* DESCRIPTION\r
-*      Delete an entry by the given key\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key);\r
-/*\r
-* PARAMETERS\r
-*\r
-*  p_domain\r
-*    [in] Pointer to the database domain object\r
-*\r
-*      p_key\r
-*              [in] The key to look for\r
-*\r
-* RETURN VALUES\r
-*  0 on success\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_domain_init, osm_db_restore, osm_db_clear, osm_db_store,\r
-*  osm_db_keys, osm_db_lookup, osm_db_update\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_DB_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_db_pack.h b/branches/opensm_3/user/include/opensm/osm_db_pack.h
deleted file mode 100644 (file)
index 039cbd8..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/****h* OpenSM/DB-Pack\r
-* NAME\r
-*      Database Types\r
-*\r
-* DESCRIPTION\r
-*      This module provides packing and unpacking of the database\r
-*  storage into specific types.\r
-*\r
-*  The following domains/conversions are supported:\r
-*  guid2lid - key is a guid and data is a lid.\r
-*\r
-* AUTHOR\r
-*      Eitan Zahavi, Mellanox Technologies LTD\r
-*\r
-*********/\r
-\r
-#ifndef _OSM_DB_PACK_H_\r
-#define _OSM_DB_PACK_H_\r
-\r
-#include <opensm/osm_db.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_init\r
-* NAME\r
-*      osm_db_guid2lid_init\r
-*\r
-* DESCRIPTION\r
-*      Initialize a domain for the guid2lid table\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_db_domain_t *osm_db_guid2lid_init(IN osm_db_t * p_db)\r
-{\r
-       return (osm_db_domain_init(p_db, "guid2lid"));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_db\r
-*              [in] Pointer to the database object to construct\r
-*\r
-* RETURN VALUES\r
-*      The pointer to the new allocated domain object or NULL.\r
-*\r
-* NOTE: DB domains are destroyed by the osm_db_destroy\r
-*\r
-* SEE ALSO\r
-*      Database, osm_db_init, osm_db_destroy\r
-*********/\r
-\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_init\r
-* NAME\r
-*      osm_db_guid2lid_init\r
-*\r
-* DESCRIPTION\r
-*      Initialize a domain for the guid2lid table\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_db_guid_elem {\r
-       cl_list_item_t item;\r
-       uint64_t guid;\r
-} osm_db_guid_elem_t;\r
-/*\r
-* FIELDS\r
-*      item\r
-*              required for list manipulations\r
-*\r
-*  guid\r
-*\r
-************/\r
-\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_guids\r
-* NAME\r
-*      osm_db_guid2lid_guids\r
-*\r
-* DESCRIPTION\r
-*      Provides back a list of guid elements.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l,\r
-                         OUT cl_qlist_t * p_guid_list);\r
-/*\r
-* PARAMETERS\r
-*      p_g2l\r
-*              [in] Pointer to the guid2lid domain\r
-*\r
-*  p_guid_list\r
-*     [out] A quick list of guid elements of type osm_db_guid_elem_t\r
-*\r
-* RETURN VALUES\r
-*      0 if successful\r
-*\r
-* NOTE: the output qlist should be initialized and each item freed\r
-*       by the caller, then destroyed.\r
-*\r
-* SEE ALSO\r
-* osm_db_guid2lid_init, osm_db_guid2lid_guids, osm_db_guid2lid_get\r
-* osm_db_guid2lid_set, osm_db_guid2lid_delete\r
-*********/\r
-\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_get\r
-* NAME\r
-*      osm_db_guid2lid_get\r
-*\r
-* DESCRIPTION\r
-*      Get a lid range by given guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid,\r
-                       OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid);\r
-/*\r
-* PARAMETERS\r
-*      p_g2l\r
-*              [in] Pointer to the guid2lid domain\r
-*\r
-*  guid\r
-*     [in] The guid to look for\r
-*\r
-*  p_min_lid\r
-*     [out] Pointer to the resulting min lid in host order.\r
-*\r
-*  p_max_lid\r
-*     [out] Pointer to the resulting max lid in host order.\r
-*\r
-* RETURN VALUES\r
-*      0 if successful. The lid will be set to 0 if not found.\r
-*\r
-* SEE ALSO\r
-* osm_db_guid2lid_init, osm_db_guid2lid_guids\r
-* osm_db_guid2lid_set, osm_db_guid2lid_delete\r
-*********/\r
-\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_set\r
-* NAME\r
-*      osm_db_guid2lid_set\r
-*\r
-* DESCRIPTION\r
-*      Set a lid range for the given guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid,\r
-                       IN uint16_t min_lid, IN uint16_t max_lid);\r
-/*\r
-* PARAMETERS\r
-*      p_g2l\r
-*              [in] Pointer to the guid2lid domain\r
-*\r
-*  guid\r
-*     [in] The guid to look for\r
-*\r
-*  min_lid\r
-*     [in] The min lid value to set\r
-*\r
-*  max_lid\r
-*     [in] The max lid value to set\r
-*\r
-* RETURN VALUES\r
-*      0 if successful\r
-*\r
-* SEE ALSO\r
-* osm_db_guid2lid_init, osm_db_guid2lid_guids\r
-* osm_db_guid2lid_get, osm_db_guid2lid_delete\r
-*********/\r
-\r
-/****f* OpenSM: DB-Pack/osm_db_guid2lid_delete\r
-* NAME\r
-*      osm_db_guid2lid_delete\r
-*\r
-* DESCRIPTION\r
-*      Delete the entry by the given guid\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_db_guid2lid_delete(IN osm_db_domain_t * p_g2l, IN uint64_t guid);\r
-/*\r
-* PARAMETERS\r
-*      p_g2l\r
-*              [in] Pointer to the guid2lid domain\r
-*\r
-*  guid\r
-*     [in] The guid to look for\r
-*\r
-* RETURN VALUES\r
-*      0 if successful otherwise 1\r
-*\r
-* SEE ALSO\r
-* osm_db_guid2lid_init, osm_db_guid2lid_guids\r
-* osm_db_guid2lid_get, osm_db_guid2lid_set\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_DB_PACK_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_errors.h b/branches/opensm_3/user/include/opensm/osm_errors.h
deleted file mode 100644 (file)
index 667e0b4..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of error code ranges for the various OpenSM modules.\r
- */\r
-\r
-#ifndef _OSM_ERRORS_H_\r
-#define _OSM_ERRORS_H_\r
-\r
-/*\r
-       Generic Request Controller\r
-       0100 - 01FF\r
-\r
-       Node Info Receive Controller\r
-       0200 - 02FF\r
-\r
-       Generic Requester\r
-       0300 - 03FF\r
-\r
-       Node Info Receiver\r
-       0400 - 04FF\r
-\r
-       Node Description Receiver\r
-       0500 - 05FF\r
-\r
-       Node Description Receive Controller\r
-       0600 - 06FF\r
-\r
-       Port Info Receiver\r
-       0700 - 07FF\r
-\r
-       Port Info Receive Controller\r
-       0800 - 08FF\r
-\r
-       Mad Pool\r
-       0900 - 09FF\r
-\r
-       SM\r
-       1000 - 10FF\r
-\r
-       SM MAD Controller\r
-       1100 - 11FF\r
-\r
-       VL15 Interface\r
-       1200 - 12FF\r
-\r
-       Switch Info Receive Controller\r
-       1300 - 13FF\r
-\r
-       Switch Info Receiver\r
-       1400 - 14FF\r
-\r
-       State Manager\r
-       1500 - 15FF\r
-\r
-       State Manager Controller\r
-       1600 - 16FF\r
-\r
-       LID Manager\r
-       1700 - 17FF\r
-\r
-       Link Manager\r
-       1800 - 18FF\r
-\r
-       Drop Manager\r
-       1900 - 19FF\r
-\r
-       Linear Forwarding Receive Controller\r
-       2000 - 20FF\r
-\r
-       Linear Forwarding Receiver\r
-       2100 - 21FF\r
-\r
-       Vendor Specific\r
-       2200 - 22FF\r
-\r
-       SMInfo Receive Controller\r
-       2300 - 23FF\r
-\r
-       SMInfo Info Receiver\r
-       2400 - 24FF\r
-\r
-       Generic Responder\r
-       2500 - 25FF\r
-\r
-       Linear Forwarding Receive Controller\r
-       2600 - 26FF\r
-\r
-       Linear Forwarding Receiver\r
-       2700 - 27FF\r
-\r
-       SA MAD controller\r
-       2800 - 28FF\r
-\r
-       Node Record Controller\r
-       2900 - 29FF\r
-\r
-       PortInfo Record Controller\r
-       3000 - 30FF\r
-\r
-       Link Record Controller\r
-       3100 - 31FF\r
-\r
-       Path Record Controller\r
-       3200 - 32FF\r
-\r
-       SMInfo Record Controller\r
-       3300 - 33FF\r
-\r
-       Multicast Record Controller\r
-       3400 - 34FF\r
-\r
-       Unicast Manager\r
-       3500 - 35FF\r
-\r
-       Multicast Manager\r
-       3600 - 36FF\r
-\r
-       SA Response\r
-       3700 - 37FF\r
-\r
-       Link Record Receiver\r
-       3800 - 38FF\r
-\r
-       Multicast Forwarding Receive Controller\r
-       3900 - 39FF\r
-\r
-       Multicast Forwarding Receiver\r
-       4000 - 40FF\r
-\r
-       SMInfo Record Receiver\r
-       4100 - 41FF\r
-\r
-       PortInfo Record Receiver\r
-       4200 - 42FF\r
-\r
-       Service Record Receiver\r
-       4300 - 43FF\r
-\r
-*/\r
-\r
-#endif                         /* _OSM_ERRORS_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_event_plugin.h b/branches/opensm_3/user/include/opensm/osm_event_plugin.h
deleted file mode 100644 (file)
index 1ba2659..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_EVENT_PLUGIN_H_\r
-#define _OSM_EVENT_PLUGIN_H_\r
-\r
-#include <time.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-#include <opensm/osm_config.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM Event plugin interface\r
-* DESCRIPTION\r
-*       Database interface to record subnet events\r
-*\r
-*       Implementations of this object _MUST_ be thread safe.\r
-*\r
-* AUTHOR\r
-*      Ira Weiny, LLNL\r
-*\r
-*********/\r
-\r
-#define OSM_EPI_NODE_NAME_LEN (65)\r
-\r
-struct osm_opensm;\r
-/** =========================================================================\r
- * Event types\r
- */\r
-typedef enum {\r
-       OSM_EVENT_ID_PORT_ERRORS = 0,\r
-       OSM_EVENT_ID_PORT_DATA_COUNTERS,\r
-       OSM_EVENT_ID_PORT_SELECT,\r
-       OSM_EVENT_ID_TRAP,\r
-       OSM_EVENT_ID_SUBNET_UP,\r
-       OSM_EVENT_ID_MAX\r
-} osm_epi_event_id_t;\r
-\r
-typedef struct osm_epi_port_id {\r
-       uint64_t node_guid;\r
-       uint8_t port_num;\r
-       char node_name[OSM_EPI_NODE_NAME_LEN];\r
-} osm_epi_port_id_t;\r
-\r
-/** =========================================================================\r
- * Port error event\r
- * OSM_EVENT_ID_PORT_COUNTER\r
- * This is a difference from the last reading.  NOT an absolute reading.\r
- */\r
-typedef struct osm_epi_pe_event {\r
-       osm_epi_port_id_t port_id;\r
-       uint64_t symbol_err_cnt;\r
-       uint64_t link_err_recover;\r
-       uint64_t link_downed;\r
-       uint64_t rcv_err;\r
-       uint64_t rcv_rem_phys_err;\r
-       uint64_t rcv_switch_relay_err;\r
-       uint64_t xmit_discards;\r
-       uint64_t xmit_constraint_err;\r
-       uint64_t rcv_constraint_err;\r
-       uint64_t link_integrity;\r
-       uint64_t buffer_overrun;\r
-       uint64_t vl15_dropped;\r
-       time_t time_diff_s;\r
-} osm_epi_pe_event_t;\r
-\r
-/** =========================================================================\r
- * Port data counter event\r
- * This is a difference from the last reading.  NOT an absolute reading.\r
- */\r
-typedef struct osm_epi_dc_event {\r
-       osm_epi_port_id_t port_id;\r
-       uint64_t xmit_data;\r
-       uint64_t rcv_data;\r
-       uint64_t xmit_pkts;\r
-       uint64_t rcv_pkts;\r
-       uint64_t unicast_xmit_pkts;\r
-       uint64_t unicast_rcv_pkts;\r
-       uint64_t multicast_xmit_pkts;\r
-       uint64_t multicast_rcv_pkts;\r
-       time_t time_diff_s;\r
-} osm_epi_dc_event_t;\r
-\r
-/** =========================================================================\r
- * Port select event\r
- * This is a difference from the last reading.  NOT an absolute reading.\r
- */\r
-typedef struct osm_api_ps_event {\r
-       osm_epi_port_id_t port_id;\r
-       uint64_t xmit_wait;\r
-       time_t time_diff_s;\r
-} osm_epi_ps_event_t;\r
-\r
-/** =========================================================================\r
- * Plugin creators should allocate an object of this type\r
- *    (named OSM_EVENT_PLUGIN_IMPL_NAME)\r
- * The version should be set to OSM_EVENT_PLUGIN_INTERFACE_VER\r
- */\r
-#define OSM_EVENT_PLUGIN_IMPL_NAME "osm_event_plugin"\r
-#define OSM_ORIG_EVENT_PLUGIN_INTERFACE_VER 1\r
-#define OSM_EVENT_PLUGIN_INTERFACE_VER 2\r
-typedef struct osm_event_plugin {\r
-       const char *osm_version;\r
-       void *(*create) (struct osm_opensm *osm);\r
-       void (*delete) (void *plugin_data);\r
-       void (*report) (void *plugin_data, osm_epi_event_id_t event_id,\r
-                       void *event_data);\r
-} osm_event_plugin_t;\r
-\r
-/** =========================================================================\r
- * The plugin structure should be considered opaque\r
- */\r
-typedef struct osm_epi_plugin {\r
-       cl_list_item_t list;\r
-       void *handle;\r
-       osm_event_plugin_t *impl;\r
-       void *plugin_data;\r
-       char *plugin_name;\r
-} osm_epi_plugin_t;\r
-\r
-/**\r
- * functions\r
- */\r
-osm_epi_plugin_t *osm_epi_construct(struct osm_opensm *osm, char *plugin_name);\r
-void osm_epi_destroy(osm_epi_plugin_t * plugin);\r
-\r
-/** =========================================================================\r
- * Helper functions\r
- */\r
-static inline void\r
-osm_epi_create_port_id(osm_epi_port_id_t * port_id, uint64_t node_guid,\r
-                      uint8_t port_num, char *node_name)\r
-{\r
-       port_id->node_guid = node_guid;\r
-       port_id->port_num = port_num;\r
-       strncpy(port_id->node_name, node_name, OSM_EPI_NODE_NAME_LEN);\r
-       port_id->node_name[OSM_EPI_NODE_NAME_LEN - 1] = '\0';\r
-}\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_EVENT_PLUGIN_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_helper.h b/branches/opensm_3/user/include/opensm/osm_helper.h
deleted file mode 100644 (file)
index 1c2fae6..0000000
+++ /dev/null
@@ -1,549 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_HELPER_H_\r
-#define _OSM_HELPER_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_path.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * Abstract:\r
- *     Declaration of helpful functions.\r
- */\r
-/****f* OpenSM: Helper/ib_get_sa_method_str\r
- * NAME\r
- *     ib_get_sa_method_str\r
- *\r
- * DESCRIPTION\r
- *     Returns a string for the specified SA Method value.\r
- *\r
- * SYNOPSIS\r
- */\r
-const char *ib_get_sa_method_str(IN uint8_t method);\r
-/*\r
- * PARAMETERS\r
- *     method\r
- *             [in] Network order METHOD ID value.\r
- *\r
- * RETURN VALUES\r
- *     Pointer to the method string.\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OpenSM: Helper/ib_get_sm_method_str\r
-* NAME\r
-*      ib_get_sm_method_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SM Method value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *ib_get_sm_method_str(IN uint8_t method);\r
-/*\r
-* PARAMETERS\r
-*      method\r
-*              [in] Network order METHOD ID value.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the method string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/ib_get_sm_attr_str\r
-* NAME\r
-*      ib_get_sm_attr_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SM attribute value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *ib_get_sm_attr_str(IN ib_net16_t attr);\r
-/*\r
-* PARAMETERS\r
-*      attr\r
-*              [in] Network order attribute ID value.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the attribute string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/ib_get_sa_attr_str\r
-* NAME\r
-*      ib_get_sa_attr_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SA attribute value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *ib_get_sa_attr_str(IN ib_net16_t attr);\r
-/*\r
-* PARAMETERS\r
-*      attr\r
-*              [in] Network order attribute ID value.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the attribute string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/ib_get_trap_str\r
-* NAME\r
-*      ib_get_trap_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a name for the specified trap.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *ib_get_trap_str(uint16_t trap_num);\r
-/*\r
-* PARAMETERS\r
-*      trap_num\r
-*              [in] Network order trap number.\r
-*\r
-* RETURN VALUES\r
-*      Name of the trap.\r
-*\r
-*********/\r
-\r
-extern const ib_gid_t ib_zero_gid;\r
-\r
-/****f* IBA Base: Types/ib_gid_is_notzero\r
-* NAME\r
-*      ib_gid_is_notzero\r
-*\r
-* DESCRIPTION\r
-*      Returns a boolean indicating whether or not the GID is zero.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t ib_gid_is_notzero(IN const ib_gid_t * p_gid)\r
-{\r
-       return memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if GID is not zero.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_dump_port_info\r
-* NAME\r
-*      osm_dump_port_info\r
-*\r
-* DESCRIPTION\r
-*      Dumps the PortInfo attribute to the log.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,\r
-                       IN ib_net64_t port_guid, IN uint8_t port_num,\r
-                       IN const ib_port_info_t * p_pi,\r
-                       IN osm_log_level_t log_level);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the osm_log_t object\r
-*\r
-*      node_guid\r
-*              [in] Node GUID that owns this port.\r
-*\r
-*      port_guid\r
-*              [in] Port GUID for this port.\r
-*\r
-*      port_num\r
-*              [in] Port number for this port.\r
-*\r
-*      p_pi\r
-*              [in] Pointer to the PortInfo attribute\r
-*\r
-*      log_level\r
-*              [in] Log verbosity level with which to dump the data.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,\r
-                         IN osm_log_level_t log_level);\r
-\r
-void osm_dump_multipath_record(IN osm_log_t * p_log,\r
-                              IN const ib_multipath_rec_t * p_mpr,\r
-                              IN osm_log_level_t log_level);\r
-\r
-void osm_dump_node_record(IN osm_log_t * p_log,\r
-                         IN const ib_node_record_t * p_nr,\r
-                         IN osm_log_level_t log_level);\r
-\r
-void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,\r
-                       IN osm_log_level_t log_level);\r
-\r
-void osm_dump_link_record(IN osm_log_t * p_log,\r
-                         IN const ib_link_record_t * p_lr,\r
-                         IN osm_log_level_t log_level);\r
-\r
-void osm_dump_service_record(IN osm_log_t * p_log,\r
-                            IN const ib_service_record_t * p_sr,\r
-                            IN osm_log_level_t log_level);\r
-\r
-void osm_dump_portinfo_record(IN osm_log_t * p_log,\r
-                             IN const ib_portinfo_record_t * p_pir,\r
-                             IN osm_log_level_t log_level);\r
-\r
-void osm_dump_guidinfo_record(IN osm_log_t * p_log,\r
-                             IN const ib_guidinfo_record_t * p_gir,\r
-                             IN osm_log_level_t log_level);\r
-\r
-void osm_dump_inform_info(IN osm_log_t * p_log,\r
-                         IN const ib_inform_info_t * p_ii,\r
-                         IN osm_log_level_t log_level);\r
-\r
-void osm_dump_inform_info_record(IN osm_log_t * p_log,\r
-                                IN const ib_inform_info_record_t * p_iir,\r
-                                IN osm_log_level_t log_level);\r
-\r
-void osm_dump_switch_info_record(IN osm_log_t * p_log,\r
-                                IN const ib_switch_info_record_t * p_sir,\r
-                                IN osm_log_level_t log_level);\r
-\r
-void osm_dump_sm_info_record(IN osm_log_t * p_log,\r
-                            IN const ib_sminfo_record_t * p_smir,\r
-                            IN osm_log_level_t log_level);\r
-\r
-void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                        IN uint16_t block_num, IN uint8_t port_num,\r
-                        IN const ib_pkey_table_t * p_pkey_tbl,\r
-                        IN osm_log_level_t log_level);\r
-\r
-void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                            IN uint8_t in_port_num, IN uint8_t out_port_num,\r
-                            IN const ib_slvl_table_t * p_slvl_tbl,\r
-                            IN osm_log_level_t log_level);\r
-\r
-void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                          IN uint8_t block_num, IN uint8_t port_num,\r
-                          IN const ib_vl_arb_table_t * p_vla_tbl,\r
-                          IN osm_log_level_t log_level);\r
-\r
-/****f* OpenSM: Helper/osm_dump_port_info\r
-* NAME\r
-*      osm_dump_port_info\r
-*\r
-* DESCRIPTION\r
-*      Dumps the PortInfo attribute to the log.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_dump_node_info(IN osm_log_t * p_log,\r
-                       IN const ib_node_info_t * p_ni,\r
-                       IN osm_log_level_t log_level);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the osm_log_t object\r
-*\r
-*      p_ni\r
-*              [in] Pointer to the NodeInfo attribute\r
-*\r
-*      log_level\r
-*              [in] Log verbosity level with which to dump the data.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_dump_sm_info\r
-* NAME\r
-*      osm_dump_sm_info\r
-*\r
-* DESCRIPTION\r
-*      Dumps the SMInfo attribute to the log.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,\r
-                     IN osm_log_level_t log_level);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the osm_log_t object\r
-*\r
-*      p_smi\r
-*              [in] Pointer to the SMInfo attribute\r
-*\r
-*      log_level\r
-*              [in] Log verbosity level with which to dump the data.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_dump_switch_info\r
-* NAME\r
-*      osm_dump_switch_info\r
-*\r
-* DESCRIPTION\r
-*      Dumps the SwitchInfo attribute to the log.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_dump_switch_info(IN osm_log_t * p_log,\r
-                         IN const ib_switch_info_t * p_si,\r
-                         IN osm_log_level_t log_level);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the osm_log_t object\r
-*\r
-*      p_si\r
-*              [in] Pointer to the SwitchInfo attribute\r
-*\r
-*      log_level\r
-*              [in] Log verbosity level with which to dump the data.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_dump_notice\r
-* NAME\r
-*      osm_dump_notice\r
-*\r
-* DESCRIPTION\r
-*      Dumps the Notice attribute to the log.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_dump_notice(IN osm_log_t * p_log,\r
-                    IN const ib_mad_notice_attr_t * p_ntci,\r
-                    IN osm_log_level_t log_level);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the osm_log_t object\r
-*\r
-*      p_ntci\r
-*              [in] Pointer to the Notice attribute\r
-*\r
-*      log_level\r
-*              [in] Log verbosity level with which to dump the data.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/osm_get_disp_msg_str\r
-* NAME\r
-*      osm_get_disp_msg_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified Dispatcher message.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg);\r
-/*\r
-* PARAMETERS\r
-*      msg\r
-*              [in] Dispatcher message ID value.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the message description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,\r
-                     IN osm_log_level_t level);\r
-\r
-void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,\r
-                         IN osm_log_level_t level);\r
-\r
-void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,\r
-                    IN osm_log_level_t level);\r
-\r
-void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,\r
-                    IN osm_log_level_t level);\r
-\r
-/****f* IBA Base: Types/osm_get_sm_signal_str\r
-* NAME\r
-*      osm_get_sm_signal_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SM state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *osm_get_sm_signal_str(IN osm_signal_t signal);\r
-/*\r
-* PARAMETERS\r
-*      state\r
-*              [in] Signal value\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the signal description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state);\r
-\r
-const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type);\r
-\r
-const char *osm_get_manufacturer_str(IN uint64_t guid_ho);\r
-\r
-const char *osm_get_mtu_str(IN uint8_t mtu);\r
-\r
-const char *osm_get_lwa_str(IN uint8_t lwa);\r
-\r
-const char *osm_get_mtu_str(IN uint8_t mtu);\r
-\r
-const char *osm_get_lwa_str(IN uint8_t lwa);\r
-\r
-const char *osm_get_lsa_str(IN uint8_t lsa);\r
-\r
-/****f* IBA Base: Types/osm_get_sm_mgr_signal_str\r
-* NAME\r
-*      osm_get_sm_mgr_signal_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SM manager signal.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal);\r
-/*\r
-* PARAMETERS\r
-*      signal\r
-*              [in] SM manager signal\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the signal description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/osm_get_sm_mgr_state_str\r
-* NAME\r
-*      osm_get_sm_mgr_state_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified SM manager state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *osm_get_sm_mgr_state_str(IN uint16_t state);\r
-/*\r
-* PARAMETERS\r
-*      state\r
-*              [in] SM manager state\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the state description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_HELPER_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_inform.h b/branches/opensm_3/user/include/opensm/osm_inform.h
deleted file mode 100644 (file)
index 293ee5c..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_inform_rec_t.\r
- *     This object represents an IBA Inform Record.\r
- *     This object is part of the OpenSM family of objects.\r
- *\r
- * Author:\r
- *    Eitan Zahavi, Mellanox\r
- */\r
-\r
-#ifndef _OSM_INFR_H_\r
-#define _OSM_INFR_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Inform Record\r
-* NAME\r
-*      Inform Record\r
-*\r
-* DESCRIPTION\r
-*      The Inform record encapsulates the information needed by the\r
-*      SA to manage InformInfo registrations and sending Reports(Notice)\r
-*      when SM receives Traps for registered LIDs.\r
-*\r
-*      The inform records is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*    Eitan Zahavi, Mellanox\r
-*\r
-*********/\r
-/****s* OpenSM: Inform Record/osm_infr_t\r
-* NAME\r
-*      osm_infr_t\r
-*\r
-* DESCRIPTION\r
-*      Inform Record structure.\r
-*\r
-*      The osm_infr_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_infr {\r
-       cl_list_item_t list_item;\r
-       osm_bind_handle_t h_bind;\r
-       osm_sa_t *sa;\r
-       osm_mad_addr_t report_addr;\r
-       ib_inform_info_record_t inform_record;\r
-} osm_infr_t;\r
-/*\r
-* FIELDS\r
-*      list_item\r
-*              List Item for qlist linkage.  Must be first element!!\r
-*\r
-*      h_bind\r
-*              A handle of lower level mad srvc\r
-*\r
-*      sa\r
-*              A pointer to osm_sa object\r
-*\r
-*      report_addr\r
-*              Report address\r
-*\r
-*      inform_record\r
-*              The Inform Info Record\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Inform Record/osm_infr_new\r
-* NAME\r
-*      osm_infr_new\r
-*\r
-* DESCRIPTION\r
-*      Allocates and initializes a Inform Record for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec);\r
-/*\r
-* PARAMETERS\r
-*      p_inf_rec\r
-*              [in] Pointer to IB Inform Record\r
-*\r
-* RETURN VALUES\r
-*      pointer to osm_infr_t structure.\r
-*\r
-* NOTES\r
-*      Allows calling other inform record methods.\r
-*\r
-* SEE ALSO\r
-*      Inform Record, osm_infr_delete\r
-*********/\r
-\r
-/****f* OpenSM: Inform Record/osm_infr_delete\r
-* NAME\r
-*      osm_infr_delete\r
-*\r
-* DESCRIPTION\r
-*      Destroys and deallocates the osm_infr_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_infr_delete(IN osm_infr_t * p_infr);\r
-/*\r
-* PARAMETERS\r
-*      p_infr\r
-*              [in] Pointer to osm_infr_t structure\r
-*\r
-* SEE ALSO\r
-*      Inform Record, osm_infr_new\r
-*********/\r
-\r
-/****f* OpenSM: Inform Record/osm_infr_get_by_rec\r
-* NAME\r
-*      osm_infr_get_by_rec\r
-*\r
-* DESCRIPTION\r
-*      Find a matching osm_infr_t in the subnet DB by inform_info_record\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,\r
-                               IN osm_log_t * p_log,\r
-                               IN osm_infr_t * p_infr_rec);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to the subnet object\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object\r
-*\r
-*      p_inf_rec\r
-*              [in] Pointer to an inform_info record\r
-*\r
-* RETURN\r
-*      The matching osm_infr_t\r
-* SEE ALSO\r
-*      Inform Record, osm_infr_new, osm_infr_delete\r
-*********/\r
-\r
-void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                          IN osm_infr_t * p_infr);\r
-\r
-void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                            IN osm_infr_t * p_infr);\r
-\r
-/****f* OpenSM: Inform Record/osm_report_notice\r
-* NAME\r
-*      osm_report_notice\r
-*\r
-* DESCRIPTION\r
-* Once a Trap was received by the osm_trap_rcv, or a Trap sourced in\r
-* the SM was sent (Traps 64-67) this routine is called with a copy of\r
-* the notice data.\r
-* Given a notice attribute - compare and see if it matches the InformInfo\r
-* Element and if it does - call the Report(Notice) for the\r
-* target QP registered by the address stored in the InformInfo element\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,\r
-                                 IN ib_mad_notice_attr_t * p_ntc);\r
-/*\r
-* PARAMETERS\r
-*      p_rcv\r
-*              [in] Pointer to the trap receiver\r
-*\r
-*      p_ntc\r
-*              [in] Pointer to a copy of the incoming trap notice attribute.\r
-*\r
-* RETURN\r
-*      IB_SUCCESS on good completion\r
-*\r
-* SEE ALSO\r
-*      Inform Record, osm_trap_rcv\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_INFR_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_lid_mgr.h b/branches/opensm_3/user/include/opensm/osm_lid_mgr.h
deleted file mode 100644 (file)
index 5d1a608..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_lid_mgr_t.\r
- *     This object represents the LID Manager object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_LID_MGR_H_\r
-#define _OSM_LID_MGR_H_\r
-\r
-#include <complib/cl_passivelock.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_db.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define OSM_LID_MGR_LIST_SIZE_MIN 256\r
-/****h* OpenSM/LID Manager\r
-* NAME\r
-*      LID Manager\r
-*\r
-* DESCRIPTION\r
-*      The LID Manager object encapsulates the information\r
-*      needed to control LID assignments on the subnet.\r
-*\r
-*      The LID Manager object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-struct osm_sm;\r
-/****s* OpenSM: LID Manager/osm_lid_mgr_t\r
-* NAME\r
-*      osm_lid_mgr_t\r
-*\r
-* DESCRIPTION\r
-*      LID Manager structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_lid_mgr {\r
-       struct osm_sm *sm;\r
-       osm_subn_t *p_subn;\r
-       osm_db_t *p_db;\r
-       osm_log_t *p_log;\r
-       cl_plock_t *p_lock;\r
-       osm_db_domain_t *p_g2l;\r
-       cl_qlist_t free_ranges;\r
-       uint8_t used_lids[IB_LID_UCAST_END_HO + 1];\r
-} osm_lid_mgr_t;\r
-/*\r
-* FIELDS\r
-*      sm\r
-*              Pointer to the SM object.\r
-*\r
-*      p_subn\r
-*              Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_db\r
-*              Pointer to the database (persistency) object\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_lock\r
-*              Pointer to the serializing lock.\r
-*\r
-*      p_g2l\r
-*              Pointer to the database domain storing guid to lid mapping.\r
-*\r
-*      used_lids\r
-*              An array of used lids. keeps track of\r
-*              existing and non existing mapping of guid->lid\r
-*\r
-*      free_ranges\r
-*              A list of available free lid ranges. The list is initialized\r
-*              by the code that initializes the lid assignment and is consumed\r
-*              by the procedure that finds a free range. It holds elements of\r
-*              type osm_lid_mgr_range_t\r
-*\r
-* SEE ALSO\r
-*      LID Manager object\r
-*********/\r
-\r
-/****f* OpenSM: LID Manager/osm_lid_mgr_construct\r
-* NAME\r
-*      osm_lid_mgr_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a LID Manager object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to a LID Manager object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows osm_lid_mgr_destroy\r
-*\r
-*      Calling osm_lid_mgr_construct is a prerequisite to calling any other\r
-*      method except osm_lid_mgr_init.\r
-*\r
-* SEE ALSO\r
-*      LID Manager object, osm_lid_mgr_init,\r
-*      osm_lid_mgr_destroy\r
-*********/\r
-\r
-/****f* OpenSM: LID Manager/osm_lid_mgr_destroy\r
-* NAME\r
-*      osm_lid_mgr_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_lid_mgr_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified\r
-*      LID Manager object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_lid_mgr_construct or osm_lid_mgr_init.\r
-*\r
-* SEE ALSO\r
-*      LID Manager object, osm_lid_mgr_construct,\r
-*      osm_lid_mgr_init\r
-*********/\r
-\r
-/****f* OpenSM: LID Manager/osm_lid_mgr_init\r
-* NAME\r
-*      osm_lid_mgr_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_lid_mgr_init function initializes a\r
-*      LID Manager object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN struct osm_sm * sm);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_lid_mgr_t object to initialize.\r
-*\r
-*      sm\r
-*              [in] Pointer to the SM object for this subnet.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the LID Manager object was initialized\r
-*      successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other LID Manager methods.\r
-*\r
-* SEE ALSO\r
-*      LID Manager object, osm_lid_mgr_construct,\r
-*      osm_lid_mgr_destroy\r
-*********/\r
-\r
-/****f* OpenSM: LID Manager/osm_lid_mgr_process_sm\r
-* NAME\r
-*      osm_lid_mgr_process_sm\r
-*\r
-* DESCRIPTION\r
-*      Configures the SM's port with its designated LID values.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_lid_mgr_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns 0 on success and non-zero value otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      LID Manager\r
-*********/\r
-\r
-/****f* OpenSM: LID Manager/osm_lid_mgr_process_subnet\r
-* NAME\r
-*      osm_lid_mgr_process_subnet\r
-*\r
-* DESCRIPTION\r
-*      Configures subnet ports (except the SM port itself) with their\r
-*      designated LID values.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_lid_mgr_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns 0 on success and non-zero value otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      LID Manager\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_LID_MGR_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_log.h b/branches/opensm_3/user/include/opensm/osm_log.h
deleted file mode 100644 (file)
index b115e91..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_log_t.\r
- *     This object represents the log file.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_LOG_H_\r
-#define _OSM_LOG_H_\r
-\r
-#ifndef __WIN__\r
-#include <syslog.h>\r
-#endif\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_base.h>\r
-#include <iba/ib_types.h>\r
-#include <stdio.h>\r
-\r
-#ifdef __GNUC__\r
-#define STRICT_OSM_LOG_FORMAT __attribute__((format(printf, 3, 4)))\r
-#else\r
-#define STRICT_OSM_LOG_FORMAT\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define LOG_ENTRY_SIZE_MAX             4096\r
-#define BUF_SIZE                       LOG_ENTRY_SIZE_MAX\r
-#define __func__ __FUNCTION__\r
-#define OSM_LOG_ENTER( OSM_LOG_PTR ) \\r
-       osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \\r
-                "%s: [\n", __func__);\r
-#define OSM_LOG_EXIT( OSM_LOG_PTR ) \\r
-       osm_log( OSM_LOG_PTR, OSM_LOG_FUNCS, \\r
-                "%s: ]\n", __func__);\r
-/****h* OpenSM/Log\r
-* NAME\r
-*      Log\r
-*\r
-* DESCRIPTION\r
-*\r
-* AUTHOR\r
-*\r
-*********/\r
-typedef uint8_t osm_log_level_t;\r
-\r
-#define OSM_LOG_NONE   0x00\r
-#define OSM_LOG_ERROR  0x01\r
-#define OSM_LOG_INFO   0x02\r
-#define OSM_LOG_VERBOSE        0x04\r
-#define OSM_LOG_DEBUG  0x08\r
-#define OSM_LOG_FUNCS  0x10\r
-#define OSM_LOG_FRAMES 0x20\r
-#define OSM_LOG_ROUTING        0x40\r
-#define OSM_LOG_ALL    0x7f\r
-#define OSM_LOG_SYS    0x80\r
-\r
-/*\r
-       DEFAULT - turn on ERROR and INFO only\r
-*/\r
-#define OSM_LOG_DEFAULT_LEVEL          OSM_LOG_ERROR | OSM_LOG_INFO\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_log_t\r
-* NAME\r
-*      osm_log_t\r
-*\r
-* DESCRIPTION\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_log {\r
-       osm_log_level_t level;\r
-       cl_spinlock_t lock;\r
-       unsigned long count;\r
-       unsigned long max_size;\r
-       boolean_t flush;\r
-       FILE *out_port;\r
-       boolean_t accum_log_file;\r
-       boolean_t daemon;\r
-       char *log_file_name;\r
-       char *log_prefix;\r
-} osm_log_t;\r
-/*********/\r
-\r
-/****f* OpenSM: Log/osm_log_construct\r
-* NAME\r
-*      osm_log_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a Log object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_log_construct(IN osm_log_t * p_log)\r
-{\r
-       cl_spinlock_construct(&p_log->lock);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a Log object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_log_init, osm_log_init_v2, osm_log_destroy\r
-*\r
-*      Calling osm_log_construct is a prerequisite to calling any other\r
-*      method except osm_log_init or osm_log_init_v2.\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_init, osm_log_init_v2,\r
-*      osm_log_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_destroy\r
-* NAME\r
-*      osm_log_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_log_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_log_destroy(IN osm_log_t * p_log)\r
-{\r
-       cl_spinlock_destroy(&p_log->lock);\r
-       if (p_log->out_port != stdout) {\r
-               fclose(p_log->out_port);\r
-               p_log->out_port = stdout;\r
-       }\r
-       closelog();\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified\r
-*      Log object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_log_construct, osm_log_init, or osm_log_init_v2.\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_construct,\r
-*      osm_log_init, osm_log_init_v2\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_init_v2\r
-* NAME\r
-*      osm_log_init_v2\r
-*\r
-* DESCRIPTION\r
-*      The osm_log_init_v2 function initializes a\r
-*      Log object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush,\r
-                               IN uint8_t log_flags, IN const char *log_file,\r
-                               IN unsigned long max_size,\r
-                               IN boolean_t accum_log_file);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      flush\r
-*              [in] Set to TRUE directs the log to flush all log messages\r
-*              immediately.  This severely degrades log performance,\r
-*              and is normally used for debugging only.\r
-*\r
-*      log_flags\r
-*              [in] The log verbosity level to be used.\r
-*\r
-*      log_file\r
-*              [in] if not NULL defines the name of the log file. Otherwise\r
-*              it is stdout.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the Log object was initialized\r
-*      successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other Log methods.\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_construct,\r
-*      osm_log_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_reopen_file\r
-* NAME\r
-*      osm_log_reopen_file\r
-*\r
-* DESCRIPTION\r
-*      The osm_log_reopen_file function reopens the log file\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_log_reopen_file(osm_log_t * p_log);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-* RETURN VALUES\r
-*      0 on success or nonzero value otherwise.\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_init\r
-* NAME\r
-*      osm_log_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_log_init function initializes a\r
-*      Log object for use. It is a wrapper for osm_log_init_v2().\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_log_init(IN osm_log_t * p_log, IN boolean_t flush,\r
-                            IN uint8_t log_flags, IN const char *log_file,\r
-                            IN boolean_t accum_log_file);\r
-/*\r
- * Same as osm_log_init_v2() but without max_size parameter\r
- */\r
-\r
-void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,\r
-            IN const char *p_str, ...) STRICT_OSM_LOG_FORMAT;\r
-\r
-/****f* OpenSM: Log/osm_log_get_level\r
-* NAME\r
-*      osm_log_get_level\r
-*\r
-* DESCRIPTION\r
-*      Returns the current log level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_log_level_t osm_log_get_level(IN const osm_log_t * p_log)\r
-{\r
-       return p_log->level;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the current log level.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_construct,\r
-*      osm_log_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_set_level\r
-* NAME\r
-*      osm_log_set_level\r
-*\r
-* DESCRIPTION\r
-*      Sets the current log level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_log_set_level(IN osm_log_t * p_log,\r
-                                    IN osm_log_level_t level)\r
-{\r
-       p_log->level = level;\r
-       osm_log(p_log, OSM_LOG_ALL, "Setting log level to: 0x%02x\n", level);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      level\r
-*              [in] New level to set.\r
-*\r
-* RETURN VALUES\r
-*      Returns the current log level.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_construct,\r
-*      osm_log_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Log/osm_log_is_active\r
-* NAME\r
-*      osm_log_is_active\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the specified log level would be logged.\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_log_is_active(IN const osm_log_t * p_log,\r
-                                         IN osm_log_level_t level)\r
-{\r
-       return ((p_log->level & level) != 0);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      level\r
-*              [in] Level to check.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the specified log level would be logged.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Log object, osm_log_construct,\r
-*      osm_log_destroy\r
-*********/\r
-\r
-extern void osm_log_msg_box(osm_log_t *log, osm_log_level_t level,\r
-                           const char *func_name, const char *msg);\r
-extern void osm_log_raw(IN osm_log_t * p_log, IN osm_log_level_t verbosity,\r
-                       IN const char *p_buf);\r
-\r
-#define OSM_LOG(log, level, fmt, ...) do { \\r
-               if (osm_log_is_active(log, (level))) \\r
-                       osm_log(log, level, "%s: " fmt, __func__, ## __VA_ARGS__); \\r
-       } while (0)\r
-\r
-#define OSM_LOG_MSG_BOX(log, level, msg) \\r
-               osm_log_msg_box(log, level, __func__, msg)\r
-\r
-#define DBG_CL_LOCK 0\r
-\r
-#define CL_PLOCK_EXCL_ACQUIRE( __exp__ )  \\r
-{                                                                                                      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_excl_acquire: Acquiring %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-   cl_plock_excl_acquire( __exp__ );      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_excl_acquire: Acquired %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-}\r
-\r
-#define CL_PLOCK_ACQUIRE( __exp__ )  \\r
-{                                                                                                      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_acquire: Acquiring %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-   cl_plock_acquire( __exp__ );      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_acquire: Acquired %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-}\r
-\r
-#define CL_PLOCK_RELEASE( __exp__ )  \\r
-{                                                                                                      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_release: Releasing %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-   cl_plock_release( __exp__ );      \\r
-   if (DBG_CL_LOCK)                      \\r
-     printf("cl_plock_release: Released  %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-}\r
-\r
-#define DBG_CL_SPINLOCK 0\r
-#define CL_SPINLOCK_RELEASE( __exp__ )  \\r
-{                                                                                                      \\r
-   if (DBG_CL_SPINLOCK)                      \\r
-     printf("cl_spinlock_release: Releasing %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-   cl_spinlock_release( __exp__ );      \\r
-   if (DBG_CL_SPINLOCK)                      \\r
-     printf("cl_spinlock_release: Released  %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-}\r
-\r
-#define CL_SPINLOCK_ACQUIRE( __exp__ )  \\r
-{                                                                                                      \\r
-   if (DBG_CL_SPINLOCK)                      \\r
-     printf("cl_spinlock_acquire: Acquiring %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-   cl_spinlock_acquire( __exp__ );      \\r
-   if (DBG_CL_SPINLOCK)                      \\r
-     printf("cl_spinlock_acquire: Acquired %p file %s, line %d\n", \\r
-          __exp__,__FILE__, __LINE__);            \\r
-}\r
-\r
-/****f* OpenSM: Helper/osm_is_debug\r
-* NAME\r
-*      osm_is_debug\r
-*\r
-* DESCRIPTION\r
-*      The osm_is_debug function returns TRUE if the opensm was compiled\r
-*      in debug mode, and FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_is_debug(void);\r
-/*\r
-* PARAMETERS\r
-*      None\r
-*\r
-* RETURN VALUE\r
-*      TRUE if compiled in debug version. FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_LOG_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_mad_pool.h b/branches/opensm_3/user/include/opensm/osm_mad_pool.h
deleted file mode 100644 (file)
index c7665a6..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mad_pool_t.\r
- *     This object represents a pool of management datagram (MAD) objects.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MAD_POOL_H_\r
-#define _OSM_MAD_POOL_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_atomic.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_madw.h>\r
-#include <vendor/osm_vendor.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/MAD Pool\r
-* NAME\r
-*      MAD Pool\r
-*\r
-* DESCRIPTION\r
-*      The MAD Pool encapsulates the information needed by the\r
-*      OpenSM to manage a pool of MAD objects.  The OpenSM allocates\r
-*      one MAD Pool per IBA subnet.\r
-*\r
-*      The MAD Pool is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: MAD Pool/osm_mad_pool_t\r
-* NAME\r
-*      osm_mad_pool_t\r
-*\r
-* DESCRIPTION\r
-*      MAD Pool structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mad_pool {\r
-       atomic32_t mads_out;\r
-} osm_mad_pool_t;\r
-/*\r
-* FIELDS\r
-*      mads_out\r
-*              Running total of the number of MADs outstanding.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_construct\r
-* NAME\r
-*      osm_mad_pool_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a MAD Pool.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to a MAD Pool to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_mad_pool_init, osm_mad_pool_destroy\r
-*\r
-*      Calling osm_mad_pool_construct is a prerequisite to calling any other\r
-*      method except osm_mad_pool_init.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_init, osm_mad_pool_destroy\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_destroy\r
-* NAME\r
-*      osm_mad_pool_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_mad_pool_destroy function destroys a node, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to a MAD Pool to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified MAD Pool.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_mad_pool_construct or\r
-*      osm_mad_pool_init.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_construct, osm_mad_pool_init\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_init\r
-* NAME\r
-*      osm_mad_pool_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_mad_pool_init function initializes a MAD Pool for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object to initialize.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the MAD Pool was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other MAD Pool methods.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_construct, osm_mad_pool_destroy\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_get\r
-* NAME\r
-*      osm_mad_pool_get\r
-*\r
-* DESCRIPTION\r
-*      Gets a MAD wrapper and wire MAD from the pool.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * p_pool,\r
-                            IN osm_bind_handle_t h_bind,\r
-                            IN uint32_t total_size,\r
-                            IN const osm_mad_addr_t * p_mad_addr);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object.\r
-*\r
-*      h_bind\r
-*              [in] Handle returned from osm_vendor_bind() call to the\r
-*              port over which this mad will be sent.\r
-*\r
-*      total_size\r
-*              [in] Total size, including MAD header of the requested MAD.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to the MAD address structure.  This parameter\r
-*              may be NULL for directed route MADs.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to a MAD wrapper containing the MAD.\r
-*      A return value of NULL means no MADs are available.\r
-*\r
-* NOTES\r
-*      The MAD must eventually be returned to the pool with a call to\r
-*      osm_mad_pool_put.\r
-*\r
-*      The osm_mad_pool_construct or osm_mad_pool_init must be called before\r
-*      using this function.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_put\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_put\r
-* NAME\r
-*      osm_mad_pool_put\r
-*\r
-* DESCRIPTION\r
-*      Returns a MAD to the pool.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mad_pool_put(IN osm_mad_pool_t * p_pool, IN osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object.\r
-*\r
-*      p_madw\r
-*              [in] Pointer to a MAD Wrapper for a MAD that was previously\r
-*              retrieved from the pool.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      The osm_mad_pool_construct or osm_mad_pool_init must be called before\r
-*      using this function.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_get\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_get_wrapper\r
-* NAME\r
-*      osm_mad_pool_get_wrapper\r
-*\r
-* DESCRIPTION\r
-*      Gets a only MAD wrapper from the pool (no wire MAD).\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool,\r
-                                    IN osm_bind_handle_t h_bind,\r
-                                    IN uint32_t total_size,\r
-                                    IN const ib_mad_t * p_mad,\r
-                                    IN const osm_mad_addr_t * p_mad_addr);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object.\r
-*\r
-*      h_bind\r
-*              [in] Handle returned from osm_vendor_bind() call to the\r
-*              port for which this mad wrapper will be used.\r
-*\r
-*      total_size\r
-*              [in] Total size, including MAD header of the MAD that will\r
-*              be attached to this wrapper.\r
-*\r
-*      p_mad\r
-*              [in] Pointer to the MAD to attach to this wrapper.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to the MAD address structure.  This parameter\r
-*              may be NULL for directed route MADs.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to a MAD wrapper.\r
-*      A return value of NULL means no MAD wrappers are available.\r
-*\r
-* NOTES\r
-*      The MAD must eventually be returned to the pool with a call to\r
-*      osm_mad_pool_put.\r
-*\r
-*      The osm_mad_pool_construct or osm_mad_pool_init must be called before\r
-*      using this function.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_put\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_get_wrapper_raw\r
-* NAME\r
-*      osm_mad_pool_get_wrapper_raw\r
-*\r
-* DESCRIPTION\r
-*      Gets a only an uninitialized MAD wrapper from the pool (no wire MAD).\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to a MAD wrapper.\r
-*      A return value of NULL means no MAD wrappers are available.\r
-*\r
-* NOTES\r
-*      The MAD must eventually be returned to the pool with a call to\r
-*      osm_mad_pool_put.\r
-*\r
-*      The osm_mad_pool_construct or osm_mad_pool_init must be called before\r
-*      using this function.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_put\r
-*********/\r
-\r
-/****f* OpenSM: MAD Pool/osm_mad_pool_get_outstanding\r
-* NAME\r
-*      osm_mad_pool_get_count\r
-*\r
-* DESCRIPTION\r
-*      Returns the running count of MADs currently outstanding from the pool.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint32_t\r
-osm_mad_pool_get_outstanding(IN const osm_mad_pool_t * p_pool)\r
-{\r
-       return p_pool->mads_out;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pool\r
-*              [in] Pointer to an osm_mad_pool_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the running count of MADs currently outstanding from the pool.\r
-*\r
-* NOTES\r
-*      The osm_mad_pool_construct or osm_mad_pool_init must be called before\r
-*      using this function.\r
-*\r
-* SEE ALSO\r
-*      MAD Pool, osm_mad_pool_get\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MAD_POOL_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_madw.h b/branches/opensm_3/user/include/opensm/osm_madw.h
deleted file mode 100644 (file)
index 81d30e1..0000000
+++ /dev/null
@@ -1,1120 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mad_wrapper_t.\r
- *     This object represents the context wrapper for OpenSM MAD processing.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MADW_H_\r
-#define _OSM_MADW_H_\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <opensm/osm_base.h>\r
-#include <vendor/osm_vendor.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: MAD Wrapper/osm_bind_info_t\r
-* NAME\r
-*   osm_bind_info_t\r
-*\r
-* DESCRIPTION\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_bind_info {\r
-       ib_net64_t port_guid;\r
-       uint8_t mad_class;\r
-       uint8_t class_version;\r
-       boolean_t is_responder;\r
-       boolean_t is_trap_processor;\r
-       boolean_t is_report_processor;\r
-       uint32_t send_q_size;\r
-       uint32_t recv_q_size;\r
-       uint32_t timeout;\r
-       uint32_t retries;\r
-} osm_bind_info_t;\r
-/*\r
-* FIELDS\r
-*      portguid\r
-*              PortGuid of local port\r
-*\r
-*      mad_class\r
-*              Mgmt Class ID\r
-*\r
-*      class_version\r
-*              Mgmt Class version\r
-*\r
-*      is_responder\r
-*              True if this is a GSI Agent\r
-*\r
-*      is_trap_processor\r
-*              True if GSI Trap msgs are handled\r
-*\r
-*      is_report_processor\r
-*              True if GSI Report msgs are handled\r
-*\r
-*      send_q_size\r
-*              SendQueueSize\r
-*\r
-*      recv_q_size\r
-*              Receive Queue Size\r
-*\r
-*      timeout\r
-*              Transaction timeout\r
-*\r
-*      retries\r
-*              Number of retries for transaction\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****h* OpenSM/MAD Wrapper\r
-* NAME\r
-*      MAD Wrapper\r
-*\r
-* DESCRIPTION\r
-*      The MAD Wrapper object encapsulates the information needed by the\r
-*      OpenSM to manage individual MADs.  The OpenSM allocates one MAD Wrapper\r
-*      per MAD.\r
-*\r
-*      The MAD Wrapper is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_ni_context_t\r
-* NAME\r
-*      osm_ni_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of NodeInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_ni_context {\r
-       ib_net64_t node_guid;\r
-       uint8_t port_num;\r
-       ib_net64_t dup_node_guid;\r
-       uint8_t dup_port_num;\r
-       unsigned dup_count;\r
-} osm_ni_context_t;\r
-/*\r
-* FIELDS\r
-*      p_node\r
-*              Pointer to the node thru which we got to this node.\r
-*\r
-*      p_sw\r
-*              Pointer to the switch object (if any) of the switch\r
-*              thru which we got to this node.\r
-*\r
-*      port_num\r
-*              Port number on the node or switch thru which we got\r
-*              to this node.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_pi_context_t\r
-* NAME\r
-*      osm_pi_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_pi_context {\r
-       ib_net64_t node_guid;\r
-       ib_net64_t port_guid;\r
-       boolean_t set_method;\r
-       boolean_t light_sweep;\r
-       boolean_t active_transition;\r
-} osm_pi_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_nd_context_t\r
-* NAME\r
-*      osm_nd_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of NodeDescription attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_nd_context {\r
-       ib_net64_t node_guid;\r
-} osm_nd_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_si_context_t\r
-* NAME\r
-*      osm_si_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of SwitchInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_si_context {\r
-       ib_net64_t node_guid;\r
-       boolean_t set_method;\r
-       boolean_t light_sweep;\r
-} osm_si_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_lft_context_t\r
-* NAME\r
-*      osm_lft_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of LinearForwardingTable attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_lft_context {\r
-       ib_net64_t node_guid;\r
-       boolean_t set_method;\r
-} osm_lft_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_mft_context_t\r
-* NAME\r
-*      osm_mft_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of MulticastForwardingTable attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mft_context {\r
-       ib_net64_t node_guid;\r
-       boolean_t set_method;\r
-} osm_mft_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_smi_context_t\r
-* NAME\r
-*      osm_smi_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of SMInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_smi_context {\r
-       ib_net64_t port_guid;\r
-       boolean_t set_method;\r
-       boolean_t light_sweep;\r
-} osm_smi_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_pkey_context_t\r
-* NAME\r
-*      osm_pkey_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of P_Key attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_pkey_context {\r
-       ib_net64_t node_guid;\r
-       ib_net64_t port_guid;\r
-       boolean_t set_method;\r
-} osm_pkey_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_slvl_context_t\r
-* NAME\r
-*      osm_slvl_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_slvl_context {\r
-       ib_net64_t node_guid;\r
-       ib_net64_t port_guid;\r
-       boolean_t set_method;\r
-} osm_slvl_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_vla_context_t\r
-* NAME\r
-*      osm_vla_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipient of VL Arb attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_vla_context {\r
-       ib_net64_t node_guid;\r
-       ib_net64_t port_guid;\r
-       boolean_t set_method;\r
-} osm_vla_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_perfmgr_context_t\r
-* DESCRIPTION\r
-*      Context for Performance manager queries\r
-*/\r
-typedef struct osm_perfmgr_context {\r
-       uint64_t node_guid;\r
-       uint16_t port;\r
-       uint8_t mad_method;     /* was this a get or a set */\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-       struct timeval query_start;\r
-#endif\r
-} osm_perfmgr_context_t;\r
-/*********/\r
-\r
-#ifndef OSM_VENDOR_INTF_OPENIB\r
-/****s* OpenSM: MAD Wrapper/osm_arbitrary_context_t\r
-* NAME\r
-*      osm_arbitrary_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by arbitrary recipient.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_arbitrary_context {\r
-       void *context1;\r
-       void *context2;\r
-} osm_arbitrary_context_t;\r
-/*********/\r
-#endif\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_madw_context_t\r
-* NAME\r
-*      osm_madw_context_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed by recipients of MAD responses.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef union _osm_madw_context {\r
-       osm_ni_context_t ni_context;\r
-       osm_pi_context_t pi_context;\r
-       osm_nd_context_t nd_context;\r
-       osm_si_context_t si_context;\r
-       osm_lft_context_t lft_context;\r
-       osm_mft_context_t mft_context;\r
-       osm_smi_context_t smi_context;\r
-       osm_slvl_context_t slvl_context;\r
-       osm_pkey_context_t pkey_context;\r
-       osm_vla_context_t vla_context;\r
-       osm_perfmgr_context_t perfmgr_context;\r
-#ifndef OSM_VENDOR_INTF_OPENIB\r
-       osm_arbitrary_context_t arb_context;\r
-#endif\r
-} osm_madw_context_t;\r
-/*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_mad_addr_t\r
-* NAME\r
-*   osm_mad_addr_t\r
-*\r
-* DESCRIPTION\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mad_addr {\r
-       ib_net16_t dest_lid;\r
-       uint8_t path_bits;\r
-       uint8_t static_rate;\r
-       union addr_type {\r
-               struct _smi {\r
-                       ib_net16_t source_lid;\r
-                       uint8_t port_num;\r
-               } smi;\r
-\r
-               struct _gsi {\r
-                       ib_net32_t remote_qp;\r
-                       ib_net32_t remote_qkey;\r
-                       uint16_t pkey_ix;\r
-                       uint8_t service_level;\r
-                       boolean_t global_route;\r
-                       ib_grh_t grh_info;\r
-               } gsi;\r
-       } addr_type;\r
-} osm_mad_addr_t;\r
-/*\r
-* FIELDS\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: MAD Wrapper/osm_madw_t\r
-* NAME\r
-*      osm_madw_t\r
-*\r
-* DESCRIPTION\r
-*      Context needed for processing individual MADs\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_madw {\r
-       cl_list_item_t list_item;\r
-       osm_bind_handle_t h_bind;\r
-       osm_vend_wrap_t vend_wrap;\r
-       osm_mad_addr_t mad_addr;\r
-       osm_bind_info_t bind_info;\r
-       osm_madw_context_t context;\r
-       uint32_t mad_size;\r
-       ib_api_status_t status;\r
-       cl_disp_msgid_t fail_msg;\r
-       boolean_t resp_expected;\r
-       const ib_mad_t *p_mad;\r
-} osm_madw_t;\r
-/*\r
-* FIELDS\r
-*      list_item\r
-*              List linkage for lists.  MUST BE FIRST MEMBER!\r
-*\r
-*      h_bind\r
-*              Bind handle for the port on which this MAD will be sent\r
-*              or was received.\r
-*\r
-*      vend_wrap\r
-*              Transport vendor specific context.  This structure is not\r
-*              used outside MAD transport vendor specific code.\r
-*\r
-*      context\r
-*              Union of controller specific contexts needed for this MAD.\r
-*              This structure allows controllers to indirectly communicate\r
-*              with each other through the dispatcher.\r
-*\r
-*      mad_size\r
-*              Size of this MAD in bytes.\r
-*\r
-*      status\r
-*              Status of completed operation on the MAD.\r
-*              CL_SUCCESS if the operation was successful.\r
-*\r
-*      fail_msg\r
-*              Dispatcher message with which to post this MAD on failure.\r
-*              This value is set by the originator of the MAD.\r
-*              If an operation on this MAD fails, for example due to a timeout,\r
-*              then the transport layer will dispose of the MAD by sending\r
-*              it through the Dispatcher with this message type.  Presumably,\r
-*              there is a controller listening for the failure message that can\r
-*              properly clean up.\r
-*\r
-*      resp_expected\r
-*              TRUE if a response is expected to this MAD.\r
-*              FALSE otherwise.\r
-*\r
-*      p_mad\r
-*              Pointer to the wire MAD.  The MAD itself cannot be part of the\r
-*              wrapper, since wire MADs typically reside in special memory\r
-*              registered with the local HCA.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_init\r
-* NAME\r
-*      osm_madw_init\r
-*\r
-* DESCRIPTION\r
-*      Initializes a MAD Wrapper object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_madw_init(IN osm_madw_t * p_madw,\r
-                                IN osm_bind_handle_t h_bind,\r
-                                IN uint32_t mad_size,\r
-                                IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       memset(p_madw, 0, sizeof(*p_madw));\r
-       p_madw->h_bind = h_bind;\r
-       p_madw->fail_msg = CL_DISP_MSGID_NONE;\r
-       p_madw->mad_size = mad_size;\r
-       if (p_mad_addr)\r
-               p_madw->mad_addr = *p_mad_addr;\r
-       p_madw->resp_expected = FALSE;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object to initialize.\r
-*\r
-*      h_bind\r
-*              [in] Pointer to the wire MAD.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to the MAD address structure.  This parameter may\r
-*              be NULL for directed route MADs.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_smp_ptr\r
-* NAME\r
-*      osm_madw_get_smp_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SMP in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_smp_t *osm_madw_get_smp_ptr(IN const osm_madw_t * p_madw)\r
-{\r
-       return ((ib_smp_t *) p_madw->p_mad);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object to initialize.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the SMP MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      MAD Wrapper object\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_sa_mad_ptr\r
-* NAME\r
-*      osm_madw_get_sa_mad_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SA MAD in this MAD wrapper.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_sa_mad_t *osm_madw_get_sa_mad_ptr(IN const osm_madw_t * p_madw)\r
-{\r
-       return ((ib_sa_mad_t *) p_madw->p_mad);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the SA MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      MAD Wrapper object\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_perfmgt_mad_ptr\r
-* DESCRIPTION\r
-*      Gets a pointer to the PerfMgt MAD in this MAD wrapper.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_perfmgt_mad_t *osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t\r
-                                                            * p_madw)\r
-{\r
-       return ((ib_perfmgt_mad_t *) p_madw->p_mad);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the PerfMgt MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      MAD Wrapper object\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_ni_context_ptr\r
-* NAME\r
-*      osm_madw_get_ni_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the NodeInfo context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_ni_context_t *osm_madw_get_ni_context_ptr(IN const osm_madw_t\r
-                                                           * p_madw)\r
-{\r
-       return ((osm_ni_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_pi_context_ptr\r
-* NAME\r
-*      osm_madw_get_pi_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the PortInfo context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_pi_context_t *osm_madw_get_pi_context_ptr(IN const osm_madw_t\r
-                                                           * p_madw)\r
-{\r
-       return ((osm_pi_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_nd_context_ptr\r
-* NAME\r
-*      osm_madw_get_nd_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the NodeDescription context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_nd_context_t *osm_madw_get_nd_context_ptr(IN const osm_madw_t\r
-                                                           * p_madw)\r
-{\r
-       return ((osm_nd_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_lft_context_ptr\r
-* NAME\r
-*      osm_madw_get_lft_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the LFT context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_lft_context_t *osm_madw_get_lft_context_ptr(IN const\r
-                                                             osm_madw_t *\r
-                                                             p_madw)\r
-{\r
-       return ((osm_lft_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_mft_context_ptr\r
-* NAME\r
-*      osm_madw_get_mft_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the MFT context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_mft_context_t *osm_madw_get_mft_context_ptr(IN const\r
-                                                             osm_madw_t *\r
-                                                             p_madw)\r
-{\r
-       return ((osm_mft_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_si_context_ptr\r
-* NAME\r
-*      osm_madw_get_si_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SwitchInfo context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_si_context_t *osm_madw_get_si_context_ptr(IN const osm_madw_t\r
-                                                           * p_madw)\r
-{\r
-       return ((osm_si_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_smi_context_ptr\r
-* NAME\r
-*      osm_madw_get_smi_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SMInfo context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_smi_context_t *osm_madw_get_smi_context_ptr(IN const\r
-                                                             osm_madw_t *\r
-                                                             p_madw)\r
-{\r
-       return ((osm_smi_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_pkey_context_ptr\r
-* NAME\r
-*      osm_madw_get_pkey_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the P_Key context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_pkey_context_t *osm_madw_get_pkey_context_ptr(IN const\r
-                                                               osm_madw_t *\r
-                                                               p_madw)\r
-{\r
-       return ((osm_pkey_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_slvl_context_ptr\r
-* NAME\r
-*      osm_madw_get_slvl_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the PortInfo context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_slvl_context_t *osm_madw_get_slvl_context_ptr(IN const\r
-                                                               osm_madw_t *\r
-                                                               p_madw)\r
-{\r
-       return ((osm_slvl_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_vla_context_ptr\r
-* NAME\r
-*      osm_madw_get_vla_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the Vl Arb context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_vla_context_t *osm_madw_get_vla_context_ptr(IN const\r
-                                                             osm_madw_t *\r
-                                                             p_madw)\r
-{\r
-       return ((osm_vla_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#ifndef OSM_VENDOR_INTF_OPENIB\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_arbitrary_context_ptr\r
-* NAME\r
-*      osm_madw_get_arbitrary_context_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the arbitrary context in this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_arbitrary_context_t *osm_madw_get_arbitrary_context_ptr(IN\r
-                                                                         const\r
-                                                                         osm_madw_t\r
-                                                                         *\r
-                                                                         const\r
-                                                                         p_madw)\r
-{\r
-       return ((osm_arbitrary_context_t *) & p_madw->context);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the start of the context structure.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-#endif\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_vend_ptr\r
-* NAME\r
-*      osm_madw_get_vend_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the vendor specific MAD wrapper component.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_vend_wrap_t *osm_madw_get_vend_ptr(IN const osm_madw_t *\r
-                                                    p_madw)\r
-{\r
-       return ((osm_vend_wrap_t *) & p_madw->vend_wrap);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Gets a pointer to the vendor specific MAD wrapper component.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_vend_ptr\r
-* NAME\r
-*      osm_madw_get_vend_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns the bind handle associated with this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_bind_handle_t\r
-osm_madw_get_bind_handle(IN const osm_madw_t * p_madw)\r
-{\r
-       return ((osm_bind_handle_t) p_madw->h_bind);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the bind handle associated with this MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_mad_addr_ptr\r
-* NAME\r
-*      osm_madw_get_mad_addr_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns the mad address structure associated with this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_mad_addr_t *osm_madw_get_mad_addr_ptr(IN const osm_madw_t *\r
-                                                       p_madw)\r
-{\r
-       return ((osm_mad_addr_t *) & p_madw->mad_addr);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the mad address structure associated with this MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_mad_ptr\r
-* NAME\r
-*      osm_madw_get_mad_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns the mad address structure associated with this MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_mad_t *osm_madw_get_mad_ptr(IN const osm_madw_t * p_madw)\r
-{\r
-       return ((ib_mad_t *) p_madw->p_mad);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the mad address structure associated with this MAD.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_get_err_msg\r
-* NAME\r
-*      osm_madw_get_err_msg\r
-*\r
-* DESCRIPTION\r
-*      Returns the message with which to post this mad wrapper if\r
-*      an error occurs during processing the mad.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline cl_disp_msgid_t osm_madw_get_err_msg(IN const osm_madw_t * p_madw)\r
-{\r
-       return ((cl_disp_msgid_t) p_madw->fail_msg);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the message with which to post this mad wrapper if\r
-*      an error occurs during processing the mad.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_set_mad\r
-* NAME\r
-*      osm_madw_set_mad\r
-*\r
-* DESCRIPTION\r
-*      Associates a wire MAD with this MAD Wrapper object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_madw_set_mad(IN osm_madw_t * p_madw,\r
-                                   IN const ib_mad_t * p_mad)\r
-{\r
-       p_madw->p_mad = p_mad;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to an osm_madw_t object.\r
-*\r
-*      p_mad\r
-*              [in] Pointer to the wire MAD to attach to this wrapper.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: MAD Wrapper/osm_madw_copy_context\r
-* NAME\r
-*      osm_madw_copy_context\r
-*\r
-* DESCRIPTION\r
-*      Copies the controller context from one MAD Wrapper to another.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_madw_copy_context(IN osm_madw_t * p_dest,\r
-                                        IN const osm_madw_t * p_src)\r
-{\r
-       p_dest->context = p_src->context;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_dest\r
-*              [in] Pointer to the destination osm_madw_t object.\r
-*\r
-*      p_src\r
-*              [in] Pointer to the source osm_madw_t object.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MADW_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h b/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h
deleted file mode 100644 (file)
index 9f65f13..0000000
+++ /dev/null
@@ -1,486 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mcast_tbl_t.\r
- *     This object represents a multicast forwarding table.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MCAST_TBL_H_\r
-#define _OSM_MCAST_TBL_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_base.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: Forwarding Table/osm_mcast_tbl_t\r
-* NAME\r
-*      osm_mcast_tbl_t\r
-*\r
-* DESCRIPTION\r
-*      Multicast Forwarding Table structure.\r
-*\r
-*      Callers may directly access this object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mcast_fwdbl {\r
-       uint8_t num_ports;\r
-       uint8_t max_position;\r
-       uint16_t max_block;\r
-       int16_t max_block_in_use;\r
-       uint16_t num_entries;\r
-       uint16_t max_mlid_ho;\r
-       uint16_t mft_depth;\r
-       uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];\r
-} osm_mcast_tbl_t;\r
-/*\r
-* FIELDS\r
-*      num_ports\r
-*              The number of ports in the port mask.  This value\r
-*              is the same as the number of ports on the switch\r
-*\r
-*      max_position\r
-*              Maximum bit mask position for this table.  This value\r
-*              is computed from the number of ports on the switch.\r
-*\r
-*      max_block\r
-*              Maximum block number supported in the table.  This value\r
-*              is approximately the number of MLID entries divided by the\r
-*              number of MLIDs per block\r
-*\r
-*      num_entries\r
-*              Number of entries in the table (aka number of MLIDs supported).\r
-*\r
-*      max_mlid_ho\r
-*              Maximum MLID (host order) for the currently allocated multicast\r
-*              port mask table.\r
-*\r
-*      mft_depth\r
-*              Number of MLIDs in the currently allocated multicast port mask\r
-*              table.\r
-*\r
-*      p_mask_tbl\r
-*              Pointer to a two dimensional array of port_masks for this switch.\r
-*              The first dimension is MLID offset, second dimension is mask position.\r
-*              This pointer is null for switches that do not support multicast.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_init\r
-* NAME\r
-*      osm_mcast_tbl_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes a Multicast Forwarding Table object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,\r
-                       IN uint16_t capacity);\r
-/*\r
-* PARAMETERS\r
-*      num_ports\r
-*              [in] Number of ports in the switch owning this table.\r
-*\r
-*      capacity\r
-*              [in] The number of MLID entries (starting at 0xC000) supported\r
-*              by this switch.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_delete\r
-* NAME\r
-*      osm_mcast_tbl_delete\r
-*\r
-* DESCRIPTION\r
-*      This destroys and deallocates a Multicast Forwarding Table object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** pp_tbl);\r
-/*\r
-* PARAMETERS\r
-*      pp_tbl\r
-*              [in] Pointer a Pointer to the Multicast Forwarding Table object.\r
-*\r
-* RETURN VALUE\r
-*      On success, returns a pointer to a new Multicast Forwarding Table object\r
-*      of the specified size.\r
-*      NULL otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_realloc\r
-* NAME\r
-*      osm_mcast_tbl_realloc\r
-*\r
-* DESCRIPTION\r
-*      This function reallocates the multicast port mask table if necessary.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      mlid_offset\r
-*              [in] Offset of MLID being accessed.\r
-*\r
-* RETURN VALUE\r
-*      Returns 0 on success and non-zero value otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_destroy\r
-* NAME\r
-*      osm_mcast_tbl_destroy\r
-*\r
-* DESCRIPTION\r
-*      This destroys and deallocates a Multicast Forwarding Table object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-* RETURN VALUE\r
-*    None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_set\r
-* NAME\r
-*      osm_mcast_tbl_set\r
-*\r
-* DESCRIPTION\r
-*      Adds the port to the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,\r
-                      IN uint8_t port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID value (host order) for which to set the route.\r
-*\r
-*      port_num\r
-*              [in] Port to add to the multicast group.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_clear_mlid\r
-* NAME\r
-*      osm_mcast_tbl_clear_mlid\r
-*\r
-* DESCRIPTION\r
-*      Removes all multicast paths for the specified MLID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID value (host order) for which to clear.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_port\r
-* NAME\r
-*      osm_mcast_tbl_is_port\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the port is in the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,\r
-                               IN uint16_t mlid_ho, IN uint8_t port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID value (host order).\r
-*\r
-*      port_num\r
-*              [in] Port number on the switch\r
-*\r
-* RETURN VALUE\r
-*      Returns the port that routes the specified LID.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_any_port\r
-* NAME\r
-*      osm_mcast_tbl_is_any_port\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if any port is in the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,\r
-                                   IN uint16_t mlid_ho);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID value (host order).\r
-*\r
-* RETURN VALUE\r
-*      Returns TRUE if any port is in the multicast group.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_set_block\r
-* NAME\r
-*      osm_mcast_tbl_set_block\r
-*\r
-* DESCRIPTION\r
-*      Copies the specified block into the Multicast Forwarding Table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,\r
-                                       IN const ib_net16_t * p_block,\r
-                                       IN int16_t block_num,\r
-                                       IN uint8_t position);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to the Multicast Forwarding Table object.\r
-*\r
-*      p_block\r
-*              [in] Pointer to the Forwarding Table block.\r
-*\r
-*      block_num\r
-*              [in] Block number of this block.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_get_tbl_block\r
-* NAME\r
-*      osm_mcast_get_tbl_block\r
-*\r
-* DESCRIPTION\r
-*      Retrieve a multicast forwarding table block.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl,\r
-                                 IN int16_t block_num, IN uint8_t position,\r
-                                 OUT ib_net16_t * p_block);\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to an osm_mcast_tbl_t object.\r
-*\r
-*      p_block\r
-*              [in] Pointer to the Forwarding Table block.\r
-*\r
-*      block_num\r
-*              [in] Block number of this block.\r
-*\r
-*      p_block\r
-*              [out] Pointer to the 32 entry array to store the\r
-*              forwarding table clock specified by block_id.\r
-*\r
-* RETURN VALUES\r
-*      Returns true if there are more blocks necessary to\r
-*      configure all the MLIDs reachable from this switch.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block\r
-* NAME\r
-*      osm_mcast_tbl_get_max_block\r
-*\r
-* DESCRIPTION\r
-*      Returns the maximum block ID in this table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * p_tbl)\r
-{\r
-       return p_tbl->max_block;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to an osm_mcast_tbl_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the maximum block ID in this table.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block_in_use\r
-* NAME\r
-*      osm_mcast_tbl_get_max_block_in_use\r
-*\r
-* DESCRIPTION\r
-*      Returns the maximum block ID in use in this table.\r
-*      A value of -1 indicates no blocks are in use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline int16_t\r
-osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * p_tbl)\r
-{\r
-       return (p_tbl->max_block_in_use);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to an osm_mcast_tbl_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the maximum block ID in use in this table.\r
-*      A value of -1 indicates no blocks are in use.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_position\r
-* NAME\r
-*      osm_mcast_tbl_get_max_position\r
-*\r
-* DESCRIPTION\r
-*      Returns the maximum position in this table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * p_tbl)\r
-{\r
-       return (p_tbl->max_position);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_tbl\r
-*              [in] Pointer to an osm_mcast_tbl_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the maximum position in this table.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MCAST_TBL_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_mcm_port.h b/branches/opensm_3/user/include/opensm/osm_mcm_port.h
deleted file mode 100644 (file)
index ee0ff99..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mcm_port_t.\r
- *     This object represents the membership of a port in a multicast group.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MCM_PORT_H_\r
-#define _OSM_MCM_PORT_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_port.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-struct osm_mgrp;\r
-\r
-/****s* OpenSM: MCM Port Object/osm_mcm_port_t\r
-* NAME\r
-*   osm_mcm_port_t\r
-*\r
-* DESCRIPTION\r
-*   This object represents a particular        port as a member of a\r
-*      multicast group.\r
-*\r
-*   This object should be treated as opaque and should\r
-*   be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mcm_port {\r
-       cl_map_item_t map_item;\r
-       cl_list_item_t list_item;\r
-       osm_port_t *port;\r
-       struct osm_mgrp *mgrp;\r
-       ib_gid_t port_gid;\r
-       uint8_t scope_state;\r
-       boolean_t proxy_join;\r
-} osm_mcm_port_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Map Item for qmap linkage.  Must be first element!!\r
-*\r
-*      port\r
-*              Reference to the parent port.\r
-*\r
-*      mgrp\r
-*              The pointer to multicast group where this port is member of\r
-*\r
-*      port_gid\r
-*              GID of the member port.\r
-*\r
-*      scope_state\r
-*              ???\r
-*\r
-*      proxy_join\r
-*              If FALSE - Join was performed by the endport identified\r
-*              by PortGID. If TRUE - Join was performed on behalf of\r
-*              the endport identified by PortGID by another port within\r
-*              the same partition.\r
-*\r
-* SEE ALSO\r
-*      MCM Port Object\r
-*********/\r
-\r
-/****f* OpenSM: MCM Port Object/osm_mcm_port_new\r
-* NAME\r
-*      osm_mcm_port_new\r
-*\r
-* DESCRIPTION\r
-*      The osm_mcm_port_new function allocates and initializes a\r
-*      MCM Port Object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp,\r
-                                IN ib_member_rec_t *mcmr, IN boolean_t proxy);\r
-/*\r
-* PARAMETERS\r
-*      port\r
-*              [in] Pointer to the port object.\r
-*\r
-*      mgrp\r
-*              [in] Pointer to multicast group where this port is joined.\r
-*\r
-*      mcmr\r
-*              [in] Pointer to MCMember record of the join request\r
-*\r
-*      proxy\r
-*              [in] proxy_join state analyzed from the request\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the allocated and initialized MCM Port object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      MCM Port Object, osm_mcm_port_delete,\r
-*********/\r
-\r
-/****f* OpenSM: MCM Port Object/osm_mcm_port_delete\r
-* NAME\r
-*      osm_mcm_port_delete\r
-*\r
-* DESCRIPTION\r
-*      The osm_mcm_port_delete function destroys and dellallocates an\r
-*      MCM Port Object, releasing all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm);\r
-/*\r
-* PARAMETERS\r
-*      p_mcm\r
-*              [in] Pointer to a MCM Port Object to delete.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      MCM Port Object, osm_mcm_port_new\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MCM_PORT_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_mesh.h b/branches/opensm_3/user/include/opensm/osm_mesh.h
deleted file mode 100644 (file)
index 4be391f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *      Declarations for mesh analysis\r
- */\r
-\r
-#ifndef OSM_MESH_H\r
-#define OSM_MESH_H\r
-\r
-struct _lash;\r
-struct _switch;\r
-\r
-/*\r
- * per switch to switch link info\r
- */\r
-typedef struct _link {\r
-       int switch_id;\r
-       int link_id;\r
-       int next_port;\r
-       int num_ports;\r
-       int ports[0];\r
-} link_t;\r
-\r
-/*\r
- * per switch node mesh info\r
- */\r
-typedef struct _mesh_node {\r
-       int *axes;                      /* used to hold and reorder assigned axes */\r
-       int *coord;                     /* mesh coordinates of switch */\r
-       int **matrix;                   /* distances between adjacant switches */\r
-       int *poly;                      /* characteristic polynomial of matrix */\r
-                                       /* used as an invariant classification */\r
-       int dimension;                  /* apparent dimension of mesh around node */\r
-       int temp;                       /* temporary holder for distance info */\r
-       int type;                       /* index of node type in mesh_info array */\r
-       unsigned int num_links;         /* number of 'links' to adjacent switches */\r
-       link_t *links[0];               /* per link information */\r
-} mesh_node_t;\r
-\r
-void osm_mesh_node_delete(struct _lash *p_lash, struct _switch *sw);\r
-int osm_mesh_node_create(struct _lash *p_lash, struct _switch *sw);\r
-int osm_do_mesh_analysis(struct _lash *p_lash);\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/include/opensm/osm_msgdef.h b/branches/opensm_3/user/include/opensm/osm_msgdef.h
deleted file mode 100644 (file)
index 6d4c34f..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of Dispatcher message values.\r
- */\r
-\r
-#ifndef _OSM_MSGDEF_H_\r
-#define _OSM_MSGDEF_H_\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Dispatcher Messages\r
-* NAME\r
-*      Dispatcher Messages\r
-*\r
-* DESCRIPTION\r
-*      These constants define the messages sent between OpenSM controllers\r
-*      attached to the Dispatcher.\r
-*\r
-*      Each message description contains the following information:\r
-*      Sent by: which controller(s) send this message\r
-*      Received by: which controller receives this message\r
-*      Delivery notice: Indicates if the sender requires confirmation\r
-*              that the message has been delivered.  Typically a "yes" here\r
-*              means that some resources associated with sending the\r
-*              message must be freed.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Dispatcher Messages/OSM_MSG_MAD_NODE_INFO\r
-* NAME\r
-*      OSM_MSG_MAD_NODE_INFO\r
-*\r
-* DESCRIPTION\r
-*      Message for received NodeInfo MADs.\r
-*\r
-* NOTES\r
-*      Sent by:                        osm_mad_ctrl_t\r
-*      Received by:                    osm_ni_rcv_ctrl_t\r
-*      Delivery notice:                yes\r
-*\r
-*\r
-***********/\r
-/****s* OpenSM: Dispatcher Messages/OSM_MSG_MAD_PORT_INFO\r
-* NAME\r
-*      OSM_MSG_MAD_PORT_INFO\r
-*\r
-* DESCRIPTION\r
-*      Message for received PortInfo MADs.\r
-*\r
-* NOTES\r
-*      Sent by:                        osm_mad_ctrl_t\r
-*      Received by:                    osm_pi_rcv_ctrl_t\r
-*      Delivery notice:                yes\r
-*\r
-*\r
-***********/\r
-/****s* OpenSM: Dispatcher Messages/OSM_MSG_MAD_SWITCH_INFO\r
-* NAME\r
-*      OSM_MSG_MAD_SWITCH_INFO\r
-*\r
-* DESCRIPTION\r
-*      Message for received SwitchInfo MADs.\r
-*\r
-* NOTES\r
-*      Sent by:                        osm_mad_ctrl_t\r
-*      Received by:                    osm_si_rcv_ctrl_t\r
-*      Delivery notice:                yes\r
-*\r
-***********/\r
-/****s* OpenSM: Dispatcher Messages/OSM_MSG_MAD_NODE_DESC\r
-* NAME\r
-*      OSM_MSG_MAD_NODE_DESC\r
-*\r
-* DESCRIPTION\r
-*      Message for received NodeDescription MADs.\r
-*\r
-* NOTES\r
-*      Sent by:                        osm_mad_ctrl_t\r
-*      Received by:                    osm_nd_rcv_ctrl_t\r
-*      Delivery notice:                yes\r
-*\r
-* SOURCE\r
-***********/\r
-enum {\r
-       OSM_MSG_NONE = 0,\r
-       OSM_MSG_MAD_NODE_INFO,\r
-       OSM_MSG_MAD_PORT_INFO,\r
-       OSM_MSG_MAD_SWITCH_INFO,\r
-       OSM_MSG_MAD_NODE_DESC,\r
-       OSM_MSG_MAD_NODE_RECORD,\r
-       OSM_MSG_MAD_PORTINFO_RECORD,\r
-       OSM_MSG_MAD_SERVICE_RECORD,\r
-       OSM_MSG_MAD_PATH_RECORD,\r
-       OSM_MSG_MAD_MCMEMBER_RECORD,\r
-       OSM_MSG_MAD_LINK_RECORD,\r
-       OSM_MSG_MAD_SMINFO_RECORD,\r
-       OSM_MSG_MAD_CLASS_PORT_INFO,\r
-       OSM_MSG_MAD_INFORM_INFO,\r
-       OSM_MSG_MAD_LFT_RECORD,\r
-       OSM_MSG_MAD_LFT,\r
-       OSM_MSG_MAD_SM_INFO,\r
-       OSM_MSG_MAD_NOTICE,\r
-       OSM_MSG_LIGHT_SWEEP_FAIL,\r
-       OSM_MSG_MAD_MFT,\r
-       OSM_MSG_MAD_PKEY_TBL_RECORD,\r
-       OSM_MSG_MAD_VL_ARB_RECORD,\r
-       OSM_MSG_MAD_SLVL_TBL_RECORD,\r
-       OSM_MSG_MAD_PKEY,\r
-       OSM_MSG_MAD_VL_ARB,\r
-       OSM_MSG_MAD_SLVL,\r
-       OSM_MSG_MAD_GUIDINFO_RECORD,\r
-       OSM_MSG_MAD_INFORM_INFO_RECORD,\r
-       OSM_MSG_MAD_SWITCH_INFO_RECORD,\r
-       OSM_MSG_MAD_MFT_RECORD,\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       OSM_MSG_MAD_MULTIPATH_RECORD,\r
-#endif\r
-       OSM_MSG_MAD_PORT_COUNTERS,\r
-       OSM_MSG_MAX\r
-};\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MSGDEF_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_mtree.h b/branches/opensm_3/user/include/opensm/osm_mtree.h
deleted file mode 100644 (file)
index 43db7f8..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mtree_t.\r
- *     This object represents multicast spanning tree.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MTREE_H_\r
-#define _OSM_MTREE_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_switch.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define OSM_MTREE_LEAF ((void*)-1)\r
-/****h* OpenSM/Multicast Tree\r
-* NAME\r
-*      Multicast Tree\r
-*\r
-* DESCRIPTION\r
-*      The Multicast Tree object encapsulates the information needed by the\r
-*      OpenSM to manage multicast fabric routes.  It is a tree structure\r
-*      in which each node in the tree represents a switch, and may have a\r
-*      varying number of children.\r
-*\r
-*      Multicast trees do not contain loops.\r
-*\r
-*      The Multicast Tree is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Multicast Tree/osm_mtree_node_t\r
-* NAME\r
-*      osm_mtree_node_t\r
-*\r
-* DESCRIPTION\r
-*      The MTree Node object encapsulates the information needed by the\r
-*      OpenSM for a particular switch in the multicast tree.\r
-*\r
-*      The MTree Node object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mtree_node {\r
-       cl_map_item_t map_item;\r
-       const osm_switch_t *p_sw;\r
-       uint8_t max_children;\r
-       struct osm_mtree_node *p_up;\r
-       struct osm_mtree_node *child_array[1];\r
-} osm_mtree_node_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage for quick map.  MUST BE FIRST ELEMENT!!!\r
-*\r
-*      p_sw\r
-*              Pointer to the switch represented by this tree node.\r
-*\r
-*      max_children\r
-*              Maximum number of child nodes of this node.  Equal to the\r
-*              the number of ports on the switch if the switch supports\r
-*              multicast.  Equal to 1 (default route) if the switch does\r
-*              not support multicast.\r
-*\r
-*      p_up\r
-*              Pointer to the parent of this node.  If this pointer is\r
-*              NULL, the node is at the root of the tree.\r
-*\r
-*      child_array\r
-*              Array (indexed by port number) of pointers to the\r
-*              child osm_mtree_node_t objects of this tree node, if any.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Tree/osm_mtree_node_new\r
-* NAME\r
-*      osm_mtree_node_new\r
-*\r
-* DESCRIPTION\r
-*      Returns an initialized a Multicast Tree object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch represented by this node.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to an initialized tree node.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Tree/osm_mtree_destroy\r
-* NAME\r
-*      osm_mtree_destroy\r
-*\r
-* DESCRIPTION\r
-*      Destroys a Multicast Tree object given by the p_mtn\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn);\r
-/*\r
-* PARAMETERS\r
-*      p_mtn\r
-*              [in] Pointer to an osm_mtree_node_t object to destroy.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Tree/osm_mtree_node_get_max_children\r
-* NAME\r
-*      osm_mtree_node_get_max_children\r
-*\r
-* DESCRIPTION\r
-*      Returns the number maximum number of children of this node.\r
-*      The return value is 1 greater than the highest valid port\r
-*      number on the switch.\r
-*\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_mtree_node_get_max_children(IN const osm_mtree_node_t * p_mtn)\r
-{\r
-       return (p_mtn->max_children);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_mtn\r
-*              [in] Pointer to the multicast tree node.\r
-*\r
-* RETURN VALUES\r
-*      See description.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Tree/osm_mtree_node_get_child\r
-* NAME\r
-*      osm_mtree_node_get_child\r
-*\r
-* DESCRIPTION\r
-*      Returns the specified child node of this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_mtree_node_t *osm_mtree_node_get_child(IN const\r
-                                                        osm_mtree_node_t *\r
-                                                        p_mtn,\r
-                                                        IN uint8_t child)\r
-{\r
-       CL_ASSERT(child < p_mtn->max_children);\r
-       return (p_mtn->child_array[child]);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_mtn\r
-*              [in] Pointer to the multicast tree node.\r
-*\r
-*      child\r
-*              [in] Index of the child to retrieve.\r
-*\r
-* RETURN VALUES\r
-*      Returns the specified child node of this node.\r
-*\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Tree/osm_mtree_node_get_switch_ptr\r
-* NAME\r
-*      osm_mtree_node_get_switch_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the switch object represented by this tree node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const osm_switch_t *osm_mtree_node_get_switch_ptr(IN const\r
-                                                         osm_mtree_node_t *\r
-                                                         p_mtn)\r
-{\r
-       return p_mtn->p_sw;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_mtn\r
-*              [in] Pointer to the multicast tree node.\r
-*\r
-*      child\r
-*              [in] Index of the child to retrieve.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the switch object represented by this tree node.\r
-*\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MTREE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_multicast.h b/branches/opensm_3/user/include/opensm/osm_multicast.h
deleted file mode 100644 (file)
index c869342..0000000
+++ /dev/null
@@ -1,389 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mgrp_t.\r
- *     This object represents an IBA Multicast Group.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_MULTICAST_H_\r
-#define _OSM_MULTICAST_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_fleximap.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_mtree.h>\r
-#include <opensm/osm_mcm_port.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Multicast Group\r
-* NAME\r
-*      Multicast Group\r
-*\r
-* DESCRIPTION\r
-*      The Multicast Group encapsulates the information needed by the\r
-*      OpenSM to manage Multicast Groups.  The OpenSM allocates one\r
-*      Multicast Group object per Multicast Group in the IBA subnet.\r
-*\r
-*      The Multicast Group is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Multicast Group/osm_mgrp_t\r
-* NAME\r
-*      osm_mgrp_t\r
-*\r
-* DESCRIPTION\r
-*      Multicast Group structure.\r
-*\r
-*      The osm_mgrp_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mgrp {\r
-       cl_fmap_item_t map_item;\r
-       cl_list_item_t list_item;\r
-       ib_net16_t mlid;\r
-       cl_qmap_t mcm_port_tbl;\r
-       ib_member_rec_t mcmember_rec;\r
-       boolean_t well_known;\r
-       unsigned full_members;\r
-} osm_mgrp_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Map Item for fmap linkage.  Must be first element!!\r
-*\r
-*      list_item\r
-*              List item for linkage in osm_mgrp_box's mgrp_list qlist.\r
-*\r
-*      mlid\r
-*              The network ordered LID of this Multicast Group (must be\r
-*              >= 0xC000).\r
-*\r
-*      mcm_port_tbl\r
-*              Table (sorted by port GUID) of osm_mcm_port_t objects\r
-*              representing the member ports of this multicast group.\r
-*\r
-*      mcmember_rec\r
-*              Holds the parameters of the Multicast Group.\r
-*\r
-*      well_known\r
-*              Indicates that this is the wellknown multicast group which\r
-*              is created during the initialization of SM/SA and will be\r
-*              present even if there are no ports for this group\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: Multicast Group/osm_mgrp_box_t\r
-* NAME\r
-*      osm_mgrp_box_t\r
-*\r
-* DESCRIPTION\r
-*      Multicast structure which holds all multicast groups with same MLID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_mgrp_box {\r
-       uint16_t mlid;\r
-       cl_qlist_t mgrp_list;\r
-       osm_mtree_node_t *root;\r
-} osm_mgrp_box_t;\r
-/*\r
-* FIELDS\r
-*      mlid\r
-*              The host ordered LID of this Multicast Group (must be\r
-*              >= 0xC000).\r
-*\r
-*      p_root\r
-*              Pointer to the root "tree node" in the single spanning tree\r
-*              for this multicast group.  The nodes of the tree represent\r
-*              switches.  Member ports are not represented in the tree.\r
-*\r
-*      mgrp_list\r
-*              List of multicast groups (mpgr object) having same MLID value.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_new\r
-* NAME\r
-*      osm_mgrp_new\r
-*\r
-* DESCRIPTION\r
-*      Allocates and initializes a Multicast Group for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,\r
-                        IN ib_member_rec_t * mcmr);\r
-/*\r
-* PARAMETERS\r
-*      subn\r
-*              [in] Pointer to osm_subn_t object.\r
-*      mlid\r
-*              [in] Multicast LID for this multicast group.\r
-*\r
-*      mcmr\r
-*              [in] MCMember Record for this multicast group.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if initialization was successful.\r
-*\r
-* NOTES\r
-*      Allows calling other Multicast Group methods.\r
-*\r
-* SEE ALSO\r
-*      Multicast Group, osm_mgrp_delete\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_is_guid\r
-* NAME\r
-*      osm_mgrp_is_guid\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the specified port GUID is a member of the Multicast Group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_mgrp_is_guid(IN const osm_mgrp_t * p_mgrp,\r
-                                        IN ib_net64_t port_guid)\r
-{\r
-       return (cl_qmap_get(&p_mgrp->mcm_port_tbl, port_guid) !=\r
-               cl_qmap_end(&p_mgrp->mcm_port_tbl));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\r
-*\r
-*      port_guid\r
-*              [in] Port GUID.\r
-*\r
-* RETURN VALUES\r
-*      TRUE if the port GUID is a member of the group,\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Multicast Group\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_is_empty\r
-* NAME\r
-*      osm_mgrp_is_empty\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the multicast group has any member ports.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_mgrp_is_empty(IN const osm_mgrp_t * p_mgrp)\r
-{\r
-       return (cl_qmap_count(&p_mgrp->mcm_port_tbl) == 0);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\r
-*\r
-* RETURN VALUES\r
-*      TRUE if there are no ports in the multicast group.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Multicast Group\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_get_mlid\r
-* NAME\r
-*      osm_mgrp_get_mlid\r
-*\r
-* DESCRIPTION\r
-*      The osm_mgrp_get_mlid function returns the multicast LID of this group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t osm_mgrp_get_mlid(IN const osm_mgrp_t * p_mgrp)\r
-{\r
-       return p_mgrp->mlid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\r
-*\r
-* RETURN VALUES\r
-*      MLID of the Multicast Group.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Multicast Group\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_add_port\r
-* NAME\r
-*      osm_mgrp_add_port\r
-*\r
-* DESCRIPTION\r
-*      Adds a port to the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_mcm_port_t *osm_mgrp_add_port(osm_subn_t *subn, osm_log_t *log,\r
-                                 IN osm_mgrp_t * mgrp, IN osm_port_t *port,\r
-                                 IN ib_member_rec_t *mcmr, IN boolean_t proxy);\r
-/*\r
-* PARAMETERS\r
-*      mgrp\r
-*              [in] Pointer to an osm_mgrp_t object to initialize.\r
-*\r
-*      port\r
-*              [in] Pointer to an osm_port_t object\r
-*\r
-*      mcmr\r
-*              [in] Pointer to MCMember record received for the join\r
-*\r
-*      proxy\r
-*              [in] The proxy join state for this port in the group.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS\r
-*      IB_INSUFFICIENT_MEMORY\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_get_mcm_port\r
-* NAME\r
-*      osm_mgrp_get_mcm_port\r
-*\r
-* DESCRIPTION\r
-*      finds a port in the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_mcm_port_t *osm_mgrp_get_mcm_port(IN const osm_mgrp_t * p_mgrp,\r
-                                     IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*      p_mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\r
-*\r
-*      port_guid\r
-*              [in] Port guid of the departing port.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the mcm port object when present or NULL otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Multicast Group/osm_mgrp_remove_port\r
-* NAME\r
-*      osm_mgrp_remove_port\r
-*\r
-* DESCRIPTION\r
-*      Removes a port from the multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_mgrp_delete_port(IN osm_subn_t * subn, IN osm_log_t * log,\r
-                         IN osm_mgrp_t * mgrp, IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      subn\r
-*              [in] Pointer to the subnet object\r
-*\r
-*      log\r
-*              [in] The log object pointer\r
-*\r
-*      mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\r
-*\r
-*      port_guid\r
-*              [in] Port guid of the departing port.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,\r
-                         osm_mcm_port_t * mcm_port, ib_member_rec_t * mcmr);\r
-void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr);\r
-void osm_mgrp_box_delete(osm_mgrp_box_t *mbox);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_MULTICAST_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_node.h b/branches/opensm_3/user/include/opensm/osm_node.h
deleted file mode 100644 (file)
index 797fe37..0000000
+++ /dev/null
@@ -1,668 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_node_t.\r
- *     This object represents an IBA node.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_NODE_H_\r
-#define _OSM_NODE_H_\r
-\r
-#include <complib/cl_qmap.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_path.h>\r
-#include <opensm/osm_madw.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-struct osm_switch;\r
-\r
-/****h* OpenSM/Node\r
-* NAME\r
-*      Node\r
-*\r
-* DESCRIPTION\r
-*      The Node object encapsulates the information needed by the\r
-*      OpenSM to manage nodes.  The OpenSM allocates one Node object\r
-*      per node in the IBA subnet.\r
-*\r
-*      The Node object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Node/osm_node_t\r
-* NAME\r
-*      osm_node_t\r
-*\r
-* DESCRIPTION\r
-*      Node structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_node {\r
-       cl_map_item_t map_item;\r
-       struct osm_switch *sw;\r
-       ib_node_info_t node_info;\r
-       ib_node_desc_t node_desc;\r
-       uint32_t discovery_count;\r
-       uint32_t physp_tbl_size;\r
-       char *print_desc;\r
-       osm_physp_t physp_table[1];\r
-} osm_node_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!\r
-*\r
-*      sw\r
-*              For switch node contains pointer to appropriate osm_switch\r
-*              structure. NULL for non-switch nodes. Can be used for fast\r
-*              access to switch object and for simple node type detection\r
-*\r
-*      node_info\r
-*              The IBA defined NodeInfo data for this node.\r
-*\r
-*      node_desc\r
-*              The IBA defined NodeDescription data for this node.\r
-*\r
-*      discovery_count\r
-*              The number of times this node has been discovered\r
-*              during the current fabric sweep.  This number is reset\r
-*              to zero at the start of a sweep.\r
-*\r
-*      phsyp_tbl_size\r
-*              The size of the physp_table array.  This value is one greater\r
-*              than the number of ports in the node, since port numbers\r
-*              start with 1 for some bizzare reason.\r
-*\r
-*      print_desc\r
-*              A printable version of the node description.\r
-*\r
-*      phsyp_table\r
-*              Array of physical port objects belonging to this node.\r
-*              Index is contiguous by local port number.\r
-*              For switches, port 0 is the always the management port (14.2.5.6).\r
-*              MUST BE LAST MEMBER! - Since it grows !!!!\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_delete\r
-* NAME\r
-*      osm_node_delete\r
-*\r
-* DESCRIPTION\r
-*      The osm_node_delete function destroys a node, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_node_delete(IN OUT osm_node_t ** p_node);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in][out] Pointer to a Pointer a Node object to destroy.\r
-*              On return, the pointer to set to NULL.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified Node object.\r
-*      This function should only be called after a call to osm_node_new.\r
-*\r
-* SEE ALSO\r
-*      Node object, osm_node_new\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_new\r
-* NAME\r
-*      osm_node_new\r
-*\r
-* DESCRIPTION\r
-*      The osm_node_new function initializes a Node object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_node_t *osm_node_new(IN const osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_madw\r
-*              [in] Pointer to a osm_madw_t object containing a mad with\r
-*              the node's NodeInfo attribute.  The caller may discard the\r
-*              osm_madw_t structure after calling osm_node_new.\r
-*\r
-* RETURN VALUES\r
-*      On success, a pointer to the new initialized osm_node_t structure.\r
-*      NULL otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_physp_ptr\r
-* NAME\r
-*      osm_node_get_physp_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the physical port object at the\r
-*      specified local port number.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_physp_t *osm_node_get_physp_ptr(IN osm_node_t * p_node,\r
-                                                 IN uint32_t port_num)\r
-{\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       return osm_physp_is_valid(&p_node->physp_table[port_num]) ?\r
-               &p_node->physp_table[port_num] : NULL;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Local port number.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the physical port object at the\r
-*      specified local port number.\r
-*      A return value of zero means the port number was out of range.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_type\r
-* NAME\r
-*      osm_node_get_type\r
-*\r
-* DESCRIPTION\r
-*      Returns the type of this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_node_get_type(IN const osm_node_t * p_node)\r
-{\r
-       return p_node->node_info.node_type;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the IBA defined type of this node.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_num_physp\r
-* NAME\r
-*      osm_node_get_num_physp\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of osm_physp ports allocated for this node.\r
-*      For switches, it is the number of external physical ports plus\r
-*      port 0. For CAs and routers, it is the number of external physical\r
-*      ports plus 1.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_node_get_num_physp(IN const osm_node_t * p_node)\r
-{\r
-       return (uint8_t) p_node->physp_tbl_size;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the IBA defined type of this node.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_remote_node\r
-* NAME\r
-*      osm_node_get_remote_node\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the node on the other end of the\r
-*      specified port.\r
-*      Returns NULL if no remote node exists.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,\r
-                                    IN uint8_t port_num,\r
-                                    OUT uint8_t * p_remote_port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to get the remote node.\r
-*\r
-*      p_remote_port_num\r
-*              [out] Port number in the remote's node through which this\r
-*              link exists.  The caller may specify NULL for this pointer\r
-*              if the port number isn't needed.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the node on the other end of the\r
-*      specified port.\r
-*      Returns NULL if no remote node exists.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_base_lid\r
-* NAME\r
-*      osm_node_get_base_lid\r
-*\r
-* DESCRIPTION\r
-*      Returns the LID value of the specified port on this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t osm_node_get_base_lid(IN const osm_node_t * p_node,\r
-                                              IN uint32_t port_num)\r
-{\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       return osm_physp_get_base_lid(&p_node->physp_table[port_num]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Local port number.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the physical port object at the\r
-*      specified local port number.\r
-*      A return value of zero means the port number was out of range.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_remote_base_lid\r
-* NAME\r
-*      osm_node_get_remote_base_lid\r
-*\r
-* DESCRIPTION\r
-*      Returns the base LID value of the port on the other side\r
-*      of the wire from the specified port on this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,\r
-                                       IN uint32_t port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Local port number.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the physical port object at the\r
-*      specified local port number.\r
-*      A return value of zero means the port number was out of range.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_lmc\r
-* NAME\r
-*      osm_node_get_lmc\r
-*\r
-* DESCRIPTION\r
-*      Returns the LMC value of the specified port on this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_node_get_lmc(IN const osm_node_t * p_node,\r
-                                      IN uint32_t port_num)\r
-{\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       return osm_physp_get_lmc(&p_node->physp_table[port_num]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Local port number.\r
-*\r
-* RETURN VALUES\r
-*      Returns the LMC value of the specified port on this node.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_init_physp\r
-* NAME\r
-*      osm_node_init_physp\r
-*\r
-* DESCRIPTION\r
-*      Initializes a physical port for the given node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,\r
-                        IN const osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      p_madw\r
-*              [in] Pointer to a osm_madw_t object containing a mad with\r
-*              the node's NodeInfo attribute as discovered through the\r
-*              Physical Port to add to the node.  The caller may discard the\r
-*              osm_madw_t structure after calling osm_node_new.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object, Physical Port object.\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_get_node_guid\r
-* NAME\r
-*      osm_node_get_node_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the node GUID of this node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t osm_node_get_node_guid(IN const osm_node_t * p_node)\r
-{\r
-       return p_node->node_info.node_guid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the node GUID of this node.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_link\r
-* NAME\r
-*      osm_node_link\r
-*\r
-* DESCRIPTION\r
-*      Logically connects a node to another node through the specified port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                  IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to create the link.\r
-*\r
-*      p_remote_node\r
-*              [in] Pointer to the remote port object.\r
-*\r
-*      remote_port_num\r
-*              [in] Port number in the remote's node through which to\r
-*              create this link.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_unlink\r
-* NAME\r
-*      osm_node_unlink\r
-*\r
-* DESCRIPTION\r
-*      Logically disconnects a node from another node through\r
-*      the specified port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                    IN osm_node_t * p_remote_node, IN uint8_t remote_port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to unlink.\r
-*\r
-*      p_remote_node\r
-*              [in] Pointer to the remote port object.\r
-*\r
-*      remote_port_num\r
-*              [in] Port number in the remote's node through which to unlink.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_link_exists\r
-* NAME\r
-*      osm_node_link_exists\r
-*\r
-* DESCRIPTION\r
-*      Return TRUE if a link exists between the specified nodes on\r
-*      the specified ports.\r
-*      Returns FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                              IN osm_node_t * p_remote_node,\r
-                              IN uint8_t remote_port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to check the link.\r
-*\r
-*      p_remote_node\r
-*              [in] Pointer to the remote port object.\r
-*\r
-*      remote_port_num\r
-*              [in] Port number in the remote's node through which to\r
-*              check this link.\r
-*\r
-* RETURN VALUES\r
-*      Return TRUE if a link exists between the specified nodes on\r
-*      the specified ports.\r
-*      Returns FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_has_any_link\r
-* NAME\r
-*      osm_node_has_any_link\r
-*\r
-* DESCRIPTION\r
-*      Return TRUE if a any link exists from the specified nodes on\r
-*      the specified port.\r
-*      Returns FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to check the link.\r
-*\r
-* RETURN VALUES\r
-*      Return TRUE if a any link exists from the specified nodes on\r
-*      the specified port.\r
-*      Returns FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-/****f* OpenSM: Node/osm_node_link_has_valid_ports\r
-* NAME\r
-*      osm_node_link_has_valid_ports\r
-*\r
-* DESCRIPTION\r
-*      Return TRUE if both ports in the link are valid (initialized).\r
-*      Returns FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,\r
-                                       IN uint8_t port_num,\r
-                                       IN osm_node_t * p_remote_node,\r
-                                       IN uint8_t remote_port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to an osm_node_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number in p_node through which to check the link.\r
-*\r
-* RETURN VALUES\r
-*      Return TRUE if both ports in the link are valid (initialized).\r
-*      Returns FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Node object\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_NODE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_opensm.h b/branches/opensm_3/user/include/opensm/osm_opensm.h
deleted file mode 100644 (file)
index 7049088..0000000
+++ /dev/null
@@ -1,523 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_opensm_t.\r
- *     This object represents the OpenSM super object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_OPENSM_H_\r
-#define _OSM_OPENSM_H_\r
-\r
-#include <stdio.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_atomic.h>\r
-#include <complib/cl_nodenamemap.h>\r
-#include <opensm/osm_console_io.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_event_plugin.h>\r
-#include <opensm/osm_db.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_vl15intf.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/OpenSM\r
-* NAME\r
-*      OpenSM\r
-*\r
-* DESCRIPTION\r
-*      The OpenSM object encapsulates the information needed by the\r
-*      OpenSM to govern itself.  The OpenSM is one OpenSM object.\r
-*\r
-*      The OpenSM object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****d* OpenSM: OpenSM/osm_routing_engine_type_t\r
-* NAME\r
-*       osm_routing_engine_type_t\r
-*\r
-* DESCRIPTION\r
-*       Enumerates the possible routing engines that\r
-*       could be used to route a subnet.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osm_routing_engine_type {\r
-       OSM_ROUTING_ENGINE_TYPE_NONE = 0,\r
-       OSM_ROUTING_ENGINE_TYPE_MINHOP,\r
-       OSM_ROUTING_ENGINE_TYPE_UPDN,\r
-       OSM_ROUTING_ENGINE_TYPE_FILE,\r
-       OSM_ROUTING_ENGINE_TYPE_FTREE,\r
-       OSM_ROUTING_ENGINE_TYPE_LASH,\r
-       OSM_ROUTING_ENGINE_TYPE_DOR,\r
-       OSM_ROUTING_ENGINE_TYPE_UNKNOWN\r
-} osm_routing_engine_type_t;\r
-/***********/\r
-\r
-/****s* OpenSM: OpenSM/osm_routing_engine\r
-* NAME\r
-*      struct osm_routing_engine\r
-*\r
-* DESCRIPTION\r
-*      OpenSM routing engine module definition.\r
-* NOTES\r
-*      routing engine structure - multicast callbacks may be\r
-*      added later.\r
-*/\r
-struct osm_routing_engine {\r
-       const char *name;\r
-       void *context;\r
-       int (*build_lid_matrices) (void *context);\r
-       int (*ucast_build_fwd_tables) (void *context);\r
-       void (*ucast_dump_tables) (void *context);\r
-       void (*delete) (void *context);\r
-       struct osm_routing_engine *next;\r
-};\r
-/*\r
-* FIELDS\r
-*      name\r
-*              The routing engine name (will be used in logs).\r
-*\r
-*      context\r
-*              The routing engine context. Will be passed as parameter\r
-*              to the callback functions.\r
-*\r
-*      build_lid_matrices\r
-*              The callback for lid matrices generation.\r
-*\r
-*      ucast_build_fwd_tables\r
-*              The callback for unicast forwarding table generation.\r
-*\r
-*      ucast_dump_tables\r
-*              The callback for dumping unicast routing tables.\r
-*\r
-*      delete\r
-*              The delete method, may be used for routing engine\r
-*              internals cleanup.\r
-*\r
-*      next\r
-*              Pointer to next routing engine in the list.\r
-*/\r
-\r
-/****s* OpenSM: OpenSM/osm_opensm_t\r
-* NAME\r
-*      osm_opensm_t\r
-*\r
-* DESCRIPTION\r
-*      OpenSM structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_opensm {\r
-       const char *osm_version;\r
-       osm_subn_t subn;\r
-       osm_sm_t sm;\r
-       osm_sa_t sa;\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       osm_perfmgr_t perfmgr;\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-       cl_qlist_t plugin_list;\r
-       osm_db_t db;\r
-       osm_mad_pool_t mad_pool;\r
-       osm_vendor_t *p_vendor;\r
-       osm_vl15_t vl15;\r
-       osm_log_t log;\r
-       cl_dispatcher_t disp;\r
-       cl_plock_t lock;\r
-       struct osm_routing_engine *routing_engine_list;\r
-       osm_routing_engine_type_t routing_engine_used;\r
-       osm_stats_t stats;\r
-       osm_console_t console;\r
-       nn_map_t *node_name_map;\r
-} osm_opensm_t;\r
-/*\r
-* FIELDS\r
-*      osm_version\r
-*              OpenSM version (as generated in osm_version.h)\r
-*\r
-*      subn\r
-*              Subnet object for this subnet.\r
-*\r
-*      sm\r
-*              The Subnet Manager (SM) object for this subnet.\r
-*\r
-*      sa\r
-*              The Subnet Administration (SA) object for this subnet.\r
-*\r
-*      db\r
-*              Persistant storage of some data required between sessions.\r
-*\r
-*      mad_pool\r
-*              Pool of Management Datagram (MAD) objects.\r
-*\r
-*      p_vendor\r
-*              Pointer to the Vendor specific adapter for various\r
-*              transport interfaces, such as UMADT, AL, etc.  The\r
-*              particular interface is set at compile time.\r
-*\r
-*      vl15\r
-*              The VL15 interface.\r
-*\r
-*      log\r
-*              Log facility used by all OpenSM components.\r
-*\r
-*      disp\r
-*              Central dispatcher containing the OpenSM worker threads.\r
-*\r
-*      lock\r
-*              Shared lock guarding most OpenSM structures.\r
-*\r
-*      routing_engine_list\r
-*              List of routing engines that should be tried for use.\r
-*\r
-*      routing_engine_used\r
-*              Indicates which routing engine was used to route a subnet.\r
-*\r
-*      stats\r
-*              Open SM statistics block\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_construct\r
-* NAME\r
-*      osm_opensm_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an OpenSM object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_opensm_construct(IN osm_opensm_t * p_osm);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to a OpenSM object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_opensm_init, osm_opensm_destroy\r
-*\r
-*      Calling osm_opensm_construct is a prerequisite to calling any other\r
-*      method except osm_opensm_init.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_opensm_init, osm_opensm_destroy\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_destroy\r
-* NAME\r
-*      osm_opensm_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_opensm_destroy function destroys an SM, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_opensm_destroy(IN osm_opensm_t * p_osm);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to a OpenSM object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified OpenSM object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_opensm_construct or\r
-*      osm_opensm_init.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_opensm_construct, osm_opensm_init\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_init\r
-* NAME\r
-*      osm_opensm_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_opensm_init function initializes a OpenSM object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,\r
-                               IN const osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object to initialize.\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the OpenSM object was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other OpenSM methods.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_opensm_construct, osm_opensm_destroy\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_sweep\r
-* NAME\r
-*      osm_opensm_sweep\r
-*\r
-* DESCRIPTION\r
-*      Initiates a subnet sweep.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_opensm_sweep(IN osm_opensm_t * p_osm)\r
-{\r
-       osm_sm_sweep(&p_osm->sm);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object on which to\r
-*              initiate a sweep.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      If the OpenSM object is not bound to a port, this function\r
-*      does nothing.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_set_log_flags\r
-* NAME\r
-*      osm_opensm_set_log_flags\r
-*\r
-* DESCRIPTION\r
-*      Sets the log level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_opensm_set_log_flags(IN osm_opensm_t * p_osm,\r
-                                           IN osm_log_level_t log_flags)\r
-{\r
-       osm_log_set_level(&p_osm->log, log_flags);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object.\r
-*\r
-*      log_flags\r
-*              [in] Log level flags to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_bind\r
-* NAME\r
-*      osm_opensm_bind\r
-*\r
-* DESCRIPTION\r
-*      Binds the opensm object to a port guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object to bind.\r
-*\r
-*      guid\r
-*              [in] Local port GUID with which to bind.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given opensm object can only be bound to one port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_opensm_wait_for_subnet_up\r
-* NAME\r
-*      osm_opensm_wait_for_subnet_up\r
-*\r
-* DESCRIPTION\r
-*      Blocks the calling thread until the subnet is up.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline cl_status_t\r
-osm_opensm_wait_for_subnet_up(IN osm_opensm_t * p_osm, IN uint32_t wait_us,\r
-                             IN boolean_t interruptible)\r
-{\r
-       return osm_sm_wait_for_subnet_up(&p_osm->sm, wait_us, interruptible);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object.\r
-*\r
-*      wait_us\r
-*              [in] Number of microseconds to wait.\r
-*\r
-*      interruptible\r
-*              [in] Indicates whether the wait operation can be interrupted\r
-*              by external signals.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the wait operation succeeded in response to the event\r
-*      being set.\r
-*\r
-*      CL_TIMEOUT if the specified time period elapses.\r
-*\r
-*      CL_NOT_DONE if the wait was interrupted by an external signal.\r
-*\r
-*      CL_ERROR if the wait operation failed.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_routing_engine_type_str\r
-* NAME\r
-*      osm_routing_engine_type_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified routing engine type.\r
-*\r
-* SYNOPSIS\r
-*/\r
-const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type);\r
-/*\r
-* PARAMETERS\r
-*      type\r
-*              [in] routing engine type.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to routing engine name.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_routing_engine_type\r
-* NAME\r
-*      osm_routing_engine_type\r
-*\r
-* DESCRIPTION\r
-*      Returns a routing engine type specified routing engine name string.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_routing_engine_type_t osm_routing_engine_type(IN const char *str);\r
-/*\r
-* PARAMETERS\r
-*      str\r
-*              [in] routing engine name string.\r
-*\r
-* RETURN VALUES\r
-*      Routing engine type.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-void osm_opensm_report_event(osm_opensm_t *osm, osm_epi_event_id_t event_id,\r
-                            void *event_data);\r
-\r
-/* dump helpers */\r
-void osm_dump_mcast_routes(osm_opensm_t * osm);\r
-void osm_dump_all(osm_opensm_t * osm);\r
-void osm_dump_qmap_to_file(osm_opensm_t * p_osm, const char *file_name,\r
-                          cl_qmap_t * map,\r
-                          void (*func) (cl_map_item_t *, FILE *, void *),\r
-                          void *cxt);\r
-\r
-/****v* OpenSM/osm_exit_flag\r
-*/\r
-extern volatile unsigned int osm_exit_flag;\r
-/*\r
-* DESCRIPTION\r
-*  Set to one to cause all threads to leave\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_OPENSM_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_partition.h b/branches/opensm_3/user/include/opensm/osm_partition.h
deleted file mode 100644 (file)
index 201802b..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_prtn_t.\r
- *     This object represents an IBA Partition.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_PARTITION_H_\r
-#define _OSM_PARTITION_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_map.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_multicast.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Partition\r
-* NAME\r
-*      Partition\r
-*\r
-* DESCRIPTION\r
-*      The Partition object encapsulates the information needed by the\r
-*      OpenSM to manage Partitions.  The OpenSM allocates one Partition\r
-*      object per Partition in the IBA subnet.\r
-*\r
-*      The Partition is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Partition/osm_prtn_t\r
-* NAME\r
-*      osm_prtn_t\r
-*\r
-* DESCRIPTION\r
-*      Partition structure.\r
-*\r
-*      The osm_prtn_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_prtn {\r
-       cl_map_item_t map_item;\r
-       ib_net16_t pkey;\r
-       uint8_t sl;\r
-       osm_mgrp_t *mgrp;\r
-       cl_map_t full_guid_tbl;\r
-       cl_map_t part_guid_tbl;\r
-       char name[32];\r
-} osm_prtn_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!\r
-*\r
-*      pkey\r
-*              The IBA defined P_KEY of this Partition.\r
-*\r
-*      sl\r
-*              The Service Level (SL) associated with this Partiton.\r
-*\r
-*      mgrp\r
-*              The pointer to the well known Multicast Group\r
-*              that was created for this partition (when configured).\r
-*\r
-*      full_guid_tbl\r
-*              Container of pointers to all Port objects in the Partition\r
-*              with full membership, indexed by port GUID.\r
-*\r
-*      part_guid_tbl\r
-*              Container of pointers to all Port objects in the Partition\r
-*              with limited membership, indexed by port GUID.\r
-*\r
-*      name\r
-*              Name of the Partition as specified in partition\r
-*              configuration.\r
-*\r
-* SEE ALSO\r
-*      Partition\r
-*********/\r
-\r
-/****f* OpenSM: Partition/osm_prtn_delete\r
-* NAME\r
-*      osm_prtn_delete\r
-*\r
-* DESCRIPTION\r
-*      This function destroys and deallocates a Partition object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_prtn_delete(IN OUT osm_prtn_t ** pp_prtn);\r
-/*\r
-* PARAMETERS\r
-*      pp_prtn\r
-*              [in][out] Pointer to a pointer to a Partition object to\r
-*              delete. On return, this pointer is NULL.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified Partition object.\r
-*\r
-* SEE ALSO\r
-*      Partition, osm_prtn_new\r
-*********/\r
-\r
-/****f* OpenSM: Partition/osm_prtn_new\r
-* NAME\r
-*      osm_prtn_new\r
-*\r
-* DESCRIPTION\r
-*      This function allocates and initializes a Partition object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_prtn_t *osm_prtn_new(IN const char *name, IN uint16_t pkey);\r
-/*\r
-* PARAMETERS\r
-*      name\r
-*              [in] Partition name string\r
-*\r
-*      pkey\r
-*              [in] Partition P_Key value\r
-*\r
-* RETURN VALUE\r
-*      Pointer to the initialize Partition object.\r
-*\r
-* NOTES\r
-*      Allows calling other partition methods.\r
-*\r
-* SEE ALSO\r
-*      Partition\r
-*********/\r
-\r
-/****f* OpenSM: Partition/osm_prtn_is_guid\r
-* NAME\r
-*      osm_prtn_is_guid\r
-*\r
-* DESCRIPTION\r
-*      Indicates if a port is a member of the partition.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * p_prtn,\r
-                                        IN ib_net64_t guid)\r
-{\r
-       return (cl_map_get(&p_prtn->full_guid_tbl, guid) != NULL) ||\r
-           (cl_map_get(&p_prtn->part_guid_tbl, guid) != NULL);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_prtn\r
-*              [in] Pointer to an osm_prtn_t object.\r
-*\r
-*      guid\r
-*              [in] Port GUID.\r
-*\r
-* RETURN VALUES\r
-*      TRUE if the specified port GUID is a member of the partition,\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Partition/osm_prtn_make_partitions\r
-* NAME\r
-*      osm_prtn_make_partitions\r
-*\r
-* DESCRIPTION\r
-*      Makes all partitions in subnet.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_prtn_make_partitions(IN osm_log_t * p_log,\r
-                                        IN osm_subn_t * p_subn);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to subnet object.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS value on success.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Partition/osm_prtn_find_by_name\r
-* NAME\r
-*      osm_prtn_find_by_name\r
-*\r
-* DESCRIPTION\r
-*      Fides partition by name.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_prtn_t *osm_prtn_find_by_name(IN osm_subn_t * p_subn, IN const char *name);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to a subnet object.\r
-*\r
-*      name\r
-*              [in] Required partition name.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the partition object on success.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PARTITION_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_path.h b/branches/opensm_3/user/include/opensm/osm_path.h
deleted file mode 100644 (file)
index 85847e7..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_PATH_H_\r
-#define _OSM_PATH_H_\r
-\r
-#include <string.h>\r
-#include <opensm/osm_base.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * Abstract:\r
- *     Declaration of path related objects.\r
- *     These objects are part of the OpenSM family of objects.\r
- */\r
-/****h* OpenSM/DR Path\r
-* NAME\r
-*      DR Path\r
-*\r
-* DESCRIPTION\r
-*      The DR Path structure encapsulates a directed route through the subnet.\r
-*\r
-*      This structure allows direct access to member variables.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: DR Path/osm_dr_path_t\r
-* NAME\r
-*      osm_dr_path_t\r
-*\r
-* DESCRIPTION\r
-*      Directed Route structure.\r
-*\r
-*      This structure allows direct access to member variables.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_dr_path {\r
-       osm_bind_handle_t h_bind;\r
-       uint8_t hop_count;\r
-       uint8_t path[IB_SUBNET_PATH_HOPS_MAX];\r
-} osm_dr_path_t;\r
-/*\r
-* FIELDS\r
-*      h_bind\r
-*              Bind handle for port to which this path applies.\r
-*\r
-*      hop_count\r
-*              The number of hops in this path.\r
-*\r
-*      path\r
-*              The array of port numbers that comprise this path.\r
-*\r
-* SEE ALSO\r
-*      DR Path structure\r
-*********/\r
-/****f* OpenSM: DR Path/osm_dr_path_construct\r
-* NAME\r
-*      osm_dr_path_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a directed route path object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_dr_path_construct(IN osm_dr_path_t * p_path)\r
-{\r
-       /* The first location in the path array is reserved. */\r
-       memset(p_path, 0, sizeof(*p_path));\r
-       p_path->h_bind = OSM_BIND_INVALID_HANDLE;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_path\r
-*              [in] Pointer to a directed route path object to initialize.\r
-*\r
-*      h_bind\r
-*              [in] Bind handle for the port on which this path applies.\r
-*\r
-*      hop_count\r
-*              [in] Hop count needed to reach this node.\r
-*\r
-*      path\r
-*              [in] Directed route path to reach this node.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: DR Path/osm_dr_path_init\r
-* NAME\r
-*      osm_dr_path_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes a directed route path object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void\r
-osm_dr_path_init(IN osm_dr_path_t * p_path, IN osm_bind_handle_t h_bind,\r
-                IN uint8_t hop_count,\r
-                IN const uint8_t path[IB_SUBNET_PATH_HOPS_MAX])\r
-{\r
-       /* The first location in the path array is reserved. */\r
-       CL_ASSERT(path[0] == 0);\r
-       CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);\r
-       p_path->h_bind = h_bind;\r
-       p_path->hop_count = hop_count;\r
-       memcpy(p_path->path, path, hop_count + 1);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_path\r
-*              [in] Pointer to a directed route path object to initialize.\r
-*\r
-*      h_bind\r
-*              [in] Bind handle for the port on which this path applies.\r
-*\r
-*      hop_count\r
-*              [in] Hop count needed to reach this node.\r
-*\r
-*      path\r
-*              [in] Directed route path to reach this node.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-/****f* OpenSM: DR Path/osm_dr_path_extend\r
-* NAME\r
-*      osm_dr_path_extend\r
-*\r
-* DESCRIPTION\r
-*      Adds a new hop to a path.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline int osm_dr_path_extend(IN osm_dr_path_t * p_path,\r
-                                    IN uint8_t port_num)\r
-{\r
-       p_path->hop_count++;\r
-\r
-       if (p_path->hop_count >= IB_SUBNET_PATH_HOPS_MAX)\r
-               return -1;\r
-       /*\r
-          Location 0 in the path array is reserved per IB spec.\r
-        */\r
-       p_path->path[p_path->hop_count] = port_num;\r
-       return 0;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_path\r
-*              [in] Pointer to a directed route path object to initialize.\r
-*\r
-*      port_num\r
-*              [in] Additional port to add to the DR path.\r
-*\r
-* RETURN VALUES\r
-*      0 indicates path was extended.\r
-*      Other than 0 indicates path was not extended.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: DR Path/osm_dr_path_get_bind_handle\r
-* NAME\r
-*      osm_dr_path_get_bind_handle\r
-*\r
-* DESCRIPTION\r
-*      Gets the bind handle from a path.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_bind_handle_t\r
-osm_dr_path_get_bind_handle(IN const osm_dr_path_t * p_path)\r
-{\r
-       return p_path->h_bind;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_path\r
-*              [in] Pointer to a directed route path object to initialize.\r
-*\r
-*      port_num\r
-*              [in] Additional port to add to the DR path.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PATH_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_perfmgr.h b/branches/opensm_3/user/include/opensm/osm_perfmgr.h
deleted file mode 100644 (file)
index a99c4b3..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- * Copyright (c) 2007-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_PERFMGR_H_\r
-#define _OSM_PERFMGR_H_\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_event.h>\r
-#include <complib/cl_timer.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_perfmgr_db.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_event_plugin.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif                         /* __cplusplus */\r
-\r
-/****h* OpenSM/PerfMgr\r
-* NAME\r
-*      PerfMgr\r
-*\r
-* DESCRIPTION\r
-*       Performance manager thread which takes care of polling the fabric for\r
-*       Port counters values.\r
-*\r
-*      The PerfMgr object is thread safe.\r
-*\r
-* AUTHOR\r
-*      Ira Weiny, LLNL\r
-*\r
-*********/\r
-\r
-#define OSM_PERFMGR_DEFAULT_SWEEP_TIME_S 180\r
-#define OSM_PERFMGR_DEFAULT_DUMP_FILE "opensm_port_counters.log"\r
-#define OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES 500\r
-\r
-/****s* OpenSM: PerfMgr/osm_perfmgr_state_t */\r
-typedef enum {\r
-       PERFMGR_STATE_DISABLE,\r
-       PERFMGR_STATE_ENABLED,\r
-       PERFMGR_STATE_NO_DB\r
-} osm_perfmgr_state_t;\r
-\r
-/****s* OpenSM: PerfMgr/osm_perfmgr_sweep_state_t */\r
-typedef enum {\r
-       PERFMGR_SWEEP_SLEEP,\r
-       PERFMGR_SWEEP_ACTIVE,\r
-       PERFMGR_SWEEP_SUSPENDED\r
-} osm_perfmgr_sweep_state_t;\r
-\r
-/* Redirection information */\r
-typedef struct redir {\r
-       ib_net16_t redir_lid;\r
-       ib_net32_t redir_qp;\r
-} redir_t;\r
-\r
-/* Node to store information about nodes being monitored */\r
-typedef struct monitored_node {\r
-       cl_map_item_t map_item;\r
-       struct monitored_node *next;\r
-       uint64_t guid;\r
-       boolean_t esp0;\r
-       char *name;\r
-       uint32_t num_ports;\r
-       redir_t redir_port[1];  /* redirection on a per port basis */\r
-} monitored_node_t;\r
-\r
-struct osm_opensm;\r
-\r
-/****s* OpenSM: PerfMgr/osm_perfmgr_t\r
-*  This object should be treated as opaque and should\r
-*  be manipulated only through the provided functions.\r
-*/\r
-typedef struct osm_perfmgr {\r
-       cl_event_t sig_sweep;\r
-       cl_timer_t sweep_timer;\r
-       struct osm_opensm *osm;\r
-       osm_subn_t *subn;\r
-       osm_sm_t *sm;\r
-       cl_plock_t *lock;\r
-       osm_log_t *log;\r
-       osm_mad_pool_t *mad_pool;\r
-       atomic32_t trans_id;\r
-       osm_vendor_t *vendor;\r
-       osm_bind_handle_t bind_handle;\r
-       cl_disp_reg_handle_t pc_disp_h;\r
-       osm_perfmgr_state_t state;\r
-       osm_perfmgr_sweep_state_t sweep_state;\r
-       uint16_t sweep_time_s;\r
-       perfmgr_db_t *db;\r
-       atomic32_t outstanding_queries; /* this along with sig_query */\r
-       cl_event_t sig_query;   /* will throttle our queries */\r
-       uint32_t max_outstanding_queries;\r
-       cl_qmap_t monitored_map;        /* map the nodes being tracked */\r
-       monitored_node_t *remove_list;\r
-} osm_perfmgr_t;\r
-/*\r
-* FIELDS\r
-*      subn\r
-*            Subnet object for this subnet.\r
-*\r
-*      log\r
-*            Pointer to the log object.\r
-*\r
-*      mad_pool\r
-*            Pointer to the MAD pool.\r
-*\r
-*      mad_ctrl\r
-*            Mad Controller\r
-*********/\r
-\r
-/****f* OpenSM: Creation Functions */\r
-void osm_perfmgr_shutdown(osm_perfmgr_t * p_perfmgr);\r
-void osm_perfmgr_destroy(osm_perfmgr_t * p_perfmgr);\r
-\r
-/****f* OpenSM: Inline accessor functions */\r
-inline static void osm_perfmgr_set_state(osm_perfmgr_t * p_perfmgr,\r
-                                        osm_perfmgr_state_t state)\r
-{\r
-       p_perfmgr->state = state;\r
-       if (state == PERFMGR_STATE_ENABLED)\r
-               osm_sm_signal(p_perfmgr->sm, OSM_SIGNAL_PERFMGR_SWEEP);\r
-}\r
-\r
-inline static osm_perfmgr_state_t osm_perfmgr_get_state(osm_perfmgr_t * perfmgr)\r
-{\r
-       return perfmgr->state;\r
-}\r
-\r
-inline static char *osm_perfmgr_get_state_str(osm_perfmgr_t * p_perfmgr)\r
-{\r
-       switch (p_perfmgr->state) {\r
-       case PERFMGR_STATE_DISABLE:\r
-               return "Disabled";\r
-               break;\r
-       case PERFMGR_STATE_ENABLED:\r
-               return "Enabled";\r
-               break;\r
-       case PERFMGR_STATE_NO_DB:\r
-               return "No Database";\r
-               break;\r
-       }\r
-       return "UNKNOWN";\r
-}\r
-\r
-inline static char *osm_perfmgr_get_sweep_state_str(osm_perfmgr_t * perfmgr)\r
-{\r
-       switch (perfmgr->sweep_state) {\r
-       case PERFMGR_SWEEP_SLEEP:\r
-               return "Sleeping";\r
-               break;\r
-       case PERFMGR_SWEEP_ACTIVE:\r
-               return "Active";\r
-               break;\r
-       case PERFMGR_SWEEP_SUSPENDED:\r
-               return "Suspended";\r
-               break;\r
-       }\r
-       return "UNKNOWN";\r
-}\r
-\r
-inline static void osm_perfmgr_set_sweep_time_s(osm_perfmgr_t * p_perfmgr,\r
-                                               uint16_t time_s)\r
-{\r
-       p_perfmgr->sweep_time_s = time_s;\r
-       osm_sm_signal(p_perfmgr->sm, OSM_SIGNAL_PERFMGR_SWEEP);\r
-}\r
-\r
-inline static uint16_t osm_perfmgr_get_sweep_time_s(osm_perfmgr_t * p_perfmgr)\r
-{\r
-       return p_perfmgr->sweep_time_s;\r
-}\r
-\r
-void osm_perfmgr_clear_counters(osm_perfmgr_t * p_perfmgr);\r
-void osm_perfmgr_dump_counters(osm_perfmgr_t * p_perfmgr,\r
-                              perfmgr_db_dump_t dump_type);\r
-void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp);\r
-\r
-ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * p_perfmgr,\r
-                                ib_net64_t port_guid);\r
-\r
-void osm_perfmgr_process(osm_perfmgr_t * pm);\r
-\r
-/****f* OpenSM: PerfMgr/osm_perfmgr_init */\r
-ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * perfmgr,\r
-                                struct osm_opensm *osm,\r
-                                const osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*      perfmgr\r
-*              [in] Pointer to an osm_perfmgr_t object to initialize.\r
-*\r
-*      osm\r
-*              [in] Pointer to the OpenSM object.\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the PerfMgr object was initialized successfully.\r
-*********/\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif                         /* __cplusplus */\r
-\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-#endif                         /* _OSM_PERFMGR_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_perfmgr_db.h b/branches/opensm_3/user/include/opensm/osm_perfmgr_db.h
deleted file mode 100644 (file)
index 58267f7..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _PERFMGR_EVENT_DB_H_\r
-#define _PERFMGR_EVENT_DB_H_\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-\r
-#include <stdio.h>\r
-#include <time.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-struct osm_perfmgr;\r
-/****h* OpenSM/PerfMgr Event Database\r
-* DESCRIPTION\r
-*       Database interface to record subnet events\r
-*\r
-*       Implementations of this object _MUST_ be thread safe.\r
-*\r
-* AUTHOR\r
-*      Ira Weiny, LLNL\r
-*\r
-*********/\r
-typedef enum {\r
-       PERFMGR_EVENT_DB_SUCCESS = 0,\r
-       PERFMGR_EVENT_DB_FAIL,\r
-       PERFMGR_EVENT_DB_NOMEM,\r
-       PERFMGR_EVENT_DB_GUIDNOTFOUND,\r
-       PERFMGR_EVENT_DB_PORTNOTFOUND,\r
-       PERFMGR_EVENT_DB_NOT_IMPL\r
-} perfmgr_db_err_t;\r
-\r
-/** =========================================================================\r
- * Port error reading\r
- */\r
-typedef struct {\r
-       uint64_t symbol_err_cnt;\r
-       uint64_t link_err_recover;\r
-       uint64_t link_downed;\r
-       uint64_t rcv_err;\r
-       uint64_t rcv_rem_phys_err;\r
-       uint64_t rcv_switch_relay_err;\r
-       uint64_t xmit_discards;\r
-       uint64_t xmit_constraint_err;\r
-       uint64_t rcv_constraint_err;\r
-       uint64_t link_integrity;\r
-       uint64_t buffer_overrun;\r
-       uint64_t vl15_dropped;\r
-       time_t time;\r
-} perfmgr_db_err_reading_t;\r
-\r
-/** =========================================================================\r
- * Port data count reading\r
- */\r
-typedef struct {\r
-       uint64_t xmit_data;     /* can be used for std or extended */\r
-       uint64_t rcv_data;      /* can be used for std or extended */\r
-       uint64_t xmit_pkts;     /* can be used for std or extended */\r
-       uint64_t rcv_pkts;      /* can be used for std or extended */\r
-       uint64_t unicast_xmit_pkts;\r
-       uint64_t unicast_rcv_pkts;\r
-       uint64_t multicast_xmit_pkts;\r
-       uint64_t multicast_rcv_pkts;\r
-       time_t time;\r
-} perfmgr_db_data_cnt_reading_t;\r
-\r
-/** =========================================================================\r
- * Dump output options\r
- */\r
-typedef enum {\r
-       PERFMGR_EVENT_DB_DUMP_HR = 0,   /* Human readable */\r
-       PERFMGR_EVENT_DB_DUMP_MR        /* Machine readable */\r
-} perfmgr_db_dump_t;\r
-\r
-/** =========================================================================\r
- * Port counter object.\r
- * Store all the port counters for a single port.\r
- */\r
-typedef struct db_port {\r
-       perfmgr_db_err_reading_t err_total;\r
-       perfmgr_db_err_reading_t err_previous;\r
-       perfmgr_db_data_cnt_reading_t dc_total;\r
-       perfmgr_db_data_cnt_reading_t dc_previous;\r
-       time_t last_reset;\r
-} db_port_t;\r
-\r
-/** =========================================================================\r
- * group port counters for ports into the nodes\r
- */\r
-#define NODE_NAME_SIZE (IB_NODE_DESCRIPTION_SIZE + 1)\r
-typedef struct db_node {\r
-       cl_map_item_t map_item; /* must be first */\r
-       uint64_t node_guid;\r
-       boolean_t esp0;\r
-       db_port_t *ports;\r
-       uint8_t num_ports;\r
-       char node_name[NODE_NAME_SIZE];\r
-} db_node_t;\r
-\r
-/** =========================================================================\r
- * all nodes in the subnet.\r
- */\r
-typedef struct perfmgr_db {\r
-       cl_qmap_t pc_data;      /* stores type (db_node_t *) */\r
-       cl_plock_t lock;\r
-       struct osm_perfmgr *perfmgr;\r
-} perfmgr_db_t;\r
-\r
-/**\r
- * functions\r
- */\r
-perfmgr_db_t *perfmgr_db_construct(struct osm_perfmgr *perfmgr);\r
-void perfmgr_db_destroy(perfmgr_db_t * db);\r
-\r
-perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid,\r
-                                        boolean_t esp0, uint8_t num_ports,\r
-                                        char *node_name);\r
-\r
-perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,\r
-                                           uint8_t port,\r
-                                           perfmgr_db_err_reading_t * reading);\r
-perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid,\r
-                                        uint8_t port,\r
-                                        perfmgr_db_err_reading_t * reading);\r
-perfmgr_db_err_t perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid,\r
-                                          uint8_t port);\r
-\r
-perfmgr_db_err_t perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid,\r
-                                          uint8_t port,\r
-                                          perfmgr_db_data_cnt_reading_t *\r
-                                          reading);\r
-perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,\r
-                                       uint8_t port,\r
-                                       perfmgr_db_data_cnt_reading_t *\r
-                                       reading);\r
-perfmgr_db_err_t perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid,\r
-                                         uint8_t port);\r
-\r
-void perfmgr_db_clear_counters(perfmgr_db_t * db);\r
-perfmgr_db_err_t perfmgr_db_dump(perfmgr_db_t * db, char *file,\r
-                                perfmgr_db_dump_t dump_type);\r
-void perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp);\r
-void perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t guid, FILE *fp);\r
-\r
-/** =========================================================================\r
- * helper functions to fill in the various db objects from wire objects\r
- */\r
-\r
-void perfmgr_db_fill_err_read(ib_port_counters_t * wire_read,\r
-                             perfmgr_db_err_reading_t * reading);\r
-void perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read,\r
-                                     perfmgr_db_data_cnt_reading_t * reading);\r
-void perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read,\r
-                                      perfmgr_db_data_cnt_reading_t * reading);\r
-\r
-END_C_DECLS\r
-\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-#endif                         /* _PERFMGR_PM_DB_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_pkey.h b/branches/opensm_3/user/include/opensm/osm_pkey.h
deleted file mode 100644 (file)
index 28d4fa8..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
-/*\r
- * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_PKEY_H_\r
-#define _OSM_PKEY_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <complib/cl_map.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_msgdef.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
-   Forward references.\r
-*/\r
-struct osm_physp;\r
-struct osm_port;\r
-struct osm_subn;\r
-struct osm_node;\r
-struct osm_physp;\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of pkey manipulation functions.\r
- */\r
-\r
-/****s* OpenSM: osm_pkey_tbl_t\r
-* NAME\r
-*      osm_pkey_tbl_t\r
-*\r
-* DESCRIPTION\r
-*      This object represents a pkey table. The need for a special object\r
-*  is required to optimize search performance of a PKey in the IB standard\r
-*  non sorted table.\r
-*\r
-*      The osm_pkey_tbl_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_pkeybl {\r
-       cl_ptr_vector_t blocks;\r
-       cl_ptr_vector_t new_blocks;\r
-       cl_map_t keys;\r
-       cl_qlist_t pending;\r
-       uint16_t used_blocks;\r
-       uint16_t max_blocks;\r
-} osm_pkey_tbl_t;\r
-/*\r
-* FIELDS\r
-*      blocks\r
-*              The IBA defined blocks of pkey values, updated from the subnet\r
-*\r
-*      new_blocks\r
-*              The blocks of pkey values, will be used for updates by SM\r
-*\r
-*      keys\r
-*              A set holding all keys\r
-*\r
-*      pending\r
-*              A list of osm_pending_pkey structs that is temporarily set by\r
-*              the pkey mgr and used during pkey mgr algorithm only\r
-*\r
-*      used_blocks\r
-*              Tracks the number of blocks having non-zero pkeys\r
-*\r
-*      max_blocks\r
-*              The maximal number of blocks this partition table might hold\r
-*              this value is based on node_info (for port 0 or CA) or\r
-*              switch_info updated on receiving the node_info or switch_info\r
-*              GetResp\r
-*\r
-* NOTES\r
-* 'blocks' vector should be used to store pkey values obtained from\r
-* the port and SM pkey manager should not change it directly, for this\r
-* purpose 'new_blocks' should be used.\r
-*\r
-* The only pkey values stored in 'blocks' vector will be mapped with\r
-* 'keys' map\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: osm_pending_pkey_t\r
-* NAME\r
-*      osm_pending_pkey_t\r
-*\r
-* DESCRIPTION\r
-*      This objects stores temporary information on pkeys, their target block,\r
-*  and index during the pkey manager operation\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_pending_pkey {\r
-       cl_list_item_t list_item;\r
-       uint16_t pkey;\r
-       uint16_t block;\r
-       uint8_t index;\r
-       boolean_t is_new;\r
-} osm_pending_pkey_t;\r
-/*\r
-* FIELDS\r
-*      pkey\r
-*              The actual P_Key\r
-*\r
-*      block\r
-*              The block index based on the previous table extracted from the\r
-*              device\r
-*\r
-*      index\r
-*              The index of the pkey within the block\r
-*\r
-*      is_new\r
-*              TRUE for new P_Keys such that the block and index are invalid\r
-*              in that case\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_construct\r
-* NAME\r
-*  osm_pkey_tbl_construct\r
-*\r
-* DESCRIPTION\r
-*  Constructs the PKey table object\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_init\r
-* NAME\r
-*  osm_pkey_tbl_init\r
-*\r
-* DESCRIPTION\r
-*  Inits the PKey table object\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_destroy\r
-* NAME\r
-*  osm_pkey_tbl_destroy\r
-*\r
-* DESCRIPTION\r
-*  Destroys the PKey table object\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_get_num_blocks\r
-* NAME\r
-*  osm_pkey_tbl_get_num_blocks\r
-*\r
-* DESCRIPTION\r
-*  Obtain the number of blocks in IB PKey table\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t\r
-osm_pkey_tbl_get_num_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       return ((uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->blocks)));\r
-}\r
-\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-* RETURN VALUES\r
-*  The IB pkey table of that pkey table element\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_block_get\r
-* NAME\r
-*  osm_pkey_tbl_block_get\r
-*\r
-* DESCRIPTION\r
-*  Obtain the pointer to the IB PKey table block stored in the object\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_pkey_table_t *osm_pkey_tbl_block_get(const osm_pkey_tbl_t *\r
-                                                     p_pkey_tbl,\r
-                                                     uint16_t block)\r
-{\r
-       return ((block < cl_ptr_vector_get_size(&p_pkey_tbl->blocks)) ?\r
-               cl_ptr_vector_get(&p_pkey_tbl->blocks, block) : NULL);\r
-};\r
-\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-*  block\r
-*     [in] The block number to get\r
-*\r
-* RETURN VALUES\r
-*  The IB pkey table of that pkey table element\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_new_block_get\r
-* NAME\r
-*  osm_pkey_tbl_new_block_get\r
-*\r
-* DESCRIPTION\r
-*  The same as above but for new block\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_pkey_table_t *osm_pkey_tbl_new_block_get(const osm_pkey_tbl_t *\r
-                                                         p_pkey_tbl,\r
-                                                         uint16_t block)\r
-{\r
-       return (block < cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks)) ?\r
-           cl_ptr_vector_get(&p_pkey_tbl->new_blocks, block) : NULL;\r
-};\r
-\r
-/****f* OpenSM: osm_pkey_tbl_set_new_entry\r
-* NAME\r
-*  osm_pkey_tbl_set_new_entry\r
-*\r
-* DESCRIPTION\r
-*   Stores the given pkey in the "new" blocks array and update\r
-*   the "map" to show that on the "old" blocks\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                          IN uint16_t block_idx,\r
-                          IN uint8_t pkey_idx, IN uint16_t pkey);\r
-/*\r
-* p_pkey_tbl\r
-*   [in] Pointer to the PKey table\r
-*\r
-* block_idx\r
-*   [in] The block index to use\r
-*\r
-* pkey_idx\r
-*   [in] The index within the block\r
-*\r
-* pkey\r
-*   [in] PKey to store\r
-*\r
-* RETURN VALUES\r
-*   IB_SUCCESS if OK\r
-*   IB_ERROR if failed\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_find_next_free_entry\r
-* NAME\r
-*  osm_pkey_find_next_free_entry\r
-*\r
-* DESCRIPTION\r
-*  Find the next free entry in the PKey table starting at the given\r
-*  index and block number. The user should increment pkey_idx before\r
-*  next call\r
-*  Inspect the "new" blocks array for empty space.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t\r
-osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                             OUT uint16_t * p_block_idx,\r
-                             OUT uint8_t * p_pkey_idx);\r
-/*\r
-* p_pkey_tbl\r
-*   [in] Pointer to the PKey table\r
-*\r
-* p_block_idx\r
-*   [out] The block index to use\r
-*\r
-* p_pkey_idx\r
-*   [out] The index within the block to use\r
-*\r
-* RETURN VALUES\r
-*   TRUE if found\r
-*   FALSE if did not find\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_init_new_blocks\r
-* NAME\r
-*  osm_pkey_tbl_init_new_blocks\r
-*\r
-* DESCRIPTION\r
-*  Initializes new_blocks vector content (allocate and clear)\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_pkey_tbl_init_new_blocks(const osm_pkey_tbl_t * p_pkey_tbl);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_get_block_and_idx\r
-* NAME\r
-*  osm_pkey_tbl_get_block_and_idx\r
-*\r
-* DESCRIPTION\r
-*  Set the block index and pkey index the given\r
-*  pkey is found in. Return IB_NOT_FOUND if could\r
-*  not find it, IB_SUCCESS if OK\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                              IN uint16_t * p_pkey,\r
-                              OUT uint16_t * block_idx,\r
-                              OUT uint8_t * pkey_index);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-*  p_pkey\r
-*     [in] Pointer to the P_Key entry searched\r
-*\r
-*  p_block_idx\r
-*     [out] Pointer to the block index to be updated\r
-*\r
-*  p_pkey_idx\r
-*     [out] Pointer to the pkey index (in the block) to be updated\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_pkey_tbl_set\r
-* NAME\r
-*  osm_pkey_tbl_set\r
-*\r
-* DESCRIPTION\r
-*  Set the PKey table block provided in the PKey object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                IN uint16_t block, IN ib_pkey_table_t * p_tbl);\r
-/*\r
-*  p_pkey_tbl\r
-*     [in] Pointer to osm_pkey_tbl_t object.\r
-*\r
-*  block\r
-*     [in] The block number to set\r
-*\r
-*  p_tbl\r
-*     [in] The IB PKey block to copy to the object\r
-*\r
-* RETURN VALUES\r
-*  IB_SUCCESS or IB_ERROR\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_physp_share_this_pkey\r
-* NAME\r
-*  osm_physp_share_this_pkey\r
-*\r
-* DESCRIPTION\r
-*  Checks if the given physical ports share the specified pkey.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_physp_share_this_pkey(IN const struct osm_physp * p_physp1,\r
-                                   IN const struct osm_physp * p_physp2,\r
-                                   IN ib_net16_t pkey);\r
-/*\r
-* PARAMETERS\r
-*\r
-*  p_physp1\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-*  p_physp2\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-*  pkey\r
-*     [in] value of P_Key to check.\r
-*\r
-* RETURN VALUES\r
-*  Returns TRUE if the two ports are matching.\r
-*  FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_physp_find_common_pkey\r
-* NAME\r
-*  osm_physp_find_common_pkey\r
-*\r
-* DESCRIPTION\r
-*  Returns first matching P_Key values for specified physical ports.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1,\r
-                                     IN const struct osm_physp *p_physp2);\r
-/*\r
-* PARAMETERS\r
-*\r
-*  p_physp1\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-*  p_physp2\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*  Returns value of first shared P_Key or INVALID P_Key (0x0) if not\r
-*  found.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_physp_share_pkey\r
-* NAME\r
-*  osm_physp_share_pkey\r
-*\r
-* DESCRIPTION\r
-*  Checks if the given physical ports share a pkey.\r
-*  The meaning P_Key matching:\r
-*  10.9.3 :\r
-*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming\r
-*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against\r
-*   in the packet's destination endnode.\r
-*\r
-*    If:\r
-*    * neither M_P_Key nor E_P_Key are the invalid P_Key\r
-*    * and the low-order 15 bits of the M_P_Key match the low order 15\r
-*      bits of the E_P_Key\r
-*    * and the high order bit(membership type) of both the M_P_Key and\r
-*      E_P_Key are not both 0 (i.e., both are not Limited members of\r
-*      the partition)\r
-*\r
-*    then the P_Keys are said to match.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,\r
-                              IN const struct osm_physp * p_physp_1,\r
-                              IN const struct osm_physp * p_physp_2);\r
-\r
-/*\r
-* PARAMETERS\r
-*  p_log\r
-*     [in] Pointer to a log object.\r
-*\r
-*  p_physp_1\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-*  p_physp_2\r
-*     [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*  Returns TRUE if the 2 physical ports are matching.\r
-*  FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_port_share_pkey\r
-* NAME\r
-*  osm_port_share_pkey\r
-*\r
-* DESCRIPTION\r
-*  Checks if the given ports (on their default physical port) share a pkey.\r
-*  The meaning P_Key matching:\r
-*  10.9.3 :\r
-*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming\r
-*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against\r
-*   in the packet's destination endnode.\r
-*\r
-*    If:\r
-*    * neither M_P_Key nor E_P_Key are the invalid P_Key\r
-*    * and the low-order 15 bits of the M_P_Key match the low order 15\r
-*      bits of the E_P_Key\r
-*    * and the high order bit(membership type) of both the M_P_Key and\r
-*      E_P_Key are not both 0 (i.e., both are not Limited members of\r
-*      the partition)\r
-*\r
-*    then the P_Keys are said to match.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_port_share_pkey(IN osm_log_t * p_log,\r
-                             IN const struct osm_port * p_port_1,\r
-                             IN const struct osm_port * p_port_2);\r
-\r
-/*\r
-* PARAMETERS\r
-*  p_log\r
-*     [in] Pointer to a log object.\r
-*\r
-*  p_port_1\r
-*     [in] Pointer to an osm_port_t object.\r
-*\r
-*  p_port_2\r
-*     [in] Pointer to an osm_port_t object.\r
-*\r
-* RETURN VALUES\r
-*  Returns TRUE if the 2 ports are matching.\r
-*  FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: osm_physp_has_pkey\r
-* NAME\r
-*  osm_physp_has_pkey\r
-*\r
-* DESCRIPTION\r
-*  Checks if the given lids and port_numbers share a pkey.\r
-*  The meaning P_Key matching:\r
-*  10.9.3 :\r
-*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming\r
-*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against\r
-*   in the packet's destination endnode.\r
-*\r
-*    If:\r
-*    * neither M_P_Key nor E_P_Key are the invalid P_Key\r
-*    * and the low-order 15 bits of the M_P_Key match the low order 15\r
-*      bits of the E_P_Key\r
-*    * and the high order bit(membership type) of both the M_P_Key and\r
-*      E_P_Key are not both 0 (i.e., both are not Limited members of\r
-*      the partition)\r
-*\r
-*    then the P_Keys are said to match.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,\r
-                            IN const struct osm_physp *p_physp);\r
-\r
-/*\r
-* PARAMETERS\r
-*  p_log\r
-*     [in] Pointer to a log object.\r
-*\r
-*  pkey\r
-*     [in] pkey number to look for.\r
-*\r
-*  p_physp\r
-*     [in] Pointer to osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*  Returns TRUE if the p_physp has the pkey given. False otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PKEY_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_port.h b/branches/opensm_3/user/include/opensm/osm_port.h
deleted file mode 100644 (file)
index b599958..0000000
+++ /dev/null
@@ -1,1460 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of port related objects.\r
- *     These objects comprise an IBA port.\r
- *     These objects are part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_PORT_H_\r
-#define _OSM_PORT_H_\r
-\r
-#include <complib/cl_qmap.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_path.h>\r
-#include <opensm/osm_pkey.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
-       Forward references.\r
-*/\r
-struct osm_port;\r
-struct osm_node;\r
-struct osm_mgrp;\r
-\r
-/****h* OpenSM/Physical Port\r
-* NAME\r
-*      Physical Port\r
-*\r
-* DESCRIPTION\r
-*      The Physical Port object encapsulates the information needed by the\r
-*      OpenSM to manage physical ports.  The OpenSM allocates one Physical Port\r
-*      per physical port in the IBA subnet.\r
-*\r
-*      In a switch, one multiple Physical Port objects share the same port GUID.\r
-*      In an end-point, Physical Ports do not share GUID values.\r
-*\r
-*      The Physical Port is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      These objects should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Physical Port/osm_physp_t\r
-* NAME\r
-*      osm_physp_t\r
-*\r
-* DESCRIPTION\r
-*      This object represents a physical port on a switch, router or end-point.\r
-*\r
-*      The osm_physp_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_physp {\r
-       ib_port_info_t port_info;\r
-       ib_net64_t port_guid;\r
-       uint8_t port_num;\r
-       struct osm_node *p_node;\r
-       struct osm_physp *p_remote_physp;\r
-       boolean_t healthy;\r
-       uint8_t vl_high_limit;\r
-       unsigned need_update;\r
-       unsigned is_prof_ignored;\r
-       osm_dr_path_t dr_path;\r
-       osm_pkey_tbl_t pkeys;\r
-       ib_vl_arb_table_t vl_arb[4];\r
-       cl_ptr_vector_t slvl_by_port;\r
-       uint8_t hop_wf;\r
-} osm_physp_t;\r
-/*\r
-* FIELDS\r
-*      port_info\r
-*              The IBA defined PortInfo data for this port.\r
-*\r
-*      port_guid\r
-*              Port GUID value of this port.  For switches,\r
-*              all ports share the same GUID value.\r
-*\r
-*      port_num\r
-*              The port number of this port.  The PortInfo also\r
-*              contains a port_number, but that number is not\r
-*              the port number of this port, but rather the number\r
-*              of the port that received the SMP during discovery.\r
-*              Therefore, we must keep a separate record for this\r
-*              port's port number.\r
-*\r
-*      p_node\r
-*              Pointer to the parent Node object of this Physical Port.\r
-*\r
-*      p_remote_physp\r
-*              Pointer to the Physical Port on the other side of the wire.\r
-*              If this pointer is NULL no link exists at this port.\r
-*\r
-*      healthy\r
-*              Tracks the health of the port. Normally should be TRUE but\r
-*              might change as a result of incoming traps indicating the port\r
-*              healthy is questionable.\r
-*\r
-*      vl_high_limit\r
-*              PortInfo:VLHighLimit value which installed by QoS manager\r
-*              and should be uploaded to port's PortInfo\r
-*\r
-*      need_update\r
-*              When set indicates that port was probably reset and port\r
-*              related tables (PKey, SL2VL, VLArb) require refreshing.\r
-*\r
-*      is_prof_ignored\r
-*              When set indicates that switch port will be ignored by\r
-*              the link load equalization algorithm.\r
-*\r
-*      dr_path\r
-*              The directed route path to this port.\r
-*\r
-*      pkeys\r
-*              osm_pkey_tbl_t object holding the port PKeys.\r
-*\r
-*      vl_arb[]\r
-*              Each Physical Port has 4 sections of VL Arbitration table.\r
-*\r
-*      slvl_by_port\r
-*              A vector of pointers to the sl2vl tables (ordered by input port).\r
-*              Switches have an entry for every other input port (inc SMA=0).\r
-*              On CAs only one per port.\r
-*\r
-*      hop_wf\r
-*              Hop weighting factor to be used in the routing.\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_construct\r
-* NAME\r
-*      osm_physp_construct\r
-*\r
-* DESCRIPTION\r
-*      Constructs a Physical Port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_physp_construct(IN osm_physp_t * p_physp);\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object to initialize.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_init\r
-* NAME\r
-*      osm_physp_init\r
-*\r
-* DESCRIPTION\r
-*      Initializes a Physical Port for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid,\r
-                   IN uint8_t port_num, IN const struct osm_node *p_node,\r
-                   IN osm_bind_handle_t h_bind, IN uint8_t hop_count,\r
-                   IN const uint8_t * p_initial_path);\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object to initialize.\r
-*\r
-*      port_guid\r
-*              [in] GUID value of this port.  Switch ports all share\r
-*              the same value.\r
-*              Caller should use 0 if the guid is unknown.\r
-*\r
-*      port_num\r
-*              [in] The port number of this port.\r
-*\r
-*      p_node\r
-*              [in] Pointer to the parent Node object of this Physical Port.\r
-*\r
-*      h_bind\r
-*              [in] Bind handle on which this port is accessed.\r
-*              Caller should use OSM_INVALID_BIND_HANDLE if the bind\r
-*              handle to this port is unknown.\r
-*\r
-*      hop_count\r
-*              [in] Directed route hop count to reach this port.\r
-*              Caller should use 0 if the hop count is unknown.\r
-*\r
-*      p_initial_path\r
-*              [in] Pointer to the directed route path to reach this node.\r
-*              Caller should use NULL if the path is unknown.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/void osm_physp_destroy\r
-* NAME\r
-*      osm_physp_destroy\r
-*\r
-* DESCRIPTION\r
-*      This function destroys a Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_physp_destroy(IN osm_physp_t * p_physp);\r
-/*\r
-* PARAMETERS\r
-*      p_port\r
-*              [in] Pointer to a PhysPort object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified PhysPort object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_physp_construct or\r
-*      osm_physp_init.\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_is_valid\r
-* NAME\r
-*      osm_physp_is_valid\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the Physical Port has been successfully initialized.\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_physp_is_valid(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       return (p_physp->port_guid != 0);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the Physical Port has been successfully initialized.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_is_healthy\r
-* NAME\r
-*      osm_physp_is_healthy\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the Physical Port has been maked as healthy\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_physp_is_healthy(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       return p_physp->healthy;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the Physical Port has been maked as healthy\r
-*      FALSE otherwise.\r
-*  All physical ports are initialized as "healthy" but may be marked\r
-*  otherwise if a received trap claims otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_link_is_healthy\r
-* NAME\r
-*      osm_link_is_healthy\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the link given by the physical port is health,\r
-*  and FALSE otherwise. Link is healthy if both its physical ports are\r
-*  healthy\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp);\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      TRUE if both physical ports on the link are healthy, and FALSE otherwise.\r
-*  All physical ports are initialized as "healthy" but may be marked\r
-*  otherwise if a received trap claiming otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_set_health\r
-* NAME\r
-*      osm_physp_set_health\r
-*\r
-* DESCRIPTION\r
-*      Sets the port health flag. TRUE means the port is healthy and\r
-*  should be used for packet routing. FALSE means it should be avoided.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_set_health(IN osm_physp_t * p_physp,\r
-                                       IN boolean_t is_healthy)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       p_physp->healthy = is_healthy;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      is_healthy\r
-*              [in] The health value to be assigned to the port.\r
-*                   TRUE if the Physical Port should been maked as healthy\r
-*                   FALSE otherwise.\r
-*\r
-* RETURN VALUES\r
-*  NONE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_set_port_info\r
-* NAME\r
-*      osm_physp_set_port_info\r
-*\r
-* DESCRIPTION\r
-*      Copies the PortInfo attribute into the Physical Port object\r
-*      based on the PortState.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_set_port_info(IN osm_physp_t * p_physp,\r
-                                          IN const ib_port_info_t * p_pi)\r
-{\r
-       CL_ASSERT(p_pi);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-\r
-       if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN) {\r
-               /* If PortState is down, only copy PortState */\r
-               /* and PortPhysicalState per C14-24-2.1 */\r
-               ib_port_info_set_port_state(&p_physp->port_info, IB_LINK_DOWN);\r
-               ib_port_info_set_port_phys_state\r
-                   (ib_port_info_get_port_phys_state(p_pi),\r
-                    &p_physp->port_info);\r
-       } else\r
-               p_physp->port_info = *p_pi;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      p_pi\r
-*              [in] Pointer to the IBA defined PortInfo at this port number.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_set_pkey_tbl\r
-* NAME\r
-*  osm_physp_set_pkey_tbl\r
-*\r
-* DESCRIPTION\r
-*  Copies the P_Key table into the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,\r
-                           IN osm_physp_t * p_physp,\r
-                           IN ib_pkey_table_t * p_pkey_tbl,\r
-                           IN uint16_t block_num);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the subnet data structure.\r
-*\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      p_pkey_tbl\r
-*              [in] Pointer to the IBA defined P_Key table for this port\r
-*                   number.\r
-*\r
-*      block_num\r
-*              [in] The part of the P_Key table as defined in the IBA\r
-*                   (valid values 0-2047, and is further limited by the\r
-*                   partitionCap).\r
-*\r
-* RETURN VALUES\r
-*  This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*  Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_pkey_tbl\r
-* NAME\r
-*  osm_physp_get_pkey_tbl\r
-*\r
-* DESCRIPTION\r
-*  Returns a pointer to the P_Key table object of the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const osm_pkey_tbl_t *osm_physp_get_pkey_tbl(IN const osm_physp_t\r
-                                                          * p_physp)\r
-{\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       /*\r
-          (14.2.5.7) - the block number valid values are 0-2047, and are\r
-          further limited by the size of the P_Key table specified by the\r
-          PartitionCap on the node.\r
-        */\r
-       return &p_physp->pkeys;\r
-};\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*  The pointer to the P_Key table object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*  Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_set_slvl_tbl\r
-* NAME\r
-*      osm_physp_set_slvl_tbl\r
-*\r
-* DESCRIPTION\r
-*      Copies the SLtoVL attribute into the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_set_slvl_tbl(IN osm_physp_t * p_physp,\r
-                                         IN ib_slvl_table_t * p_slvl_tbl,\r
-                                         IN uint8_t in_port_num)\r
-{\r
-       ib_slvl_table_t *p_tbl;\r
-\r
-       CL_ASSERT(p_slvl_tbl);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);\r
-       *p_tbl = *p_slvl_tbl;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      p_slvl_tbl\r
-*              [in] Pointer to the IBA defined SLtoVL map table for this\r
-*                   port number.\r
-*\r
-*      in_port_num\r
-*              [in] Input Port Number for this SLtoVL.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_slvl_tbl\r
-* NAME\r
-*      osm_physp_get_slvl_tbl\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the SLtoVL attribute of the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_slvl_table_t *osm_physp_get_slvl_tbl(IN const osm_physp_t *\r
-                                                     p_physp,\r
-                                                     IN uint8_t in_port_num)\r
-{\r
-       ib_slvl_table_t *p_tbl;\r
-\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       p_tbl = cl_ptr_vector_get(&p_physp->slvl_by_port, in_port_num);\r
-       return p_tbl;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      in_port_num\r
-*              [in] Input Port Number for this SLtoVL.\r
-*\r
-* RETURN VALUES\r
-*      The pointer to the slvl table\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_set_vla_tbl\r
-* NAME\r
-*      osm_physp_set_vla_tbl\r
-*\r
-* DESCRIPTION\r
-*      Copies the VL Arbitration attribute into the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_set_vla_tbl(IN osm_physp_t * p_physp,\r
-                                        IN ib_vl_arb_table_t * p_vla_tbl,\r
-                                        IN uint8_t block_num)\r
-{\r
-       CL_ASSERT(p_vla_tbl);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       CL_ASSERT((1 <= block_num) && (block_num <= 4));\r
-       p_physp->vl_arb[block_num - 1] = *p_vla_tbl;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      p_vla_tbl\r
-*              [in] Pointer to the IBA defined VL Arbitration table for this\r
-*                   port number.\r
-*\r
-*      block_num\r
-*              [in] The part of the VL arbitration as defined in the IBA\r
-*                   (valid values 1-4)\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_vla_tbl\r
-* NAME\r
-*      osm_physp_get_vla_tbl\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the VL Arbitration table of the Physical Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_vl_arb_table_t *osm_physp_get_vla_tbl(IN osm_physp_t * p_physp,\r
-                                                      IN uint8_t block_num)\r
-{\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       CL_ASSERT((1 <= block_num) && (block_num <= 4));\r
-       return &(p_physp->vl_arb[block_num - 1]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      block_num\r
-*              [in] The part of the VL arbitration as defined in the IBA\r
-*                   (valid values 1-4)\r
-*\r
-* RETURN VALUES\r
-*  The pointer to the VL Arbitration table\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_remote\r
-* NAME\r
-*      osm_physp_get_remote\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the Physical Port on the other side the wire.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_physp_t *osm_physp_get_remote(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->p_remote_physp;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the Physical Port on the other side of\r
-*      the wire.  A return value of NULL means there is no link at this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_port_guid\r
-* NAME\r
-*      osm_physp_get_port_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the port guid of this physical port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t osm_physp_get_port_guid(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->port_guid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the port guid of this physical port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_subnet_prefix\r
-* NAME\r
-*      osm_physp_get_subnet_prefix\r
-*\r
-* DESCRIPTION\r
-*      Returns the subnet prefix for this physical port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t\r
-osm_physp_get_subnet_prefix(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->port_info.subnet_prefix;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the subnet prefix for this physical port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_link_exists\r
-* NAME\r
-*      osm_physp_link_exists\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the Physical Port has a link to the specified port.\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_physp_link_exists(IN const osm_physp_t * p_physp,\r
-                                             IN const osm_physp_t * p_remote_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       CL_ASSERT(p_remote_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_remote_physp));\r
-       return ((p_physp->p_remote_physp == p_remote_physp) &&\r
-               (p_remote_physp->p_remote_physp == p_physp));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      p_remote_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the Physical Port has a link to another port.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_link\r
-* NAME\r
-*      osm_physp_link\r
-*\r
-* DESCRIPTION\r
-*      Sets the pointers to the Physical Ports on the other side the wire.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_link(IN osm_physp_t * p_physp,\r
-                                 IN osm_physp_t * p_remote_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(p_remote_physp);\r
-       p_physp->p_remote_physp = p_remote_physp;\r
-       p_remote_physp->p_remote_physp = p_physp;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object to link.\r
-*\r
-*      p_remote_physp\r
-*              [in] Pointer to the adjacent osm_physp_t object to link.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_unlink\r
-* NAME\r
-*      osm_physp_unlink\r
-*\r
-* DESCRIPTION\r
-*      Clears the pointers to the Physical Port on the other side the wire.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_physp_unlink(IN osm_physp_t * p_physp,\r
-                                   IN osm_physp_t * p_remote_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(p_remote_physp);\r
-       CL_ASSERT(osm_physp_link_exists(p_physp, p_remote_physp));\r
-       p_physp->p_remote_physp = NULL;\r
-       p_remote_physp->p_remote_physp = NULL;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object to link.\r
-*\r
-*      p_remote_physp\r
-*              [in] Pointer to the adjacent osm_physp_t object to link.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_has_any_link\r
-* NAME\r
-*      osm_physp_has_any_link\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the Physical Port has a link to another port.\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_physp_has_any_link(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       if (osm_physp_is_valid(p_physp))\r
-               return (p_physp->p_remote_physp != NULL);\r
-       else\r
-               return FALSE;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the Physical Port has a link to another port.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_port_num\r
-* NAME\r
-*      osm_physp_get_port_num\r
-*\r
-* DESCRIPTION\r
-*      Returns the local port number of this Physical Port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_physp_get_port_num(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->port_num;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the local port number of this Physical Port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_node_ptr\r
-* NAME\r
-*      osm_physp_get_node_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the parent Node object for this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline struct osm_node *osm_physp_get_node_ptr(IN const osm_physp_t *\r
-                                                      p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->p_node;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the parent Node object for this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_port_state\r
-* NAME\r
-*      osm_physp_get_port_state\r
-*\r
-* DESCRIPTION\r
-*      Returns the port state of this Physical Port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_physp_get_port_state(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return ib_port_info_get_port_state(&p_physp->port_info);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the local port number of this Physical Port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_base_lid\r
-* NAME\r
-*      osm_physp_get_base_lid\r
-*\r
-* DESCRIPTION\r
-*      Returns the base lid of this Physical Port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t osm_physp_get_base_lid(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return p_physp->port_info.base_lid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the base lid of this Physical Port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_lmc\r
-* NAME\r
-*      osm_physp_get_lmc\r
-*\r
-* DESCRIPTION\r
-*      Returns the LMC value of this Physical Port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_physp_get_lmc(IN const osm_physp_t * p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return ib_port_info_get_lmc(&p_physp->port_info);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the LMC value of this Physical Port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_get_dr_path_ptr\r
-* NAME\r
-*      osm_physp_get_dr_path_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the directed route path for this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_dr_path_t *osm_physp_get_dr_path_ptr(IN const osm_physp_t *\r
-                                                       p_physp)\r
-{\r
-       CL_ASSERT(p_physp);\r
-       CL_ASSERT(osm_physp_is_valid(p_physp));\r
-       return (osm_dr_path_t *) & p_physp->dr_path;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_physp\r
-*              [in] Pointer to a Physical Port object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the directed route path for this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Physical Port object\r
-*********/\r
-\r
-/****h* OpenSM/Port\r
-* NAME\r
-*      Port\r
-*\r
-* DESCRIPTION\r
-*      The Port object encapsulates the information needed by the\r
-*      OpenSM to manage ports.  The OpenSM allocates one Port object\r
-*      per port in the IBA subnet.\r
-*\r
-*      Each Port object is associated with a single port GUID.  A Port object\r
-*      contains 1 or more Physical Port objects.  An end point node has\r
-*      one Physical Port per Port.  A switch node has more than\r
-*      one Physical Port per Port.\r
-*\r
-*      The Port object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      These objects should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Port/osm_port_t\r
-* NAME\r
-*      osm_port_t\r
-*\r
-* DESCRIPTION\r
-*      This object represents a logical port on a switch, router, or CA.\r
-*\r
-*      The osm_port_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_port {\r
-       cl_map_item_t map_item;\r
-       cl_list_item_t list_item;\r
-       struct osm_node *p_node;\r
-       ib_net64_t guid;\r
-       uint32_t discovery_count;\r
-       unsigned is_new;\r
-       osm_physp_t *p_physp;\r
-       cl_qlist_t mcm_list;\r
-       int flag;\r
-       void *priv;\r
-} osm_port_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!\r
-*\r
-*      list_item\r
-*              Linkage structure for cl_qlist. Used by ucast mgr during\r
-*              LFT calculation.\r
-*\r
-*      p_node\r
-*              Points to the Node object that owns this port.\r
-*\r
-*      guid\r
-*              Manufacturer assigned GUID for this port.\r
-*\r
-*      discovery_count\r
-*              The number of times this port has been discovered\r
-*              during the current fabric sweep.  This number is reset\r
-*              to zero at the start of a sweep.\r
-*\r
-*      p_physp\r
-*              The pointer to physical port used when physical\r
-*              characteristics contained in the Physical Port are needed.\r
-*\r
-*      mcm_list\r
-*              Multicast member list\r
-*\r
-*      flag\r
-*              Utility flag for port management\r
-*\r
-* SEE ALSO\r
-*      Port, Physical Port, Physical Port Table\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_delete\r
-* NAME\r
-*      osm_port_delete\r
-*\r
-* DESCRIPTION\r
-*      This function destroys and deallocates a Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_port_delete(IN OUT osm_port_t ** pp_port);\r
-/*\r
-* PARAMETERS\r
-*      pp_port\r
-*              [in][out] Pointer to a pointer to a Port object to delete.\r
-*              On return, this pointer is NULL.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified Port object.\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_new\r
-* NAME\r
-*      osm_port_new\r
-*\r
-* DESCRIPTION\r
-*      This function allocates and initializes a Port object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,\r
-                        IN struct osm_node *p_parent_node);\r
-/*\r
-* PARAMETERS\r
-*      p_ni\r
-*              [in] Pointer to the NodeInfo attribute relavent for this port.\r
-*\r
-*      p_parent_node\r
-*              [in] Pointer to the initialized parent osm_node_t object\r
-*              that owns this port.\r
-*\r
-* RETURN VALUE\r
-*      Pointer to the initialize Port object.\r
-*\r
-* NOTES\r
-*      Allows calling other port methods.\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_get_base_lid\r
-* NAME\r
-*      osm_port_get_base_lid\r
-*\r
-* DESCRIPTION\r
-*      Gets the base LID of a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t osm_port_get_base_lid(IN const osm_port_t * p_port)\r
-{\r
-       CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));\r
-       return osm_physp_get_base_lid(p_port->p_physp);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_port\r
-*              [in] Pointer to a Port object.\r
-*\r
-* RETURN VALUE\r
-*      Base LID of the port.\r
-*      If the return value is 0, then this port has no assigned LID.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_get_lmc\r
-* NAME\r
-*      osm_port_get_lmc\r
-*\r
-* DESCRIPTION\r
-*      Gets the LMC value of a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_port_get_lmc(IN const osm_port_t * p_port)\r
-{\r
-       CL_ASSERT(p_port->p_physp && osm_physp_is_valid(p_port->p_physp));\r
-       return osm_physp_get_lmc(p_port->p_physp);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_port\r
-*              [in] Pointer to a Port object.\r
-*\r
-* RETURN VALUE\r
-*      Gets the LMC value of a port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_get_guid\r
-* NAME\r
-*      osm_port_get_guid\r
-*\r
-* DESCRIPTION\r
-*      Gets the GUID of a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t osm_port_get_guid(IN const osm_port_t * p_port)\r
-{\r
-       return p_port->guid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_port\r
-*              [in] Pointer to a Port object.\r
-*\r
-* RETURN VALUE\r
-*      Manufacturer assigned GUID of the port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_port_get_lid_range_ho\r
-* NAME\r
-*      osm_port_get_lid_range_ho\r
-*\r
-* DESCRIPTION\r
-*      Returns the HOST ORDER lid min and max values for this port,\r
-*      based on the lmc value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_port_get_lid_range_ho(IN const osm_port_t * p_port,\r
-                              OUT uint16_t * p_min_lid,\r
-                              OUT uint16_t * p_max_lid);\r
-/*\r
-* PARAMETERS\r
-*      p_port\r
-*              [in] Pointer to a Port object.\r
-*\r
-*      p_min_lid\r
-*              [out] Pointer to the minimum LID value occupied by this port.\r
-*\r
-*      p_max_lid\r
-*              [out] Pointer to the maximum LID value occupied by this port.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Port\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_calc_link_mtu\r
-* NAME\r
-*      osm_physp_calc_link_mtu\r
-*\r
-* DESCRIPTION\r
-*      Calculate the Port MTU based on current and remote\r
-*  physical ports MTU CAP values.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log,\r
-                               IN const osm_physp_t * p_physp);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      The MTU of the link to be used.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      PhysPort object\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_calc_link_op_vls\r
-* NAME\r
-*      osm_physp_calc_link_op_vls\r
-*\r
-* DESCRIPTION\r
-*      Calculate the Port OP_VLS based on current and remote\r
-*  physical ports VL CAP values. Allowing user option for a max limit.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint8_t osm_physp_calc_link_op_vls(IN osm_log_t * p_log,\r
-                                  IN const osm_subn_t * p_subn,\r
-                                  IN const osm_physp_t * p_physp);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the subnet object for accessing of the options.\r
-*\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-* RETURN VALUES\r
-*      The OP_VLS of the link to be used.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*  PhysPort object\r
-*********/\r
-\r
-/****f* OpenSM: Physical Port/osm_physp_replace_dr_path_with_alternate_dr_path\r
-* NAME\r
-*      osm_physp_replace_dr_path_with_alternate_dr_path\r
-*\r
-* DESCRIPTION\r
-*      Replace the direct route path for the given phys port with an\r
-*  alternate path going through forien set of phys port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void\r
-osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,\r
-                                                IN osm_subn_t const *p_subn,\r
-                                                IN osm_physp_t const *p_physp,\r
-                                                IN osm_bind_handle_t * h_bind);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the subnet object for accessing of the options.\r
-*\r
-*      p_physp\r
-*              [in] Pointer to an osm_physp_t object.\r
-*\r
-*      h_bind\r
-*              [in] Pointer to osm_bind_handle_t object.\r
-*\r
-* RETURN VALUES\r
-*      NONE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      PhysPort object\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PORT_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_port_profile.h b/branches/opensm_3/user/include/opensm/osm_port_profile.h
deleted file mode 100644 (file)
index ba08b10..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of Switch/osm_port_profile_t.\r
- *     This object represents a port profile for an IBA switch.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_PORT_PROFILE_H_\r
-#define _OSM_PORT_PROFILE_H_\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_mcast_tbl.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Port Profile\r
-* NAME\r
-*      Port Profile\r
-*\r
-* DESCRIPTION\r
-*      The Port Profile object contains profiling information for\r
-*      each Physical Port on a switch.  The profile information\r
-*      may be used to optimize path selection.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Switch/osm_port_profile_t\r
-* NAME\r
-*      osm_port_profile_t\r
-*\r
-* DESCRIPTION\r
-*      The Port Profile object contains profiling information for\r
-*      each Physical Port on the switch.  The profile information\r
-*      may be used to optimize path selection.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_port_profile {\r
-       uint32_t num_paths;\r
-} osm_port_profile_t;\r
-/*\r
-* FIELDS\r
-*      num_paths\r
-*              The number of paths using this port.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: Switch/osm_port_mask_t\r
-* NAME\r
-*      osm_port_mask_t\r
-*\r
-* DESCRIPTION\r
-*       The Port Mask object contains a port numbered bit mask\r
-*      for whether the port should be ignored by the link load\r
-*      equalization algorithm.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef long osm_port_mask_t[32 / sizeof(long)];\r
-/*\r
-* FIELDS\r
-*      osm_port_mask_t\r
-*              Bit mask by port number\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Port Profile/osm_port_prof_construct\r
-* NAME\r
-*      osm_port_prof_construct\r
-*\r
-* DESCRIPTION\r
-*\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_port_prof_construct(IN osm_port_profile_t * p_prof)\r
-{\r
-       CL_ASSERT(p_prof);\r
-       memset(p_prof, 0, sizeof(*p_prof));\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_prof\r
-*              [in] Pointer to the Port Profile object to construct.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Port Profile/osm_port_prof_path_count_inc\r
-* NAME\r
-*      osm_port_prof_path_count_inc\r
-*\r
-* DESCRIPTION\r
-*      Increments the count of the number of paths going through this port.\r
-*\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_port_prof_path_count_inc(IN osm_port_profile_t * p_prof)\r
-{\r
-       CL_ASSERT(p_prof);\r
-       p_prof->num_paths++;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_prof\r
-*              [in] Pointer to the Port Profile object.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Port Profile/osm_port_prof_path_count_get\r
-* NAME\r
-*      osm_port_prof_path_count_get\r
-*\r
-* DESCRIPTION\r
-*      Returns the count of the number of paths going through this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint32_t\r
-osm_port_prof_path_count_get(IN const osm_port_profile_t * p_prof)\r
-{\r
-       return p_prof->num_paths;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_prof\r
-*              [in] Pointer to the Port Profile object.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PORT_PROFILE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_prefix_route.h b/branches/opensm_3/user/include/opensm/osm_prefix_route.h
deleted file mode 100644 (file)
index b2f354b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_PREFIX_ROUTE_H_\r
-#define _OSM_PREFIX_ROUTE_H_\r
-\r
-#include <complib/cl_types.h>\r
-#include <complib/cl_qlist.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-typedef struct {\r
-       cl_list_item_t list_item;       /* must be first */\r
-       ib_net64_t prefix;              /* zero means "any" */\r
-       ib_net64_t guid;                /* zero means "any" */\r
-} osm_prefix_route_t;\r
-\r
-#ifdef ROUTER_EXP\r
-#error ROUTER_EXP is deprecated, specify prefix routes at runtime instead (see opensm man page for details)\r
-#endif\r
-\r
-END_C_DECLS\r
-#endif /* _OSM_PREFIX_ROUTE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_qos_policy.h b/branches/opensm_3/user/include/opensm/osm_qos_policy.h
deleted file mode 100644 (file)
index 864ed91..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Declaration of OSM QoS Policy data types and functions.\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-\r
-#ifndef OSM_QOS_POLICY_H\r
-#define OSM_QOS_POLICY_H\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_list.h>\r
-#include <opensm/st.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_partition.h>\r
-\r
-#define YYSTYPE char *\r
-#define OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH  128\r
-#define OSM_QOS_POLICY_DEFAULT_LEVEL_NAME   "default"\r
-\r
-#define OSM_QOS_POLICY_ULP_SDP_SERVICE_ID   0x0000000000010000ULL\r
-#define OSM_QOS_POLICY_ULP_RDS_SERVICE_ID   0x0000000001060000ULL\r
-#define OSM_QOS_POLICY_ULP_RDS_PORT         0x48CA\r
-#define OSM_QOS_POLICY_ULP_ISER_SERVICE_ID  0x0000000001060000ULL\r
-#define OSM_QOS_POLICY_ULP_ISER_PORT        0x0CBC\r
-\r
-#define OSM_QOS_POLICY_NODE_TYPE_CA        (((uint8_t)1)<<IB_NODE_TYPE_CA)\r
-#define OSM_QOS_POLICY_NODE_TYPE_SWITCH    (((uint8_t)1)<<IB_NODE_TYPE_SWITCH)\r
-#define OSM_QOS_POLICY_NODE_TYPE_ROUTER    (((uint8_t)1)<<IB_NODE_TYPE_ROUTER)\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_port {\r
-       cl_map_item_t map_item;\r
-       osm_physp_t * p_physp;\r
-} osm_qos_port_t;\r
-\r
-typedef struct osm_qos_port_group {\r
-       char *name;                     /* single string (this port group name) */\r
-       char *use;                      /* single string (description) */\r
-       uint8_t node_types;             /* node types bitmask */\r
-       cl_qmap_t port_map;\r
-} osm_qos_port_group_t;\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_vlarb_scope {\r
-       cl_list_t group_list;           /* list of group names (strings) */\r
-       cl_list_t across_list;          /* list of 'across' group names (strings) */\r
-       cl_list_t vlarb_high_list;      /* list of num pairs (n:m,...), 32-bit values */\r
-       cl_list_t vlarb_low_list;       /* list of num pairs (n:m,...), 32-bit values */\r
-       uint32_t vl_high_limit;         /* single integer */\r
-       boolean_t vl_high_limit_set;\r
-} osm_qos_vlarb_scope_t;\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_sl2vl_scope {\r
-       cl_list_t group_list;           /* list of strings (port group names) */\r
-       boolean_t from[OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH];\r
-       boolean_t to[OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH];\r
-       cl_list_t across_from_list;     /* list of strings (port group names) */\r
-       cl_list_t across_to_list;       /* list of strings (port group names) */\r
-       uint8_t sl2vl_table[16];        /* array of sl2vl values */\r
-       boolean_t sl2vl_table_set;\r
-} osm_qos_sl2vl_scope_t;\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_level {\r
-       char *use;\r
-       char *name;\r
-       uint8_t sl;\r
-       boolean_t sl_set;\r
-       uint8_t mtu_limit;\r
-       boolean_t mtu_limit_set;\r
-       uint8_t rate_limit;\r
-       boolean_t rate_limit_set;\r
-       uint8_t pkt_life;\r
-       boolean_t pkt_life_set;\r
-       uint64_t **path_bits_range_arr; /* array of bit ranges (real values are 32bits) */\r
-       unsigned path_bits_range_len;   /* num of bit ranges in the array */\r
-       uint64_t **pkey_range_arr;      /* array of PKey ranges (real values are 16bits) */\r
-       unsigned pkey_range_len;\r
-} osm_qos_level_t;\r
-\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_match_rule {\r
-       char *use;\r
-       cl_list_t source_list;                  /* list of strings */\r
-       cl_list_t source_group_list;            /* list of pointers to relevant port-group */\r
-       cl_list_t destination_list;             /* list of strings */\r
-       cl_list_t destination_group_list;       /* list of pointers to relevant port-group */\r
-       char *qos_level_name;\r
-       osm_qos_level_t *p_qos_level;\r
-       uint64_t **service_id_range_arr;        /* array of SID ranges (64-bit values) */\r
-       unsigned service_id_range_len;\r
-       uint64_t **qos_class_range_arr;         /* array of QoS Class ranges (real values are 16bits) */\r
-       unsigned qos_class_range_len;\r
-       uint64_t **pkey_range_arr;              /* array of PKey ranges (real values are 16bits) */\r
-       unsigned pkey_range_len;\r
-} osm_qos_match_rule_t;\r
-\r
-/***************************************************/\r
-\r
-typedef struct osm_qos_policy {\r
-       cl_list_t port_groups;                  /* list of osm_qos_port_group_t */\r
-       cl_list_t sl2vl_tables;                 /* list of osm_qos_sl2vl_scope_t */\r
-       cl_list_t vlarb_tables;                 /* list of osm_qos_vlarb_scope_t */\r
-       cl_list_t qos_levels;                   /* list of osm_qos_level_t */\r
-       cl_list_t qos_match_rules;              /* list of osm_qos_match_rule_t */\r
-       osm_qos_level_t *p_default_qos_level;   /* default QoS level */\r
-       osm_subn_t *p_subn;                     /* osm subnet object */\r
-       st_table * p_node_hash;                 /* node by name hash */\r
-} osm_qos_policy_t;\r
-\r
-/***************************************************/\r
-\r
-osm_qos_port_t *osm_qos_policy_port_create(osm_physp_t * p_physp);\r
-osm_qos_port_group_t * osm_qos_policy_port_group_create();\r
-void osm_qos_policy_port_group_destroy(osm_qos_port_group_t * p_port_group);\r
-\r
-osm_qos_vlarb_scope_t * osm_qos_policy_vlarb_scope_create();\r
-void osm_qos_policy_vlarb_scope_destroy(osm_qos_vlarb_scope_t * p_vlarb_scope);\r
-\r
-osm_qos_sl2vl_scope_t * osm_qos_policy_sl2vl_scope_create();\r
-void osm_qos_policy_sl2vl_scope_destroy(osm_qos_sl2vl_scope_t * p_sl2vl_scope);\r
-\r
-osm_qos_level_t * osm_qos_policy_qos_level_create();\r
-void osm_qos_policy_qos_level_destroy(osm_qos_level_t * p_qos_level);\r
-\r
-boolean_t osm_qos_level_has_pkey(IN const osm_qos_level_t * p_qos_level,\r
-                                IN ib_net16_t pkey);\r
-\r
-ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,\r
-                                        IN const osm_physp_t * p_src_physp,\r
-                                        IN const osm_physp_t * p_dest_physp);\r
-\r
-osm_qos_match_rule_t * osm_qos_policy_match_rule_create();\r
-void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p_match_rule);\r
-\r
-osm_qos_policy_t * osm_qos_policy_create(osm_subn_t * p_subn);\r
-void osm_qos_policy_destroy(osm_qos_policy_t * p_qos_policy);\r
-int osm_qos_policy_validate(osm_qos_policy_t * p_qos_policy, osm_log_t * p_log);\r
-\r
-osm_qos_level_t * osm_qos_policy_get_qos_level_by_pr(\r
-       IN const osm_qos_policy_t * p_qos_policy,\r
-       IN const ib_path_rec_t * p_pr,\r
-       IN const osm_physp_t * p_src_physp,\r
-       IN const osm_physp_t * p_dest_physp,\r
-       IN ib_net64_t comp_mask);\r
-\r
-osm_qos_level_t * osm_qos_policy_get_qos_level_by_mpr(\r
-       IN const osm_qos_policy_t * p_qos_policy,\r
-       IN const ib_multipath_rec_t * p_mpr,\r
-       IN const osm_physp_t * p_src_physp,\r
-       IN const osm_physp_t * p_dest_physp,\r
-       IN ib_net64_t comp_mask);\r
-\r
-/***************************************************/\r
-\r
-int osm_qos_parse_policy_file(IN osm_subn_t * p_subn);\r
-\r
-/***************************************************/\r
-\r
-#endif                         /* ifndef OSM_QOS_POLICY_H */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_remote_sm.h b/branches/opensm_3/user/include/opensm/osm_remote_sm.h
deleted file mode 100644 (file)
index 9c30398..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_sm_t, osm_remote_sm_t.\r
- *     This object represents an IBA subnet.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_REMOTE_SM_H_\r
-#define _OSM_REMOTE_SM_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_port.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Remote SM\r
-* NAME\r
-*      Remote SM\r
-*\r
-* DESCRIPTION\r
-*      The Remote SM object encapsulates the information tracked for\r
-*      other SM ports on the subnet.\r
-*\r
-*      The Remote SM object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Remote SM/osm_remote_sm_t\r
-* NAME\r
-*      osm_remote_sm_t\r
-*\r
-* DESCRIPTION\r
-*      Remote Subnet Manager structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_remote_sm {\r
-       cl_map_item_t map_item;\r
-       const osm_port_t *p_port;\r
-       ib_sm_info_t smi;\r
-} osm_remote_sm_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage for the cl_qmap container.  MUST BE FIRST ELEMENT!!\r
-*      p_port\r
-*              Pointer to the port object for this SM.\r
-*\r
-*      smi\r
-*              The SMInfo attribute for this SM.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_remote_sm_construct\r
-* NAME\r
-*      osm_remote_sm_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an Remote SM object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an Remote SM object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_remote_sm_init, osm_remote_sm_destroy\r
-*\r
-*      Calling osm_remote_sm_construct is a prerequisite to calling any other\r
-*      method except osm_remote_sm_init.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_remote_sm_init, osm_remote_sm_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_remote_sm_destroy\r
-* NAME\r
-*      osm_remote_sm_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_remote_sm_destroy function destroys an SM, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an Remote SM object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified Remote SM object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_remote_sm_construct or osm_remote_sm_init.\r
-*\r
-* SEE ALSO\r
-*      Remote SM object, osm_remote_sm_construct, osm_remote_sm_init\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_remote_sm_init\r
-* NAME\r
-*      osm_remote_sm_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_remote_sm_init function initializes an Remote SM object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, IN const osm_port_t * p_port,\r
-                       IN const ib_sm_info_t * p_smi);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_remote_sm_t object to initialize.\r
-*\r
-*      p_port\r
-*              [in] Pointer to the Remote SM's port object.\r
-*\r
-*      p_smi\r
-*              [in] Pointer to the SMInfo attribute for this SM.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling other Remote SM methods.\r
-*\r
-* SEE ALSO\r
-*      Remote SM object, osm_remote_sm_construct, osm_remote_sm_destroy\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_REMOTE_SM_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_router.h b/branches/opensm_3/user/include/opensm/osm_router.h
deleted file mode 100644 (file)
index 722e601..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_router_t.\r
- *     This object represents an IBA router.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_ROUTER_H_\r
-#define _OSM_ROUTER_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_mcast_tbl.h>\r
-#include <opensm/osm_port_profile.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Router\r
-* NAME\r
-*      Router\r
-*\r
-* DESCRIPTION\r
-*      The Router object encapsulates the information needed by the\r
-*      OpenSM to manage routers.  The OpenSM allocates one router object\r
-*      per router in the IBA subnet.\r
-*\r
-*      The Router object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Hal Rosenstock, Voltaire\r
-*\r
-*********/\r
-/****s* OpenSM: Router/osm_router_t\r
-* NAME\r
-*      osm_router_t\r
-*\r
-* DESCRIPTION\r
-*      Router structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_router {\r
-       cl_map_item_t map_item;\r
-       osm_port_t *p_port;\r
-} osm_router_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!\r
-*\r
-*      p_port\r
-*              Pointer to the Port object for this router.\r
-*\r
-* SEE ALSO\r
-*      Router object\r
-*********/\r
-\r
-/****f* OpenSM: Router/osm_router_delete\r
-* NAME\r
-*      osm_router_delete\r
-*\r
-* DESCRIPTION\r
-*      Destroys and deallocates the object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_router_delete(IN OUT osm_router_t ** pp_rtr);\r
-/*\r
-* PARAMETERS\r
-*      p_rtr\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Router object, osm_router_new\r
-*********/\r
-\r
-/****f* OpenSM: Router/osm_router_new\r
-* NAME\r
-*      osm_router_new\r
-*\r
-* DESCRIPTION\r
-*      The osm_router_new function initializes a Router object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_router_t *osm_router_new(IN osm_port_t * p_port);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to the node object of this router\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the new initialized router object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Router object, osm_router_new\r
-*********/\r
-\r
-/****f* OpenSM: Router/osm_router_get_port_ptr\r
-* NAME\r
-*      osm_router_get_port_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the Port object for this router.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t * p_rtr)\r
-{\r
-       return p_rtr->p_port;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rtr\r
-*              [in] Pointer to an osm_router_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the Port object for this router.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Router object\r
-*********/\r
-\r
-/****f* OpenSM: Router/osm_router_get_node_ptr\r
-* NAME\r
-*      osm_router_get_node_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the Node object for this router.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t * p_rtr)\r
-{\r
-       return p_rtr->p_port->p_node;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rtr\r
-*              [in] Pointer to an osm_router_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the Node object for this router.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Router object\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_ROUTER_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_sa.h b/branches/opensm_3/user/include/opensm/osm_sa.h
deleted file mode 100644 (file)
index ccaddd2..0000000
+++ /dev/null
@@ -1,495 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_sa_t.\r
- *     This object represents an IBA subnet.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SA_H_\r
-#define _OSM_SA_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_event.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_timer.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_sa_mad_ctrl.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_multicast.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/SA\r
-* NAME\r
-*      SA\r
-*\r
-* DESCRIPTION\r
-*      The SA object encapsulates the information needed by the\r
-*      OpenSM to instantiate a subnet administrator.  The OpenSM allocates\r
-*      one SA object per subnet manager.\r
-*\r
-*      The SA object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Ranjit Pandit, Intel\r
-*      Anil Keshavamurthy, Intel\r
-*\r
-*********/\r
-/****d* OpenSM: SA/osm_sa_state_t\r
-* NAME\r
-*      osm_sa_state_t\r
-*\r
-* DESCRIPTION\r
-*      Enumerates the possible states of SA object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osm_sa_state {\r
-       OSM_SA_STATE_INIT = 0,\r
-       OSM_SA_STATE_READY\r
-} osm_sa_state_t;\r
-/***********/\r
-\r
-/****s* OpenSM: SM/osm_sa_t\r
-* NAME\r
-*      osm_sa_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet Administration structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_sa {\r
-       osm_sa_state_t state;\r
-       osm_sm_t *sm;\r
-       osm_subn_t *p_subn;\r
-       osm_vendor_t *p_vendor;\r
-       osm_log_t *p_log;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       cl_dispatcher_t *p_disp;\r
-       cl_plock_t *p_lock;\r
-       atomic32_t sa_trans_id;\r
-       osm_sa_mad_ctrl_t mad_ctrl;\r
-       cl_timer_t sr_timer;\r
-       boolean_t dirty;\r
-       cl_disp_reg_handle_t cpi_disp_h;\r
-       cl_disp_reg_handle_t nr_disp_h;\r
-       cl_disp_reg_handle_t pir_disp_h;\r
-       cl_disp_reg_handle_t gir_disp_h;\r
-       cl_disp_reg_handle_t lr_disp_h;\r
-       cl_disp_reg_handle_t pr_disp_h;\r
-       cl_disp_reg_handle_t smir_disp_h;\r
-       cl_disp_reg_handle_t mcmr_disp_h;\r
-       cl_disp_reg_handle_t sr_disp_h;\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       cl_disp_reg_handle_t mpr_disp_h;\r
-#endif\r
-       cl_disp_reg_handle_t infr_disp_h;\r
-       cl_disp_reg_handle_t infir_disp_h;\r
-       cl_disp_reg_handle_t vlarb_disp_h;\r
-       cl_disp_reg_handle_t slvl_disp_h;\r
-       cl_disp_reg_handle_t pkey_disp_h;\r
-       cl_disp_reg_handle_t lft_disp_h;\r
-       cl_disp_reg_handle_t sir_disp_h;\r
-       cl_disp_reg_handle_t mft_disp_h;\r
-} osm_sa_t;\r
-/*\r
-* FIELDS\r
-*      state\r
-*              State of this SA object\r
-*\r
-*      sm\r
-*              Pointer to the Subnet Manager object.\r
-*\r
-*      p_subn\r
-*              Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_vendor\r
-*              Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_mad_pool\r
-*              Pointer to the MAD pool.\r
-*\r
-*      p_disp\r
-*              Pointer to dispatcher\r
-*\r
-*      p_lock\r
-*              Pointer to Lock for serialization\r
-*\r
-*      sa_trans_id\r
-*              Transaction ID\r
-*\r
-*      mad_ctrl\r
-*              Mad Controller\r
-*\r
-*      dirty\r
-*              A flag that denotes that SA DB is dirty and needs\r
-*              to be written to the dump file (if dumping is enabled)\r
-*\r
-* SEE ALSO\r
-*      SM object\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_construct\r
-* NAME\r
-*      osm_sa_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an SA object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_construct(IN osm_sa_t * p_sa);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to a SA object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_sa_destroy.\r
-*\r
-*      Calling osm_sa_construct is a prerequisite to calling any other\r
-*      method except osm_sa_init.\r
-*\r
-* SEE ALSO\r
-*      SA object, osm_sa_init, osm_sa_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_shutdown\r
-* NAME\r
-*      osm_sa_shutdown\r
-*\r
-* DESCRIPTION\r
-*      The osm_sa_shutdown function shutdowns an SA, unregistering from all\r
-*  dispatcher messages and unbinding the QP1 mad service\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_shutdown(IN osm_sa_t * p_sa);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to a SA object to shutdown.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* SEE ALSO\r
-*      SA object, osm_sa_construct, osm_sa_init\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_destroy\r
-* NAME\r
-*      osm_sa_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_sa_destroy function destroys an SA, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_destroy(IN osm_sa_t * p_sa);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to a SA object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified SA object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_sa_construct or\r
-*      osm_sa_init.\r
-*\r
-* SEE ALSO\r
-*      SA object, osm_sa_construct, osm_sa_init\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_init\r
-* NAME\r
-*      osm_sa_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_sa_init function initializes a SA object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa,\r
-                           IN osm_subn_t * p_subn, IN osm_vendor_t * p_vendor,\r
-                           IN osm_mad_pool_t * p_mad_pool,\r
-                           IN osm_log_t * p_log, IN osm_stats_t * p_stats,\r
-                           IN cl_dispatcher_t * p_disp,\r
-                           IN cl_plock_t * p_lock);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to an osm_sa_t object to initialize.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_vendor\r
-*              [in] Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_mad_pool\r
-*              [in] Pointer to the MAD pool.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              [in] Pointer to the statistics object.\r
-*\r
-*      p_disp\r
-*              [in] Pointer to the OpenSM central Dispatcher.\r
-*\r
-*      p_lock\r
-*              [in] Pointer to the OpenSM serializing lock.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the SA object was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other SA methods.\r
-*\r
-* SEE ALSO\r
-*      SA object, osm_sa_construct, osm_sa_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_bind\r
-* NAME\r
-*      osm_sa_bind\r
-*\r
-* DESCRIPTION\r
-*      Binds the SA object to a port guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_bind(IN osm_sa_t * p_sa, IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to an osm_sa_t object to bind.\r
-*\r
-*      port_guid\r
-*              [in] Local port GUID with which to bind.\r
-*\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given SA object can only be bound to one port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_send\r
-* NAME\r
-*      osm_sa_send\r
-*\r
-* DESCRIPTION\r
-*      Sends SA MAD via osm_vendor_send and maintains the QP1 sent statistic\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * p_madw,\r
-                           IN boolean_t resp_expected);\r
-\r
-/****f* IBA Base: Types/osm_sa_send_error\r
-* NAME\r
-*      osm_sa_send_error\r
-*\r
-* DESCRIPTION\r
-*      Sends a generic SA response with the specified error status.\r
-*      The payload is simply replicated from the request MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_send_error(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,\r
-                      IN ib_net16_t sa_status);\r
-/*\r
-* PARAMETERS\r
-*      sa\r
-*              [in] Pointer to an osm_sa_t object.\r
-*\r
-*      p_madw\r
-*              [in] Original MAD to which the response must be sent.\r
-*\r
-*      sa_status\r
-*              [in] Status to send in the response.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* SEE ALSO\r
-*      SA object\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_respond\r
-* NAME\r
-*      osm_sa_respond\r
-*\r
-* DESCRIPTION\r
-*      Sends SA MAD response\r
-*/\r
-void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,\r
-                   cl_qlist_t *list);\r
-/*\r
-* PARAMETERS\r
-*      sa\r
-*              [in] Pointer to an osm_sa_t object.\r
-*\r
-*      p_madw\r
-*              [in] Original MAD to which the response must be sent.\r
-*\r
-*      attr_size\r
-*              [in] Size of this SA attribute.\r
-*\r
-*      list\r
-*              [in] List of attribute to respond - it will be freed after\r
-*              sending.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* SEE ALSO\r
-*      SA object\r
-*********/\r
-\r
-struct osm_opensm;\r
-/****f* OpenSM: SA/osm_sa_db_file_dump\r
-* NAME\r
-*      osm_sa_db_file_dump\r
-*\r
-* DESCRIPTION\r
-*      Dumps the SA DB to the dump file.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_sa_db_file_dump(struct osm_opensm *p_osm);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object.\r
-*\r
-* RETURN VALUES\r
-*       0 if the SA DB was actually dumped\r
-*      >0 if there was no need to dump the SA DB\r
-*      <0 if some error occurred.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_db_file_load\r
-* NAME\r
-*      osm_sa_db_file_load\r
-*\r
-* DESCRIPTION\r
-*      Loads SA DB from the file.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_sa_db_file_load(struct osm_opensm *p_osm);\r
-/*\r
-* PARAMETERS\r
-*      p_osm\r
-*              [in] Pointer to an osm_opensm_t object.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, other value on failure.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: MC Member Record Receiver/osm_mcmr_rcv_find_or_create_new_mgrp\r
-* NAME\r
-*      osm_mcmr_rcv_find_or_create_new_mgrp\r
-*\r
-* DESCRIPTION\r
-*      Create new Multicast group\r
-*\r
-* SYNOPSIS\r
-*/\r
-\r
-ib_api_status_t\r
-osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa, IN ib_net64_t comp_mask,\r
-                                    IN ib_member_rec_t * p_recvd_mcmember_rec,\r
-                                    OUT osm_mgrp_t ** pp_mgrp);\r
-/*\r
-* PARAMETERS\r
-*      p_sa\r
-*              [in] Pointer to an osm_sa_t object.\r
-*      p_recvd_mcmember_rec\r
-*              [in] Received Multicast member record\r
-*\r
-*      pp_mgrp\r
-*              [out] pointer the osm_mgrp_t object\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS, IB_ERROR\r
-*\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SA_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_sa_mad_ctrl.h b/branches/opensm_3/user/include/opensm/osm_sa_mad_ctrl.h
deleted file mode 100644 (file)
index 0d57db2..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_sa_mad_ctrl_t.\r
- *     This object represents a controller that receives the IBA SA\r
- *     attributes from a node.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SA_MAD_CTRL_H_\r
-#define _OSM_SA_MAD_CTRL_H_\r
-\r
-#include <complib/cl_dispatcher.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/SA MAD Controller\r
-* NAME\r
-*      SA MAD Controller\r
-*\r
-* DESCRIPTION\r
-*      The SA MAD Controller object encapsulates\r
-*      the information needed to receive MADs from the transport layer.\r
-*\r
-*      The SA MAD Controller object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Ranjit Pandit, Intel\r
-*\r
-*********/\r
-\r
-struct osm_sa;\r
-/****s* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_t\r
-* NAME\r
-*      osm_sa_mad_ctrl_t\r
-*\r
-* DESCRIPTION\r
-*      SA MAD Controller structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_sa_mad_ctrl {\r
-       struct osm_sa *sa;\r
-       osm_log_t *p_log;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       osm_vendor_t *p_vendor;\r
-       osm_bind_handle_t h_bind;\r
-       cl_dispatcher_t *p_disp;\r
-       cl_disp_reg_handle_t h_disp;\r
-       osm_stats_t *p_stats;\r
-       osm_subn_t *p_subn;\r
-} osm_sa_mad_ctrl_t;\r
-/*\r
-* FIELDS\r
-*      sa\r
-*              Pointer to the SA object.\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_mad_pool\r
-*              Pointer to the MAD pool.\r
-*\r
-*      p_vendor\r
-*              Pointer to the vendor specific interfaces object.\r
-*\r
-*      h_bind\r
-*              Bind handle returned by the transport layer.\r
-*\r
-*      p_disp\r
-*              Pointer to the Dispatcher.\r
-*\r
-*      h_disp\r
-*              Handle returned from dispatcher registration.\r
-*\r
-*      p_stats\r
-*              Pointer to the OpenSM statistics block.\r
-*\r
-* SEE ALSO\r
-*      SA MAD Controller object\r
-*      SA MADr object\r
-*********/\r
-\r
-/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_construct\r
-* NAME\r
-*      osm_sa_mad_ctrl_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a SA MAD Controller object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to a SA MAD Controller\r
-*              object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_sa_mad_ctrl_init, and osm_sa_mad_ctrl_destroy.\r
-*\r
-*      Calling osm_sa_mad_ctrl_construct is a prerequisite to calling any other\r
-*      method except osm_sa_mad_ctrl_init.\r
-*\r
-* SEE ALSO\r
-*      SA MAD Controller object, osm_sa_mad_ctrl_init,\r
-*      osm_sa_mad_ctrl_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_destroy\r
-* NAME\r
-*      osm_sa_mad_ctrl_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_sa_mad_ctrl_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * p_ctrl);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified\r
-*      SA MAD Controller object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_sa_mad_ctrl_construct or osm_sa_mad_ctrl_init.\r
-*\r
-* SEE ALSO\r
-*      SA MAD Controller object, osm_sa_mad_ctrl_construct,\r
-*      osm_sa_mad_ctrl_init\r
-*********/\r
-\r
-/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_init\r
-* NAME\r
-*      osm_sa_mad_ctrl_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_sa_mad_ctrl_init function initializes a\r
-*      SA MAD Controller object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * p_ctrl,\r
-                                    IN struct osm_sa * sa,\r
-                                    IN osm_mad_pool_t * p_mad_pool,\r
-                                    IN osm_vendor_t * p_vendor,\r
-                                    IN osm_subn_t * p_subn,\r
-                                    IN osm_log_t * p_log,\r
-                                    IN osm_stats_t * p_stats,\r
-                                    IN cl_dispatcher_t * p_disp);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.\r
-*\r
-*      sa\r
-*              [in] Pointer to the SA object.\r
-*\r
-*      p_mad_pool\r
-*              [in] Pointer to the MAD pool.\r
-*\r
-*      p_vendor\r
-*              [in] Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              [in] Pointer to the OpenSM stastics block.\r
-*\r
-*      p_disp\r
-*              [in] Pointer to the OpenSM central Dispatcher.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the SA MAD Controller object was initialized\r
-*      successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other SA MAD Controller methods.\r
-*\r
-* SEE ALSO\r
-*      SA MAD Controller object, osm_sa_mad_ctrl_construct,\r
-*      osm_sa_mad_ctrl_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_mad_ctrl_bind\r
-* NAME\r
-*      osm_sa_mad_ctrl_bind\r
-*\r
-* DESCRIPTION\r
-*      Binds the SA MAD Controller object to a port guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * p_ctrl,\r
-                                    IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.\r
-*\r
-*      port_guid\r
-*              [in] Local port GUID with which to bind.\r
-*\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given SA MAD Controller object can only be bound to one\r
-*      port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_mad_ctrl_unbind\r
-* NAME\r
-*      osm_sa_mad_ctrl_unbind\r
-*\r
-* DESCRIPTION\r
-*      Un-Binds the SA MAD Controller object from the IB port\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * p_ctrl);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given SA MAD Controller should be previously bound to IB\r
-*      port.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SA/osm_sa_mad_ctrl_get_bind_handle\r
-* NAME\r
-*      osm_sa_mad_ctrl_get_bind_handle\r
-*\r
-* DESCRIPTION\r
-*      Returns the bind handle.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_bind_handle_t\r
-osm_sa_mad_ctrl_get_bind_handle(IN const osm_sa_mad_ctrl_t * p_ctrl)\r
-{\r
-       return p_ctrl->h_bind;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sa_mad_ctrl_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the bind handle, which may be OSM_BIND_INVALID_HANDLE\r
-*      if no port has been bound.\r
-*\r
-* NOTES\r
-*      A given SA MAD Controller object can only be bound to one\r
-*      port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SA_MAD_CTRL_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_service.h b/branches/opensm_3/user/include/opensm/osm_service.h
deleted file mode 100644 (file)
index fa8c31d..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_SVCR_H_\r
-#define _OSM_SVCR_H_\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_service_rec_t.\r
- *     This object represents an IBA Service Record.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Service Record\r
-* NAME\r
-*      Service Record\r
-*\r
-* DESCRIPTION\r
-*      The service record encapsulates the information needed by the\r
-*      SA to manage service registrations.\r
-*\r
-*      The service records is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Anil S Keshavamurthy, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Service Record/osm_svcr_t\r
-* NAME\r
-*      osm_svcr_t\r
-*\r
-* DESCRIPTION\r
-*      Service Record structure.\r
-*\r
-*      The osm_svcr_t object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_svcr {\r
-       cl_list_item_t list_item;\r
-       ib_service_record_t service_record;\r
-       uint32_t modified_time;\r
-       uint32_t lease_period;\r
-} osm_svcr_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Map Item for qmap linkage.  Must be first element!!\r
-*\r
-*      svc_rec\r
-*              IB Service record structure\r
-*\r
-*      modified_time\r
-*              Last modified time of this record in milliseconds\r
-*\r
-*      lease_period\r
-*              Remaining lease period for this record\r
-*\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Service Record/osm_svcr_new\r
-* NAME\r
-*      osm_svcr_new\r
-*\r
-* DESCRIPTION\r
-*      Allocates and initializes a Service Record for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec);\r
-/*\r
-* PARAMETERS\r
-*      p_svc_rec\r
-*              [in] Pointer to IB Service Record\r
-*\r
-* RETURN VALUES\r
-*      pointer to osm_svcr_t structure.\r
-*\r
-* NOTES\r
-*      Allows calling other service record methods.\r
-*\r
-* SEE ALSO\r
-*      Service Record, osm_svcr_delete\r
-*********/\r
-\r
-/****f* OpenSM: Service Record/osm_svcr_init\r
-* NAME\r
-*      osm_svcr_init\r
-*\r
-* DESCRIPTION\r
-*      Initializes the osm_svcr_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_svcr_init(IN osm_svcr_t * p_svcr,\r
-                  IN const ib_service_record_t * p_svc_rec);\r
-/*\r
-* PARAMETERS\r
-*      p_svc_rec\r
-*              [in] Pointer to osm_svcr_t structure\r
-*      p_svc_rec\r
-*              [in] Pointer to the ib_service_record_t\r
-*\r
-* SEE ALSO\r
-*      Service Record\r
-*********/\r
-\r
-/****f* OpenSM: Service Record/osm_svcr_delete\r
-* NAME\r
-*      osm_svcr_delete\r
-*\r
-* DESCRIPTION\r
-*      Deallocates the osm_svcr_t structure.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_svcr_delete(IN osm_svcr_t * p_svcr);\r
-/*\r
-* PARAMETERS\r
-*      p_svc_rec\r
-*              [in] Pointer to osm_svcr_t structure\r
-*\r
-* SEE ALSO\r
-*      Service Record, osm_svcr_new\r
-*********/\r
-\r
-osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,\r
-                               IN osm_log_t * p_log,\r
-                               IN ib_service_record_t * p_svc_rec);\r
-\r
-void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                          IN osm_svcr_t * p_svcr);\r
-void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                            IN osm_svcr_t * p_svcr);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SVCR_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_sm.h b/branches/opensm_3/user/include/opensm/osm_sm.h
deleted file mode 100644 (file)
index eeff0d5..0000000
+++ /dev/null
@@ -1,739 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_sm_t.\r
- *     This object represents an IBA subnet.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SM_H_\r
-#define _OSM_SM_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_event.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <complib/cl_event_wheel.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_vl15intf.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_sm_mad_ctrl.h>\r
-#include <opensm/osm_lid_mgr.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_db.h>\r
-#include <opensm/osm_remote_sm.h>\r
-#include <opensm/osm_multicast.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/SM\r
-* NAME\r
-*      SM\r
-*\r
-* DESCRIPTION\r
-*      The SM object encapsulates the information needed by the\r
-*      OpenSM to instantiate a subnet manager.  The OpenSM allocates\r
-*      one SM object per subnet manager.\r
-*\r
-*      The SM object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: SM/osm_sm_t\r
-* NAME\r
-*  osm_sm_t\r
-*\r
-* DESCRIPTION\r
-*  Subnet Manager structure.\r
-*\r
-*  This object should be treated as opaque and should\r
-*  be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_sm {\r
-       osm_thread_state_t thread_state;\r
-       unsigned signal_mask;\r
-       cl_spinlock_t signal_lock;\r
-       cl_spinlock_t state_lock;\r
-       cl_event_t signal_event;\r
-       cl_event_t subnet_up_event;\r
-       cl_timer_t sweep_timer;\r
-       cl_timer_t polling_timer;\r
-       cl_event_wheel_t trap_aging_tracker;\r
-       cl_thread_t sweeper;\r
-       unsigned master_sm_found;\r
-       uint32_t retry_number;\r
-       ib_net64_t master_sm_guid;\r
-       osm_remote_sm_t *p_polling_sm;\r
-       osm_subn_t *p_subn;\r
-       osm_db_t *p_db;\r
-       osm_vendor_t *p_vendor;\r
-       osm_log_t *p_log;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       osm_vl15_t *p_vl15;\r
-       cl_dispatcher_t *p_disp;\r
-       cl_plock_t *p_lock;\r
-       atomic32_t sm_trans_id;\r
-       unsigned mlids_req_max;\r
-       uint8_t *mlids_req;\r
-       osm_sm_mad_ctrl_t mad_ctrl;\r
-       osm_lid_mgr_t lid_mgr;\r
-       osm_ucast_mgr_t ucast_mgr;\r
-       cl_disp_reg_handle_t sweep_fail_disp_h;\r
-       cl_disp_reg_handle_t ni_disp_h;\r
-       cl_disp_reg_handle_t pi_disp_h;\r
-       cl_disp_reg_handle_t nd_disp_h;\r
-       cl_disp_reg_handle_t si_disp_h;\r
-       cl_disp_reg_handle_t lft_disp_h;\r
-       cl_disp_reg_handle_t mft_disp_h;\r
-       cl_disp_reg_handle_t sm_info_disp_h;\r
-       cl_disp_reg_handle_t trap_disp_h;\r
-       cl_disp_reg_handle_t slvl_disp_h;\r
-       cl_disp_reg_handle_t vla_disp_h;\r
-       cl_disp_reg_handle_t pkey_disp_h;\r
-} osm_sm_t;\r
-/*\r
-* FIELDS\r
-*      p_subn\r
-*              Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_db\r
-*              Pointer to the database (persistency) object\r
-*\r
-*      p_vendor\r
-*              Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_mad_pool\r
-*              Pointer to the MAD pool.\r
-*\r
-*      p_vl15\r
-*              Pointer to the VL15 interface.\r
-*\r
-*      mad_ctrl\r
-*              MAD Controller.\r
-*\r
-*      p_disp\r
-*              Pointer to the Dispatcher.\r
-*\r
-*      p_lock\r
-*              Pointer to the serializing lock.\r
-*\r
-* SEE ALSO\r
-*      SM object\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_construct\r
-* NAME\r
-*      osm_sm_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an SM object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_construct(IN osm_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to a SM object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_sm_init, osm_sm_destroy\r
-*\r
-*      Calling osm_sm_construct is a prerequisite to calling any other\r
-*      method except osm_sm_init.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_sm_init, osm_sm_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_shutdown\r
-* NAME\r
-*      osm_sm_shutdown\r
-*\r
-* DESCRIPTION\r
-*      The osm_sm_shutdown function shutdowns an SM, stopping the sweeper\r
-*      and unregistering all messages from the dispatcher\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_shutdown(IN osm_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to a SM object to shutdown.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_sm_construct, osm_sm_init\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_destroy\r
-* NAME\r
-*      osm_sm_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_sm_destroy function destroys an SM, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_destroy(IN osm_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to a SM object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified SM object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_sm_construct or\r
-*      osm_sm_init.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_sm_construct, osm_sm_init\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_init\r
-* NAME\r
-*      osm_sm_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_sm_init function initializes a SM object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn,\r
-                           IN osm_db_t * p_db, IN osm_vendor_t * p_vendor,\r
-                           IN osm_mad_pool_t * p_mad_pool,\r
-                           IN osm_vl15_t * p_vl15, IN osm_log_t * p_log,\r
-                           IN osm_stats_t * p_stats,\r
-                           IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_sm_t object to initialize.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_vendor\r
-*              [in] Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_mad_pool\r
-*              [in] Pointer to the MAD pool.\r
-*\r
-*      p_vl15\r
-*              [in] Pointer to the VL15 interface.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              [in] Pointer to the statistics object.\r
-*\r
-*      p_disp\r
-*              [in] Pointer to the OpenSM central Dispatcher.\r
-*\r
-*      p_lock\r
-*              [in] Pointer to the OpenSM serializing lock.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the SM object was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other SM methods.\r
-*\r
-* SEE ALSO\r
-*      SM object, osm_sm_construct, osm_sm_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_signal\r
-* NAME\r
-*      osm_sm_signal\r
-*\r
-* DESCRIPTION\r
-*      Signal event to SM\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_signal(IN osm_sm_t * p_sm, osm_signal_t signal);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      signal\r
-*              [in] sm signal number.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      SM object\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_sweep\r
-* NAME\r
-*      osm_sm_sweep\r
-*\r
-* DESCRIPTION\r
-*      Initiates a subnet sweep.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_sweep(IN osm_sm_t * p_sm);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the sweep completed successfully.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      SM object\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_bind\r
-* NAME\r
-*      osm_sm_bind\r
-*\r
-* DESCRIPTION\r
-*      Binds the sm object to a port guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_sm_t object to bind.\r
-*\r
-*      port_guid\r
-*              [in] Local port GUID with which to bind.\r
-*\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given SM object can only be bound to one port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_req_get\r
-* NAME\r
-*      osm_req_get\r
-*\r
-* DESCRIPTION\r
-*      Starts the process to transmit a directed route request for\r
-*      the attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,\r
-                           IN ib_net16_t attr_id, IN ib_net32_t attr_mod,\r
-                           IN cl_disp_msgid_t err_msg,\r
-                           IN const osm_madw_context_t * p_context);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      p_path\r
-*              [in] Pointer to the directed route path to the node\r
-*              from which to retrieve the attribute.\r
-*\r
-*      attr_id\r
-*              [in] Attribute ID to request.\r
-*\r
-*      attr_mod\r
-*              [in] Attribute modifier for this request.\r
-*\r
-*      err_msg\r
-*              [in] Message id with which to post this MAD if an error occurs.\r
-*\r
-*      p_context\r
-*              [in] Mad wrapper context structure to be copied into the wrapper\r
-*              context, and thus visible to the recipient of the response.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the request was successful.\r
-*\r
-* NOTES\r
-*      This function asynchronously requests the specified attribute.\r
-*      The response from the node will be routed through the Dispatcher\r
-*      to the appropriate receive controller object.\r
-*********/\r
-/****f* OpenSM: SM/osm_req_set\r
-* NAME\r
-*      osm_req_set\r
-*\r
-* DESCRIPTION\r
-*      Starts the process to transmit a directed route Set() request.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,\r
-                           IN const uint8_t * p_payload,\r
-                           IN size_t payload_size, IN ib_net16_t attr_id,\r
-                           IN ib_net32_t attr_mod, IN cl_disp_msgid_t err_msg,\r
-                           IN const osm_madw_context_t * p_context);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      p_path\r
-*              [in] Pointer to the directed route path of the recipient.\r
-*\r
-*      p_payload\r
-*              [in] Pointer to the SMP payload to send.\r
-*\r
-*      payload_size\r
-*              [in] The size of the payload to be copied to the SMP data field.\r
-*\r
-*      attr_id\r
-*              [in] Attribute ID to request.\r
-*\r
-*      attr_mod\r
-*              [in] Attribute modifier for this request.\r
-*\r
-*      err_msg\r
-*              [in] Message id with which to post this MAD if an error occurs.\r
-*\r
-*      p_context\r
-*              [in] Mad wrapper context structure to be copied into the wrapper\r
-*              context, and thus visible to the recipient of the response.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the request was successful.\r
-*\r
-* NOTES\r
-*      This function asynchronously requests the specified attribute.\r
-*      The response from the node will be routed through the Dispatcher\r
-*      to the appropriate receive controller object.\r
-*********/\r
-/****f* OpenSM: SM/osm_resp_send\r
-* NAME\r
-*      osm_resp_send\r
-*\r
-* DESCRIPTION\r
-*      Starts the process to transmit a directed route response.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_resp_send(IN osm_sm_t * sm,\r
-                             IN const osm_madw_t * p_req_madw,\r
-                             IN ib_net16_t status,\r
-                             IN const uint8_t * p_payload);\r
-/*\r
-* PARAMETERS\r
-*      p_resp\r
-*              [in] Pointer to an osm_resp_t object.\r
-*\r
-*      p_madw\r
-*              [in] Pointer to the MAD Wrapper object for the requesting MAD\r
-*              to which this response is generated.\r
-*\r
-*      status\r
-*              [in] Status for this response.\r
-*\r
-*      p_payload\r
-*              [in] Pointer to the payload of the response MAD.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the response was successful.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_reroute_mlid\r
-* NAME\r
-*      osm_sm_reroute_mlid\r
-*\r
-* DESCRIPTION\r
-*      Requests (schedules) MLID rerouting\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_reroute_mlid(osm_sm_t * sm, ib_net16_t mlid);\r
-\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      mlid\r
-*              [in] MLID value\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: OpenSM/osm_sm_wait_for_subnet_up\r
-* NAME\r
-*      osm_sm_wait_for_subnet_up\r
-*\r
-* DESCRIPTION\r
-*      Blocks the calling thread until the subnet is up.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline cl_status_t osm_sm_wait_for_subnet_up(IN osm_sm_t * p_sm,\r
-                                                   IN uint32_t wait_us,\r
-                                                   IN boolean_t interruptible)\r
-{\r
-       return cl_event_wait_on(&p_sm->subnet_up_event, wait_us, interruptible);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      wait_us\r
-*              [in] Number of microseconds to wait.\r
-*\r
-*      interruptible\r
-*              [in] Indicates whether the wait operation can be interrupted\r
-*              by external signals.\r
-*\r
-* RETURN VALUES\r
-*      CL_SUCCESS if the wait operation succeeded in response to the event\r
-*      being set.\r
-*\r
-*      CL_TIMEOUT if the specified time period elapses.\r
-*\r
-*      CL_NOT_DONE if the wait was interrupted by an external signal.\r
-*\r
-*      CL_ERROR if the wait operation failed.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: State Manager/osm_sm_is_greater_than\r
-* NAME\r
-*      osm_sm_is_greater_than\r
-*\r
-* DESCRIPTION\r
-*      Compares two SM's (14.4.1.2)\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_sm_is_greater_than(IN uint8_t l_priority,\r
-                                              IN ib_net64_t l_guid,\r
-                                              IN uint8_t r_priority,\r
-                                              IN ib_net64_t r_guid)\r
-{\r
-       return (l_priority > r_priority\r
-               || (l_priority == r_priority\r
-                   && cl_ntoh64(l_guid) < cl_ntoh64(r_guid)));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      l_priority\r
-*              [in] Priority of the SM on the "left"\r
-*\r
-*      l_guid\r
-*              [in] GUID of the SM on the "left"\r
-*\r
-*      r_priority\r
-*              [in] Priority of the SM on the "right"\r
-*\r
-*      r_guid\r
-*              [in] GUID of the SM on the "right"\r
-*\r
-* RETURN VALUES\r
-*      Return TRUE if an sm with l_priority and l_guid is higher than an sm\r
-*      with r_priority and r_guid, return FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      State Manager\r
-*********/\r
-\r
-/****f* OpenSM: SM State Manager/osm_sm_state_mgr_process\r
-* NAME\r
-*      osm_sm_state_mgr_process\r
-*\r
-* DESCRIPTION\r
-*      Processes and maintains the states of the SM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_state_mgr_process(IN osm_sm_t *sm,\r
-                                        IN osm_sm_signal_t signal);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      signal\r
-*              [in] Signal to the state SM engine.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      State Manager\r
-*********/\r
-\r
-/****f* OpenSM: SM State Manager/osm_sm_state_mgr_signal_master_is_alive\r
-* NAME\r
-*      osm_sm_state_mgr_signal_master_is_alive\r
-*\r
-* DESCRIPTION\r
-*      Signals that the remote Master SM is alive.\r
-*      Need to clear the retry_number variable.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_state_mgr_signal_master_is_alive(IN osm_sm_t *sm);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      State Manager\r
-*********/\r
-\r
-/****f* OpenSM: SM State Manager/osm_sm_state_mgr_check_legality\r
-* NAME\r
-*      osm_sm_state_mgr_check_legality\r
-*\r
-* DESCRIPTION\r
-*      Checks the legality of the signal received, according to the\r
-*  current state of the SM state machine.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_state_mgr_check_legality(IN osm_sm_t *sm,\r
-                                               IN osm_sm_signal_t signal);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      signal\r
-*              [in] Signal to the state SM engine.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      State Manager\r
-*********/\r
-\r
-void osm_report_sm_state(osm_sm_t *sm);\r
-\r
-/****f* OpenSM: SM State Manager/osm_send_trap144\r
-* NAME\r
-*      osm_send_trap144\r
-*\r
-* DESCRIPTION\r
-*      Send trap 144 to the master SM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_send_trap144(osm_sm_t *sm, ib_net16_t local);\r
-/*\r
-* PARAMETERS\r
-*      sm\r
-*              [in] Pointer to an osm_sm_t object.\r
-*\r
-*      local\r
-*              [in] OtherLocalChanges mask in network byte order.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, non-zero value otherwise.\r
-*\r
-*********/\r
-\r
-void osm_set_sm_priority(osm_sm_t *sm, uint8_t priority);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SM_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_sm_mad_ctrl.h b/branches/opensm_3/user/include/opensm/osm_sm_mad_ctrl.h
deleted file mode 100644 (file)
index b15b822..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_sm_mad_ctrl_t.\r
- *     This object represents a controller that receives the IBA NodeInfo\r
- *     attribute from a node.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SM_MAD_CTRL_H_\r
-#define _OSM_SM_MAD_CTRL_H_\r
-\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_vl15intf.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/SM MAD Controller\r
-* NAME\r
-*      SM MAD Controller\r
-*\r
-* DESCRIPTION\r
-*      The SM MAD Controller object encapsulates\r
-*      the information needed to receive MADs from the transport layer.\r
-*\r
-*      The SM MAD Controller object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: SM MAD Controller/osm_sm_mad_ctrl_t\r
-* NAME\r
-*      osm_sm_mad_ctrl_t\r
-*\r
-* DESCRIPTION\r
-*      SM MAD Controller structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_sm_mad_ctrl {\r
-       osm_log_t *p_log;\r
-       osm_subn_t *p_subn;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       osm_vl15_t *p_vl15;\r
-       osm_vendor_t *p_vendor;\r
-       osm_bind_handle_t h_bind;\r
-       cl_plock_t *p_lock;\r
-       cl_dispatcher_t *p_disp;\r
-       cl_disp_reg_handle_t h_disp;\r
-       osm_stats_t *p_stats;\r
-} osm_sm_mad_ctrl_t;\r
-/*\r
-* FIELDS\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_subn\r
-*              Pointer to the subnet object.\r
-*\r
-*      p_mad_pool\r
-*              Pointer to the MAD pool.\r
-*\r
-*      p_vendor\r
-*              Pointer to the vendor specific interfaces object.\r
-*\r
-*      h_bind\r
-*              Bind handle returned by the transport layer.\r
-*\r
-*      p_lock\r
-*              Pointer to the serializing lock.\r
-*\r
-*      p_disp\r
-*              Pointer to the Dispatcher.\r
-*\r
-*      h_disp\r
-*              Handle returned from dispatcher registration.\r
-*\r
-*      p_stats\r
-*              Pointer to the OpenSM statistics block.\r
-*\r
-* SEE ALSO\r
-*      SM MAD Controller object\r
-*      SM MADr object\r
-*********/\r
-\r
-/****f* OpenSM: SM MAD Controller/osm_sm_mad_ctrl_construct\r
-* NAME\r
-*      osm_sm_mad_ctrl_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a SM MAD Controller object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to a SM MAD Controller\r
-*              object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_sm_mad_ctrl_init, and osm_sm_mad_ctrl_destroy.\r
-*\r
-*      Calling osm_sm_mad_ctrl_construct is a prerequisite to calling any other\r
-*      method except osm_sm_mad_ctrl_init.\r
-*\r
-* SEE ALSO\r
-*      SM MAD Controller object, osm_sm_mad_ctrl_init,\r
-*      osm_sm_mad_ctrl_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SM MAD Controller/osm_sm_mad_ctrl_destroy\r
-* NAME\r
-*      osm_sm_mad_ctrl_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_sm_mad_ctrl_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified\r
-*      SM MAD Controller object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_sm_mad_ctrl_construct or osm_sm_mad_ctrl_init.\r
-*\r
-* SEE ALSO\r
-*      SM MAD Controller object, osm_sm_mad_ctrl_construct,\r
-*      osm_sm_mad_ctrl_init\r
-*********/\r
-\r
-/****f* OpenSM: SM MAD Controller/osm_sm_mad_ctrl_init\r
-* NAME\r
-*      osm_sm_mad_ctrl_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_sm_mad_ctrl_init function initializes a\r
-*      SM MAD Controller object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                    IN osm_subn_t * p_subn,\r
-                                    IN osm_mad_pool_t * p_mad_pool,\r
-                                    IN osm_vl15_t * p_vl15,\r
-                                    IN osm_vendor_t * p_vendor,\r
-                                    IN osm_log_t * p_log,\r
-                                    IN osm_stats_t * p_stats,\r
-                                    IN cl_plock_t * p_lock,\r
-                                    IN cl_dispatcher_t * p_disp);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sm_mad_ctrl_t object to initialize.\r
-*\r
-*      p_mad_pool\r
-*              [in] Pointer to the MAD pool.\r
-*\r
-*      p_vl15\r
-*              [in] Pointer to the VL15 interface object.\r
-*\r
-*      p_vendor\r
-*              [in] Pointer to the vendor specific interfaces object.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              [in] Pointer to the OpenSM stastics block.\r
-*\r
-*      p_lock\r
-*              [in] Pointer to the OpenSM serializing lock.\r
-*\r
-*      p_disp\r
-*              [in] Pointer to the OpenSM central Dispatcher.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the SM MAD Controller object was initialized\r
-*      successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other SM MAD Controller methods.\r
-*\r
-* SEE ALSO\r
-*      SM MAD Controller object, osm_sm_mad_ctrl_construct,\r
-*      osm_sm_mad_ctrl_destroy\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_mad_ctrl_bind\r
-* NAME\r
-*      osm_sm_mad_ctrl_bind\r
-*\r
-* DESCRIPTION\r
-*      Binds the SM MAD Controller object to a port guid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                    IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sm_mad_ctrl_t object to initialize.\r
-*\r
-*      port_guid\r
-*              [in] Local port GUID with which to bind.\r
-*\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*      A given SM MAD Controller object can only be bound to one\r
-*      port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM/osm_sm_mad_ctrl_get_bind_handle\r
-* NAME\r
-*      osm_sm_mad_ctrl_get_bind_handle\r
-*\r
-* DESCRIPTION\r
-*      Returns the bind handle.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_bind_handle_t\r
-osm_sm_mad_ctrl_get_bind_handle(IN const osm_sm_mad_ctrl_t * p_ctrl)\r
-{\r
-       return p_ctrl->h_bind;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ctrl\r
-*              [in] Pointer to an osm_sm_mad_ctrl_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the bind handle, which may be OSM_BIND_INVALID_HANDLE\r
-*      if no port has been bound.\r
-*\r
-* NOTES\r
-*      A given SM MAD Controller object can only be bound to one\r
-*      port at a time.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SM_MAD_CTRL_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_stats.h b/branches/opensm_3/user/include/opensm/osm_stats.h
deleted file mode 100644 (file)
index 37f6811..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_stats_t.\r
- *     This object represents the OpenSM statistics object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_STATS_H_\r
-#define _OSM_STATS_H_\r
-\r
-#ifdef HAVE_LIBPTHREAD\r
-#include <pthread.h>\r
-#else\r
-#include <complib/cl_event.h>\r
-#endif\r
-#include <complib/cl_atomic.h>\r
-#include <opensm/osm_base.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Statistics\r
-* NAME\r
-*      OpenSM\r
-*\r
-* DESCRIPTION\r
-*      The OpenSM object encapsulates the information needed by the\r
-*      OpenSM to track interesting traffic and internal statistics.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Statistics/osm_stats_t\r
-* NAME\r
-*      osm_stats_t\r
-*\r
-* DESCRIPTION\r
-*      OpenSM statistics block.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_stats {\r
-       atomic32_t qp0_mads_outstanding;\r
-       atomic32_t qp0_mads_outstanding_on_wire;\r
-       atomic32_t qp0_mads_rcvd;\r
-       atomic32_t qp0_mads_sent;\r
-       atomic32_t qp0_unicasts_sent;\r
-       atomic32_t qp0_mads_rcvd_unknown;\r
-       atomic32_t sa_mads_outstanding;\r
-       atomic32_t sa_mads_rcvd;\r
-       atomic32_t sa_mads_sent;\r
-       atomic32_t sa_mads_rcvd_unknown;\r
-       atomic32_t sa_mads_ignored;\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_mutex_t mutex;\r
-       pthread_cond_t cond;\r
-#else\r
-       cl_event_t event;\r
-#endif\r
-} osm_stats_t;\r
-/*\r
-* FIELDS\r
-*      qp0_mads_outstanding\r
-*              Contains the number of MADs outstanding on QP0.\r
-*              When this value reaches zero, OpenSM has discovered all\r
-*              nodes on the subnet, and finished retrieving attributes.\r
-*              At that time, subnet configuration may begin.\r
-*              This variable must be manipulated using atomic instructions.\r
-*\r
-*      qp0_mads_outstanding_on_wire\r
-*              The number of MADs outstanding on the wire at any moment.\r
-*\r
-*      qp0_mads_rcvd\r
-*              Total number of QP0 MADs received.\r
-*\r
-*      qp0_mads_sent\r
-*              Total number of QP0 MADs sent.\r
-*\r
-*      qp0_unicasts_sent\r
-*              Total number of response-less MADs sent on the wire.  This count\r
-*              includes getresp(), send() and trap() methods.\r
-*\r
-*      qp0_mads_rcvd_unknown\r
-*              Total number of unknown QP0 MADs received. This includes\r
-*              unrecognized attribute IDs and methods.\r
-*\r
-*      sa_mads_outstanding\r
-*              Contains the number of SA MADs outstanding on QP1.\r
-*\r
-*      sa_mads_rcvd\r
-*              Total number of SA MADs received.\r
-*\r
-*      sa_mads_sent\r
-*              Total number of SA MADs sent.\r
-*\r
-*      sa_mads_rcvd_unknown\r
-*              Total number of unknown SA MADs received. This includes\r
-*              unrecognized attribute IDs and methods.\r
-*\r
-*      sa_mads_ignored\r
-*              Total number of SA MADs received because SM is not\r
-*              master or SM is in first time sweep.\r
-*\r
-* SEE ALSO\r
-***************/\r
-\r
-static inline uint32_t osm_stats_inc_qp0_outstanding(osm_stats_t *stats)\r
-{\r
-       uint32_t outstanding;\r
-\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_mutex_lock(&stats->mutex);\r
-       outstanding = ++stats->qp0_mads_outstanding;\r
-       pthread_mutex_unlock(&stats->mutex);\r
-#else\r
-       outstanding = cl_atomic_inc(&stats->qp0_mads_outstanding);\r
-#endif\r
-\r
-       return outstanding;\r
-}\r
-\r
-static inline uint32_t osm_stats_dec_qp0_outstanding(osm_stats_t *stats)\r
-{\r
-       uint32_t outstanding;\r
-\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_mutex_lock(&stats->mutex);\r
-       outstanding = --stats->qp0_mads_outstanding;\r
-       if (!outstanding)\r
-               pthread_cond_signal(&stats->cond);\r
-       pthread_mutex_unlock(&stats->mutex);\r
-#else\r
-       outstanding = cl_atomic_dec(&stats->qp0_mads_outstanding);\r
-       if (!outstanding)\r
-               cl_event_signal(&stats->event);\r
-#endif\r
-\r
-       return outstanding;\r
-}\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_STATS_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_subnet.h b/branches/opensm_3/user/include/opensm/osm_subnet.h
deleted file mode 100644 (file)
index 94079f1..0000000
+++ /dev/null
@@ -1,1185 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_subn_t.\r
- *     This object represents an IBA subnet.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SUBNET_H_\r
-#define _OSM_SUBNET_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_fleximap.h>\r
-#include <complib/cl_map.h>\r
-#include <complib/cl_ptr_vector.h>\r
-#include <complib/cl_list.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_prefix_route.h>\r
-#include <stdio.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define OSM_SUBNET_VECTOR_MIN_SIZE                     0\r
-#define OSM_SUBNET_VECTOR_GROW_SIZE                    1\r
-#define OSM_SUBNET_VECTOR_CAPACITY                     256\r
-struct osm_opensm;\r
-struct osm_qos_policy;\r
-\r
-/****h* OpenSM/Subnet\r
-* NAME\r
-*      Subnet\r
-*\r
-* DESCRIPTION\r
-*      The Subnet object encapsulates the information needed by the\r
-*      OpenSM to manage a subnet.  The OpenSM allocates one Subnet object\r
-*      per IBA subnet.\r
-*\r
-*      The Subnet object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object is essentially a container for the various components\r
-*      of a subnet.  Callers may directly access the member variables.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Subnet/osm_qos_options_t\r
-* NAME\r
-*      osm_qos_options_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet QoS options structure.  This structure contains the various\r
-*      QoS specific configuration parameters for the subnet.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_qos_options {\r
-       unsigned max_vls;\r
-       int high_limit;\r
-       char *vlarb_high;\r
-       char *vlarb_low;\r
-       char *sl2vl;\r
-} osm_qos_options_t;\r
-/*\r
-* FIELDS\r
-*\r
-*      max_vls\r
-*              The number of maximum VLs on the Subnet (0 == use default)\r
-*\r
-*      high_limit\r
-*              The limit of High Priority component of VL Arbitration\r
-*              table (IBA 7.6.9) (-1 == use default)\r
-*\r
-*      vlarb_high\r
-*              High priority VL Arbitration table template. (NULL == use default)\r
-*\r
-*      vlarb_low\r
-*              Low priority VL Arbitration table template. (NULL == use default)\r
-*\r
-*      sl2vl\r
-*              SL2VL Mapping table (IBA 7.6.6) template. (NULL == use default)\r
-*\r
-*********/\r
-\r
-/****s* OpenSM: Subnet/osm_subn_opt_t\r
-* NAME\r
-*      osm_subn_opt_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet options structure.  This structure contains the various\r
-*      site specific configuration parameters for the subnet.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_subn_opt {\r
-       char *config_file;\r
-       ib_net64_t guid;\r
-       ib_net64_t m_key;\r
-       ib_net64_t sm_key;\r
-       ib_net64_t sa_key;\r
-       ib_net64_t subnet_prefix;\r
-       ib_net16_t m_key_lease_period;\r
-       uint32_t sweep_interval;\r
-       uint32_t max_wire_smps;\r
-       uint32_t transaction_timeout;\r
-       uint32_t transaction_retries;\r
-       uint8_t sm_priority;\r
-       uint8_t lmc;\r
-       boolean_t lmc_esp0;\r
-       uint8_t max_op_vls;\r
-       uint8_t force_link_speed;\r
-       boolean_t reassign_lids;\r
-       boolean_t ignore_other_sm;\r
-       boolean_t single_thread;\r
-       boolean_t disable_multicast;\r
-       boolean_t force_log_flush;\r
-       uint8_t subnet_timeout;\r
-       uint8_t packet_life_time;\r
-       uint8_t vl_stall_count;\r
-       uint8_t leaf_vl_stall_count;\r
-       uint8_t head_of_queue_lifetime;\r
-       uint8_t leaf_head_of_queue_lifetime;\r
-       uint8_t local_phy_errors_threshold;\r
-       uint8_t overrun_errors_threshold;\r
-       uint32_t sminfo_polling_timeout;\r
-       uint32_t polling_retry_number;\r
-       uint32_t max_msg_fifo_timeout;\r
-       boolean_t force_heavy_sweep;\r
-       uint8_t log_flags;\r
-       char *dump_files_dir;\r
-       char *log_file;\r
-       unsigned long log_max_size;\r
-       char *partition_config_file;\r
-       boolean_t no_partition_enforcement;\r
-       boolean_t qos;\r
-       char *qos_policy_file;\r
-       boolean_t accum_log_file;\r
-       char *console;\r
-       uint16_t console_port;\r
-       char *port_prof_ignore_file;\r
-       char *hop_weights_file;\r
-       char *dimn_ports_file;\r
-       boolean_t port_profile_switch_nodes;\r
-       boolean_t sweep_on_trap;\r
-       char *routing_engine_names;\r
-       boolean_t use_ucast_cache;\r
-       boolean_t connect_roots;\r
-       char *lid_matrix_dump_file;\r
-       char *lfts_file;\r
-       char *root_guid_file;\r
-       char *cn_guid_file;\r
-       char *io_guid_file;\r
-       uint16_t max_reverse_hops;\r
-       char *ids_guid_file;\r
-       char *guid_routing_order_file;\r
-       char *sa_db_file;\r
-       boolean_t sa_db_dump;\r
-       boolean_t do_mesh_analysis;\r
-       boolean_t exit_on_fatal;\r
-       boolean_t honor_guid2lid_file;\r
-       boolean_t daemon;\r
-       boolean_t sm_inactive;\r
-       boolean_t babbling_port_policy;\r
-       boolean_t use_optimized_slvl;\r
-       osm_qos_options_t qos_options;\r
-       osm_qos_options_t qos_ca_options;\r
-       osm_qos_options_t qos_sw0_options;\r
-       osm_qos_options_t qos_swe_options;\r
-       osm_qos_options_t qos_rtr_options;\r
-       boolean_t enable_quirks;\r
-       boolean_t no_clients_rereg;\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       boolean_t perfmgr;\r
-       boolean_t perfmgr_redir;\r
-       uint16_t perfmgr_sweep_time_s;\r
-       uint32_t perfmgr_max_outstanding_queries;\r
-       char *event_db_dump_file;\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-       char *event_plugin_name;\r
-       char *event_plugin_options;\r
-       char *node_name_map_name;\r
-       char *prefix_routes_file;\r
-       char *log_prefix;\r
-       boolean_t consolidate_ipv6_snm_req;\r
-       struct osm_subn_opt *file_opts; /* used for update */\r
-       uint8_t lash_start_vl;                  /* starting vl to use in lash */\r
-       uint8_t sm_sl;                  /* which SL to use for SM/SA communication */\r
-} osm_subn_opt_t;\r
-/*\r
-* FIELDS\r
-*\r
-*      config_file\r
-*              The name of the config file.\r
-*\r
-*      guid\r
-*              The port guid that the SM is binding to.\r
-*\r
-*      m_key\r
-*              M_Key value sent to all ports qualifying all Set(PortInfo).\r
-*\r
-*      sm_key\r
-*              SM_Key value of the SM used for SM authentication.\r
-*\r
-*      sa_key\r
-*              SM_Key value to qualify rcv SA queries as "trusted".\r
-*\r
-*      subnet_prefix\r
-*              Subnet prefix used on this subnet.\r
-*\r
-*      m_key_lease_period\r
-*              The lease period used for the M_Key on this subnet.\r
-*\r
-*      sweep_interval\r
-*              The number of seconds between subnet sweeps.  A value of 0\r
-*              disables sweeping.\r
-*\r
-*      max_wire_smps\r
-*              The maximum number of SMPs sent in parallel.  Default is 4.\r
-*\r
-*      transaction_timeout\r
-*              The maximum time in milliseconds allowed for a transaction\r
-*              to complete.  Default is 200.\r
-*\r
-*      transaction_retries\r
-*              The number of retries for a transaction. Default is 3.\r
-*\r
-*      sm_priority\r
-*              The priority of this SM as specified by the user.  This\r
-*              value is made available in the SMInfo attribute.\r
-*\r
-*      lmc\r
-*              The LMC value used on this subnet.\r
-*\r
-*      lmc_esp0\r
-*              Whether LMC value used on subnet should be used for\r
-*              enhanced switch port 0 or not.  If TRUE, it is used.\r
-*              Otherwise (the default), LMC is set to 0 for ESP0.\r
-*\r
-*      max_op_vls\r
-*              Limit the maximal operational VLs. default is 1.\r
-*\r
-*      reassign_lids\r
-*              If TRUE cause all lids to be re-assigend.\r
-*              Otherwise (the default),\r
-*              OpenSM always tries to preserve as LIDs as much as possible.\r
-*\r
-*      ignore_other_sm_option\r
-*              This flag is TRUE if other SMs on the subnet should be ignored.\r
-*\r
-*      disable_multicast\r
-*              This flag is TRUE if OpenSM should disable multicast support.\r
-*\r
-*      max_msg_fifo_timeout\r
-*              The maximal time a message can stay in the incoming message\r
-*              queue. If there is more than one message in the queue and the\r
-*              last message stayed in the queue more than this value the SA\r
-*              request will be immediately returned with a BUSY status.\r
-*\r
-*      subnet_timeout\r
-*              The subnet_timeout that will be set for all the ports in the\r
-*              design SubnSet(PortInfo.vl_stall_life))\r
-*\r
-*      vl_stall_count\r
-*              The number of sequential packets dropped that cause the port\r
-*              to enter the VLStalled state.\r
-*\r
-*      leaf_vl_stall_count\r
-*              The number of sequential packets dropped that cause the port\r
-*              to enter the VLStalled state. This is for switch ports driving\r
-*              a CA or router port.\r
-*\r
-*      head_of_queue_lifetime\r
-*              The maximal time a packet can live at the head of a VL queue\r
-*              on any port not driving a CA or router port.\r
-*\r
-*      leaf_head_of_queue_lifetime\r
-*              The maximal time a packet can live at the head of a VL queue\r
-*              on switch ports driving a CA or router.\r
-*\r
-*      local_phy_errors_threshold\r
-*              Threshold of local phy errors for sending Trap 129\r
-*\r
-*      overrun_errors_threshold\r
-*              Threshold of credits overrun errors for sending Trap 129\r
-*\r
-*      sminfo_polling_timeout\r
-*              Specifies the polling timeout (in milliseconds) - the timeout\r
-*              between one poll to another.\r
-*\r
-*      packet_life_time\r
-*              The maximal time a packet can stay in a switch.\r
-*              The value is send to all switches as\r
-*              SubnSet(SwitchInfo.life_state)\r
-*\r
-*      dump_files_dir\r
-*              The directory to be used for opensm-subnet.lst, opensm.fdbs,\r
-*              opensm.mcfdbs, and default log file (the latter for Windows,\r
-*              not Linux).\r
-*\r
-*      log_file\r
-*              Name of the log file (or NULL) for stdout.\r
-*\r
-*      log_max_size\r
-*              This option defines maximal log file size in MB. When\r
-*              specified the log file will be truncated upon reaching\r
-*              this limit.\r
-*\r
-*      qos\r
-*              Boolean that specifies whether the OpenSM QoS functionality\r
-*              should be off or on.\r
-*\r
-*      qos_policy_file\r
-*              Name of the QoS policy file.\r
-*\r
-*      accum_log_file\r
-*              If TRUE (default) - the log file will be accumulated.\r
-*              If FALSE - the log file will be erased before starting\r
-*              current opensm run.\r
-*\r
-*      port_prof_ignore_file\r
-*              Name of file with port guids to be ignored by port profiling.\r
-*\r
-*      port_profile_switch_nodes\r
-*              If TRUE will count the number of switch nodes routed through\r
-*              the link. If FALSE - only CA/RT nodes are counted.\r
-*\r
-*      sweep_on_trap\r
-*              Received traps will initiate a new sweep.\r
-*\r
-*      routing_engine_names\r
-*              Name of routing engine(s) to use.\r
-*\r
-*      connect_roots\r
-*              The option which will enforce root to root connectivity with\r
-*              up/down and fat-tree routing engines (even if this violates\r
-*              "pure" deadlock free up/down or fat-tree algorithm)\r
-*\r
-*      use_ucast_cache\r
-*              When TRUE enables unicast routing cache.\r
-*\r
-*      lid_matrix_dump_file\r
-*              Name of the lid matrix dump file from where switch\r
-*              lid matrices (min hops tables) will be loaded\r
-*\r
-*      lfts_file\r
-*              Name of the unicast LFTs routing file from where switch\r
-*              forwarding tables will be loaded\r
-*\r
-*      root_guid_file\r
-*              Name of the file that contains list of root guids that\r
-*              will be used by fat-tree or up/dn routing (provided by User)\r
-*\r
-*      cn_guid_file\r
-*              Name of the file that contains list of compute node guids that\r
-*              will be used by fat-tree routing (provided by User)\r
-*\r
-*      io_guid_file\r
-*              Name of the file that contains list of I/O node guids that\r
-*              will be used by fat-tree routing (provided by User)\r
-*\r
-*      ids_guid_file\r
-*              Name of the file that contains list of ids which should be\r
-*              used by Up/Down algorithm instead of node GUIDs\r
-*\r
-*      guid_routing_order_file\r
-*              Name of the file that contains list of guids for routing order\r
-*              that will be used by minhop and up/dn routing (provided by User).\r
-*\r
-*      sa_db_file\r
-*              Name of the SA database file.\r
-*\r
-*      sa_db_dump\r
-*              When TRUE causes OpenSM to dump SA DB at the end of every\r
-*              light sweep regardless the current verbosity level.\r
-*\r
-*      exit_on_fatal\r
-*              If TRUE (default) - SM will exit on fatal subnet initialization\r
-*              issues.\r
-*              If FALSE - SM will not exit.\r
-*              Fatal initialization issues:\r
-*              a. SM recognizes 2 different nodes with the same guid, or\r
-*                 12x link with lane reversal badly configured.\r
-*\r
-*      honor_guid2lid_file\r
-*              Always honor the guid2lid file if it exists and is valid. This\r
-*              means that the file will be honored when SM is coming out of\r
-*              STANDBY. By default this is FALSE.\r
-*\r
-*      daemon\r
-*              OpenSM will run in daemon mode.\r
-*\r
-*      sm_inactive\r
-*              OpenSM will start with SM in not active state.\r
-*\r
-*      babbling_port_policy\r
-*              OpenSM will enforce its "babbling" port policy.\r
-*\r
-*      use_optimized_slvl\r
-*              Use optimized SLtoVLMappingTable programming if\r
-*              device indicates it supports this.\r
-*\r
-*      perfmgr\r
-*              Enable or disable the performance manager\r
-*\r
-*      perfmgr_redir\r
-*              Enable or disable the saving of redirection by PerfMgr\r
-*\r
-*      perfmgr_sweep_time_s\r
-*              Define the period (in seconds) of PerfMgr sweeps\r
-*\r
-*       event_db_dump_file\r
-*               File to dump the event database to\r
-*\r
-*       event_plugin_name\r
-*               Specify the name(s) of the event plugin(s)\r
-*\r
-*       event_plugin_options\r
-*               Options string that would be passed to the plugin(s)\r
-*\r
-*      qos_options\r
-*              Default set of QoS options\r
-*\r
-*      qos_ca_options\r
-*              QoS options for CA ports\r
-*\r
-*      qos_sw0_options\r
-*              QoS options for switches' port 0\r
-*\r
-*      qos_swe_options\r
-*              QoS options for switches' external ports\r
-*\r
-*      qos_rtr_options\r
-*              QoS options for router ports\r
-*\r
-*      enable_quirks\r
-*              Enable high risk new features and not fully qualified\r
-*              hardware specific work arounds\r
-*\r
-*      no_clients_rereg\r
-*              When TRUE disables clients reregistration request.\r
-*\r
-* SEE ALSO\r
-*      Subnet object\r
-*********/\r
-\r
-/****s* OpenSM: Subnet/osm_subn_t\r
-* NAME\r
-*      osm_subn_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet structure.  Callers may directly access member components,\r
-*      after grabbing a lock.\r
-*\r
-* TO DO\r
-*      This structure should probably be volatile.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_subn {\r
-       struct osm_opensm *p_osm;\r
-       cl_qmap_t sw_guid_tbl;\r
-       cl_qmap_t node_guid_tbl;\r
-       cl_qmap_t port_guid_tbl;\r
-       cl_qmap_t rtr_guid_tbl;\r
-       cl_qlist_t prefix_routes_list;\r
-       cl_qmap_t prtn_pkey_tbl;\r
-       cl_qmap_t sm_guid_tbl;\r
-       cl_qlist_t sa_sr_list;\r
-       cl_qlist_t sa_infr_list;\r
-       cl_ptr_vector_t port_lid_tbl;\r
-       ib_net16_t master_sm_base_lid;\r
-       ib_net16_t sm_base_lid;\r
-       ib_net64_t sm_port_guid;\r
-       uint8_t sm_state;\r
-       osm_subn_opt_t opt;\r
-       struct osm_qos_policy *p_qos_policy;\r
-       uint16_t max_ucast_lid_ho;\r
-       uint16_t max_mcast_lid_ho;\r
-       uint8_t min_ca_mtu;\r
-       uint8_t min_ca_rate;\r
-       boolean_t ignore_existing_lfts;\r
-       boolean_t subnet_initialization_error;\r
-       boolean_t force_heavy_sweep;\r
-       boolean_t force_reroute;\r
-       boolean_t in_sweep_hop_0;\r
-       boolean_t first_time_master_sweep;\r
-       boolean_t coming_out_of_standby;\r
-       unsigned need_update;\r
-       cl_fmap_t mgrp_mgid_tbl;\r
-       void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];\r
-} osm_subn_t;\r
-/*\r
-* FIELDS\r
-*      sw_guid_tbl\r
-*              Container of pointers to all Switch objects in the subent.\r
-*              Indexed by node GUID.\r
-*\r
-*      node_guid_tbl\r
-*              Container of pointers to all Node objects in the subent.\r
-*              Indexed by node GUID.\r
-*\r
-*      port_guid_tbl\r
-*              Container of pointers to all Port objects in the subent.\r
-*              Indexed by port GUID - network order!\r
-*\r
-*      rtr_guid_tbl\r
-*              Container of pointers to all Router objects in the subent.\r
-*              Indexed by node GUID.\r
-*\r
-*      prtn_pkey_tbl\r
-*              Container of pointers to all Partition objects in the subnet.\r
-*              Indexed by P_KEY.\r
-*\r
-*      sm_guid_tbl\r
-*              Container of pointers to SM objects representing other SMs\r
-*              on the subnet.\r
-*\r
-*      port_lid_tbl\r
-*              Container of pointers to all Port objects in the subent.\r
-*              Indexed by port LID.\r
-*\r
-*      master_sm_base_lid\r
-*              The base LID owned by the subnet's master SM.\r
-*\r
-*      sm_base_lid\r
-*              The base LID of the local port where the SM is.\r
-*\r
-*      sm_port_guid\r
-*              This SM's own port GUID.\r
-*\r
-*      sm_state\r
-*              The high-level state of the SM.  This value is made available\r
-*              in the SMInfo attribute.\r
-*\r
-*      opt\r
-*              Subnet options structure contains site specific configuration.\r
-*\r
-*      p_qos_policy\r
-*              Subnet QoS policy structure.\r
-*\r
-*      max_ucast_lid_ho\r
-*              The minimal max unicast lid reported by all switches\r
-*\r
-*      max_mcast_lid_ho\r
-*              The minimal max multicast lid reported by all switches\r
-*\r
-*      min_ca_mtu\r
-*              The minimal MTU reported by all CAs ports on the subnet\r
-*\r
-*      min_ca_rate\r
-*              The minimal rate reported by all CA ports on the subnet\r
-*\r
-*      ignore_existing_lfts\r
-*              This flag is a dynamic flag to instruct the LFT assignment to\r
-*              ignore existing legal LFT settings.\r
-*              The value will be set according to :\r
-*              - Any change to the list of switches will set it to high\r
-*              - Coming out of STANDBY it will be cleared (other SM worked)\r
-*              - Set to FALSE upon end of all lft assignments.\r
-*\r
-*      subnet_initalization_error\r
-*              Similar to the force_heavy_sweep flag. If TRUE - means that\r
-*              we had errors during initialization (due to SubnSet requests\r
-*              that failed). We want to declare the subnet as unhealthy, and\r
-*              force another heavy sweep.\r
-*\r
-*      force_heavy_sweep\r
-*              If TRUE - we want to force a heavy sweep. This can be done\r
-*              either due to receiving of trap - meaning there is some change\r
-*              on the subnet, or we received a handover from a remote sm.\r
-*              In this case we want to sweep and reconfigure the entire\r
-*              subnet. This will cause another heavy sweep to occure when\r
-*              the current sweep is done.\r
-*\r
-*      force_reroute\r
-*              If TRUE - we want to force switches in the fabric to be\r
-*              rerouted.\r
-*\r
-*      in_sweep_hop_0\r
-*              When in_sweep_hop_0 flag is set to TRUE - this means we are\r
-*              in sweep_hop_0 - meaning we do not want to continue beyond\r
-*              the current node.\r
-*              This is relevant for the case of SM on switch, since in the\r
-*              switch info we need to signal somehow not to continue\r
-*              the sweeping.\r
-*\r
-*      first_time_master_sweep\r
-*              This flag is used for the PortInfo setting. On the first\r
-*              sweep as master (meaning after moving from Standby|Discovering\r
-*              state), the SM must send a PortInfoSet to all ports. After\r
-*              that - we want to minimize the number of PortInfoSet requests\r
-*              sent, and to send only requests that change the value from\r
-*              what is updated in the port (or send a first request if this\r
-*              is a new port). We will set this flag to TRUE when entering\r
-*              the master state, and set it back to FALSE at the end of the\r
-*              drop manager. This is done since at the end of the drop manager\r
-*              we have updated all the ports that are reachable, and from now\r
-*              on these are the only ports we have data of. We don't want\r
-*              to send extra set requests to these ports anymore.\r
-*\r
-*      coming_out_of_standby\r
-*              TRUE on the first sweep after the SM was in standby.\r
-*              Used for nulling any cache of LID and Routing.\r
-*              The flag is set true if the SM state was standby and now\r
-*              changed to MASTER it is reset at the end of the sweep.\r
-*\r
-*      need_update\r
-*              This flag should be on during first non-master heavy\r
-*              (including pre-master discovery stage)\r
-*\r
-*      mgrp_mgid_tbl\r
-*              Container of pointers to all Multicast group objects in\r
-*              the subnet. Indexed by MGID.\r
-*\r
-*      mboxes\r
-*              Array of pointers to all Multicast MLID box objects in the\r
-*              subnet. Indexed by MLID offset from base MLID.\r
-*\r
-* SEE ALSO\r
-*      Subnet object\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_construct\r
-* NAME\r
-*      osm_subn_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a Subnet object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_subn_construct(IN osm_subn_t * p_subn);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to a Subnet object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_subn_init, and osm_subn_destroy.\r
-*\r
-*      Calling osm_subn_construct is a prerequisite to calling any other\r
-*      method except osm_subn_init.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_init, osm_subn_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_destroy\r
-* NAME\r
-*      osm_subn_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_subn_destroy function destroys a subnet, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_subn_destroy(IN osm_subn_t * p_subn);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to a Subnet object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified Subnet object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_subn_construct\r
-*      or osm_subn_init.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_init\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_init\r
-* NAME\r
-*      osm_subn_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_subn_init function initializes a Subnet object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn,\r
-                             IN struct osm_opensm *p_osm,\r
-                             IN const osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object to initialize.\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the Subnet object was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other Subnet methods.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_destroy\r
-*********/\r
-\r
-/*\r
-  Forward references.\r
-*/\r
-struct osm_mad_addr;\r
-struct osm_log;\r
-struct osm_switch;\r
-struct osm_physp;\r
-struct osm_port;\r
-struct osm_mgrp;\r
-\r
-/****f* OpenSM: Helper/osm_get_gid_by_mad_addr\r
-* NAME\r
-*      osm_get_gid_by_mad_addr\r
-*\r
-* DESCRIPTION\r
-*      Looks for the requester gid in the mad address.\r
-*\r
-* Note: This code is not thread safe. Need to grab the lock before\r
-* calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_get_gid_by_mad_addr(IN struct osm_log *p_log,\r
-                                       IN const osm_subn_t * p_subn,\r
-                                       IN struct osm_mad_addr *p_mad_addr,\r
-                                       OUT ib_gid_t * p_gid);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to subnet object.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to mad address object.\r
-*\r
-*      p_gid\r
-*              [out] Pointer to the GID structure to fill in.\r
-*\r
-* RETURN VALUES\r
-*     IB_SUCCESS if able to find the GID by address given.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_get_physp_by_mad_addr\r
-* NAME\r
-*      osm_get_physp_by_mad_addr\r
-*\r
-* DESCRIPTION\r
-*      Looks for the requester physical port in the mad address.\r
-*\r
-* Note: This code is not thread safe. Need to grab the lock before\r
-* calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_physp *osm_get_physp_by_mad_addr(IN struct osm_log *p_log,\r
-                                            IN const osm_subn_t * p_subn,\r
-                                            IN struct osm_mad_addr\r
-                                            *p_mad_addr);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to subnet object.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to mad address object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to requester physical port object if found. Null otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Helper/osm_get_port_by_mad_addr\r
-* NAME\r
-*      osm_get_port_by_mad_addr\r
-*\r
-* DESCRIPTION\r
-*      Looks for the requester port in the mad address.\r
-*\r
-* Note: This code is not thread safe. Need to grab the lock before\r
-* calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_port *osm_get_port_by_mad_addr(IN struct osm_log *p_log,\r
-                                          IN const osm_subn_t * p_subn,\r
-                                          IN struct osm_mad_addr *p_mad_addr);\r
-/*\r
-* PARAMETERS\r
-*      p_log\r
-*              [in] Pointer to a log object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to subnet object.\r
-*\r
-*      p_mad_addr\r
-*              [in] Pointer to mad address object.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to requester port object if found. Null otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_get_switch_by_guid\r
-* NAME\r
-*      osm_get_switch_by_guid\r
-*\r
-* DESCRIPTION\r
-*      Looks for the given switch guid in the subnet table of switches by guid.\r
-*  NOTE: this code is not thread safe. Need to grab the lock before\r
-*  calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_switch *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,\r
-                                         IN uint64_t guid);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object\r
-*\r
-*      guid\r
-*              [in] The node guid in host order\r
-*\r
-* RETURN VALUES\r
-*      The switch structure pointer if found. NULL otherwise.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_destroy,\r
-*      osm_switch_t\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_get_node_by_guid\r
-* NAME\r
-*      osm_get_node_by_guid\r
-*\r
-* DESCRIPTION\r
-*      The looks for the given node giud in the subnet table of nodes by guid.\r
-*  NOTE: this code is not thread safe. Need to grab the lock before\r
-*  calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_node *osm_get_node_by_guid(IN osm_subn_t const *p_subn,\r
-                                     IN uint64_t guid);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object\r
-*\r
-*      guid\r
-*              [in] The node guid in host order\r
-*\r
-* RETURN VALUES\r
-*      The node structure pointer if found. NULL otherwise.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_destroy,\r
-*      osm_node_t\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_get_port_by_guid\r
-* NAME\r
-*      osm_get_port_by_guid\r
-*\r
-* DESCRIPTION\r
-*      The looks for the given port guid in the subnet table of ports by guid.\r
-*  NOTE: this code is not thread safe. Need to grab the lock before\r
-*  calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,\r
-                                     IN ib_net64_t guid);\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object\r
-*\r
-*      guid\r
-*              [in] The port guid in network order\r
-*\r
-* RETURN VALUES\r
-*      The port structure pointer if found. NULL otherwise.\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_destroy,\r
-*      osm_port_t\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_get_port_by_lid_ho\r
-* NAME\r
-*      osm_get_port_by_lid_ho\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer of the port object for given lid value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_port *osm_get_port_by_lid_ho(const osm_subn_t * subn, uint16_t lid);\r
-/*\r
-* PARAMETERS\r
-*      subn\r
-*              [in] Pointer to the subnet data structure.\r
-*\r
-*      lid\r
-*              [in] LID requested in hot byte order.\r
-*\r
-* RETURN VALUES\r
-*      The port structure pointer if found. NULL otherwise.\r
-*\r
-* SEE ALSO\r
-*       Subnet object, osm_port_t\r
-*********/\r
-\r
-/****f* OpenSM: Port/osm_get_port_by_lid\r
-* NAME\r
-*      osm_get_port_by_lid\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer of the port object for given lid value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline struct osm_port *osm_get_port_by_lid(IN osm_subn_t const * subn,\r
-                                                  IN ib_net16_t lid)\r
-{\r
-       return osm_get_port_by_lid_ho(subn, cl_ntoh16(lid));\r
-}\r
-/*\r
-* PARAMETERS\r
-*      subn\r
-*              [in] Pointer to the subnet data structure.\r
-*\r
-*      lid\r
-*              [in] LID requested in network byte order.\r
-*\r
-* RETURN VALUES\r
-*      The port structure pointer if found. NULL otherwise.\r
-*\r
-* SEE ALSO\r
-*       Subnet object, osm_port_t\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_get_mgrp_by_mgid\r
-* NAME\r
-*      osm_get_mgrp_by_mgid\r
-*\r
-* DESCRIPTION\r
-*      The looks for the given multicast group in the subnet table by mgid.\r
-*      NOTE: this code is not thread safe. Need to grab the lock before\r
-*      calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_mgrp *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid);\r
-/*\r
-* PARAMETERS\r
-*      subn\r
-*              [in] Pointer to an osm_subn_t object\r
-*\r
-*      mgid\r
-*              [in] The multicast group MGID value\r
-*\r
-* RETURN VALUES\r
-*      The multicast group structure pointer if found. NULL otherwise.\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_get_mbox_by_mlid\r
-* NAME\r
-*      osm_get_mbox_by_mlid\r
-*\r
-* DESCRIPTION\r
-*      The looks for the given multicast group in the subnet table by mlid.\r
-*      NOTE: this code is not thread safe. Need to grab the lock before\r
-*      calling it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline struct osm_mgrp_box *osm_get_mbox_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)\r
-{\r
-       return p_subn->mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object\r
-*\r
-*      mlid\r
-*              [in] The multicast group mlid in network order\r
-*\r
-* RETURN VALUES\r
-*      The multicast group structure pointer if found. NULL otherwise.\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_set_default_opt\r
-* NAME\r
-*      osm_subn_set_default_opt\r
-*\r
-* DESCRIPTION\r
-*      The osm_subn_set_default_opt function sets the default options.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Subnet object, osm_subn_construct, osm_subn_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_parse_conf_file\r
-* NAME\r
-*      osm_subn_parse_conf_file\r
-*\r
-* DESCRIPTION\r
-*      The osm_subn_parse_conf_file function parses the configuration file\r
-*      and sets the defaults accordingly.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_subn_parse_conf_file(char *conf_file, osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, positive value if file doesn't exist,\r
-*      negative value otherwise\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_rescan_conf_files\r
-* NAME\r
-*      osm_subn_rescan_conf_files\r
-*\r
-* DESCRIPTION\r
-*      The osm_subn_rescan_conf_files function parses the configuration\r
-*      files and update selected subnet options\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_subn\r
-*              [in] Pointer to the subnet structure.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, positive value if file doesn't exist,\r
-*      negative value otherwise\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_output_conf\r
-* NAME\r
-*      osm_subn_output_conf\r
-*\r
-* DESCRIPTION\r
-*      Output configuration info\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      out\r
-*              [in] File stream to output to.\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, negative value otherwise\r
-*********/\r
-\r
-/****f* OpenSM: Subnet/osm_subn_write_conf_file\r
-* NAME\r
-*      osm_subn_write_conf_file\r
-*\r
-* DESCRIPTION\r
-*      Write the configuration file into the cache\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * p_opt);\r
-/*\r
-* PARAMETERS\r
-*\r
-*      p_opt\r
-*              [in] Pointer to the subnet options structure.\r
-*\r
-* RETURN VALUES\r
-*      0 on success, negative value otherwise\r
-*\r
-* NOTES\r
-*      Assumes the conf file is part of the cache dir which defaults to\r
-*      OSM_DEFAULT_CACHE_DIR or OSM_CACHE_DIR the name is opensm.opts\r
-*********/\r
-int osm_subn_verify_config(osm_subn_opt_t * p_opt);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SUBNET_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_switch.h b/branches/opensm_3/user/include/opensm/osm_switch.h
deleted file mode 100644 (file)
index 7fe1142..0000000
+++ /dev/null
@@ -1,1143 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_switch_t.\r
- *     This object represents an IBA switch.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_SWITCH_H_\r
-#define _OSM_SWITCH_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_mcast_tbl.h>\r
-#include <opensm/osm_port_profile.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Switch\r
-* NAME\r
-*      Switch\r
-*\r
-* DESCRIPTION\r
-*      The Switch object encapsulates the information needed by the\r
-*      OpenSM to manage switches.  The OpenSM allocates one switch object\r
-*      per switch in the IBA subnet.\r
-*\r
-*      The Switch object is not thread safe, thus callers must provide\r
-*      serialization.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Switch/osm_switch_t\r
-* NAME\r
-*      osm_switch_t\r
-*\r
-* DESCRIPTION\r
-*      Switch structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_switch {\r
-       cl_map_item_t map_item;\r
-       osm_node_t *p_node;\r
-       ib_switch_info_t switch_info;\r
-       uint16_t max_lid_ho;\r
-       uint8_t num_ports;\r
-       uint16_t num_hops;\r
-       uint8_t **hops;\r
-       osm_port_profile_t *p_prof;\r
-       uint8_t *dimn_ports;\r
-       uint8_t *lft;\r
-       uint8_t *new_lft;\r
-       uint16_t lft_size;\r
-       osm_mcast_tbl_t mcast_tbl;\r
-       int32_t mft_block_num;\r
-       uint32_t mft_position;\r
-       unsigned endport_links;\r
-       unsigned need_update;\r
-       void *priv;\r
-       cl_map_item_t mgrp_item;\r
-       uint32_t num_of_mcm;\r
-       uint8_t is_mc_member;\r
-} osm_switch_t;\r
-/*\r
-* FIELDS\r
-*      map_item\r
-*              Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!\r
-*\r
-*      p_node\r
-*              Pointer to the Node object for this switch.\r
-*\r
-*      switch_info\r
-*              IBA defined SwitchInfo structure for this switch.\r
-*\r
-*      max_lid_ho\r
-*              Max LID that is accessible from this switch.\r
-*\r
-*      num_ports\r
-*              Number of ports for this switch.\r
-*\r
-*      num_hops\r
-*              Size of hops table for this switch.\r
-*\r
-*      hops\r
-*              LID Matrix for this switch containing the hop count\r
-*              to every LID from every port.\r
-*\r
-*      p_prof\r
-*              Pointer to array of Port Profile objects for this switch.\r
-*\r
-*      lft\r
-*              This switch's linear forwarding table.\r
-*\r
-*      new_lft\r
-*              This switch's linear forwarding table, as was\r
-*              calculated by the last routing engine execution.\r
-*\r
-*      mcast_tbl\r
-*              Multicast forwarding table for this switch.\r
-*\r
-*      need_update\r
-*              When set indicates that switch was probably reset, so\r
-*              fwd tables and rest cached data should be flushed\r
-*\r
-*      mgrp_item\r
-*              map item for switch in building mcast tree\r
-*\r
-*      num_of_mcm\r
-*              number of mcast members(ports) connected to switch\r
-*\r
-*      is_mc_member\r
-*              whether switch is a mcast member itself\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****s* OpenSM: Switch/struct osm_remote_guids_count\r
-* NAME\r
-*      struct osm_remote_guids_count\r
-*\r
-* DESCRIPTION\r
-*      Stores array of pointers to remote node and the numbers of\r
-*      times a switch has forwarded to it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-struct osm_remote_guids_count {\r
-       unsigned count;\r
-       struct osm_remote_node {\r
-               osm_node_t *node;\r
-               unsigned forwarded_to;\r
-               uint8_t port;\r
-       } guids[0];\r
-};\r
-/*\r
-* FIELDS\r
-*      count\r
-*              A number of used entries in array.\r
-*\r
-*      node\r
-*              A pointer to node.\r
-*\r
-*      forwarded_to\r
-*              A count of lids forwarded to this node.\r
-*\r
-*      port\r
-*              Port number on the node.\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_delete\r
-* NAME\r
-*      osm_switch_delete\r
-*\r
-* DESCRIPTION\r
-*      Destroys and deallocates the object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_switch_delete(IN OUT osm_switch_t ** pp_sw);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object, osm_switch_new\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_new\r
-* NAME\r
-*      osm_switch_new\r
-*\r
-* DESCRIPTION\r
-*      The osm_switch_new function initializes a Switch object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_switch_t *osm_switch_new(IN osm_node_t * p_node,\r
-                            IN const osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_node\r
-*              [in] Pointer to the node object of this switch\r
-*\r
-*      p_madw\r
-*              [in] Pointer to the MAD Wrapper containing the switch's\r
-*              SwitchInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the new initialized switch object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object, osm_switch_delete\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_hop_count\r
-* NAME\r
-*      osm_switch_get_hop_count\r
-*\r
-* DESCRIPTION\r
-*      Returns the hop count at the specified LID/Port intersection.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_switch_get_hop_count(IN const osm_switch_t * p_sw,\r
-                                              IN uint16_t lid_ho,\r
-                                              IN uint8_t port_num)\r
-{\r
-       return (lid_ho > p_sw->max_lid_ho || !p_sw->hops[lid_ho]) ?\r
-           OSM_NO_PATH : p_sw->hops[lid_ho][port_num];\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to a Switch object.\r
-*\r
-*      lid_ho\r
-*              [in] LID value (host order) for which to return the hop count\r
-*\r
-*      port_num\r
-*              [in] Port number in the switch\r
-*\r
-* RETURN VALUES\r
-*      Returns the hop count at the specified LID/Port intersection.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_set_hops\r
-* NAME\r
-*      osm_switch_set_hops\r
-*\r
-* DESCRIPTION\r
-*      Sets the hop count at the specified LID/Port intersection.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho,\r
-                               IN uint8_t port_num, IN uint8_t num_hops);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to a Switch object.\r
-*\r
-*      lid_ho\r
-*              [in] LID value (host order) for which to set the count.\r
-*\r
-*      port_num\r
-*              [in] port number for which to set the count.\r
-*\r
-*      num_hops\r
-*              [in] value to assign to this entry.\r
-*\r
-* RETURN VALUES\r
-*      Returns 0 if successfull. -1 if it failed\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_clear_hops\r
-* NAME\r
-*      osm_switch_clear_hops\r
-*\r
-* DESCRIPTION\r
-*      Cleanup existing hops tables (lid matrix)\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_switch_clear_hops(IN osm_switch_t * p_sw);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to a Switch object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_least_hops\r
-* NAME\r
-*      osm_switch_get_least_hops\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of hops in the short path to this lid from\r
-*      any port on the switch.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_switch_get_least_hops(IN const osm_switch_t * p_sw,\r
-                                               IN uint16_t lid_ho)\r
-{\r
-       return (lid_ho > p_sw->max_lid_ho || !p_sw->hops[lid_ho]) ?\r
-           OSM_NO_PATH : p_sw->hops[lid_ho][0];\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      lid_ho\r
-*              [in] LID (host order) for which to retrieve the shortest hop count.\r
-*\r
-* RETURN VALUES\r
-*      Returns the number of hops in the short path to this lid from\r
-*      any port on the switch.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_port_least_hops\r
-* NAME\r
-*      osm_switch_get_port_least_hops\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of hops in the short path to this port from\r
-*      any port on the switch.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,\r
-                                      IN const osm_port_t * p_port);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      p_port\r
-*              [in] Pointer to an osm_port_t object for which to\r
-*              retrieve the shortest hop count.\r
-*\r
-* RETURN VALUES\r
-*      Returns the number of hops in the short path to this lid from\r
-*      any port on the switch.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_port_by_lid\r
-* NAME\r
-*      osm_switch_get_port_by_lid\r
-*\r
-* DESCRIPTION\r
-*      Returns the switch port number on which the specified LID is routed.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_switch_get_port_by_lid(IN const osm_switch_t * p_sw,\r
-                                                IN uint16_t lid_ho)\r
-{\r
-       if (lid_ho == 0 || lid_ho > p_sw->max_lid_ho)\r
-               return OSM_NO_PATH;\r
-       return p_sw->lft[lid_ho];\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      lid_ho\r
-*              [in] LID (host order) for which to retrieve the shortest hop count.\r
-*\r
-* RETURN VALUES\r
-*      Returns the switch port on which the specified LID is routed.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_route_by_lid\r
-* NAME\r
-*      osm_switch_get_route_by_lid\r
-*\r
-* DESCRIPTION\r
-*      Gets the physical port object that routes the specified LID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_physp_t *osm_switch_get_route_by_lid(IN const osm_switch_t *\r
-                                                      p_sw, IN ib_net16_t lid)\r
-{\r
-       uint8_t port_num;\r
-\r
-       CL_ASSERT(p_sw);\r
-       CL_ASSERT(lid);\r
-\r
-       port_num = osm_switch_get_port_by_lid(p_sw, cl_ntoh16(lid));\r
-\r
-       /*\r
-          In order to avoid holes in the subnet (usually happens when\r
-          running UPDN algorithm), i.e. cases where port is\r
-          unreachable through a switch (we put an OSM_NO_PATH value at\r
-          the port entry, we do not assert on unreachable lid entries\r
-          at the fwd table but return NULL\r
-        */\r
-       if (port_num != OSM_NO_PATH)\r
-               return (osm_node_get_physp_ptr(p_sw->p_node, port_num));\r
-       else\r
-               return NULL;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      lid\r
-*              [in] LID for which to find a route.  This must be a unicast\r
-*              LID value < 0xC000.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the Physical Port Object object that\r
-*      routes the specified LID.  A return value of zero means\r
-*      there is no route for the lid through this switch.\r
-*      The lid value must be a unicast LID.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_sp0_is_lmc_capable\r
-* NAME\r
-*      osm_switch_sp0_is_lmc_capable\r
-*\r
-* DESCRIPTION\r
-*      Returns whether switch port 0 (SP0) can support LMC\r
-*\r
-*/\r
-static inline unsigned\r
-osm_switch_sp0_is_lmc_capable(IN const osm_switch_t * p_sw,\r
-                             IN osm_subn_t * p_subn)\r
-{\r
-       return (p_subn->opt.lmc_esp0 &&\r
-               ib_switch_info_is_enhanced_port0(&p_sw->switch_info)) ? 1 : 0;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      p_subn\r
-*              [in] Pointer to an osm_subn_t object.\r
-*\r
-* RETURN VALUES\r
-*      TRUE if SP0 is enhanced and globally enabled. FALSE otherwise.\r
-*\r
-* NOTES\r
-*      This is workaround function, it takes into account user defined\r
-*      p_subn->opt.lmc_esp0 parameter.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_max_block_id_in_use\r
-* NAME\r
-*      osm_switch_get_max_block_id_in_use\r
-*\r
-* DESCRIPTION\r
-*      Returns the maximum block ID (host order) of this switch that\r
-*      is used for unicast routing.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t\r
-osm_switch_get_max_block_id_in_use(IN const osm_switch_t * p_sw)\r
-{\r
-       return cl_ntoh16(p_sw->switch_info.lin_top) / IB_SMP_DATA_SIZE;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the maximum block ID (host order) of this switch.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Switch object\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_lft_block\r
-* NAME\r
-*      osm_switch_get_lft_block\r
-*\r
-* DESCRIPTION\r
-*      Retrieve a linear forwarding table block.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,\r
-                                  IN uint16_t block_id, OUT uint8_t * p_block);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      block_ID\r
-*              [in] The block_id to retrieve.\r
-*\r
-*      p_block\r
-*              [out] Pointer to the 64 byte array to store the\r
-*              forwarding table clock specified by block_id.\r
-*\r
-* RETURN VALUES\r
-*      Returns true if there are more blocks necessary to\r
-*      configure all the LIDs reachable from this switch.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_supports_mcast\r
-* NAME\r
-*      osm_switch_supports_mcast\r
-*\r
-* DESCRIPTION\r
-*      Indicates if a switch supports multicast.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_switch_supports_mcast(IN const osm_switch_t * p_sw)\r
-{\r
-       return (p_sw->switch_info.mcast_cap != 0);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the switch supports multicast.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_set_switch_info\r
-* NAME\r
-*      osm_switch_set_switch_info\r
-*\r
-* DESCRIPTION\r
-*      Updates the switch info attribute of this switch.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_switch_set_switch_info(IN osm_switch_t * p_sw,\r
-                                             IN const ib_switch_info_t * p_si)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       CL_ASSERT(p_si);\r
-       p_sw->switch_info = *p_si;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to a Switch object.\r
-*\r
-*      p_si\r
-*              [in] Pointer to the SwitchInfo attribute for this switch.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_count_path\r
-* NAME\r
-*      osm_switch_count_path\r
-*\r
-* DESCRIPTION\r
-*      Counts this path in port profile.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void osm_switch_count_path(IN osm_switch_t * p_sw,\r
-                                        IN uint8_t port)\r
-{\r
-       osm_port_prof_path_count_inc(&p_sw->p_prof[port]);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      port\r
-*              [in] Port to count path.\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_set_lft_block\r
-* NAME\r
-*      osm_switch_set_lft_block\r
-*\r
-* DESCRIPTION\r
-*      Copies in the specified block into\r
-*      the switch's Linear Forwarding Table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_api_status_t\r
-osm_switch_set_lft_block(IN osm_switch_t * p_sw, IN const uint8_t * p_block,\r
-                        IN uint32_t block_num)\r
-{\r
-       uint16_t lid_start =\r
-               (uint16_t) (block_num * IB_SMP_DATA_SIZE);\r
-       CL_ASSERT(p_sw);\r
-\r
-       if (lid_start + IB_SMP_DATA_SIZE > p_sw->lft_size)\r
-               return IB_INVALID_PARAMETER;\r
-\r
-       memcpy(&p_sw->lft[lid_start], p_block, IB_SMP_DATA_SIZE);\r
-       return IB_SUCCESS;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      p_block\r
-*              [in] Pointer to the forwarding table block.\r
-*\r
-*      block_num\r
-*              [in] Block number for this block\r
-*\r
-* RETURN VALUE\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_set_mft_block\r
-* NAME\r
-*      osm_switch_set_mft_block\r
-*\r
-* DESCRIPTION\r
-*      Sets a block of multicast port masks into the multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_api_status_t\r
-osm_switch_set_mft_block(IN osm_switch_t * p_sw, IN const ib_net16_t * p_block,\r
-                        IN uint16_t block_num, IN uint8_t position)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       return osm_mcast_tbl_set_block(&p_sw->mcast_tbl, p_block, block_num,\r
-                                      position);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      p_block\r
-*              [in] Pointer to the block of port masks to set.\r
-*\r
-*      block_num\r
-*              [in] Block number (0-511) to set.\r
-*\r
-*      position\r
-*              [in] Port mask position (0-15) to set.\r
-*\r
-* RETURN VALUE\r
-*      IB_SUCCESS on success.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mft_block\r
-* NAME\r
-*      osm_switch_get_mft_block\r
-*\r
-* DESCRIPTION\r
-*      Retrieve a block of multicast port masks from the multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t osm_switch_get_mft_block(IN osm_switch_t * p_sw,\r
-                                                IN uint16_t block_num,\r
-                                                IN uint8_t position,\r
-                                                OUT ib_net16_t * p_block)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       return osm_mcast_tbl_get_block(&p_sw->mcast_tbl, block_num, position,\r
-                                      p_block);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      block_num\r
-*              [in] Block number (0-511) to set.\r
-*\r
-*      position\r
-*              [in] Port mask position (0-15) to set.\r
-*\r
-*      p_block\r
-*              [out] Pointer to the block of port masks stored.\r
-*\r
-* RETURN VALUES\r
-*      Returns true if there are more blocks necessary to\r
-*      configure all the MLIDs reachable from this switch.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mft_max_block\r
-* NAME\r
-*      osm_switch_get_mft_max_block\r
-*\r
-* DESCRIPTION\r
-*       Get the max_block from the associated multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t osm_switch_get_mft_max_block(IN osm_switch_t * p_sw)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       return osm_mcast_tbl_get_max_block(&p_sw->mcast_tbl);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-* RETURN VALUE\r
-*/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mft_max_block_in_use\r
-* NAME\r
-*      osm_switch_get_mft_max_block_in_use\r
-*\r
-* DESCRIPTION\r
-*      Get the max_block_in_use from the associated multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline int16_t osm_switch_get_mft_max_block_in_use(IN osm_switch_t * p_sw)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       return osm_mcast_tbl_get_max_block_in_use(&p_sw->mcast_tbl);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-* RETURN VALUES\r
-*      Returns the maximum block ID in use in this switch's mcast table.\r
-*      A value of -1 indicates no blocks are in use.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mft_max_position\r
-* NAME\r
-*      osm_switch_get_mft_max_position\r
-*\r
-* DESCRIPTION\r
-*       Get the max_position from the associated multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_switch_get_mft_max_position(IN osm_switch_t * p_sw)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       return osm_mcast_tbl_get_max_position(&p_sw->mcast_tbl);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-* RETURN VALUE\r
-*/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_dimn_port\r
-* NAME\r
-*      osm_switch_get_dimn_port\r
-*\r
-* DESCRIPTION\r
-*      Get the routing ordered port\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t osm_switch_get_dimn_port(IN const osm_switch_t * p_sw,\r
-                                              IN uint8_t port_num)\r
-{\r
-       CL_ASSERT(p_sw);\r
-       if (p_sw->dimn_ports == NULL)\r
-               return port_num;\r
-       return p_sw->dimn_ports[port_num];\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      port_num\r
-*              [in] Port number in the switch\r
-*\r
-* RETURN VALUES\r
-*      Returns the port number ordered for routing purposes.\r
-*/\r
-\r
-/****f* OpenSM: Switch/osm_switch_recommend_path\r
-* NAME\r
-*      osm_switch_recommend_path\r
-*\r
-* DESCRIPTION\r
-*      Returns the recommended port on which to route this LID.\r
-*      In cases where LMC > 0, the remote side system and node\r
-*      used for the routing are tracked in the provided arrays\r
-*      (and counts) such that other lid for the same port will\r
-*      try and avoid going through the same remote system/node.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,\r
-                                 IN osm_port_t * p_port, IN uint16_t lid_ho,\r
-                                 IN unsigned start_from,\r
-                                 IN boolean_t ignore_existing,\r
-                                 IN boolean_t dor);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      p_port\r
-*              [in] Pointer to the port object for which to get a path\r
-*              advisory.\r
-*\r
-*      lid_ho\r
-*              [in] LID value (host order) for which to get a path advisory.\r
-*\r
-*      start_from\r
-*              [in] Port number from where to start balance counting.\r
-*\r
-*      ignore_existing\r
-*              [in] Set to cause the switch to choose the optimal route\r
-*              regardless of existing paths.\r
-*              If false, the switch will choose an existing route if one\r
-*              exists, otherwise will choose the optimal route.\r
-*\r
-*      dor\r
-*              [in] If TRUE, Dimension Order Routing will be done.\r
-*\r
-* RETURN VALUE\r
-*      Returns the recommended port on which to route this LID.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_recommend_mcast_path\r
-* NAME\r
-*      osm_switch_recommend_mcast_path\r
-*\r
-* DESCRIPTION\r
-*      Returns the recommended port on which to route this LID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-uint8_t osm_switch_recommend_mcast_path(IN osm_switch_t * p_sw,\r
-                                       IN osm_port_t * p_port,\r
-                                       IN uint16_t mlid_ho,\r
-                                       IN boolean_t ignore_existing);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch object.\r
-*\r
-*      p_port\r
-*              [in] Pointer to the port object for which to get\r
-*              the multicast path.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID for the multicast group in question.\r
-*\r
-*      ignore_existing\r
-*              [in] Set to cause the switch to choose the optimal route\r
-*              regardless of existing paths.\r
-*              If false, the switch will choose an existing route if one exists,\r
-*              otherwise will choose the optimal route.\r
-*\r
-* RETURN VALUE\r
-*      Returns the recommended port on which to route this LID.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mcast_fwd_tbl_size\r
-* NAME\r
-*      osm_switch_get_mcast_fwd_tbl_size\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of entries available in the multicast forwarding table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t\r
-osm_switch_get_mcast_fwd_tbl_size(IN const osm_switch_t * p_sw)\r
-{\r
-       return cl_ntoh16(p_sw->switch_info.mcast_cap);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch.\r
-*\r
-* RETURN VALUE\r
-*      Returns the number of entries available in the multicast forwarding table.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_path_count_get\r
-* NAME\r
-*      osm_switch_path_count_get\r
-*\r
-* DESCRIPTION\r
-*      Returns the count of the number of paths going through this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint32_t osm_switch_path_count_get(IN const osm_switch_t * p_sw,\r
-                                                IN uint8_t port_num)\r
-{\r
-       return osm_port_prof_path_count_get(&p_sw->p_prof[port_num]);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the Switch object.\r
-*\r
-*      port_num\r
-*              [in] Port number for which to get path count.\r
-*\r
-* RETURN VALUE\r
-*      Returns the count of the number of paths going through this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_prepare_path_rebuild\r
-* NAME\r
-*      osm_switch_prepare_path_rebuild\r
-*\r
-* DESCRIPTION\r
-*      Prepares a switch to rebuild pathing information.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw,\r
-                                   IN uint16_t max_lids);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the Switch object.\r
-*\r
-*      max_lids\r
-*              [in] Max number of lids in the subnet.\r
-*\r
-* RETURN VALUE\r
-*      Returns zero on success, or negative value if an error occurred.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_get_mcast_tbl_ptr\r
-* NAME\r
-*      osm_switch_get_mcast_tbl_ptr\r
-*\r
-* DESCRIPTION\r
-*      Returns a pointer to the switch's multicast table.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline osm_mcast_tbl_t *osm_switch_get_mcast_tbl_ptr(IN const\r
-                                                           osm_switch_t * p_sw)\r
-{\r
-       return (osm_mcast_tbl_t *) & p_sw->mcast_tbl;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch.\r
-*\r
-* RETURN VALUE\r
-*      Returns a pointer to the switch's multicast table.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Switch/osm_switch_is_in_mcast_tree\r
-* NAME\r
-*      osm_switch_is_in_mcast_tree\r
-*\r
-* DESCRIPTION\r
-*      Returns true if this switch already belongs in the tree for the specified\r
-*      multicast group.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t\r
-osm_switch_is_in_mcast_tree(IN const osm_switch_t * p_sw, IN uint16_t mlid_ho)\r
-{\r
-       const osm_mcast_tbl_t *p_tbl;\r
-\r
-       p_tbl = &p_sw->mcast_tbl;\r
-       if (p_tbl)\r
-               return osm_mcast_tbl_is_any_port(&p_sw->mcast_tbl, mlid_ho);\r
-       else\r
-               return FALSE;\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to the switch.\r
-*\r
-*      mlid_ho\r
-*              [in] MLID (host order) of the multicast tree to check.\r
-*\r
-* RETURN VALUE\r
-*      Returns true if this switch already belongs in the tree for the specified\r
-*      multicast group.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_SWITCH_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_ucast_cache.h b/branches/opensm_3/user/include/opensm/osm_ucast_cache.h
deleted file mode 100644 (file)
index af17bb2..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Header file that describes Unicast Cache functions.\r
- *\r
- * Environment:\r
- *     Linux User Mode\r
- *\r
- * $Revision: 1.4 $\r
- */\r
-\r
-#ifndef _OSM_UCAST_CACHE_H_\r
-#define _OSM_UCAST_CACHE_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_switch.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-struct osm_ucast_mgr;\r
-\r
-/****h* OpenSM/Unicast Manager/Unicast Cache\r
-* NAME\r
-*      Unicast Cache\r
-*\r
-* DESCRIPTION\r
-*      The Unicast Cache object encapsulates the information\r
-*      needed to cache and write unicast routing of the subnet.\r
-*\r
-*      The Unicast Cache object is NOT thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Yevgeny Kliteynik, Mellanox\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Cache/osm_ucast_cache_invalidate\r
-* NAME\r
-*      osm_ucast_cache_invalidate\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_cache_invalidate function purges the\r
-*      unicast cache and marks the cache as invalid.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_cache_invalidate(struct osm_ucast_mgr *p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the ucast mgr object.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return any value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Cache/osm_ucast_cache_check_new_link\r
-* NAME\r
-*      osm_ucast_cache_check_new_link\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_cache_check_new_link checks whether\r
-*      the newly discovered link still allows us to use\r
-*      cached unicast routing.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_cache_check_new_link(struct osm_ucast_mgr *p_mgr,\r
-                                   osm_node_t * p_node_1, uint8_t port_num_1,\r
-                                   osm_node_t * p_node_2, uint8_t port_num_2);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the unicast manager object.\r
-*\r
-*      physp1\r
-*              [in] Pointer to the first physical port of the link.\r
-*\r
-*      physp2\r
-*              [in] Pointer to the second physical port of the link.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return any value.\r
-*\r
-* NOTES\r
-*      The function checks whether the link was previously\r
-*      cached/dropped or is this a completely new link.\r
-*      If it decides that the new link makes cached routing\r
-*      invalid, the cache is purged and marked as invalid.\r
-*\r
-* SEE ALSO\r
-*      Unicast Cache object\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Cache/osm_ucast_cache_add_link\r
-* NAME\r
-*      osm_ucast_cache_add_link\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_cache_add_link adds link to the cache.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_cache_add_link(struct osm_ucast_mgr *p_mgr,\r
-                             osm_physp_t * physp1, osm_physp_t * physp2);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the unicast manager object.\r
-*\r
-*      physp1\r
-*              [in] Pointer to the first physical port of the link.\r
-*\r
-*      physp2\r
-*              [in] Pointer to the second physical port of the link.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return any value.\r
-*\r
-* NOTES\r
-*      Since the cache operates with ports and not links,\r
-*      the function adds two port entries (both sides of the\r
-*      link) to the cache.\r
-*      If it decides that the dropped link makes cached routing\r
-*      invalid, the cache is purged and marked as invalid.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Cache/osm_ucast_cache_add_node\r
-* NAME\r
-*      osm_ucast_cache_add_node\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_cache_add_node adds node and all\r
-*      its links to the cache.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_cache_add_node(struct osm_ucast_mgr *p_mgr, osm_node_t * p_node);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the unicast manager object.\r
-*\r
-*      p_node\r
-*              [in] Pointer to the node object that should be cached.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return any value.\r
-*\r
-* NOTES\r
-*      If the function decides that the dropped node makes cached\r
-*      routing invalid, the cache is purged and marked as invalid.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Cache/osm_ucast_cache_process\r
-* NAME\r
-*      osm_ucast_cache_process\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_cache_process function writes the\r
-*      cached unicast routing on the subnet switches.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_ucast_cache_process(struct osm_ucast_mgr *p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the unicast manager object.\r
-*\r
-* RETURN VALUE\r
-*      This function returns zero on sucess and non-zero\r
-*      value otherwise.\r
-*\r
-* NOTES\r
-*      Iterates through all the subnet switches and writes\r
-*      the LFTs that were calculated during the last routing\r
-*       engine execution to the switches.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_UCAST_CACHE_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_ucast_lash.h b/branches/opensm_3/user/include/opensm/osm_ucast_lash.h
deleted file mode 100644 (file)
index 3224a75..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*\r
- * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2007      Simula Research Laboratory. All rights reserved.\r
- * Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *      Declarations for LASH algorithm\r
- */\r
-\r
-#ifndef OSM_UCAST_LASH_H\r
-#define OSM_UCAST_LASH_H\r
-\r
-#include <opensm/osm_mesh.h>\r
-\r
-enum {\r
-       UNQUEUED,\r
-       Q_MEMBER,\r
-       MST_MEMBER,\r
-       MAX_INT = 9999,\r
-       NONE = MAX_INT\r
-};\r
-\r
-typedef struct _cdg_vertex {\r
-       int from;\r
-       int to;\r
-       int seen;\r
-       int temp;\r
-       int visiting_number;\r
-       struct _cdg_vertex *next;\r
-       int num_temp_depend;\r
-       int num_using_vertex;\r
-       int num_deps;\r
-       struct vertex_deps {\r
-               struct _cdg_vertex *v;\r
-               int num_used;\r
-       } deps[0];\r
-} cdg_vertex_t;\r
-\r
-typedef struct _switch {\r
-       osm_switch_t *p_sw;\r
-       int id;\r
-       int used_channels;\r
-       int *dij_channels;\r
-       int q_state;\r
-       mesh_node_t *node;\r
-       struct routing_table {\r
-               unsigned out_link;\r
-               unsigned lane;\r
-       } routing_table[0];\r
-} switch_t;\r
-\r
-typedef struct _lash {\r
-       osm_opensm_t *p_osm;\r
-       int num_switches;\r
-       uint8_t vl_min;\r
-       int balance_limit;\r
-       switch_t **switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix;\r
-       int num_mst_in_lane[IB_MAX_NUM_VLS];\r
-       int ***virtual_location;\r
-} lash_t;\r
-\r
-uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, const osm_port_t * p_src_port,\r
-                       const osm_port_t * p_dst_port);\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/include/opensm/osm_ucast_mgr.h b/branches/opensm_3/user/include/opensm/osm_ucast_mgr.h
deleted file mode 100644 (file)
index b4490d6..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_ucast_mgr_t.\r
- *     This object represents the Unicast Manager object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_UCAST_MGR_H_\r
-#define _OSM_UCAST_MGR_H_\r
-\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_qlist.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_ucast_cache.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Unicast Manager\r
-* NAME\r
-*      Unicast Manager\r
-*\r
-* DESCRIPTION\r
-*      The Unicast Manager object encapsulates the information\r
-*      needed to control unicast LID forwarding on the subnet.\r
-*\r
-*      The Unicast Manager object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-struct osm_sm;\r
-/****s* OpenSM: Unicast Manager/osm_ucast_mgr_t\r
-* NAME\r
-*      osm_ucast_mgr_t\r
-*\r
-* DESCRIPTION\r
-*      Unicast Manager structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_ucast_mgr {\r
-       struct osm_sm *sm;\r
-       osm_subn_t *p_subn;\r
-       osm_log_t *p_log;\r
-       cl_plock_t *p_lock;\r
-       uint16_t max_lid;\r
-       cl_qlist_t port_order_list;\r
-       boolean_t is_dor;\r
-       boolean_t some_hop_count_set;\r
-       cl_qmap_t cache_sw_tbl;\r
-       boolean_t cache_valid;\r
-} osm_ucast_mgr_t;\r
-/*\r
-* FIELDS\r
-*      sm\r
-*              Pointer to the SM object.\r
-*\r
-*      p_subn\r
-*              Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_lock\r
-*              Pointer to the serializing lock.\r
-*\r
-*      is_dor\r
-*              Dimension Order Routing (DOR) will be done\r
-*\r
-*      port_order_list\r
-*              List of ports ordered for routing.\r
-*\r
-*      some_hop_count_set\r
-*              Initialized to FALSE at the beginning of each the min hop\r
-*              tables calculation iteration cycle, set to TRUE to indicate\r
-*              that some hop count changes were done.\r
-*\r
-*      cache_sw_tbl\r
-*              Cached switches table.\r
-*\r
-*      cache_valid\r
-*              TRUE if the unicast cache is valid.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_construct\r
-* NAME\r
-*      osm_ucast_mgr_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs a Unicast Manager object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to a Unicast Manager object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows osm_ucast_mgr_destroy\r
-*\r
-*      Calling osm_ucast_mgr_construct is a prerequisite to calling any other\r
-*      method except osm_ucast_mgr_init.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object, osm_ucast_mgr_init,\r
-*      osm_ucast_mgr_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_destroy\r
-* NAME\r
-*      osm_ucast_mgr_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_mgr_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to the object to destroy.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified\r
-*      Unicast Manager object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to\r
-*      osm_ucast_mgr_construct or osm_ucast_mgr_init.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object, osm_ucast_mgr_construct,\r
-*      osm_ucast_mgr_init\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_init\r
-* NAME\r
-*      osm_ucast_mgr_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_ucast_mgr_init function initializes a\r
-*      Unicast Manager object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr,\r
-                                  IN struct osm_sm * sm);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_ucast_mgr_t object to initialize.\r
-*\r
-*      sm\r
-*              [in] Pointer to the SM object.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the Unicast Manager object was initialized\r
-*      successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other Unicast Manager methods.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager object, osm_ucast_mgr_construct,\r
-*      osm_ucast_mgr_destroy\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_tables\r
-* NAME\r
-*      osm_ucast_mgr_set_fwd_tables\r
-*\r
-* DESCRIPTION\r
-*      Setup forwarding table for the switch (from prepared new_lft).\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_ucast_mgr_set_fwd_tables(IN osm_ucast_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_ucast_mgr_t object.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_build_lid_matrices\r
-* NAME\r
-*      osm_ucast_mgr_build_lid_matrices\r
-*\r
-* DESCRIPTION\r
-*      Build switches's lid matrices.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_ucast_mgr_t object.\r
-*\r
-* NOTES\r
-*      This function processes the subnet, configuring switches'\r
-*      min hops tables (aka lid matrices).\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager\r
-*********/\r
-\r
-/****f* OpenSM: Unicast Manager/osm_ucast_mgr_process\r
-* NAME\r
-*      osm_ucast_mgr_process\r
-*\r
-* DESCRIPTION\r
-*      Process and configure the subnet's unicast forwarding tables.\r
-*\r
-* SYNOPSIS\r
-*/\r
-int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr);\r
-/*\r
-* PARAMETERS\r
-*      p_mgr\r
-*              [in] Pointer to an osm_ucast_mgr_t object.\r
-*\r
-* RETURN VALUES\r
-*      Returns zero on success and negative value on failure.\r
-*\r
-* NOTES\r
-*      This function processes the subnet, configuring switch\r
-*      unicast forwarding tables.\r
-*\r
-* SEE ALSO\r
-*      Unicast Manager, Node Info Response Controller\r
-*********/\r
-END_C_DECLS\r
-#endif                         /* _OSM_UCAST_MGR_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_version.h b/branches/opensm_3/user/include/opensm/osm_version.h
deleted file mode 100644 (file)
index 5f35411..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_VERSION_H_\r
-#define _OSM_VERSION_H_\r
-\r
-/****s* OpenSM: Base/OSM_VERSION\r
-* NAME\r
-*      OSM_VERSION\r
-*\r
-* DESCRIPTION\r
-*      The version string for OpenSM\r
-*\r
-* SYNOPSIS\r
-*/\r
-#ifdef OSM_VENDOR_INTF_AL\r
-#define OSM_VERSION "OpenSM 3.3.6" " IBAL"\r
-#else\r
-#define OSM_VERSION "OpenSM 3.3.6" " UMAD"\r
-#endif\r
-/********/\r
-\r
-#endif                         /* _OSM_VERSION_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_version.h.in b/branches/opensm_3/user/include/opensm/osm_version.h.in
deleted file mode 100644 (file)
index 9f1f7aa..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_VERSION_H_\r
-#define _OSM_VERSION_H_\r
-\r
-/****s* OpenSM: Base/OSM_VERSION\r
-* NAME\r
-*      OSM_VERSION\r
-*\r
-* DESCRIPTION\r
-*      The version string for OpenSM\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define OSM_VERSION "OpenSM @VERSION@"\r
-/********/\r
-\r
-#endif                         /* _OSM_VERSION_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/osm_vl15intf.h b/branches/opensm_3/user/include/opensm/osm_vl15intf.h
deleted file mode 100644 (file)
index a2dfa8f..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_vl15_t.\r
- *     This object represents a VL15 interface object.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_VL15INTF_H_\r
-#define _OSM_VL15INTF_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <complib/cl_event.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_qlist.h>\r
-#include <opensm/osm_stats.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/VL15\r
-* NAME\r
-*      VL15\r
-*\r
-* DESCRIPTION\r
-*      The VL15 object encapsulates the information needed by the\r
-*      OpenSM to instantiate the VL15 interface.  The OpenSM allocates\r
-*      one VL15 object per subnet.\r
-*\r
-*      The VL15 object transmits MADs to the wire at a throttled rate,\r
-*      so as to not overload the VL15 buffering of subnet components.\r
-*      OpenSM modules may post VL15 MADs to the VL15 interface as fast\r
-*      as possible.\r
-*\r
-*      The VL15 object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****d* OpenSM: SM/osm_vl15_state_t\r
-* NAME\r
-*      osm_vl15_state_t\r
-*\r
-* DESCRIPTION\r
-*      Enumerates the possible states of SM object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osm_vl15_state {\r
-       OSM_VL15_STATE_INIT = 0,\r
-       OSM_VL15_STATE_READY\r
-} osm_vl15_state_t;\r
-/***********/\r
-\r
-/****s* OpenSM: VL15/osm_vl15_t\r
-* NAME\r
-*      osm_vl15_t\r
-*\r
-* DESCRIPTION\r
-*      VL15 structure.\r
-*\r
-*      This object should be treated as opaque and should\r
-*      be manipulated only through the provided functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct osm_vl15 {\r
-       osm_thread_state_t thread_state;\r
-       osm_vl15_state_t state;\r
-       uint32_t max_wire_smps;\r
-       cl_event_t signal;\r
-       cl_thread_t poller;\r
-       cl_qlist_t rfifo;\r
-       cl_qlist_t ufifo;\r
-       cl_spinlock_t lock;\r
-       osm_vendor_t *p_vend;\r
-       osm_log_t *p_log;\r
-       osm_stats_t *p_stats;\r
-} osm_vl15_t;\r
-/*\r
-* FIELDS\r
-*      thread_state\r
-*              Tracks the thread state of the poller thread.\r
-*\r
-*      state\r
-*              Tracks the state of the VL15 interface itself.\r
-*\r
-*      max_wire_smps\r
-*              Maximum number of VL15 MADs allowed on the wire at one time.\r
-*\r
-*      signal\r
-*              Event on which the poller sleeps.\r
-*\r
-*      rfifo\r
-*              First-in First-out queue for outbound VL15 MADs for which\r
-*              a response is expected, aka the "response fifo"\r
-*\r
-*      ufifo\r
-*              First-in First-out queue for outbound VL15 MADs for which\r
-*              no response is expected, aka the "unicast fifo".\r
-*\r
-*      poller\r
-*              Worker thread pool that services the fifo to transmit VL15 MADs\r
-*\r
-*      lock\r
-*              Spinlock guarding the FIFO.\r
-*\r
-*      p_vend\r
-*              Pointer to the vendor transport object.\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              Pointer to the OpenSM statistics block.\r
-*\r
-* SEE ALSO\r
-*      VL15 object\r
-*********/\r
-\r
-/****f* OpenSM: VL15/osm_vl15_construct\r
-* NAME\r
-*      osm_vl15_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an VL15 object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vl15_construct(IN osm_vl15_t * p_vl15);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to a VL15 object to construct.\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Allows calling osm_vl15_destroy.\r
-*\r
-*      Calling osm_vl15_construct is a prerequisite to calling any other\r
-*      method except osm_vl15_init.\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_init, osm_vl15_destroy\r
-*********/\r
-\r
-/****f* OpenSM: VL15/osm_vl15_destroy\r
-* NAME\r
-*      osm_vl15_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_vl15_destroy function destroys the object, releasing\r
-*      all resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vl15_destroy(IN osm_vl15_t * p_vl15, IN struct osm_mad_pool *p_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to a VL15 object to destroy.\r
-*\r
-*  p_pool\r
-*     [in] The pointer to the mad pool to return outstanding mads to\r
-*\r
-* RETURN VALUE\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      Performs any necessary cleanup of the specified VL15 object.\r
-*      Further operations should not be attempted on the destroyed object.\r
-*      This function should only be called after a call to osm_vl15_construct or\r
-*      osm_vl15_init.\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_construct, osm_vl15_init\r
-*********/\r
-\r
-/*\r
-       Initialization.\r
-       Rate specifies the minimum number of microseconds between transmissions\r
-       on VL15.\r
-*/\r
-/****f* OpenSM: VL15/osm_vl15_init\r
-* NAME\r
-*      osm_vl15_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_vl15_init function initializes a VL15 object for use.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl15, IN osm_vendor_t * p_vend,\r
-                             IN osm_log_t * p_log, IN osm_stats_t * p_stats,\r
-                             IN int32_t max_wire_smps);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to an osm_vl15_t object to initialize.\r
-*\r
-*      p_vend\r
-*              [in] Pointer to the vendor transport object.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*      p_stats\r
-*              [in] Pointer to the OpenSM stastics block.\r
-*\r
-*      max_wire_smps\r
-*              [in] Maximum number of MADs allowed on the wire at one time.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if the VL15 object was initialized successfully.\r
-*\r
-* NOTES\r
-*      Allows calling other VL15 methods.\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_construct, osm_vl15_destroy\r
-*********/\r
-\r
-/****f* OpenSM: VL15/osm_vl15_post\r
-* NAME\r
-*      osm_vl15_post\r
-*\r
-* DESCRIPTION\r
-*      Posts a MAD to the VL15 interface for transmission.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vl15_post(IN osm_vl15_t * p_vl15, IN osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to an osm_vl15_t object.\r
-*\r
-*      p_madw\r
-*              [in] Pointer to a MAD wrapper structure containing the MAD.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*      The osm_vl15_construct or osm_vl15_init must be called before using\r
-*      this function.\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_construct, osm_vl15_init\r
-*********/\r
-\r
-/****f* OpenSM: VL15/osm_vl15_poll\r
-* NAME\r
-*      osm_vl15_poll\r
-*\r
-* DESCRIPTION\r
-*      Causes the VL15 Interface to consider sending another QP0 MAD.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vl15_poll(IN osm_vl15_t * p_vl);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to an osm_vl15_t object.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*      This function signals the VL15 that it may be possible to send\r
-*      a SMP.  This function checks three criteria before sending a SMP:\r
-*      1) The VL15 worker is IDLE\r
-*      2) There are no QP0 SMPs currently outstanding\r
-*      3) There is something on the VL15 FIFO to send\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_construct, osm_vl15_init\r
-*********/\r
-\r
-/****f* OpenSM: VL15/osm_vl15_shutdown\r
-* NAME\r
-*      osm_vl15_shutdown\r
-*\r
-* DESCRIPTION\r
-*      Cleanup all outstanding MADs on both fifo's.\r
-*  This is required to return all outstanding MAD resources.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vl15_shutdown(IN osm_vl15_t * p_vl, IN osm_mad_pool_t * p_mad_pool);\r
-/*\r
-* PARAMETERS\r
-*      p_vl15\r
-*              [in] Pointer to an osm_vl15_t object.\r
-*\r
-*  p_mad_pool\r
-*     [in] The MAD pool owning the mads.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      VL15 object, osm_vl15_construct, osm_vl15_init\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VL15INTF_H_ */\r
diff --git a/branches/opensm_3/user/include/opensm/st.h b/branches/opensm_3/user/include/opensm/st.h
deleted file mode 100644 (file)
index b6e405d..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/* @(#) st.h 5.1 89/12/14 */\r
-\r
-#ifndef ST_INCLUDED\r
-#define ST_INCLUDED\r
-\r
-#include <stdlib.h>\r
-#include <inttypes.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define st_ptr_t uintptr_t\r
-typedef st_ptr_t st_data_t;\r
-\r
-#define ST_DATA_T_DEFINED\r
-\r
-typedef struct st_table st_table;\r
-\r
-struct st_hash_type {\r
-       int (*compare) (void *, void *);\r
-       st_ptr_t(*hash) (void *);\r
-};\r
-\r
-struct st_table {\r
-       struct st_hash_type *type;\r
-       int num_bins;\r
-       int num_entries;\r
-       struct st_table_entry **bins;\r
-};\r
-\r
-#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)\r
-\r
-enum st_retval { ST_CONTINUE, ST_STOP, ST_DELETE };\r
-\r
-st_table *st_init_table(struct st_hash_type *);\r
-st_table *st_init_table_with_size(struct st_hash_type *, size_t);\r
-st_table *st_init_numtable(void);\r
-st_table *st_init_numtable_with_size(size_t);\r
-st_table *st_init_strtable(void);\r
-st_table *st_init_strtable_with_size(size_t);\r
-int st_delete(st_table *, st_data_t *, st_data_t *);\r
-int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);\r
-int st_insert(st_table *, st_data_t, st_data_t);\r
-int st_lookup(st_table *, st_data_t, st_data_t *);\r
-void st_foreach(st_table *,\r
-               int (*)(st_data_t key, st_data_t val, st_data_t arg),\r
-               st_data_t);\r
-void st_add_direct(st_table *, st_data_t, st_data_t);\r
-void st_free_table(st_table *);\r
-void st_cleanup_safe(st_table *, st_data_t);\r
-st_table *st_copy(st_table *);\r
-\r
-#define ST_NUMCMP      ((int (*)()) 0)\r
-#define ST_NUMHASH     ((int (*)()) -2)\r
-\r
-#define st_numcmp      ST_NUMCMP\r
-#define st_numhash     ST_NUMHASH\r
-\r
-/* int st_strhash(void); */\r
-\r
-END_C_DECLS\r
-#endif                         /* ST_INCLUDED */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_mtl_bind.h b/branches/opensm_3/user/include/vendor/osm_mtl_bind.h
deleted file mode 100644 (file)
index fa0b6f7..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_BIND_H_\r
-#define _OSM_BIND_H_\r
-\r
-#include <opensm/osm_helper.h>\r
-#include <vendor/osm_vendor_mtl.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: Vendor/osm_vendor_mgt_bind\r
-* NAME\r
-*   osm_vendor_mgt_bind_t\r
-*\r
-* DESCRIPTION\r
-*      Tracks the handles returned by IB_MGT to the SMI and GSI\r
-*  Nulled on init of the vendor obj. Populated on first bind.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_vendor_mgt_bind {\r
-       boolean_t smi_init, gsi_init;\r
-       IB_MGT_mad_hndl_t smi_mads_hdl;\r
-       IB_MGT_mad_hndl_t gsi_mads_hdl;\r
-       struct _osm_mtl_bind_info *smi_p_bind;\r
-} osm_vendor_mgt_bind_t;\r
-\r
-/*\r
-* FIELDS\r
-*      smi_mads_hdl\r
-*              Handle returned by IB_MGT_get_handle to the IB_MGT_SMI\r
-*\r
-*      gsi_mads_hdl\r
-*              Handle returned by IB_MGT_get_handle to the IB_MGT_GSI\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: Vendor osm_mtl_bind_info_t\r
-* NAME\r
-*   osm_mtl_bind_info_t\r
-*\r
-* DESCRIPTION\r
-*      Handle to the result of binding a class callbacks to IB_MGT.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_mtl_bind_info {\r
-       IB_MGT_mad_hndl_t mad_hndl;\r
-       osm_vendor_t *p_vend;\r
-       void *client_context;\r
-       VAPI_hca_hndl_t hca_hndl;\r
-       VAPI_hca_id_t hca_id;\r
-       uint8_t port_num;\r
-       osm_vend_mad_recv_callback_t rcv_callback;\r
-       osm_vend_mad_send_err_callback_t send_err_callback;\r
-       osm_mad_pool_t *p_osm_pool;\r
-} osm_mtl_bind_info_t;\r
-\r
-/*\r
-* FIELDS\r
-*      mad_hndl\r
-*              the handle returned from the registration in IB_MGT\r
-*\r
-*      p_vend\r
-*              Pointer to the vendor object.\r
-*\r
-*      client_context\r
-*              User's context passed during osm_bind\r
-*\r
-*  hca_id\r
-*     HCA Id we bind to.\r
-*\r
-*      port_num\r
-*              Port number (within the HCA) of the bound port.\r
-*\r
-*      rcv_callback\r
-*              OSM Callback function to be called on receive of MAD.\r
-*\r
-*  send_err_callback\r
-*     OSM Callback to be called on send error.\r
-*\r
-*  p_osm_pool\r
-*     Points to the MAD pool used by OSM\r
-*\r
-*\r
-* SEE ALSO\r
-*********/\r
-ib_api_status_t\r
-osm_mtl_send_mad(IN osm_mtl_bind_info_t * p_bind, IN osm_madw_t * const p_madw);\r
-\r
-END_C_DECLS\r
-#endif                         // _OSM_BIND_H_\r
diff --git a/branches/opensm_3/user/include/vendor/osm_pkt_randomizer.h b/branches/opensm_3/user/include/vendor/osm_pkt_randomizer.h
deleted file mode 100644 (file)
index db32bbc..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_subn_t.\r
- *     This object represents an IBA subnet.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_PKT_RANDOMIZER_H_\r
-#define _OSM_PKT_RANDOMIZER_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_map.h>\r
-#include <complib/cl_ptr_vector.h>\r
-#include <complib/cl_list.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_path.h>\r
-#include <opensm/osm_madw.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Packet Randomizer\r
-* NAME\r
-*      Packet Randomizer\r
-*\r
-* DESCRIPTION\r
-*      The Packet Randomizer object encapsulates the information needed for\r
-*      randomly dropping packets for debug.\r
-*\r
-*      The Packet Randomizer object is not thread safe, thus callers must\r
-*      provide serialization.\r
-*\r
-* AUTHOR\r
-*      Yael Kalka, Mellanox\r
-*\r
-*********/\r
-/****d* OpenSM: Pkt_Randomizer/osm_pkt_randomizer_t\r
-* NAME\r
-*      osm_pkt_randomizer_t\r
-*\r
-* DESCRIPTION\r
-*      Packet randomizer structure. This structure contains the various\r
-*  parameters needed by the packet randomizer.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_pkt_randomizer {\r
-       uint8_t osm_pkt_drop_rate;\r
-       uint8_t osm_pkt_num_unstable_links;\r
-       uint8_t osm_pkt_unstable_link_rate;\r
-       osm_dr_path_t *fault_dr_paths;\r
-       uint8_t num_paths_initialized;\r
-} osm_pkt_randomizer_t;\r
-\r
-/*\r
-* FIELDS\r
-*\r
-*  osm_pkt_drop_rate\r
-*     Used by the randomizer whether to drop a packet or not.\r
-*     Taken from the global variable OSM_PKT_DROP_RATE. If not given or\r
-*     if set to zero, the randomizer will not run.\r
-*\r
-*  osm_pkt_num_unstable_links\r
-*     The number of unstable links to be drawn.\r
-*     Taken from the global variable OSM_PKT_NUM_UNSTABLE_LINKS. default = 1.\r
-*\r
-*  osm_pkt_unstable_link_rate\r
-*     Used by the randomizer whether to add a packet to the unstable links\r
-*     list or not. Taken from the global variable OSM_PKT_UNSTABLE_LINK_RATE.\r
-*     default = 20.\r
-*\r
-*      fault_dr_path\r
-*              Array of osm_dr_path_t objects, that includes all the dr_paths\r
-*     that are marked as errored.\r
-*\r
-*  num_paths_initialized\r
-*     Describes the number of paths from the fault_dr_paths array that\r
-*     have already been initialized.\r
-*\r
-* SEE ALSO\r
-*      Packet Randomizer object\r
-*********/\r
-\r
-/****f* OpenSM: Pkt_Randomizer/osm_pkt_randomizer_init\r
-* NAME\r
-*      osm_pkt_randomizer_init\r
-*\r
-* DESCRIPTION\r
-*      The osm_pkt_randomizer_init function initializes the Packet Randomizer object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_pkt_randomizer_init(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer,\r
-                       IN osm_log_t * p_log);\r
-/*\r
-* PARAMETERS\r
-*  p_pkt_randomizer\r
-*     [in] Pointer to the Packet Randomizer object to be initialized.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-* RETURN VALUE\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Pkt_Randomizer/osm_pkt_randomizer_destroy\r
-* NAME\r
-*      osm_pkt_randomizer_destroy\r
-*\r
-* DESCRIPTION\r
-*      The osm_pkt_randomizer_destroy function destroys the Packet Randomizer object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void\r
-osm_pkt_randomizer_destroy(IN osm_pkt_randomizer_t ** pp_pkt_randomizer,\r
-                          IN osm_log_t * p_log);\r
-/*\r
-* PARAMETERS\r
-*  p_pkt_randomizer\r
-*     [in] Pointer to the Packet Randomizer object to be destroyed.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-* RETURN VALUE\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Pkt_Randomizer/osm_pkt_randomizer_madw_drop\r
-* NAME\r
-*      osm_pkt_randomizer_madw_drop\r
-*\r
-* DESCRIPTION\r
-*      The osm_pkt_randomizer_madw_drop is base function of the packet\r
-*  randomizer.\r
-*  It decides according to different random criteria whether or not\r
-*  the packet received should be dropped (according to its dr_path).\r
-*  This function is relevant both for mads sent by the SM and mads\r
-*  received by the SM.\r
-*  It returns TRUE if the mad should be dropped, and FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-boolean_t\r
-osm_pkt_randomizer_mad_drop(IN osm_log_t * p_log,\r
-                           IN osm_pkt_randomizer_t * p_pkt_randomizer,\r
-                           IN const ib_mad_t * p_mad);\r
-/*\r
-* PARAMETERS\r
-*  p_subn\r
-*     [in] Pointer to the Subnet object for this subnet.\r
-*\r
-*      p_log\r
-*              [in] Pointer to the log object.\r
-*\r
-*  p_mad\r
-*     [in] Pointer to the ib_mad_t mad to be checked.\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the mad should be dropped. FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_PKT_RANDOMIZER_H */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_ts_useraccess.h b/branches/opensm_3/user/include/vendor/osm_ts_useraccess.h
deleted file mode 100644 (file)
index d30b895..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#include "ts_ib_useraccess.h"\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-typedef struct ib_user_mad_filter osm_ts_user_mad_filter;\r
-typedef struct ib_set_port_info_ioctl osm_ts_set_port_info_ioctl;\r
-typedef struct ib_get_port_info_ioctl osm_ts_get_port_info_ioctl;\r
-typedef struct ib_gid_entry_ioctl osm_ts_gid_entry_ioctl;\r
-\r
-END_C_DECLS\r
diff --git a/branches/opensm_3/user/include/vendor/osm_umadt.h b/branches/opensm_3/user/include/vendor/osm_umadt.h
deleted file mode 100644 (file)
index d4e240f..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mad_wrapper_t.\r
- *     This object represents the context wrapper for OpenSM MAD processing.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_UMADT_h_\r
-#define _OSM_UMADT_h_\r
-\r
-#include "iba/ib_types.h"\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_log.h>\r
-#include "umadt.h"\r
-#include "ibt.h"\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-typedef struct _umadt_obj_t {\r
-       void *umadt_handle;\r
-       UMADT_INTERFACE uMadtInterface;\r
-       IBT_INTERFACE IbtInterface;\r
-       boolean init_done;\r
-       cl_spinlock_t register_lock;\r
-       cl_qlist_t register_list;\r
-       osm_log_t *p_log;\r
-       uint32_t timeout;\r
-\r
-} umadt_obj_t;\r
-/*********/\r
-\r
-/****s* OpenSM: Umadt MAD Wrapper/osm_bind_info\r
-* NAME\r
-*      osm_bind_info\r
-*\r
-* DESCRIPTION\r
-*      Context needed for processing individual MADs\r
-*\r
-* SYNOPSIS\r
-*/\r
-\r
-typedef struct _mad_bind_info_t {\r
-       cl_list_item_t list_item;\r
-       umadt_obj_t *p_umadt_obj;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       osm_vend_mad_recv_callback_t mad_recv_callback;\r
-       void *client_context;\r
-       cl_thread_t recv_processor_thread;\r
-       cl_spinlock_t trans_ctxt_lock;\r
-       cl_qlist_t trans_ctxt_list;\r
-       cl_timer_t timeout_timer;\r
-       cl_spinlock_t timeout_list_lock;\r
-       cl_qlist_t timeout_list;\r
-       RegisterClassStruct umadt_reg_class;\r
-       MADT_HANDLE umadt_handle;       /* Umadt type */\r
-\r
-} mad_bind_info_t;\r
-\r
-typedef struct _trans_context_t {\r
-       cl_list_item_t list_item;\r
-       uint64_t trans_id;\r
-       uint64_t sent_time;     /* micro secs */\r
-       void *context;\r
-} trans_context_t;\r
-\r
-/*\r
-* FIELDS\r
-*      list_item\r
-*              List linkage for pools and lists.  MUST BE FIRST MEMBER!\r
-*\r
-*      p_mad_pool\r
-*              Pointer to the MAD pool to be used by mads with this bind handle.\r
-*\r
-*      mad_recv_callback\r
-*              Callback function called by the mad receive processor.\r
-*\r
-*      client_context\r
-*              context to be passed to the receive callback.\r
-*\r
-*      recv_processor_thread\r
-*              Thread structure for the receive processor thread.\r
-*\r
-*      umadt_reg_class\r
-*              Umadt register class struct used to register with Umadt.\r
-*\r
-*      umadt_handle\r
-*              Umadt returns this handle from a registration call. The transport layer\r
-*              uses this handle to talk to Umadt.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif /*_OSM_UMADT_h_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor.h b/branches/opensm_3/user/include/vendor/osm_vendor.h
deleted file mode 100644 (file)
index b7636c4..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Include file used by OpenSM to pull in the correct vendor file.\r
- */\r
-\r
-/*\r
-  this is the generic include file which includes\r
-  the proper vendor specific file\r
-*/\r
-#include <opensm/osm_config.h>\r
-\r
-#if defined( OSM_VENDOR_INTF_TEST )\r
-#include <vendor/osm_vendor_test.h>\r
-#elif defined( OSM_VENDOR_INTF_UMADT )\r
-#include <vendor/osm_vendor_umadt.h>\r
-#elif defined( OSM_VENDOR_INTF_MTL )\r
-/* HACK - I do not know how to prevent complib from loading kernel H files */\r
-#undef __init\r
-#include <vendor/osm_vendor_mlx.h>\r
-#elif defined( OSM_VENDOR_INTF_TS )\r
-#undef __init\r
-#include <vendor/osm_vendor_mlx.h>\r
-#elif defined( OSM_VENDOR_INTF_ANAFA )\r
-#undef __init\r
-#include <vendor/osm_vendor_mlx.h>\r
-#elif defined( OSM_VENDOR_INTF_SIM )\r
-#undef __init\r
-#include <vendor/osm_vendor_mlx.h>\r
-#elif defined( OSM_VENDOR_INTF_OPENIB )\r
-#include <vendor/osm_vendor_ibumad.h>\r
-#elif defined( OSM_VENDOR_INTF_AL )\r
-#include <vendor/osm_vendor_al.h>\r
-#else\r
-#error No MAD Interface selected!\r
-#error Choose an interface in osm_config.h\r
-#endif\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_al.h b/branches/opensm_3/user/include/vendor/osm_vendor_al.h
deleted file mode 100644 (file)
index 0a94266..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mad_wrapper_t.\r
- *     This object represents the context wrapper for OpenSM MAD processing.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_AL_H_\r
-#define _OSM_VENDOR_AL_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <iba/ib_al.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_thread.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Vendor AL\r
-* NAME\r
-*      Vendor AL\r
-*\r
-* DESCRIPTION\r
-*\r
-*      The Vendor AL object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-*      Enable various hacks to compensate for bugs in external code...\r
-*\r
-*\r
-* AUTHOR\r
-*\r
-*\r
-*********/\r
-/****h* OpenSM/Vendor Access Layer (AL)\r
-* NAME\r
-*      Vendor AL\r
-*\r
-* DESCRIPTION\r
-*      This file is the vendor specific file for the AL Infiniband API.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-#define OSM_AL_SQ_SGE 256\r
-#define OSM_AL_RQ_SGE 256\r
-#define OSM_DEFAULT_RETRY_COUNT 3\r
-/* AL supports RMPP */\r
-#define VENDOR_RMPP_SUPPORT 1\r
-/****s* OpenSM: Vendor AL/osm_ca_info_t\r
-* NAME\r
-*   osm_ca_info_t\r
-*\r
-* DESCRIPTION\r
-*      Structure containing information about local Channle Adapters.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-\r
-} osm_ca_info_t;\r
-/*\r
-* FIELDS\r
-*      guid\r
-*              Node GUID of the local CA.\r
-*\r
-*      attr_size\r
-*              Size of the CA attributes for this CA.\r
-*\r
-*      p_attr\r
-*              Pointer to dynamicly allocated CA Attribute structure.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_num_ports\r
-* NAME\r
-*      osm_ca_info_get_num_ports\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of ports owned by this CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)\r
-{\r
-       return (p_ca_info->p_attr->num_ports);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-* RETURN VALUE\r
-*      Returns the number of ports owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_port_guid\r
-* NAME\r
-*      osm_ca_info_get_port_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t\r
-osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,\r
-                         IN const uint8_t index)\r
-{\r
-       return (p_ca_info->p_attr->p_port_attr[index].port_guid);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-*      index\r
-*              [in] Port "index" for which to retrieve the port GUID.\r
-*              The index is the offset into the ca's internal array\r
-*              of port attributes.\r
-*\r
-* RETURN VALUE\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_port_num\r
-* NAME\r
-*      osm_ca_info_get_port_num\r
-*\r
-* DESCRIPTION\r
-*      Returns the port number of the specified port owned by this CA.\r
-*      Port numbers start with 1 for HCA's.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_ca_info_get_port_num(IN const osm_ca_info_t * const p_ca_info,\r
-                        IN const uint8_t index)\r
-{\r
-       return (p_ca_info->p_attr->p_port_attr[index].port_num);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-*      index\r
-*              [in] Port "index" for which to retrieve the port GUID.\r
-*              The index is the offset into the ca's internal array\r
-*              of port attributes.\r
-*\r
-* RETURN VALUE\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_ca_guid\r
-* NAME\r
-*      osm_ca_info_get_ca_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the GUID of the specified CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t\r
-osm_ca_info_get_ca_guid(IN const osm_ca_info_t * const p_ca_info)\r
-{\r
-       return (p_ca_info->p_attr->ca_guid);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-* RETURN VALUE\r
-*      Returns the GUID of the specified CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: Vendor AL/osm_bind_handle_t\r
-* NAME\r
-*   osm_bind_handle_t\r
-*\r
-* DESCRIPTION\r
-*      handle returned by the vendor transport bind call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef        struct _osm_vendor\r
-{\r
-       ib_al_handle_t          h_al;\r
-       osm_log_t                       *p_log;\r
-       uint32_t                        ca_count;\r
-       osm_ca_info_t           *p_ca_info;\r
-       uint32_t                        timeout;\r
-       ib_ca_handle_t          h_ca;\r
-       ib_pd_handle_t          h_pd;\r
-\r
-} osm_vendor_t;\r
-/*\r
-* FIELDS\r
-*      h_al\r
-*              Handle returned by AL open call (ib_open_al).\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      ca_count\r
-*              Number of CA's in the array pointed to by p_ca_info.\r
-*\r
-*      p_ca_info\r
-*              Pointer to dynamically allocated array of CA info objects.\r
-*\r
-*      h_pool\r
-*              MAD Pool handle returned by ib_create_mad_pool at init time.\r
-*\r
-*      timeout\r
-*              Transaction timeout time in milliseconds.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-\r
-/****s* OpenSM: Vendor AL/osm_bind_handle_t\r
-* NAME\r
-*   osm_bind_handle_t\r
-*\r
-* DESCRIPTION\r
-*      handle returned by the vendor transport bind call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void *osm_bind_handle_t;\r
-/***********/\r
-\r
-/****s* OpenSM/osm_vend_wrap_t\r
-* NAME\r
-*   AL Vendor MAD Wrapper\r
-*\r
-* DESCRIPTION\r
-*      AL specific MAD wrapper. AL transport layer uses this for\r
-*      housekeeping.\r
-*\r
-* SYNOPSIS\r
-*********/\r
-typedef struct _osm_vend_wrap_t\r
-{\r
-    uint32_t                                   size;\r
-       osm_bind_handle_t                       h_bind;\r
-       ib_mad_element_t                        *p_elem;\r
-       ib_av_handle_t                          h_av;\r
-       void*                                           p_resp_madw;\r
-\r
-} osm_vend_wrap_t;\r
-/*\r
-* FIELDS\r
-*      size\r
-*              Size of the allocated MAD\r
-*\r
-*      h_bind\r
-*              Bind handle used on this transaction\r
-*\r
-*      p_elem\r
-*              Pointer to the mad element structure associated with\r
-*              this mad.\r
-*\r
-*      h_av\r
-*              Address vector handle used for this transaction.\r
-*\r
-*      p_resp_madw\r
-*              Pointer to the mad wrapper structure used to hold the pending\r
-*              reponse to the mad, if any.  If a response is expected, the\r
-*              wrapper for the reponse is allocated during the send call.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_AL_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_api.h b/branches/opensm_3/user/include/vendor/osm_vendor_api.h
deleted file mode 100644 (file)
index 9c6a410..0000000
+++ /dev/null
@@ -1,487 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *  Specification of the OpenSM transport API. This API is OpenSM's view\r
- *  of the Infiniband transport.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_API_H_\r
-#define _OSM_VENDOR_API_H_\r
-\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <vendor/osm_vendor.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM Vendor API/osm_vend_mad_recv_callback_t\r
-* NAME\r
-*  osm_vend_mad_recv_callback_t\r
-*\r
-* DESCRIPTION\r
-*  Function prototype for the vendor MAD receive callback.\r
-*  The vendor layer calls this function for MAD receives.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void (*osm_vend_mad_recv_callback_t) (IN osm_madw_t * p_madw,\r
-                                             IN void *bind_context,\r
-                                             IN osm_madw_t * p_req_madw);\r
-/*\r
-* PARAMETERS\r
-*  p_madw\r
-*     [in] The received MAD wrapper.\r
-*\r
-*  bind_context\r
-*     [in] User context supplied during the bind call.\r
-*\r
-*  p_req_madw\r
-*     [in] Pointer to the request mad wrapper that generated this response.\r
-*     If the inbound MAD is not a response, this field is NULL.\r
-*\r
-* RETURN VALUES\r
-*  None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM Vendor API/osm_vend_mad_send_err_callback_t\r
-* NAME\r
-*  osm_vend_mad_send_err_callback_t\r
-*\r
-* DESCRIPTION\r
-*  Function prototype for the vendor send failure callback.\r
-*  The vendor layer calls this function when MADs expecting\r
-*  a response are completed in error, most likely due to a\r
-*  timeout.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void (*osm_vend_mad_send_err_callback_t) (IN void *bind_context,\r
-                                                 IN osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*  bind_context\r
-*     [in] User context supplied during the bind call.\r
-*\r
-*  p_madw\r
-*     [in] Pointer to the request mad that failed.\r
-*\r
-* RETURN VALUES\r
-*  None.\r
-*\r
-* NOTES\r
-*  The vendor layer does not call this function (or any other)\r
-*  for MADs that were not expecting a response.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_new\r
-* NAME\r
-*  osm_vendor_new\r
-*\r
-* DESCRIPTION\r
-*  Allocates and initializes a new osm_vendor_t object.\r
-*  OpenSM calls this function before any other in the vendor API.\r
-*  This object is passed as a parameter to all other vendor functions.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log,\r
-                            IN const uint32_t timeout);\r
-/*\r
-* PARAMETERS\r
-*  p_log\r
-*     [in] Pointer to the log object to use.\r
-*\r
-*  timeout\r
-*     [in] transaction timeout\r
-*\r
-* RETURN VALUES\r
-*  Returns a pointer to the vendor object.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM Vendor API/osm_vendor_delete\r
-* NAME\r
-*  osm_vendor_delete\r
-*\r
-* DESCRIPTION\r
-*  Dealocate the vendor object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vendor_delete(IN osm_vendor_t ** const pp_vend);\r
-/*\r
-* PARAMETERS\r
-*  pp_vend\r
-*     [in/out] pointer to pointer to vendor objcet to be deleted\r
-*\r
-* RETURN VALUES\r
-*  None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_get_all_port_attr\r
-* NAME\r
-*  osm_vendor_get_all_port_attr\r
-*\r
-* DESCRIPTION\r
-*  Returns an array of available port attribute structures.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                            IN ib_port_attr_t * const p_attr_array,\r
-                            IN uint32_t * const p_num_ports);\r
-/*\r
-* PARAMETERS\r
-*  p_vend\r
-*     [in] Pointer to the vendor object to initialize.\r
-*\r
-*  p_attr_array\r
-*     [in/out] Pointer to pre-allocated array of port attributes.\r
-*     If it is NULL - then the command only updates the p_num_ports,\r
-*     and return IB_INSUFFICIENT_MEMORY.\r
-*\r
-*  p_num_ports\r
-*     [in/out] Pointer to a variable to hold the total number of ports\r
-*     available on the local machine.\r
-*\r
-* RETURN VALUES\r
-*  IB_SUCCESS on success.\r
-*  IB_INSUFFICIENT_MEMORY if the attribute array was not large enough.\r
-*  The number of attributes needed is returned in num_guids.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_init\r
-* NAME\r
-*  osm_vendor_init\r
-*\r
-* DESCRIPTION\r
-*  The osm_vendor_init function initializes the vendor transport layer.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_vendor_init(IN osm_vendor_t * const p_vend, IN osm_log_t * const p_log,\r
-               IN const uint32_t timeout);\r
-/*\r
-* PARAMETERS\r
-*  p_vend\r
-*     [in] Pointer to the vendor object to initialize.\r
-*\r
-*  p_log\r
-*     [in] Pointer to OpenSM's log object.  Vendor code may\r
-*     use the log object to send messages to OpenSM's log.\r
-*\r
-*  timeout\r
-*     [in] Transaction timeout value in milliseconds.\r
-*     A value of 0 disables timeouts.\r
-*\r
-* RETURN VALUE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_bind\r
-* NAME\r
-*   osm_vendor_bind\r
-*\r
-* DESCRIPTION\r
-*   The osm_vendor_bind function registers with the vendor transport layer\r
-*   per Mad Class per PortGuid for mad transport capability.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_bind_handle_t\r
-osm_vendor_bind(IN osm_vendor_t * const p_vend,\r
-               IN osm_bind_info_t * const p_bind_info,\r
-               IN osm_mad_pool_t * const p_mad_pool,\r
-               IN osm_vend_mad_recv_callback_t mad_recv_callback,\r
-               IN osm_vend_mad_send_err_callback_t send_err_callback,\r
-               IN void *context);\r
-/*\r
-* PARAMETERS\r
-*  p_vend\r
-*    [in] pointer to the vendor object\r
-*\r
-*  p_osm_bind_info\r
-*    [in] pointer to a struct defining the type of bind to perform.\r
-*\r
-*  p_mad_pool\r
-*    [in] pointer to a mad wrappers pool to be used for allocating\r
-*    mad wrappers on send and receive.\r
-*\r
-*  mad_recv_callback\r
-*    [in] the callback function to be invoked on mad receive.\r
-*\r
-*  send_err_callback\r
-*    [in] the callback function to be invoked on mad transaction errors.\r
-*\r
-*  context\r
-*    [in] the context to be provided to the callbacks as bind_ctx.\r
-*\r
-* RETURN VALUE\r
-*  On success, a valid bind handle.\r
-*  OSM_BIND_INVALID_HANDLE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_unbind\r
-* NAME\r
-*   osm_vendor_unbind\r
-*\r
-* DESCRIPTION\r
-*   Unbind the given bind handle (obtained by osm_vendor_bind).\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vendor_unbind(IN osm_bind_handle_t h_bind);\r
-/*\r
-* PARAMETERS\r
-*  h_bind\r
-*    [in] the bind handle to release.\r
-*\r
-* RETURN VALUE\r
-*    NONE.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_get\r
-* NAME\r
-*   osm_vendor_get\r
-*\r
-* DESCRIPTION\r
-*   Obtain a mad wrapper holding actual mad buffer to be sent via\r
-*   the transport.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,\r
-                        IN const uint32_t mad_size,\r
-                        IN osm_vend_wrap_t * const p_vend_wrap);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*      [in] the bind handle obtained by calling osm_vendor_bind\r
-*\r
-*   mad_size\r
-*      [in] the actual mad size required\r
-*\r
-*   p_vend_wrap\r
-*      [out] the returned mad vendor wrapper\r
-*\r
-* RETURN VALUE\r
-*   IB_SUCCESS on succesful completion.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_send\r
-* NAME\r
-*   osm_vendor_send\r
-*\r
-* DESCRIPTION\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_vendor_send(IN osm_bind_handle_t h_bind,\r
-               IN osm_madw_t * const p_madw, IN boolean_t const resp_expected);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*      [in] the bind handle obtained by calling osm_vendor_bind\r
-*\r
-*   p_madw\r
-*      [in] pointer to the Mad Wrapper structure for the MAD to be sent.\r
-*\r
-*   resp_expected\r
-*      [in] boolean value declaring the mad as a request (expecting a response).\r
-*\r
-* RETURN VALUE\r
-*   IB_SUCCESS on succesful completion.\r
-*\r
-* NOTES\r
-*   1. Only mads that expect a response are tracked for transaction competion.\r
-*   2. A mad that does not expect a response is being put back immediately\r
-*      after being sent.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_put\r
-* NAME\r
-*   osm_vendor_put\r
-*\r
-* DESCRIPTION\r
-*   Return a mad vendor wrapper to the mad pool. It also means that the\r
-*   mad buffer is returned to the transport.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void\r
-osm_vendor_put(IN osm_bind_handle_t h_bind,\r
-              IN osm_vend_wrap_t * const p_vend_wrap);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*      [in] the bind handle obtained by calling osm_vendor_bind\r
-*\r
-*   p_vend_wrap\r
-*      [in] pointer to the mad vendor wrapper to put back into the pool.\r
-*\r
-* RETURN VALUE\r
-*   None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****i* OpenSM Vendor API/osm_vendor_local_lid_change\r
-* NAME\r
-*   osm_vendor_local_lid_change\r
-*\r
-* DESCRIPTION\r
-*  Notifies the vendor transport layer that the local address\r
-*  has changed.  This allows the vendor layer to perform housekeeping\r
-*  functions such as address vector updates.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*      [in] the bind handle obtained by calling osm_vendor_bind\r
-*\r
-* RETURN VALUE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_set_sm\r
-* NAME\r
-*   osm_vendor_set_sm\r
-*\r
-* DESCRIPTION\r
-*  Modifies the port info for the bound port to set the "IS_SM" bit\r
-*  according to the value given (TRUE or FALSE).\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*     [in] bind handle for this port.\r
-*\r
-*   is_sm_val\r
-*     [in] If TRUE - will set the is_sm to TRUE, if FALSE - will set the\r
-*          the is_sm to FALSE.\r
-*\r
-* RETURN VALUE\r
-*  None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM Vendor API/osm_vendor_set_debug\r
-* NAME\r
-*   osm_vendor_set_debug\r
-*\r
-* DESCRIPTION\r
-*  Modifies the vendor specific debug level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level);\r
-/*\r
-* PARAMETERS\r
-*   p_vend\r
-*     [in] vendor handle.\r
-*\r
-*   level\r
-*     [in] vendor specific debug level.\r
-*\r
-* RETURN VALUE\r
-*  None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_API_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_ibumad.h b/branches/opensm_3/user/include/vendor/osm_vendor_ibumad.h
deleted file mode 100644 (file)
index dcf0eeb..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_VENDOR_UMAD_H_\r
-#define _OSM_VENDOR_UMAD_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#include <infiniband/umad.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Vendor Access Layer (UMAD)\r
-* NAME\r
-*      Vendor UMAD\r
-*\r
-* DESCRIPTION\r
-*      This file is the vendor specific file for the UMAD Infiniband API.\r
-*\r
-* AUTHOR\r
-*\r
-*\r
-*********/\r
-#define OSM_DEFAULT_RETRY_COUNT 3\r
-#define OSM_UMAD_MAX_CAS       32\r
-#define OSM_UMAD_MAX_PORTS_PER_CA      2\r
-#define OSM_UMAD_MAX_AGENTS    32\r
-\r
-/****s* OpenSM: Vendor UMAD/osm_ca_info_t\r
-* NAME\r
-*   osm_ca_info_t\r
-*\r
-* DESCRIPTION\r
-*      Structure containing information about local Channle Adapters.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-} osm_ca_info_t;\r
-/*\r
-* FIELDS\r
-*      guid\r
-*              Node GUID of the local CA.\r
-*\r
-*      attr_size\r
-*              Size of the CA attributes for this CA.\r
-*\r
-*      p_attr\r
-*              Pointer to dynamicly allocated CA Attribute structure.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_num_ports\r
-* NAME\r
-*      osm_ca_info_get_num_ports\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of ports owned by this CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)\r
-{\r
-       return (p_ca_info->p_attr->num_ports);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-* RETURN VUMADUE\r
-*      Returns the number of ports owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* OpenSM: Vendor UMAD/osm_bind_handle_t\r
-* NAME\r
-*   osm_bind_handle_t\r
-*\r
-* DESCRIPTION\r
-*      handle returned by the vendor transport bind call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void *osm_bind_handle_t;\r
-/***********/\r
-\r
-typedef struct _umad_match {\r
-       ib_net64_t tid;\r
-       void *v;\r
-       uint32_t version;\r
-} umad_match_t;\r
-\r
-#define DEFAULT_OSM_UMAD_MAX_PENDING   1000\r
-\r
-typedef struct vendor_match_tbl {\r
-       uint32_t last_version;\r
-       int max;\r
-       umad_match_t *tbl;\r
-} vendor_match_tbl_t;\r
-\r
-typedef struct _osm_vendor {\r
-       osm_log_t *p_log;\r
-       uint32_t ca_count;\r
-       osm_ca_info_t *p_ca_info;\r
-       uint32_t timeout;\r
-       int max_retries;\r
-       osm_bind_handle_t agents[OSM_UMAD_MAX_AGENTS];\r
-       char ca_names[OSM_UMAD_MAX_CAS][UMAD_CA_NAME_LEN];\r
-       vendor_match_tbl_t mtbl;\r
-       umad_port_t umad_port;\r
-       pthread_mutex_t cb_mutex;\r
-       pthread_mutex_t match_tbl_mutex;\r
-       int umad_port_id;\r
-       void *receiver;\r
-       int issmfd;\r
-       char issm_path[256];\r
-} osm_vendor_t;\r
-\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-\r
-typedef struct _osm_vend_wrap {\r
-       int agent;\r
-       int size;\r
-       int retries;\r
-       void *umad;\r
-       osm_bind_handle_t h_bind;\r
-} osm_vend_wrap_t;\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_UMAD_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h
deleted file mode 100644 (file)
index 2b105ac..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_H_\r
-#define _OSMV_H_\r
-\r
-#include <sys/types.h>\r
-#include <opensm/osm_log.h>\r
-#include <complib/cl_qlist.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
-  Forward reference\r
-*/\r
-struct _osm_pkt_randomizer;\r
-\r
-/* The structure behind the OSM Vendor handle */\r
-\r
-typedef struct _osm_vendor {\r
-\r
-       /* for holding common transport info - useful at ibmgt transport */\r
-       void *p_transport_info;\r
-\r
-       osm_log_t *p_log;\r
-\r
-       /* Uniform timeout for every ACK/single MAD */\r
-       uint32_t resp_timeout;\r
-\r
-       /* Uniform timeout for every rmpp transaction */\r
-       uint32_t ttime_timeout;\r
-\r
-       /* All the bind handles associated with the vendor */\r
-       cl_qlist_t bind_handles;\r
-\r
-       /* run randomizer flag */\r
-       boolean_t run_randomizer;\r
-\r
-       /* Packet Randomizer object */\r
-       struct _osm_pkt_randomizer *p_pkt_randomizer;\r
-\r
-} osm_vendor_t;\r
-\r
-/* Repeating the definitions in osm_vendor_api.h */\r
-\r
-typedef void *osm_bind_handle_t;\r
-\r
-typedef struct _osm_vend_wrap {\r
-       ib_mad_t *p_mad;\r
-} osm_vend_wrap_t;\r
-\r
-#ifndef OSM_BIND_INVALID_HANDLE\r
-#define OSM_BIND_INVALID_HANDLE NULL\r
-#endif\r
-\r
-/* The maximum number of retransmissions of the same MAD */\r
-#define OSM_DEFAULT_RETRY_COUNT  3\r
-\r
-END_C_DECLS\r
-#endif\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h
deleted file mode 100644 (file)
index 7bb9343..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_DEFS_H_\r
-#define _OSMV_DEFS_H_\r
-\r
-#include <vendor/osm_vendor_mlx_inout.h>\r
-#include <opensm/osm_log.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_mlx_txn.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/* The maximum number of outstanding MADs an RMPP sender can transmit */\r
-#define OSMV_RMPP_RECV_WIN       16\r
-/* Transaction Timeout = OSMV_TXN_TIMEOUT_FACTOR * Response Timeout */\r
-#define OSMV_TXN_TIMEOUT_FACTOR  128\r
-/************/\r
-/****s* OSM Vendor: Types/osmv_bind_obj_t\r
-* NAME\r
-*      osmv_bind_obj_t\r
-*\r
-* DESCRIPTION\r
-*      The object managing a single bind context.\r
-*       The bind handle is a direct pointer to it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_bind_obj {\r
-       /* Used to signal when the struct is being destroyed */\r
-       struct _osmv_bind_obj *magic_ptr;\r
-\r
-        osm_vendor_t /*const */  * p_vendor;\r
-\r
-       uint32_t hca_hndl;\r
-       uint32_t port_num;\r
-\r
-       /* Atomic access protector */\r
-       cl_spinlock_t lock;\r
-\r
-       /* is_closing == TRUE --> the handle is being unbound */\r
-       boolean_t is_closing;\r
-\r
-       /* Event callbacks */\r
-       osm_vend_mad_recv_callback_t recv_cb;\r
-       osm_vend_mad_send_err_callback_t send_err_cb;\r
-       /* ... and their context */\r
-       void *cb_context;\r
-\r
-       /* A pool to manage MAD wrappers */\r
-       osm_mad_pool_t *p_osm_pool;\r
-\r
-       /* each subvendor implements its own transport mgr */\r
-       void *p_transp_mgr;\r
-\r
-       /* The transaction DB */\r
-       osmv_txn_mgr_t txn_mgr;\r
-\r
-} osmv_bind_obj_t;\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_DEFS_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_dispatcher.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_dispatcher.h
deleted file mode 100644 (file)
index 23a2420..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_MAD_DISPATCHER_H_\r
-#define _OSMV_MAD_DISPATCHER_H_\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * NAME\r
- *   osmv_dispatch_mad\r
- *\r
- * DESCRIPTION\r
- *   Lower-level MAD dispatcher.\r
- *   Implements a switch between the following MAD consumers:\r
- *   (1) Non-RMPP consumer (DATA)\r
- *   (2) RMPP receiver     (DATA/ABORT/STOP)\r
- *   (3) RMPP sender       (ACK/ABORT/STOP)\r
- *\r
- * PARAMETERS\r
- *   h_bind                The bind handle\r
- *   p_mad_buf             The 256 byte buffer of individual MAD\r
- *   p_mad_addr            The MAD originator's address\r
- */\r
-ib_api_status_t\r
-osmv_dispatch_mad(IN osm_bind_handle_t h_bind,\r
-                 IN const void *p_mad_buf,\r
-                 IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-END_C_DECLS\r
-#endif\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_hca.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_hca.h
deleted file mode 100644 (file)
index f3477e6..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_HCA_H_\r
-#define _OSMV_HCA_H_\r
-\r
-#include <vendor/osm_vendor.h>\r
-#include <vendor/osm_vendor_mlx_inout.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#if defined( OSM_VENDOR_INTF_TS_NO_VAPI ) || defined( OSM_VENDOR_INTF_SIM )\r
-#define VAPI_hca_hndl_t uint32_t\r
-#define VAPI_hca_id_t char*\r
-#endif\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t const *p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT uint32_t * p_hca_hndl,\r
-                               OUT char *p_hca_id,\r
-                               OUT uint8_t * p_hca_idx,\r
-                               OUT uint32_t * p_port_num);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_HCA_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_inout.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_inout.h
deleted file mode 100644 (file)
index af06e2f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_INOUT_H_\r
-#define _OSMV_INOUT_H_\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#ifdef IN\r
-#undef IN\r
-#endif\r
-#ifdef OUT\r
-#undef OUT\r
-#endif\r
-#ifndef OSM_VENDOR_INTF_ANAFA\r
-#ifndef OSM_VENDOR_INTF_TS_NO_VAPI\r
-#ifndef OSM_VENDOR_INTF_SIM\r
-#include <mtl_common.h>\r
-#endif\r
-#endif\r
-#endif\r
-#ifndef IN\r
-#define IN\r
-#endif\r
-#ifndef OUT\r
-#define OUT\r
-#endif\r
-#ifndef OSM_VENDOR_INTF_TS_NO_VAPI\r
-#ifndef OSM_VENDOR_INTF_ANAFA\r
-#ifndef OSM_VENDOR_INTF_SIM\r
-#include <vapi_types.h>\r
-#include <evapi.h>\r
-#endif\r
-#endif\r
-#endif\r
-END_C_DECLS\r
-#endif                         /* _OSMV_INOUT_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_rmpp_ctx.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_rmpp_ctx.h
deleted file mode 100644 (file)
index dac3749..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_RMPP_CTX_H\r
-#define _OSMV_RMPP_CTX_H\r
-\r
-#include <complib/cl_event.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_madw.h>\r
-#include <vendor/osm_vendor_mlx_sar.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-typedef struct _osmv_rmpp_send_ctx {\r
-\r
-       uint8_t status;\r
-\r
-       uint32_t window_first;\r
-       uint32_t window_last;\r
-\r
-       uint32_t mad_sz;\r
-       boolean_t is_sa_mad;\r
-\r
-       cl_event_t event;\r
-\r
-       /* Segmentation engine */\r
-       osmv_rmpp_sar_t sar;\r
-       osm_log_t *p_log;\r
-\r
-} osmv_rmpp_send_ctx_t;\r
-\r
-typedef struct _osmv_rmpp_recv_ctx {\r
-\r
-       boolean_t is_sa_mad;\r
-\r
-       uint32_t expected_seg;\r
-\r
-       /* Reassembly buffer */\r
-       cl_qlist_t *p_rbuf;\r
-\r
-       /* Reassembly engine */\r
-       osmv_rmpp_sar_t sar;\r
-       osm_log_t *p_log;\r
-\r
-} osmv_rmpp_recv_ctx_t;\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_init\r
- *\r
- * DESCRIPTION\r
- *  c'tor for rmpp_send_ctx obj\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_send_ctx_init(osmv_rmpp_send_ctx_t * p_ctx, void *arbt_mad,\r
-                       uint32_t mad_sz, osm_log_t * p_log);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_done\r
- *\r
- * DESCRIPTION\r
- *  d'tor for rmpp_send_ctx obj\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_rmpp_send_ctx_done(IN osmv_rmpp_send_ctx_t * ctx);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_get_wf\r
- *\r
- * DESCRIPTION\r
- *  returns number of first segment in current window\r
- * SEE ALSO\r
- *\r
- */\r
-static inline uint32_t\r
-osmv_rmpp_send_ctx_get_wf(IN const osmv_rmpp_send_ctx_t * p_ctx)\r
-{\r
-       CL_ASSERT(p_ctx);\r
-       return p_ctx->window_first;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_set_wf\r
- *\r
- * DESCRIPTION\r
- *  sets number of first segment in current window\r
- * SEE ALSO\r
- *\r
- */\r
-static inline void\r
-osmv_rmpp_send_ctx_set_wf(IN osmv_rmpp_send_ctx_t * p_ctx, IN uint32_t val)\r
-{\r
-       CL_ASSERT(p_ctx);\r
-       p_ctx->window_first = val;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_get_wl\r
- *\r
- * DESCRIPTION\r
- *  returns number of last segment in current window\r
- * SEE ALSO\r
- *\r
- */\r
-static inline uint32_t\r
-osmv_rmpp_send_ctx_get_wl(IN const osmv_rmpp_send_ctx_t * p_send_ctx)\r
-{\r
-       CL_ASSERT(p_send_ctx);\r
-       return p_send_ctx->window_last;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_set_wl\r
- *\r
- * DESCRIPTION\r
- *  sets number of last segment in current window\r
- * SEE ALSO\r
- *\r
- */\r
-static inline void\r
-osmv_rmpp_send_ctx_set_wl(IN osmv_rmpp_send_ctx_t * p_ctx, IN uint32_t val)\r
-{\r
-       CL_ASSERT(p_ctx);\r
-       p_ctx->window_last = val;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_get_num_segs\r
- *\r
- * DESCRIPTION\r
- *   returns the total number of mad segments to send\r
- * SEE ALSO\r
- *\r
- */\r
-uint32_t osmv_rmpp_send_ctx_get_num_segs(IN osmv_rmpp_send_ctx_t * p_send_ctx);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_send_ctx_get_seg\r
- *\r
- * DESCRIPTION\r
- *   Retrieves the mad segment by seg number (including setting the mad relevant bits & hdrs)\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_send_ctx_get_seg(IN osmv_rmpp_send_ctx_t * p_send_ctx,\r
-                          IN uint32_t seg_idx, IN uint32_t resp_timeout,\r
-                          OUT void *p_mad);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_init\r
- *\r
- * DESCRIPTION\r
- *   c'tor for rmpp_recv_ctx obj\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_init(osmv_rmpp_recv_ctx_t * p_ctx, osm_log_t * p_log);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_done\r
- *\r
- * DESCRIPTION\r
- *   d'tor for rmpp_recv_ctx obj\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_rmpp_recv_ctx_done(IN osmv_rmpp_recv_ctx_t * p_ctx);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_get_es\r
- *\r
- * DESCRIPTION\r
- *   retrunes index of expected segement in the curr window\r
- *\r
- */\r
-static inline uint32_t\r
-osmv_rmpp_recv_ctx_get_es(IN const osmv_rmpp_recv_ctx_t * p_recv_ctx)\r
-{\r
-       CL_ASSERT(p_recv_ctx);\r
-       return p_recv_ctx->expected_seg;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_set_es\r
- *\r
- * DESCRIPTION\r
- *   sets index of expected segement in the curr window\r
- *\r
- */\r
-static inline void\r
-osmv_rmpp_recv_ctx_set_es(IN osmv_rmpp_recv_ctx_t * p_recv_ctx, IN uint32_t val)\r
-{\r
-       CL_ASSERT(p_recv_ctx);\r
-       p_recv_ctx->expected_seg = val;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_store_madw_seg\r
- *\r
- * DESCRIPTION\r
- *  stores rmpp mad in the list\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_store_mad_seg(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,\r
-                                IN void *p_mad);\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_cur_byte_num(IN osmv_rmpp_recv_ctx_t * p_recv_ctx);\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_byte_num_from_first(IN osmv_rmpp_recv_ctx_t *\r
-                                          p_recv_ctx);\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_byte_num_from_last(IN osmv_rmpp_recv_ctx_t * p_recv_ctx);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_recv_ctx_reassemble_arbt_mad\r
- *\r
- * DESCRIPTION\r
- *  reassembles all rmpp buffs to one big arbitrary mad\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_reassemble_arbt_mad(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,\r
-                                      IN uint32_t size, IN void *p_arbt_mad);\r
-\r
-END_C_DECLS\r
-#endif\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_sar.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_sar.h
deleted file mode 100644 (file)
index 7d82cb4..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_SAR_H_\r
-#define _OSMV_SAR_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-typedef struct _osmv_rmpp_sar {\r
-       void *p_arbt_mad;\r
-       uint32_t data_len;      /* total data len in all the mads */\r
-       /* these data members contain only constants */\r
-       uint32_t hdr_sz;\r
-       uint32_t data_sz;       /*typical data sz for this kind of mad (sa or regular */\r
-\r
-} osmv_rmpp_sar_t;\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_sar_alloc\r
- *\r
- * DESCRIPTION\r
- *   c'tor for rmpp_sar object\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_sar_init(osmv_rmpp_sar_t * p_sar, void *p_arbt_mad,\r
-                  uint32_t mad_size, boolean_t is_sa_mad);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_sar_dealloc\r
- *\r
- * DESCRIPTION\r
- *   d'tor for rmpp_sar object\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_rmpp_sar_done(osmv_rmpp_sar_t * p_sar);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_sar_get_mad_seg\r
- *\r
- * DESCRIPTION\r
- *  segments the original mad buffer . returnes a mad with the data of the i-th segment\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_sar_get_mad_seg(osmv_rmpp_sar_t * p_sar, uint32_t seg_idx,\r
-                         void *p_buf);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_sar_reassemble_arbt_mad\r
- *\r
- * DESCRIPTION\r
- *  gets a qlist of mads and reassmbles to one big mad buffer\r
- *  ALSO - deallocates the mad list\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_sar_reassemble_arbt_mad(osmv_rmpp_sar_t * p_sar, cl_qlist_t * p_bufs);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_SAR_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_sender.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_sender.h
deleted file mode 100644 (file)
index e8a97d6..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_RMPP_SENDER_H_\r
-#define _OSMV_RMPP_SENDER_H_\r
-\r
-#include <vendor/osm_vendor_mlx.h>\r
-#include <vendor/osm_vendor_mlx_txn.h>\r
-#include <opensm/osm_madw.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****d* OSM Vendor/osmv_simple_send_madw\r
- * NAME\r
- *   osmv_simple_send_madw\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 bytes).\r
- *\r
- *   If this MAD requires a response, set the timeout event.\r
- *   The function call returns when the MAD's send completion is received.\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_simple_send_madw(IN osm_bind_handle_t h_bind,\r
-                     IN osm_madw_t * const p_madw,\r
-                     IN osmv_txn_ctx_t * p_txn, IN boolean_t is_retry);\r
-\r
-/****d* OSM Vendor/osmv_rmpp_send_madw\r
- * NAME\r
- *   osmv_rmpp_send_madw\r
- *\r
- * DESCRIPTION\r
- *     Send a single MAD wrapper (of arbitrary length).\r
- *      Follow the RMPP semantics\r
- *      (segmentation, send window, timeouts etc).\r
- *\r
- *      The function call returns either when the whole MAD\r
- *      has been acknowledged, or upon error.\r
- */\r
-ib_api_status_t\r
-osmv_rmpp_send_madw(IN osm_bind_handle_t h_bind,\r
-                   IN osm_madw_t * const p_madw,\r
-                   IN osmv_txn_ctx_t * p_txn, IN boolean_t is_rmpp_ds);\r
-\r
-/*\r
- *  NAME            osmv_rmpp_send_ack\r
- *\r
- *  DESCRIPTION\r
- */\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_ack(IN osm_bind_handle_t h_bind,\r
-                  IN const ib_mad_t * p_req_mad,\r
-                  IN uint32_t seg_num,\r
-                  IN uint32_t nwl, IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-/*\r
- *  NAME           osmv_rmpp_send_nak\r
- *\r
- *  DESCRIPTION    Send the RMPP ABORT or STOP packet\r
- */\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_nak(IN osm_bind_handle_t h_bind,\r
-                  IN const ib_mad_t * p_req_mad,\r
-                  IN const osm_mad_addr_t * p_mad_addr,\r
-                  IN uint8_t nak_type, IN uint8_t status);\r
-\r
-/*\r
- *  NAME           osmv_rmpp_snd_error\r
- *\r
- *  DESCRIPTION    Mark an error status and signal the sender thread to handle it\r
- */\r
-\r
-static inline void\r
-osmv_rmpp_snd_error(IN osmv_rmpp_send_ctx_t * p_send_ctx,\r
-                   IN ib_api_status_t status)\r
-{\r
-       p_send_ctx->status = status;\r
-\r
-       /* Release the thread waiting on send()\r
-        * It will release the transaction's context\r
-        */\r
-       cl_event_signal(&p_send_ctx->event);\r
-}\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_RMPP_SENDER_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_svc.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_svc.h
deleted file mode 100644 (file)
index ac19294..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_SVC_H_\r
-#define _OSMV_SVC_H_\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <vendor/osm_vendor_mlx_defs.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-inline static uint8_t osmv_invert_method(IN uint8_t req_method)\r
-{\r
-       switch (req_method) {\r
-       case IB_MAD_METHOD_GET_RESP:\r
-               /* Not a 1-1 mapping! */\r
-               return IB_MAD_METHOD_GET;\r
-\r
-       case IB_MAD_METHOD_GET:\r
-               return IB_MAD_METHOD_GET_RESP;\r
-\r
-       case IB_MAD_METHOD_SET:\r
-               return IB_MAD_METHOD_GET_RESP;\r
-\r
-       case IB_MAD_METHOD_GETTABLE_RESP:\r
-               return IB_MAD_METHOD_GETTABLE;\r
-\r
-       case IB_MAD_METHOD_GETTABLE:\r
-               return IB_MAD_METHOD_GETTABLE_RESP;\r
-\r
-       case IB_MAD_METHOD_GETMULTI_RESP:\r
-               /* Not a 1-1 mapping! */\r
-               return IB_MAD_METHOD_GETMULTI;\r
-\r
-       case IB_MAD_METHOD_GETTRACETABLE:\r
-       case IB_MAD_METHOD_GETMULTI:\r
-               return IB_MAD_METHOD_GETMULTI_RESP;\r
-\r
-       case IB_MAD_METHOD_TRAP:\r
-               return IB_MAD_METHOD_TRAP_REPRESS;\r
-\r
-       case IB_MAD_METHOD_TRAP_REPRESS:\r
-               return IB_MAD_METHOD_TRAP;\r
-\r
-       case IB_MAD_METHOD_REPORT:\r
-               return IB_MAD_METHOD_REPORT_RESP;\r
-\r
-       case IB_MAD_METHOD_REPORT_RESP:\r
-               return IB_MAD_METHOD_REPORT;\r
-\r
-               /*  IB_MAD_METHOD_SEND does not have a response */\r
-       case IB_MAD_METHOD_SEND:\r
-               return IB_MAD_METHOD_SEND;\r
-\r
-       default:\r
-               CL_ASSERT(FALSE);\r
-       }\r
-\r
-       return 0;               /* Just make the compiler happy */\r
-}\r
-\r
-inline static boolean_t osmv_mad_is_rmpp(IN const ib_mad_t * p_mad)\r
-{\r
-       uint8_t rmpp_flags;\r
-       CL_ASSERT(NULL != p_mad);\r
-\r
-       rmpp_flags = ((ib_rmpp_mad_t *) p_mad)->rmpp_flags;\r
-       /* HACK - JUST SA and DevMgt for now - need to add BIS and DevAdm */\r
-       if ((p_mad->mgmt_class != IB_MCLASS_SUBN_ADM) &&\r
-           (p_mad->mgmt_class != IB_MCLASS_DEV_MGMT))\r
-               return (0);\r
-       return (0 != (rmpp_flags & IB_RMPP_FLAG_ACTIVE));\r
-}\r
-\r
-inline static boolean_t osmv_mad_is_multi_resp(IN const ib_mad_t * p_mad)\r
-{\r
-       CL_ASSERT(NULL != p_mad);\r
-       return (IB_MAD_METHOD_GETMULTI == p_mad->method\r
-               || IB_MAD_METHOD_GETTRACETABLE == p_mad->method);\r
-}\r
-\r
-inline static boolean_t osmv_mad_is_sa(IN const ib_mad_t * p_mad)\r
-{\r
-       CL_ASSERT(NULL != p_mad);\r
-       return (IB_MCLASS_SUBN_ADM == p_mad->mgmt_class);\r
-}\r
-\r
-inline static boolean_t osmv_rmpp_is_abort_stop(IN const ib_mad_t * p_mad)\r
-{\r
-       uint8_t rmpp_type;\r
-       CL_ASSERT(p_mad);\r
-\r
-       rmpp_type = ((ib_rmpp_mad_t *) p_mad)->rmpp_type;\r
-       return (IB_RMPP_TYPE_STOP == rmpp_type\r
-               || IB_RMPP_TYPE_ABORT == rmpp_type);\r
-}\r
-\r
-inline static boolean_t osmv_rmpp_is_data(IN const ib_mad_t * p_mad)\r
-{\r
-       CL_ASSERT(p_mad);\r
-       return (IB_RMPP_TYPE_DATA == ((ib_rmpp_mad_t *) p_mad)->rmpp_type);\r
-}\r
-\r
-inline static boolean_t osmv_rmpp_is_ack(IN const ib_mad_t * p_mad)\r
-{\r
-       CL_ASSERT(p_mad);\r
-       return (IB_RMPP_TYPE_ACK == ((ib_rmpp_mad_t *) p_mad)->rmpp_type);\r
-}\r
-\r
-inline static boolean_t osmv_rmpp_is_first(IN const ib_mad_t * p_mad)\r
-{\r
-       uint8_t rmpp_flags;\r
-       CL_ASSERT(NULL != p_mad);\r
-\r
-       rmpp_flags = ((ib_rmpp_mad_t *) p_mad)->rmpp_flags;\r
-       return (0 != (IB_RMPP_FLAG_FIRST & rmpp_flags));\r
-}\r
-\r
-inline static boolean_t osmv_rmpp_is_last(IN const ib_mad_t * p_mad)\r
-{\r
-       uint8_t rmpp_flags;\r
-       CL_ASSERT(NULL != p_mad);\r
-\r
-       rmpp_flags = ((ib_rmpp_mad_t *) p_mad)->rmpp_flags;\r
-       return (0 != (IB_RMPP_FLAG_LAST & rmpp_flags));\r
-}\r
-\r
-inline static uint8_t *osmv_mad_copy(IN const ib_mad_t * p_mad)\r
-{\r
-       uint8_t *p_copy;\r
-\r
-       CL_ASSERT(p_mad);\r
-       p_copy = malloc(MAD_BLOCK_SIZE);\r
-\r
-       if (NULL != p_copy) {\r
-               memset(p_copy, 0, MAD_BLOCK_SIZE);\r
-               memcpy(p_copy, p_mad, MAD_BLOCK_SIZE);\r
-       }\r
-\r
-       return p_copy;\r
-}\r
-\r
-/* Should be passed externally from the Makefile */\r
-/*  #define OSMV_RANDOM_DROP 1 */\r
-#define OSMV_DROP_RATE   0.3\r
-\r
-inline static boolean_t osmv_random_drop(void)\r
-{\r
-       srand(1);               /* Pick a new base */\r
-       return (rand() / (double)RAND_MAX < OSMV_DROP_RATE);\r
-}\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_SVC_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport.h
deleted file mode 100644 (file)
index 94d2a49..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/**\r
- *  FILE                   osmv_transport.h\r
- *  AUTHOR                 Edward Bortnikov\r
- *\r
- *  DESCRIPTION\r
- *     The lower-level MAD transport interface implementation\r
- *     that allows sending a single MAD/receiving a callback\r
- *     when a single MAD is received.\r
-*/\r
-\r
-#ifndef _OSMV_TRANSPORT_H_\r
-#define _OSMV_TRANSPORT_H_\r
-\r
-#include <vendor/osm_vendor_mlx.h>\r
-#include <vendor/osm_vendor_mlx_defs.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/*\r
- * NAME\r
- *   osmv_transport_init\r
- *\r
- * DESCRIPTION\r
- *   Setup the MAD transport infrastructure (filters, callbacks etc).\r
- */\r
-#define VENDOR_HCA_MAXNAMES 32\r
-ib_api_status_t\r
-osmv_transport_init(IN osm_bind_info_t * p_info,\r
-                   IN char hca_id[VENDOR_HCA_MAXNAMES],\r
-                   IN uint8_t hca_idx, IN osmv_bind_obj_t * p_bo);\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_send_mad\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 byte)\r
- */\r
-ib_api_status_t\r
-osmv_transport_mad_send(IN const osm_bind_handle_t h_bind,\r
-                       IN void *p_mad, IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_done\r
- *\r
- * DESCRIPTION\r
- *   deallocator of transportation infrastructure\r
- */\r
-void osmv_transport_done(IN const osm_bind_handle_t h_bind);\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_TRANSPORT_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport_anafa.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_transport_anafa.h
deleted file mode 100644 (file)
index 891aae4..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/**\r
- *  FILE                   osmv_transport.h\r
- *  AUTHOR                 Edward Bortnikov\r
- *\r
- *  DESCRIPTION\r
- *     The lower-level MAD transport interface implementation\r
- *     that allows sending a single MAD/receiving a callback\r
- *     when a single MAD is received.\r
-*/\r
-\r
-#ifndef _OSMV_TRANSPORT_ANAFA_H_\r
-#define _OSMV_TRANSPORT_ANAFA_H_\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-#define OSMV_ANAFA_ID 0\r
-typedef struct _osmv_TOPSPIN_ANAFA_transport_mgr_ {\r
-       int device_fd;\r
-       cl_thread_t receiver;\r
-} osmv_TOPSPIN_ANAFA_transport_mgr_t;\r
-\r
-typedef struct _osmv_TOPSPIN_ANAFA_transport_info_ {\r
-       int device_fd;\r
-} osmv_TOPSPIN_ANAFA_transport_info_t;\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_TRANSPORT_ANAFA_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_txn.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_txn.h
deleted file mode 100644 (file)
index 1115dc4..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSMV_TXN_H_\r
-#define _OSMV_TXN_H_\r
-\r
-#include <sys/types.h>\r
-#include <unistd.h>\r
-\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_madw.h>\r
-#include <complib/cl_event_wheel.h>\r
-\r
-#include <vendor/osm_vendor_mlx_rmpp_ctx.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-\r
-typedef enum _osmv_txn_rmpp_state {\r
-\r
-       OSMV_TXN_RMPP_NONE = 0, /* Not part of RMPP transaction */\r
-\r
-       OSMV_TXN_RMPP_SENDER,\r
-       OSMV_TXN_RMPP_RECEIVER\r
-} osmv_txn_rmpp_state_t;\r
-\r
-typedef struct _osmv_rmpp_txfr {\r
-\r
-       osmv_txn_rmpp_state_t rmpp_state;\r
-       boolean_t is_rmpp_init_by_peer;\r
-       osmv_rmpp_send_ctx_t *p_rmpp_send_ctx;\r
-       osmv_rmpp_recv_ctx_t *p_rmpp_recv_ctx;\r
-\r
-} osmv_rmpp_txfr_t;\r
-\r
-typedef struct _osmv_txn_ctx {\r
-\r
-       /* The original Transaction ID */\r
-       uint64_t tid;\r
-       /* The key by which the Transaction is stored */\r
-       uint64_t key;\r
-\r
-       /* RMPP Send/Receive contexts, if applicable */\r
-       osmv_rmpp_txfr_t rmpp_txfr;\r
-\r
-       /* A MAD that was sent during the transaction (request or response) */\r
-       osm_madw_t *p_madw;\r
-\r
-       /* Reference to a log to enable tracing */\r
-       osm_log_t *p_log;\r
-\r
-} osmv_txn_ctx_t;\r
-\r
-typedef struct _osmv_txn_mgr {\r
-\r
-       /* Container of all the transactions */\r
-       cl_qmap_t *p_txn_map;\r
-\r
-       /* The timeouts DB */\r
-       cl_event_wheel_t *p_event_wheel;\r
-\r
-       /* Reference to a log to enable tracing */\r
-       osm_log_t *p_log;\r
-\r
-} osmv_txn_mgr_t;\r
-\r
-/* *    *   *   *   *   *   osmv_txn_ctx_t functions  *    *   *   *   *   *   *   *   */\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_init\r
- *\r
- * DESCRIPTION\r
- *   allocs & inits the osmv_txn_ctx obj and insert it into the db\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_init(IN osm_bind_handle_t h_bind,\r
-             IN uint64_t tid, IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_txfr_init_sender\r
- *\r
- * DESCRIPTION\r
- *   init the rmpp send ctx in the transaction\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_init_rmpp_sender(IN osm_bind_handle_t h_bind,\r
-                         IN osmv_txn_ctx_t * p_txn, IN osm_madw_t * p_madw);\r
-\r
-/*\r
- * NAME\r
- *   osmv_rmpp_txfr_init_receiver\r
- *\r
- * DESCRIPTION\r
- *   init the rmpp recv ctx in the transaction\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_init_rmpp_receiver(IN osm_bind_handle_t h_bind,\r
-                           IN osmv_txn_ctx_t * p_txn,\r
-                           IN boolean_t is_init_by_peer);\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_done\r
- *\r
- * DESCRIPTION\r
- *   destroys txn object and removes it from the db\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-void\r
-osmv_txn_done(IN osm_bind_handle_t h_bind,\r
-             IN uint64_t key, IN boolean_t is_in_cb);\r
-/*\r
- * NAME\r
- *   osmv_txn_get_tid\r
- *\r
- * DESCRIPTION\r
- *   returns tid of the transaction\r
- * SEE ALSO\r
- *\r
- */\r
-static inline uint64_t osmv_txn_get_tid(IN osmv_txn_ctx_t * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->tid;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_get_key\r
- *\r
- * DESCRIPTION\r
- *   returns key of the transaction\r
- * SEE ALSO\r
- *\r
- */\r
-\r
-static inline uint64_t osmv_txn_get_key(IN osmv_txn_ctx_t * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->key;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_is_rmpp_init_by_peer\r
- *\r
- * DESCRIPTION\r
- *   returns whether the rmpp txfr was init by the peer\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-static inline boolean_t osmv_txn_is_rmpp_init_by_peer(IN osmv_txn_ctx_t * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->rmpp_txfr.is_rmpp_init_by_peer;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_get_rmpp_send_ctx\r
- *\r
- * DESCRIPTION\r
- *   returns osmv_rmpp_send_ctx obj\r
- * SEE ALSO\r
- *\r
- */\r
-static inline osmv_rmpp_send_ctx_t *osmv_txn_get_rmpp_send_ctx(IN osmv_txn_ctx_t\r
-                                                              * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->rmpp_txfr.p_rmpp_send_ctx;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_get_rmpp_recv_ctx\r
- *\r
- * DESCRIPTION\r
- *   returns osmv_rmpp_recv_ctx obj\r
- * SEE ALSO\r
- *\r
- */\r
-static inline osmv_rmpp_recv_ctx_t *osmv_txn_get_rmpp_recv_ctx(IN osmv_txn_ctx_t\r
-                                                              * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->rmpp_txfr.p_rmpp_recv_ctx;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_get_rmpp_state\r
- *\r
- * DESCRIPTION\r
- *   returns the rmpp role of the transactino ( send/ recv)\r
- * SEE ALSO\r
- *\r
- */\r
-static inline osmv_txn_rmpp_state_t\r
-osmv_txn_get_rmpp_state(IN osmv_txn_ctx_t * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->rmpp_txfr.rmpp_state;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_set_rmpp_state\r
- *\r
- * DESCRIPTION\r
- *   sets the rmpp role of the transaction (send/ recv)\r
- * SEE ALSO\r
- *\r
- */\r
-static inline void\r
-osmv_txn_set_rmpp_state(IN osmv_txn_ctx_t * p_txn,\r
-                       IN osmv_txn_rmpp_state_t state)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       p_txn->rmpp_txfr.rmpp_state = state;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_get_madw\r
- *\r
- * DESCRIPTION\r
- *   returns the requester madw\r
- * SEE ALSO\r
- *\r
- */\r
-static inline osm_madw_t *osmv_txn_get_madw(IN osmv_txn_ctx_t * p_txn)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       return p_txn->p_madw;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_txn_set_madw\r
- *\r
- * DESCRIPTION\r
- *   sets the requester madw\r
- * SEE ALSO\r
- *\r
- */\r
-static inline void\r
-osmv_txn_set_madw(IN osmv_txn_ctx_t * p_txn, IN osm_madw_t * p_madw)\r
-{\r
-       CL_ASSERT(NULL != p_txn);\r
-       p_txn->p_madw = p_madw;\r
-}\r
-\r
-/*\r
- * NAME\r
- *  osmv_txn_set_timeout_ev\r
- *\r
- * DESCRIPTION\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_set_timeout_ev(IN osm_bind_handle_t h_bind,\r
-                       IN uint64_t key, IN uint64_t msec);\r
-/*\r
- * NAME\r
- *  osmv_txn_remove_timeout_ev\r
- *\r
- * DESCRIPTION\r
-\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_txn_remove_timeout_ev(IN osm_bind_handle_t h_bind, IN uint64_t key);\r
-/*\r
- * NAME\r
- *  osmv_txn_lookup\r
- *\r
- * DESCRIPTION\r
- *   get a transaction by its key\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_lookup(IN osm_bind_handle_t h_bind,\r
-               IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-void osmv_txn_abort_rmpp_txns(IN osm_bind_handle_t h_bind);\r
-\r
-/*      *       *       *       *       *       *       *       *       *       *       *       */\r
-/*\r
- * NAME\r
- *  osmv_txnmgr_init\r
- *\r
- * DESCRIPTION\r
- *  c'tor for txn mgr obj\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txnmgr_init(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                IN osm_log_t * p_log, IN cl_spinlock_t * p_lock);\r
-\r
-/*\r
- * NAME\r
- *  osmv_txnmgr_done\r
- *\r
- * DESCRIPTION\r
- *  c'tor for txn mgr obj\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_txnmgr_done(IN osm_bind_handle_t h_bind);\r
-\r
-void osmv_txn_lock(IN osm_bind_handle_t h_bind);\r
-void osmv_txn_unlock(IN osm_bind_handle_t h_bind);\r
-\r
-inline static uint64_t osmv_txn_uniq_key(IN uint64_t tid)\r
-{\r
-       uint64_t pid = getpid();\r
-\r
-       return ((pid << 32) | (tid & 0xFFFFFFFF));\r
-}\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSMV_TXN_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mtl.h b/branches/opensm_3/user/include/vendor/osm_vendor_mtl.h
deleted file mode 100644 (file)
index 55f5e9e..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Definition of interface for the MTL Vendor\r
- *        This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_MTL_H_\r
-#define _OSM_VENDOR_MTL_H_\r
-\r
-#undef IN\r
-#undef OUT\r
-#include <vapi_types.h>\r
-#include <evapi.h>\r
-#include <ib_mgt.h>\r
-#define IN\r
-#define OUT\r
-#include "iba/ib_types.h"\r
-#include "iba/ib_al.h"\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_types_osd.h>\r
-#include <opensm/osm_base.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/Vendor MTL\r
-* NAME\r
-*      Vendor MTL\r
-*\r
-* DESCRIPTION\r
-*\r
-*      The Vendor MTL object is thread safe.\r
-*\r
-*      This object should be treated as opaque and should be\r
-*      manipulated only through the provided functions.\r
-*\r
-*\r
-* AUTHOR\r
-*\r
-*\r
-*********/\r
-/****s* OpenSM: Vendor MTL/osm_ca_info_t\r
-* NAME\r
-*   osm_ca_info_t\r
-*\r
-* DESCRIPTION\r
-*      Structure containing information about local Channle Adapters.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-\r
-} osm_ca_info_t;\r
-\r
-/*\r
-* FIELDS\r
-*      guid\r
-*              Node GUID of the local CA.\r
-*\r
-*      attr_size\r
-*              Size of the CA attributes for this CA.\r
-*\r
-*      p_attr\r
-*              Pointer to dynamicly allocated CA Attribute structure.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#define OSM_DEFAULT_RETRY_COUNT 3\r
-\r
-/***** OpenSM: Vendor MTL/osm_vendor_t\r
-* NAME\r
-*  osm_vendor_t\r
-*\r
-* DESCRIPTION\r
-*      The structure defining a vendor\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_vendor {\r
-       ib_al_handle_t h_al;\r
-       osm_log_t *p_log;\r
-       uint32_t ca_count;\r
-       osm_ca_info_t *p_ca_info;\r
-       uint32_t timeout;\r
-       struct osm_transaction_mgr_t *p_transaction_mgr;\r
-} osm_vendor_t;\r
-\r
-/*\r
-* FIELDS\r
-*      h_al\r
-*              Handle returned by MTL open call (ib_open_al).\r
-*\r
-*      p_log\r
-*              Pointer to the log object.\r
-*\r
-*      ca_count\r
-*              Number of CA's in the array pointed to by p_ca_info.\r
-*\r
-*      p_ca_info\r
-*              Pointer to dynamically allocated array of CA info objects.\r
-*\r
-*      timeout\r
-*              Transaction timeout time in milliseconds.\r
-*\r
-*  p_transaction_mgr\r
-*     Pointer to Transaction Manager.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_port_guid\r
-* NAME\r
-*      osm_ca_info_get_port_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t\r
-osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,\r
-                         IN const uint8_t index)\r
-{\r
-       return (p_ca_info->p_attr->p_port_attr[index].port_guid);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-*      index\r
-*              [in] Port "index" for which to retrieve the port GUID.\r
-*              The index is the offset into the ca's internal array\r
-*              of port attributes.\r
-*\r
-* RETURN VALUE\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_num_ports\r
-* NAME\r
-*      osm_ca_info_get_num_ports\r
-*\r
-* DESCRIPTION\r
-*      Returns the number of ports of the given ca_info\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t\r
-osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)\r
-{\r
-       return (p_ca_info->p_attr->num_ports);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-* RETURN VALUE\r
-*      Returns the number of CA ports\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port\r
- * NAME\r
- *     osm_vendor_get_guid_ca_and_port\r
- *\r
- * DESCRIPTION\r
- * Given the vendor obj and a guid\r
- * return the ca id and port number that have that guid\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT VAPI_hca_hndl_t * p_hca_hndl,\r
-                               OUT VAPI_hca_id_t * p_hca_id,\r
-                               OUT uint32_t * p_port_num);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to an osm_vendor_t object.\r
-*\r
-*      guid\r
-*              [in] The guid to search for.\r
-*\r
-*      p_hca_id\r
-*              [out] The HCA Id (VAPI_hca_id_t *) that the port is found on.\r
-*\r
-*      p_port_num\r
-*              [out] Pointer to a port number arg to be filled with the port number with the given guid.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS on SUCCESS\r
-*  IB_INVALID_GUID if the guid is notfound on any Local HCA Port\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: Vendor MTL/osm_vendor_get_all_port_attr\r
- * NAME\r
- *     osm_vendor_get_all_port_attr\r
- *\r
- * DESCRIPTION\r
- * Fill in the array of port_attr with all available ports on ALL the\r
- * avilable CAs on this machine.\r
- * ALSO -\r
- * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                                            IN ib_port_attr_t *\r
-                                            const p_attr_array,\r
-                                            IN uint32_t * const p_num_ports);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to an osm_vendor_t object.\r
-*\r
-*      p_attr_array\r
-*              [out] Pre-allocated array of port attributes to be filled in\r
-*\r
-*      p_num_ports\r
-*              [out] The size of the given array. Filled in by the actual numberof ports found.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if OK\r
-*  IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-\r
-/****s* OpenSM: Vendor MTL/osm_bind_handle_t\r
-* NAME\r
-*   osm_bind_handle_t\r
-*\r
-* DESCRIPTION\r
-*      handle returned by the vendor transport bind call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void *osm_bind_handle_t;\r
-\r
-/***********/\r
-\r
-/****s* OpenSM: Vendor MTL/osm_vend_wrap_t\r
-* NAME\r
-*   MTL Vendor MAD Wrapper\r
-*\r
-* DESCRIPTION\r
-*      MTL specific MAD wrapper. MTL transport layer uses this for\r
-*      housekeeping.\r
-*\r
-* SYNOPSIS\r
-*********/\r
-typedef struct _osm_vend_wrap_t {\r
-       uint32_t size;\r
-       osm_bind_handle_t h_bind;\r
-       // ib_av_handle_t         h_av;\r
-       ib_mad_t *mad_buf_p;\r
-       void *p_resp_madw;\r
-} osm_vend_wrap_t;\r
-\r
-/*\r
-* FIELDS\r
-*      size\r
-*              Size of the allocated MAD\r
-*\r
-*      h_bind\r
-*              Bind handle used on this transaction\r
-*\r
-*      h_av\r
-*              Address vector handle used for this transaction.\r
-*\r
-*      p_resp_madw\r
-*              Pointer to the mad wrapper structure used to hold the pending\r
-*              reponse to the mad, if any.  If a response is expected, the\r
-*              wrapper for the reponse is allocated during the send call.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_MTL_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mtl_hca_guid.h b/branches/opensm_3/user/include/vendor/osm_vendor_mtl_hca_guid.h
deleted file mode 100644 (file)
index de7c554..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Provides interface over VAPI for obtaining the local ports guids or from guid\r
- *    obtaining the HCA and port number.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_HCA_GUID_H_\r
-#define _OSM_VENDOR_HCA_GUID_H_\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: Vendor AL/osm_ca_info_t\r
-* NAME\r
-*   osm_ca_info_t\r
-*\r
-* DESCRIPTION\r
-*      Structure containing information about local Channle Adapters.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-\r
-} osm_ca_info_t;\r
-\r
-/*\r
-* FIELDS\r
-*      guid\r
-*              Node GUID of the local CA.\r
-*\r
-*      attr_size\r
-*              Size of the CA attributes for this CA.\r
-*\r
-*      p_attr\r
-*              Pointer to dynamicly allocated CA Attribute structure.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_port_guid\r
-* NAME\r
-*      osm_ca_info_get_port_guid\r
-*\r
-* DESCRIPTION\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t\r
-osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,\r
-                         IN const uint8_t index)\r
-{\r
-       return (p_ca_info->p_attr->p_port_attr[index].port_guid);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ca_info\r
-*              [in] Pointer to a CA Info object.\r
-*\r
-*      index\r
-*              [in] Port "index" for which to retrieve the port GUID.\r
-*              The index is the offset into the ca's internal array\r
-*              of port attributes.\r
-*\r
-* RETURN VALUE\r
-*      Returns the port GUID of the specified port owned by this CA.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port\r
- * NAME\r
- *     osm_vendor_get_guid_ca_and_port\r
- *\r
- * DESCRIPTION\r
- * Given the vendor obj and a guid\r
- * return the ca id and port number that have that guid\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT VAPI_hca_id_t * p_hca_id,\r
-                               OUT uint32_t * p_port_num);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to an osm_vendor_t object.\r
-*\r
-*      guid\r
-*              [in] The guid to search for.\r
-*\r
-*      p_hca_id\r
-*              [out] The HCA Id (VAPI_hca_id_t *) that the port is found on.\r
-*\r
-*      p_port_num\r
-*              [out] Pointer to a port number arg to be filled with the port number with the given guid.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS on SUCCESS\r
-*  IB_INVALID_GUID if the guid is notfound on any Local HCA Port\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* OpenSM: SM Vendor/osm_vendor_get_all_port_attr\r
- * NAME\r
- *     osm_vendor_get_all_port_attr\r
- *\r
- * DESCRIPTION\r
- * Fill in the array of port_attr with all available ports on ALL the\r
- * avilable CAs on this machine.\r
- * ALSO -\r
- * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                                            IN ib_port_attr_t *\r
-                                            const p_attr_array,\r
-                                            IN uint32_t * const p_num_ports);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to an osm_vendor_t object.\r
-*\r
-*      p_attr_array\r
-*              [out] Pre-allocated array of port attributes to be filled in\r
-*\r
-*      p_num_ports\r
-*              [out] The size of the given array. Filled in by the actual numberof ports found.\r
-*\r
-* RETURN VALUES\r
-*      IB_SUCCESS if OK\r
-*  IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /*  _OSM_VENDOR_HCA_GUID_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mtl_transaction_mgr.h b/branches/opensm_3/user/include/vendor/osm_vendor_mtl_transaction_mgr.h
deleted file mode 100644 (file)
index a69be8d..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Definition of interface for the MTL Vendor\r
- *        This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_TRANSACTION_MGR_H_\r
-#define _OSM_TRANSACTION_MGR_H_\r
-\r
-  /*\r
-     #include <vapi_types.h>\r
-     #include <evapi.h>\r
-   */\r
-\r
-#include <iba/ib_types.h>\r
-#include <iba/ib_al.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_timer.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_types_osd.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_madw.h>\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-#include <ib_mgt.h>\r
-#include <opensm/osm_mtl_bind.h>\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: Transaction Manager/osm_madw_req_t\r
-* NAME\r
-*  osm_madw_req_t\r
-*\r
-* DESCRIPTION\r
-*  The structure defining each object in the transaction_mgr.\r
-*  For every request mad sent, we will save such an object for it.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_madw_req {\r
-       cl_list_item_t list_item;\r
-       cl_map_item_t map_item;\r
-       osm_madw_t *p_madw;\r
-       uint64_t waking_time;\r
-       uint8_t retry_cnt;\r
-       osm_bind_handle_t *p_bind;\r
-} osm_madw_req_t;\r
-\r
-/*\r
-* FIELDS\r
-*  list_item\r
-*     List item for qlist linkage. Must be first element!!\r
-*\r
-*  map_item\r
-*     Map item for qmap linkage.\r
-*\r
-*  p_madw\r
-*     pointer to mad wrapper that is expecting to get a response.\r
-*\r
-*  waking_time\r
-*     Time stamp (in microseconds) when the p_madw needs to wake up.\r
-*     This value is\r
-*      cl_get_time_stamp() + timeout  during the sending of the mad.\r
-*      where timeout should be given in microseconds.\r
-*\r
-*  retry_cnt\r
-*     The number of outstanding retries to be called.\r
-*********/\r
-\r
-/****s* OpenSM: Transaction Manager/osm_transaction_mgr_t\r
-* NAME\r
-*  osm_transaction_mgr_t\r
-*\r
-* DESCRIPTION\r
-*  This structure defines the transaction manager.\r
-*  It holds a qlist and a qmap, a lock on the transaction manager, and\r
-*  a timer used for the list.\r
-*  The manager is responsible for keeping track of every request mad that was\r
-*  sent. It is used for finding mads according to their transaction id, and for\r
-*  acting as an event wheel - reporting as error each packet was supposed to get\r
-*  a response and didn't get one by the timeout time expected.\r
-*\r
-*  Both the list and the map hold the osm_madw_req_t objects - one for every madw.\r
-*\r
-*  Managing of the list:\r
-*  The timer wakes on the timeout of the first madw. If the waking_time is greater than\r
-*  the current time - then the mad received a response. If not - the mad didn't get\r
-*  its response.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_transaction_mgr {\r
-       cl_qmap_t *madw_by_tid_map_p;\r
-       cl_qlist_t *madw_reqs_list_p;\r
-       cl_spinlock_t transaction_mgr_lock;\r
-       cl_timer_t madw_list_timer;\r
-} osm_transaction_mgr_t;\r
-\r
-/*\r
-* FIELDS\r
-*  madw_by_tid_map_p\r
-*     A qmap with key = transaction id. and value of osm_madw_req_t.\r
-*\r
-*  madw_reqs_list_p\r
-*     A qlist of all the madw with their waking time.\r
-*\r
-*  transaction_mgr_lock\r
-*     Lock used on the transaction manager - make sure changes on it are serial.\r
-*\r
-*  madw_list_timer\r
-*     Timer on the list.\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_init\r
-* NAME\r
-*      osm_transaction_mgr_init\r
-*\r
-* DESCRIPTION\r
-*      Initialize the transaction manager.\r
-*  Will update the p_transaction_mgr in the vendor object with\r
-*  the new Transaction Manager created.*\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_transaction_mgr_init(IN osm_vendor_t * const p_vend);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to a Osm Vendor object.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_destroy\r
-* NAME\r
-*      osm_transaction_mgr_destroy\r
-*\r
-* DESCRIPTION\r
-*      Destroy the transaction manager.\r
-*  Will de-allocate all memory allocated by the Transaction\r
-*  Manager up to now.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_transaction_mgr_destroy(IN osm_vendor_t * const p_vend);\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to a Osm Vendor object.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_insert_madw\r
-* NAME\r
-*      osm_transaction_mgr_insert_madw\r
-*\r
-* DESCRIPTION\r
-*      Insert a new madw to the manager. The madw is added with a waking_time,\r
-*  Which is equal to the current_time + timeout. This is the maximum time\r
-*  that the madw can leave without being handled (e.g - get a response).\r
-*  If there are no madw saved in the manager - start the timer for vendor\r
-*  timeout period.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_transaction_mgr_insert_madw(IN osm_bind_handle_t * p_bind,\r
-                               IN osm_madw_t * p_madw);\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to a mtl bind object.\r
-*\r
-*  p_madw\r
-*     [in] Pointer to the Mad Wrapper to be added.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_erase_madw\r
-* NAME\r
-*      osm_transaction_mgr_erase_madw\r
-*\r
-* DESCRIPTION\r
-*      Erase a madw object from the manager.\r
-*  The removal is done using the transaction id of the mad - using\r
-*  it the madw_p is allocated (in the qmap) and removed from the\r
-*  qmap and qlist.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_transaction_mgr_erase_madw(IN osm_vendor_t * const p_vend,\r
-                              IN ib_mad_t * p_mad);\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to a Osm Vendor object.\r
-*\r
-*  p_mad\r
-*      [in] Pointer to the Mad to be removed.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_get_madw_for_tid\r
-* NAME\r
-*      osm_transaction_mgr_get_madw_for_tid\r
-*\r
-* DESCRIPTION\r
-*      Return the mad wrapper, given the p_mad (and in it the transaction id)\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osm_transaction_mgr_get_madw_for_tid(IN osm_vendor_t * const p_vend,\r
-                                    IN ib_mad_t * const p_mad,\r
-                                    OUT osm_madw_t ** req_madw_p);\r
-/*\r
-* PARAMETERS\r
-*      p_vend\r
-*              [in] Pointer to a Osm Vendor object.\r
-*\r
-*  p_mad\r
-*      [in] Pointer to the Mad to be located.\r
-*\r
-* req_madw_p\r
-*      [out] Pointer to the mad Wrapper to be found.\r
-*\r
-*********/\r
-\r
-/****f* OpenSM: Transaction Manager/osm_transaction_mgr_callback\r
-* NAME\r
-*      osm_transaction_mgr_callback\r
-*\r
-* DESCRIPTION\r
-*      This callback is called on timeout of the timer.\r
-*  It checks the time of the head madw in the qlist, and compares it to\r
-*  the current time.\r
-*  Will send an error callback if the time of the madw is less than the\r
-*  current time - this means that the madw wasn't removed in the timeout\r
-*  it was supposed to be handled.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void osm_transaction_mgr_callback(IN void *context);\r
-/*\r
-* PARAMETERS\r
-*      context\r
-*              [in] void* context\r
-*\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_TRANSACTION_MGR_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_sa_api.h b/branches/opensm_3/user/include/vendor/osm_vendor_sa_api.h
deleted file mode 100644 (file)
index 0451caa..0000000
+++ /dev/null
@@ -1,866 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Specification of the OpenSM SA Client API. This API uses the basic osm\r
- *    vendor API to provide SA Client interface.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_SA_API_H_\r
-#define _OSM_VENDOR_SA_API_H_\r
-\r
-#include <iba/ib_types.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****d* OpenSM Vendor SA Client/osmv_flags_t\r
-* NAME\r
-*      osmv_flags_t\r
-*\r
-* DESCRIPTION\r
-*      Access layer flags used to direct the operation of various calls.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t osmv_flags_t;\r
-#define OSM_SA_FLAGS_SYNC                              0x00000001\r
-/*\r
-* VALUES\r
-*      OSM_SA_FLAGS_SYNC\r
-*              Indicates that the given operation should be performed synchronously.\r
-*              The call will block until it completes.  Callbacks will still be\r
-*              invoked.\r
-*\r
-* SEE ALSO\r
-*  osmv_query_sa\r
-*****/\r
-\r
-/****d* OpenSM Vendor SA Client/osmv_query_type_t\r
-* NAME\r
-*      osmv_query_type_t\r
-*\r
-* DESCRIPTION\r
-*      Abstracted queries supported by the access layer.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _osmv_query_type {\r
-       OSMV_QUERY_USER_DEFINED,\r
-\r
-       OSMV_QUERY_ALL_SVC_RECS,\r
-       OSMV_QUERY_SVC_REC_BY_NAME,\r
-       OSMV_QUERY_SVC_REC_BY_ID,\r
-\r
-       OSMV_QUERY_CLASS_PORT_INFO,\r
-\r
-       OSMV_QUERY_NODE_REC_BY_NODE_GUID,\r
-       OSMV_QUERY_PORT_REC_BY_LID,\r
-       OSMV_QUERY_PORT_REC_BY_LID_AND_NUM,\r
-\r
-       OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK,\r
-       OSMV_QUERY_SLVL_BY_LID_AND_PORTS,\r
-\r
-       OSMV_QUERY_PATH_REC_BY_PORT_GUIDS,\r
-       OSMV_QUERY_PATH_REC_BY_GIDS,\r
-       OSMV_QUERY_PATH_REC_BY_LIDS,\r
-\r
-       OSMV_QUERY_UD_MULTICAST_SET,\r
-       OSMV_QUERY_UD_MULTICAST_DELETE,\r
-\r
-       OSMV_QUERY_MULTIPATH_REC,\r
-\r
-} osmv_query_type_t;\r
-/*\r
-* VALUES\r
-*      OSMV_QUERY_USER_DEFINED\r
-*              Query the SA based on user-defined input.  Queries of this type\r
-*              should reference an osmv_user_query_t structure as input to the\r
-*              query.\r
-*\r
-*      OSMV_QUERY_SVC_REC_BY_NAME\r
-*              Query for service records based on the service name.  Queries of\r
-*              this type should reference an ib_svc_name_t structure as input\r
-*              to the query.\r
-*\r
-*      OSMV_QUERY_SVC_REC_BY_ID\r
-*              Query for service records based on the service ID.  Queries of\r
-*              this type should reference an ib_net64_t value that indicates\r
-*              the ID of the service being requested.\r
-*\r
-*      OSMV_QUERY_NODE_REC_BY_NODE_GUID\r
-*              Query for node information based on the node's GUID.  Queries of\r
-*              this type should reference an ib_net64_t value that indicates\r
-*              the GUID of the node being requested.\r
-*\r
-*      OSMV_QUERY_PORT_REC_BY_LID\r
-*              Query for port information based on the port's base LID. Queries\r
-*              of this type should reference an ib_net16_t value that indicates\r
-*              the base LID of the port being requested.\r
-*\r
-*      OSMV_QUERY_PORT_REC_BY_LID_AND_NUM\r
-*              Query for port information based on the port's LID and port num.\r
-*              Queries of this type should reference an osmv_user_query_t\r
-*              structure as input to the query. The port num and lid should\r
-*              be provided by it.\r
-*\r
-*      OSMV_QUERY_PATH_REC_BY_PORT_GUIDS\r
-*              Query for path records between the specified pair of port GUIDs.\r
-*              Queries of this type should reference an osmv_guid_pair_t\r
-*              structure that indicates the GUIDs of the path being requested.\r
-*\r
-*      OSMV_QUERY_PATH_REC_BY_GIDS\r
-*              Query for path records between the specified pair of port GIDs.\r
-*              Queries of this type should reference an osmv_gid_pair_t\r
-*              structure that indicates the GIDs of the path being requested.\r
-*\r
-*      OSMV_QUERY_PATH_REC_BY_LIDS\r
-*              Query for path records between the specified pair of port LIDs.\r
-*              Queries of this type should reference an osmv_lid_pair_t\r
-*              structure that indicates the LIDs of the path being requested.\r
-*\r
-* NOTES\r
-*      This enum is used to define abstracted queries provided by the access\r
-*      layer.  Users may issue queries not listed here by sending MADs directly\r
-*      to subnet administration or a class manager.  These queries are\r
-*      intended to represent those most often used by clients.\r
-*\r
-* SEE ALSO\r
-*      osmv_query, osmv_query_req_t, osmv_user_query_t, osmv_gid_pair_t,\r
-*      osmv_lid_pair_t osmv_guid_pair_t\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_user_query_t\r
-* NAME\r
-*      osmv_user_query_t\r
-*\r
-* DESCRIPTION\r
-*      User-defined query information.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_user_query {\r
-       uint8_t method;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t attr_offset;\r
-       ib_net32_t attr_mod;\r
-       ib_net64_t comp_mask;\r
-       void *p_attr;\r
-} osmv_user_query_t;\r
-/*\r
-* FIELDS\r
-*\r
-*      method\r
-*              Method to be used\r
-*\r
-*      attr_id\r
-*              Attribute identifier of query data.\r
-*\r
-*      attr_offset\r
-*              Size of the query attribute, in 8-byte words.  Users can set\r
-*              this value by passing in the sizeof( attribute ) into the\r
-*              ib_get_attr_offset() routine.\r
-*\r
-*      attr_mod\r
-*              Attribute modifier for query request.\r
-*\r
-*      comp_mask\r
-*              Indicates the attribute components that are specified for the\r
-*              query.\r
-*\r
-*      p_attr\r
-*              References the attribute structure used as input into the query.\r
-*              This field is ignored if comp_mask is set to 0.\r
-*\r
-* NOTES\r
-*      This structure is used to describe a user-defined query.  The attribute\r
-*      ID, attribute offset, component mask, and attribute structure must match\r
-*      those defined by the IBA specification.  Users should refer to chapter\r
-*      15 of the IBA specification for additional details.\r
-*\r
-* SEE ALSO\r
-*      osmv_query_type_t, ib_get_attr_offset, ib_get_attr_size, osmv_query_sa\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_gid_pair_t\r
-* NAME\r
-*      osmv_gid_pair_t\r
-*\r
-* DESCRIPTION\r
-*      Source and destination GIDs.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_gid_pair {\r
-       ib_gid_t src_gid;\r
-       ib_gid_t dest_gid;\r
-} osmv_gid_pair_t;\r
-/*\r
-* FIELDS\r
-*      src_gid\r
-*              Source GID of a path.\r
-*\r
-*      dest_gid\r
-*              Destination GID of a path.\r
-*\r
-* NOTES\r
-*      This structure is used to describe the endpoints of a path.\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_lid_pair_t\r
-* NAME\r
-*      osmv_lid_pair_t\r
-*\r
-* DESCRIPTION\r
-*      Source and destination LIDs.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_lid_pair {\r
-       ib_net16_t src_lid;\r
-       ib_net16_t dest_lid;\r
-} osmv_lid_pair_t;\r
-/*\r
-* FIELDS\r
-*      src_lid\r
-*              Source LID of a path.\r
-*\r
-*      dest_lid\r
-*              Destination LID of a path.\r
-*\r
-* NOTES\r
-*      This structure is used to describe the endpoints of a path.\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_guid_pair_t\r
-* NAME\r
-*      osmv_guid_pair_t\r
-*\r
-* DESCRIPTION\r
-*      Source and destination GUIDs.  These may be port or channel adapter\r
-*      GUIDs, depending on the context in which this structure is used.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_guid_pair {\r
-       ib_net64_t src_guid;\r
-       ib_net64_t dest_guid;\r
-} osmv_guid_pair_t;\r
-/*\r
-* FIELDS\r
-*      src_guid\r
-*              Source GUID of a path.\r
-*\r
-*      dest_guid\r
-*              Destination GUID of a path.\r
-*\r
-* NOTES\r
-*      This structure is used to describe the endpoints of a path.  The given\r
-*      GUID pair may belong to either ports or channel adapters.\r
-*\r
-* SEE ALSO\r
-*      ib_guid_t\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_multipath_req_t\r
-* NAME\r
-*       osmv_multipath_req_t\r
-*\r
-* DESCRIPTION\r
-*       Fields from which to generate a MultiPathRecord request.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_multipath_req_t {\r
-       ib_net64_t comp_mask;\r
-       uint16_t pkey;\r
-       boolean_t reversible;\r
-       uint8_t num_path;\r
-       uint8_t sl;\r
-       uint8_t independence;\r
-       uint8_t sgid_count;\r
-       uint8_t dgid_count;\r
-       ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];\r
-} osmv_multipath_req_t;\r
-/*\r
-* FIELDS\r
-*\r
-* NOTES\r
-*       This structure is used to describe a multipath request.\r
-*\r
-* SEE ALSO\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_query_res_t\r
-* NAME\r
-*      osmv_query_res_t\r
-*\r
-* DESCRIPTION\r
-*      Contains the results of a subnet administration query.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_query_res {\r
-       const void *query_context;\r
-       ib_api_status_t status;\r
-       osmv_query_type_t query_type;\r
-       uint32_t result_cnt;\r
-       osm_madw_t *p_result_madw;\r
-} osmv_query_res_t;\r
-/*\r
-* FIELDS\r
-*      query_context\r
-*              User-defined context information associated with the query\r
-*              through the osm_vendor_query_sa call.\r
-*\r
-*      status\r
-*              Indicates the success of the query operation.\r
-*\r
-*      query_type\r
-*              Indicates the type of query for which the results are being\r
-*              returned.  This matches the query_type specified through the\r
-*               osm_vendor_query_sa call.\r
-*\r
-*      result_cnt\r
-*              The number of result structures that were returned by the query.\r
-*\r
-*      p_result_madw\r
-*              For queries returning IB_SUCCESS or IB_REMOTE_ERROR, this\r
-*              references the MAD wrapper returned by subnet administration\r
-*              containing the list of results or the returned error code.\r
-*\r
-* NOTES\r
-*      A query result structure is returned to a client through their\r
-*      osmv_pfn_query_cb_t routine to notify them of the results of a subnet\r
-*      administration query.  If the query was successful or received an error\r
-*      from subnet administration, p_result_madw will reference a MAD wrapper\r
-*      containing the results.  The MAD referenced by p_result_madw is owned by\r
-*      the user and remains available even after their callback returns.  Users\r
-*      must call osm_mad_pool_put() to return the MAD wrapper back to the\r
-*      mad pool when they are done accessing the results.\r
-*\r
-*      To retrieve individual result structures from the p_result_madw, users\r
-*      may call osmv_get_query_result().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_sa, osmv_pfn_query_cb_t, ib_api_status_t,\r
-*      osmv_query_status_t, osmv_query_type_t,\r
-*      osmv_get_query_result\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_result\r
-* NAME\r
-*      osmv_get_query_result\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a result structure from a MADW returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void *osmv_get_query_result(IN osm_madw_t * p_result_madw,\r
-                                         IN uint32_t result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad);\r
-       CL_ASSERT(ib_get_attr_size(p_sa_mad->attr_offset) * (result_index + 1) +\r
-                 IB_SA_MAD_HDR_SIZE <= p_result_madw->mad_size);\r
-\r
-       return (p_sa_mad->data +\r
-               (ib_get_attr_size(p_sa_mad->attr_offset) * result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a result structure from a\r
-*      call to osmv_query_sa().  The type of result structure must be known to\r
-*      the user either through the user's context or the query_type returned as\r
-*      part of the osmv_query_res_t structure.\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_path_rec\r
-* NAME\r
-*      osmv_get_query_path_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a path record result from a MAD returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_path_rec_t *osmv_get_query_path_rec(IN osm_madw_t *\r
-                                                    p_result_madw,\r
-                                                    IN uint32_t result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);\r
-\r
-       return ((ib_path_rec_t *)\r
-               osmv_get_query_result(p_result_madw, result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a path record result from\r
-*      a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_path_rec_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_portinfo_rec\r
-* NAME\r
-*      osmv_get_query_portinfo_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a port info record result from a MAD returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_portinfo_record_t *osmv_get_query_portinfo_rec(IN osm_madw_t *\r
-                                                               p_result_madw,\r
-                                                               IN uint32_t\r
-                                                               result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD);\r
-\r
-       return ((ib_portinfo_record_t *) osmv_get_query_result(p_result_madw,\r
-                                                              result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a port info record result\r
-*      from a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_portinfo_record_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_node_rec\r
-* NAME\r
-*      osmv_get_query_node_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a node record result from a MAD returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_node_record_t *osmv_get_query_node_rec(IN osm_madw_t *\r
-                                                       p_result_madw,\r
-                                                       IN uint32_t\r
-                                                       result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_NODE_RECORD);\r
-\r
-       return ((ib_node_record_t *) osmv_get_query_result(p_result_madw,\r
-                                                          result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a node record result from\r
-*      a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_node_record_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_svc_rec\r
-* NAME\r
-*      osmv_get_query_svc_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a service record result from a MAD returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_service_record_t *osmv_get_query_svc_rec(IN osm_madw_t *\r
-                                                         p_result_madw,\r
-                                                         IN uint32_t\r
-                                                         result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD);\r
-\r
-       return ((ib_service_record_t *) osmv_get_query_result(p_result_madw,\r
-                                                             result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a service record result from\r
-*      a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_service_record_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_mc_rec\r
-* NAME\r
-*      osmv_get_query_mc_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves a multicast record result from a MAD returned by a call to\r
-*      osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_member_rec_t *osmv_get_query_mc_rec(IN osm_madw_t *\r
-                                                    p_result_madw,\r
-                                                    IN uint32_t result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD);\r
-\r
-       return ((ib_member_rec_t *) osmv_get_query_result(p_result_madw,\r
-                                                         result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a service record result from\r
-*      a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_member_rec_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_get_query_inform_info_rec\r
-* NAME\r
-*      osmv_get_query_inform_info_rec\r
-*\r
-* DESCRIPTION\r
-*      Retrieves an InformInfo record result from a MAD returned by\r
-*      a call to osmv_query_sa().\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_inform_info_record_t *osmv_get_query_inform_info_rec(IN\r
-                                                                     osm_madw_t\r
-                                                                     *\r
-                                                                     p_result_madw,\r
-                                                                     IN\r
-                                                                     uint32_t\r
-                                                                     result_index)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       CL_ASSERT(p_result_madw);\r
-       p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);\r
-       CL_ASSERT(p_sa_mad\r
-                 && p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD);\r
-\r
-       return ((ib_inform_info_record_t *) osmv_get_query_result(p_result_madw,\r
-                                                                 result_index));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_result_madw\r
-*              [in] This is a reference to the MAD returned as a result of the\r
-*              query.\r
-*\r
-*      result_index\r
-*              [in] A zero-based index indicating which result to return.\r
-*\r
-* NOTES\r
-*      This call returns a pointer to the start of a service record result from\r
-*      a call to osmv_query_sa().\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_inform_info_record_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_pfn_query_cb_t\r
-* NAME\r
-*      osmv_pfn_query_cb_t\r
-*\r
-* DESCRIPTION\r
-*      User-defined callback invoked on completion of subnet administration\r
-*      query.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef void\r
- (*osmv_pfn_query_cb_t) (IN osmv_query_res_t * p_query_res);\r
-/*\r
-* PARAMETERS\r
-*      p_query_res\r
-*              [in] This is a reference to a structure containing the result of\r
-*              the query.\r
-*\r
-* NOTES\r
-*      This routine is invoked to notify a client of the result of a subnet\r
-*      administration query.  The p_query_rec parameter references the result\r
-*      of the query and, in the case of a successful query, any information\r
-*      returned by subnet administration.\r
-*\r
-*      In the kernel, this callback is usually invoked using a tasklet,\r
-*      dependent on the implementation of the underlying verbs provider driver.\r
-*\r
-* SEE ALSO\r
-*      osmv_query_res_t\r
-*****/\r
-\r
-/****s* OpenSM Vendor SA Client/osmv_query_req_t\r
-* NAME\r
-*      osmv_query_req_t\r
-*\r
-* DESCRIPTION\r
-*      Information used to request an access layer provided query of subnet\r
-*      administration.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osmv_query_req {\r
-       osmv_query_type_t query_type;\r
-       const void *p_query_input;\r
-       ib_net64_t sm_key;\r
-\r
-       uint32_t timeout_ms;\r
-       uint32_t retry_cnt;\r
-       osmv_flags_t flags;\r
-\r
-       const void *query_context;\r
-       osmv_pfn_query_cb_t pfn_query_cb;\r
-} osmv_query_req_t;\r
-/*\r
-* FIELDS\r
-*      query_type\r
-*              Indicates the type of query that the access layer should\r
-*              perform.\r
-*\r
-*      p_query_input\r
-*              A pointer to the input for the query.  The data referenced by\r
-*              this structure is dependent on the type of query being requested\r
-*              and is determined by the specified query_type.\r
-*\r
-*      sm_key\r
-*              The SM_Key to be provided with the SA MAD for authentication.\r
-*              Normally 0 is used.\r
-*\r
-*      timeout_ms\r
-*              Specifies the number of milliseconds to wait for a response for\r
-*              this query until retrying or timing out the request.\r
-*\r
-*      retry_cnt\r
-*              Specifies the number of times that the query will be retried\r
-*              before failing the request.\r
-*\r
-*      flags\r
-*              Used to describe the mode of operation.  Set to IB_FLAGS_SYNC to\r
-*              process the called routine synchronously.\r
-*\r
-*      query_context\r
-*              User-defined context information associated with this query.\r
-*              The context data is returned to the user as a part of their\r
-*              query callback.\r
-*\r
-*      pfn_query_cb\r
-*              A user-defined callback that is invoked upon completion of the\r
-*              query.\r
-*\r
-* NOTES\r
-*      This structure is used when requesting an osm vendor provided query\r
-*      of subnet administration.  Clients specify the type of query through\r
-*      the query_type field.  Based on the type of query, the p_query_input\r
-*      field is set to reference the appropriate data structure.\r
-*\r
-*      The information referenced by the p_query_input field is one of the\r
-*      following:\r
-*\r
-*              -- a NULL terminated service name\r
-*              -- a service id\r
-*              -- a single GUID\r
-*              -- a pair of GUIDs specified through an osmv_guid_pair_t structure\r
-*              -- a pair of GIDs specified through an osmv_gid_pair_t structure\r
-*\r
-* SEE ALSO\r
-*      osmv_query_type_t, osmv_pfn_query_cb_t, osmv_guid_pair_t,\r
-*      osmv_gid_pair_t\r
-*****/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_bind_sa\r
-* NAME\r
-*   osmv_bind_sa\r
-*\r
-* DESCRIPTION\r
-*      Bind to the SA service and return a handle to be used for later\r
-*  queries.\r
-*\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_bind_handle_t\r
-osmv_bind_sa(IN osm_vendor_t * const p_vend,\r
-            IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid);\r
-/*\r
-* PARAMETERS\r
-*   p_vend\r
-*      [in] an osm_vendor object to work with\r
-*\r
-*   p_mad_pool\r
-*      [in] mad pool to obtain madw from\r
-*\r
-*   port_guid\r
-*      [in] the port guid to attach to.\r
-*\r
-* RETURN VALUE\r
-*      Bind handle to be used for later SA queries or OSM_BIND_INVALID_HANDLE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* osmv_query_sa\r
-*********/\r
-\r
-/****f* OpenSM Vendor SA Client/osmv_query_sa\r
-* NAME\r
-*   osmv_query_sa\r
-*\r
-* DESCRIPTION\r
-*   Query the SA given an SA query request (similar to IBAL ib_query).\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_api_status_t\r
-osmv_query_sa(IN osm_bind_handle_t h_bind,\r
-             IN const osmv_query_req_t * const p_query_req);\r
-/*\r
-* PARAMETERS\r
-*   h_bind\r
-*      [in] bind handle for this port. Should be previously\r
-*       obtained by calling osmv_bind_sa\r
-*\r
-*   p_query_req\r
-*      [in] an SA query request structure.\r
-*\r
-* RETURN VALUE\r
-*      IB_SUCCESS if completed successfuly (or in ASYNC mode\r
-*      if the request was sent).\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* osmv_bind_sa\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_SA_API_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_test.h b/branches/opensm_3/user/include/vendor/osm_vendor_test.h
deleted file mode 100644 (file)
index 8b360b9..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef _OSM_VENDOR_TEST_H_\r
-#define _OSM_VENDOR_TEST_H_\r
-\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/* This value must be zero for the TEST transport. */\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-/*\r
- * Abstract:\r
- *     Declaration of vendor specific transport interface.\r
- *  This is the "Test" vendor which allows compilation and some\r
- *  testing without a real vendor interface.\r
- *     These objects are part of the OpenSM family of objects.\r
- */\r
-/****h* OpenSM/Vendor Test\r
-* NAME\r
-*      Vendor Test\r
-*\r
-* DESCRIPTION\r
-*      The Vendor Test structure encapsulates an artificial transport layer\r
-*      interface for testing.\r
-*\r
-* AUTHOR\r
-*      Steve King, Intel\r
-*\r
-*********/\r
-/****s* OpenSM: Vendor Test/osm_vend_wrap_t\r
-* NAME\r
-*      osm_vend_wrap_t\r
-*\r
-* DESCRIPTION\r
-*      Vendor specific MAD wrapper context.\r
-*\r
-*      This structure allows direct access to member variables.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_vend_wrap {\r
-       uint32_t dummy;\r
-\r
-} osm_vend_wrap_t;\r
-/*********/\r
-\r
-/****s* OpenSM: Vendor Test/osm_vendor_t\r
-* NAME\r
-*      osm_vendor_t\r
-*\r
-* DESCRIPTION\r
-*      Vendor specific MAD interface.\r
-*\r
-*      This interface defines access to the vendor specific MAD\r
-*      transport layer.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _osm_vendor {\r
-       osm_log_t *p_log;\r
-       uint32_t timeout;\r
-\r
-} osm_vendor_t;\r
-/*********/\r
-\r
-typedef struct _osm_bind_handle {\r
-       osm_vendor_t *p_vend;\r
-       ib_net64_t port_guid;\r
-       uint8_t mad_class;\r
-       uint8_t class_version;\r
-       boolean_t is_responder;\r
-       boolean_t is_trap_processor;\r
-       boolean_t is_report_processor;\r
-       uint32_t send_q_size;\r
-       uint32_t recv_q_size;\r
-\r
-} *osm_bind_handle_t;\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_TEST_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_ts.h b/branches/opensm_3/user/include/vendor/osm_vendor_ts.h
deleted file mode 100644 (file)
index 7fbbf1a..0000000
+++ /dev/null
@@ -1,410 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Definition of interface for the TS Vendor\r
- *        This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_TS_H_\r
-#define _OSM_VENDOR_TS_H_\r
-\r
-#undef IN\r
-#undef OUT\r
-#include <vapi_types.h>\r
-#include <evapi.h>\r
-#include <ib/ts_api_ng/useraccess/include/ts_ib_useraccess.h>\r
-#define IN\r
-#define OUT\r
-#include "iba/ib_types.h"\r
-#include "iba/ib_al.h"\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_types_osd.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****s* OpenSM: Vendor TS/osm_bind_handle_t\r
- * NAME\r
- *   osm_bind_handle_t\r
- *\r
- * DESCRIPTION\r
- *     handle returned by the vendor transport bind call.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef void *osm_bind_handle_t;\r
-/*\r
-**********/\r
-#define OSM_DEFAULT_RETRY_COUNT 3\r
-\r
-/****s* OpenSM: Vendor osm_ts_bind_info_t\r
- * NAME\r
- *   osm_ts_bind_info_t\r
- *\r
- * DESCRIPTION\r
- *     Handle to the result of binding a class callbacks .\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osm_ts_bind_info {\r
-       int ul_dev_fd;\r
-       VAPI_hca_hndl_t hca_hndl;\r
-       struct _osm_vendor *p_vend;\r
-       void *client_context;\r
-       uint8_t port_num;\r
-       void *rcv_callback;\r
-       void *send_err_callback;\r
-       struct _osm_mad_pool *p_osm_pool;\r
-       cl_thread_t poller;\r
-} osm_ts_bind_info_t;\r
-/*\r
- * FIELDS\r
- *     ul_dev_file_hdl\r
- *             the file handle to be used for sending the MADs\r
- *\r
- * hca_hndl\r
- *     Handle to the HCA provided by the underlying VAPI\r
- *\r
- *     p_vend\r
- *             Pointer to the vendor object.\r
- *\r
- *     client_context\r
- *             User's context passed during osm_bind\r
- *\r
- *  hca_id\r
- *     HCA Id we bind to.\r
- *\r
- *     port_num\r
- *             Port number (within the HCA) of the bound port.\r
- *\r
- *     rcv_callback\r
- *             OSM Callback function to be called on receive of MAD.\r
- *\r
- *  send_err_callback\r
- *     OSM Callback to be called on send error.\r
- *\r
- *  p_osm_pool\r
- *     Points to the MAD pool used by OSM\r
- *\r
- *  poller\r
- *     A thread reading from the device file handle\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****h* OpenSM/Vendor TS\r
- * NAME\r
- *     Vendor TS\r
- *\r
- * DESCRIPTION\r
- *\r
- *     The Vendor TS object is thread safe.\r
- *\r
- *     This object should be treated as opaque and should be\r
- *     manipulated only through the provided functions.\r
- *\r
- *\r
- * AUTHOR\r
- *\r
- *\r
- *********/\r
-\r
-/****s* OpenSM: Vendor TS/osm_ca_info_t\r
- * NAME\r
- *   osm_ca_info_t\r
- *\r
- * DESCRIPTION\r
- *     Structure containing information about local Channle Adapters.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-\r
-} osm_ca_info_t;\r
-\r
-/*\r
- * FIELDS\r
- *     guid\r
- *             Node GUID of the local CA.\r
- *\r
- *     attr_size\r
- *             Size of the CA attributes for this CA.\r
- *\r
- *     p_attr\r
- *             Pointer to dynamicly allocated CA Attribute structure.\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/***** OpenSM: Vendor TS/osm_vendor_t\r
- * NAME\r
- *  osm_vendor_t\r
- *\r
- * DESCRIPTION\r
- *     The structure defining a TS vendor\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osm_vendor {\r
-       osm_log_t *p_log;\r
-       uint32_t ca_count;\r
-       osm_ca_info_t *p_ca_info;\r
-       uint32_t timeout;\r
-       struct _osm_transaction_mgr *p_transaction_mgr;\r
-       osm_ts_bind_info_t smi_bind;\r
-       osm_ts_bind_info_t gsi_bind;\r
-} osm_vendor_t;\r
-\r
-/*\r
- * FIELDS\r
- *     h_al\r
- *             Handle returned by TS open call .\r
- *\r
- *     p_log\r
- *             Pointer to the log object.\r
- *\r
- *     ca_count\r
- *             Number of CA's in the array pointed to by p_ca_info.\r
- *\r
- *     p_ca_info\r
- *             Pointer to dynamically allocated array of CA info objects.\r
- *\r
- *     timeout\r
- *             Transaction timeout time in milliseconds.\r
- *\r
- *  p_transaction_mgr\r
- *     Pointer to Transaction Manager.\r
- *\r
- *  smi_bind\r
- *     Bind information for handling SMI MADs\r
- *\r
- *  gsi_bind\r
- *     Bind information for GSI MADs\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_port_guid\r
- * NAME\r
- *     osm_ca_info_get_port_guid\r
- *\r
- * DESCRIPTION\r
- *     Returns the port GUID of the specified port owned by this CA.\r
- *\r
- * SYNOPSIS\r
- */\r
-static inline ib_net64_t\r
-osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,\r
-                         IN const uint8_t index)\r
-{\r
-       return (p_ca_info->p_attr->p_port_attr[index].port_guid);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *     p_ca_info\r
- *             [in] Pointer to a CA Info object.\r
- *\r
- *     index\r
- *             [in] Port "index" for which to retrieve the port GUID.\r
- *             The index is the offset into the ca's internal array\r
- *             of port attributes.\r
- *\r
- * RETURN VALUE\r
- *     Returns the port GUID of the specified port owned by this CA.\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_num_ports\r
- * NAME\r
- *     osm_ca_info_get_num_ports\r
- *\r
- * DESCRIPTION\r
- *     Returns the number of ports of the given ca_info\r
- *\r
- * SYNOPSIS\r
- */\r
-static inline uint8_t\r
-osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)\r
-{\r
-       return (p_ca_info->p_attr->num_ports);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *     p_ca_info\r
- *             [in] Pointer to a CA Info object.\r
- *\r
- * RETURN VALUE\r
- *     Returns the number of CA ports\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port\r
- * NAME\r
- *     osm_vendor_get_guid_ca_and_port\r
- *\r
- * DESCRIPTION\r
- * Given the vendor obj and a guid\r
- * return the ca id and port number that have that guid\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT VAPI_hca_hndl_t * p_hca_hndl,\r
-                               OUT VAPI_hca_id_t * p_hca_id,\r
-                               OUT uint32_t * p_port_num);\r
-\r
-/*\r
- * PARAMETERS\r
- *     p_vend\r
- *             [in] Pointer to an osm_vendor_t object.\r
- *\r
- *     guid\r
- *             [in] The guid to search for.\r
- *\r
- *     p_hca_id\r
- *             [out] The HCA Id (VAPI_hca_id_t *) that the port is found on.\r
- *\r
- *     p_port_num\r
- *             [out] Pointer to a port number arg to be filled with the port number with the given guid.\r
- *\r
- * RETURN VALUES\r
- *     IB_SUCCESS on SUCCESS\r
- *  IB_INVALID_GUID if the guid is notfound on any Local HCA Port\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OpenSM: Vendor TS/osm_vendor_get_all_port_attr\r
- * NAME\r
- *     osm_vendor_get_all_port_attr\r
- *\r
- * DESCRIPTION\r
- * Fill in the array of port_attr with all available ports on ALL the\r
- * avilable CAs on this machine.\r
- * ALSO -\r
- * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                                            IN ib_port_attr_t *\r
-                                            const p_attr_array,\r
-                                            IN uint32_t * const p_num_ports);\r
-\r
-/*\r
- * PARAMETERS\r
- *     p_vend\r
- *             [in] Pointer to an osm_vendor_t object.\r
- *\r
- *     p_attr_array\r
- *             [out] Pre-allocated array of port attributes to be filled in\r
- *\r
- *     p_num_ports\r
- *             [out] The size of the given array. Filled in by the actual numberof ports found.\r
- *\r
- * RETURN VALUES\r
- *     IB_SUCCESS if OK\r
- *  IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-\r
-/****s* OpenSM: Vendor TS/osm_vend_wrap_t\r
- * NAME\r
- *   TS Vendor MAD Wrapper\r
- *\r
- * DESCRIPTION\r
- *     TS specific MAD wrapper. TS transport layer uses this for\r
- *     housekeeping.\r
- *\r
- * SYNOPSIS\r
- *********/\r
-typedef struct _osm_vend_wrap_t {\r
-       uint32_t size;\r
-       osm_bind_handle_t h_bind;\r
-       ib_mad_t *p_mad_buf;\r
-       void *p_resp_madw;\r
-} osm_vend_wrap_t;\r
-\r
-/*\r
- * FIELDS\r
- *     size\r
- *             Size of the allocated MAD\r
- *\r
- *     h_bind\r
- *             Bind handle used on this transaction\r
- *\r
- *     h_av\r
- *             Address vector handle used for this transaction.\r
- *\r
- *     p_resp_madw\r
- *             Pointer to the mad wrapper structure used to hold the pending\r
- *             reponse to the mad, if any.  If a response is expected, the\r
- *             wrapper for the reponse is allocated during the send call.\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_TS_H_ */\r
diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_umadt.h b/branches/opensm_3/user/include/vendor/osm_vendor_umadt.h
deleted file mode 100644 (file)
index 88581c6..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*\r
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osm_mad_wrapper_t.\r
- *     This object represents the context wrapper for OpenSM MAD processing.\r
- *     This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#ifndef _OSM_VENDOR_UMADT_h_\r
-#define _OSM_VENDOR_UMADT_h_\r
-\r
-#include "iba/ib_types.h"\r
-#include "complib/cl_qlist.h"\r
-#include "complib/cl_thread.h"\r
-#include <opensm/osm_base.h>\r
-#include <vendor/umadt.h>\r
-\r
-#ifdef __cplusplus\r
-#  define BEGIN_C_DECLS extern "C" {\r
-#  define END_C_DECLS   }\r
-#else                          /* !__cplusplus */\r
-#  define BEGIN_C_DECLS\r
-#  define END_C_DECLS\r
-#endif                         /* __cplusplus */\r
-\r
-BEGIN_C_DECLS\r
-/****h* OpenSM/ Vendor Umadt\r
-* NAME\r
-*      MAD Wrapper\r
-*\r
-* DESCRIPTION\r
-*\r
-*\r
-* AUTHOR\r
-*      Ranjit Pandit, Intel\r
-*\r
-*********/\r
-typedef void *osm_vendor_t;\r
-#define OSM_BIND_INVALID_HANDLE 0\r
-\r
-/****s* OpenSM: Vendor Umadt /osm_bind_handle_t\r
-* NAME\r
-*   osm_bind_handle_t\r
-*\r
-* DESCRIPTION\r
-*      handle returned by the vendor transport bind call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-\r
-typedef void *osm_bind_handle_t;\r
-\r
-/****s* OpenSM: Vendor Umadt /mad_direction_t\r
-* NAME\r
-*      mad_direction_t\r
-*\r
-* DESCRIPTION\r
-*      Tags for mad wrapper to indicate the direction of mads.\r
-*      Umadt vendor transport layer uses this tag to call the appropriate\r
-*      Umadt APIs.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _mad_direction_t {\r
-       SEND = 0,\r
-       RECEIVE,\r
-} mad_direction_t;\r
-\r
-/****s* OpenSM/ osm_vend_wrap_t\r
-* NAME\r
-*   Umadt Vendor MAD Wrapper\r
-*\r
-* DESCRIPTION\r
-*      Umadt specific MAD wrapper. Umadt transport layer sets this for\r
-*      housekeeping.\r
-*\r
-* SYNOPSIS\r
-*********/\r
-typedef struct _osm_vend_wrap_t {\r
-       MadtStruct *p_madt_struct;\r
-       mad_direction_t direction;      // send or receive\r
-       uint32_t size;\r
-} osm_vend_wrap_t;\r
-/*\r
-* FIELDS\r
-*      p_madt_struct\r
-*              Umadt mad structure to identify a mad.\r
-*\r
-*      direction\r
-*              Used to identify a mad with it's direction.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-END_C_DECLS\r
-#endif                         /* _OSM_VENDOR_UMADT_h_ */\r
diff --git a/branches/opensm_3/user/include/vendor/winosm_common.h b/branches/opensm_3/user/include/vendor/winosm_common.h
deleted file mode 100644 (file)
index d632536..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-#ifndef _OSM_COMMON_H_\r
-#define _OSM_COMMON_H_\r
-\r
-#include <winsock2.h>\r
-#include <windows.h>\r
-#include <sys/stat.h>\r
-#include <stdio.h>\r
-#include <io.h>\r
-#include <stdlib.h>\r
-#include <linux\_string.h>\r
-#include <linux\unistd.h>\r
-#include <linux\arpa\inet.h>\r
-#include <stdarg.h>\r
-#include <ctype.h>\r
-\r
-#include <complib\cl_debug.h>\r
-#define cl_is_debug osm_is_debug\r
-\r
-#include <time.h>\r
-#include <sys\time.h>\r
-#include <getopt.h>\r
-\r
-#pragma warning(disable : 4996)\r
-#pragma warning(disable : 4100)\r
-\r
-#include <complib\cl_mutex.h>\r
-#include <complib\cl_thread.h>\r
-#include <complib\cl_timer.h>\r
-\r
-typedef int    ssize_t;\r
-\r
-#define OSM_API __stdcall\r
-#define OSM_CDECL __cdecl\r
-\r
-#define complib_init()\r
-#define complib_exit()\r
-\r
-#define chmod(a,b) _chmod(a,b)\r
-#define S_IRUSR _S_IREAD\r
-#define S_IWUSR _S_IWRITE\r
-\r
-#define snprintf _snprintf\r
-#define vsnprintf _vsnprintf\r
-#ifndef strtoull \r
-#define strtoull _strtoui64\r
-#endif\r
-\r
-#ifndef PATH_MAX\r
-#define PATH_MAX MAX_PATH\r
-#endif\r
-#define O_NONBLOCK 0\r
-\r
-#define open _open\r
-#define close _close\r
-#define fileno _fileno\r
-#define stat _stat\r
-#define fstat _fstat\r
-#define unlink(str) _unlink(str)\r
-#define dup2(a,b)\r
-#define isatty _isatty\r
-\r
-#ifndef getpid\r
-#define getpid() GetCurrentProcessId()\r
-#endif\r
-\r
-#define usleep(usec) SleepEx(usec/1000,TRUE)\r
-\r
-#define pthread_t cl_thread_t\r
-#define pthread_mutex_t cl_mutex_t\r
-\r
-#define pthread_mutex_lock cl_mutex_acquire\r
-#define pthread_mutex_unlock cl_mutex_release\r
-#define pthread_mutex_init(a,b) cl_mutex_init((a))\r
-#define pthread_mutex_destroy cl_mutex_destroy\r
-\r
-#define pthread_cond_init(a,b)\r
-#define pthread_cond_signal cl_event_signal\r
-#define pthread_cond_destroy(a)\r
-\r
-\r
-/************************************************************************/\r
-static char* \r
-get_char_option(const char* optstring,\r
-                             char*const* argv,int argc, \r
-                             int iArg, int* opt_ind,char* opt_p);   \r
-int \r
-getopt_long_only(int argc, char *const*argv,\r
-                         const char *optstring,\r
-                         const struct option *longopts, int *longindex);\r
-\r
-/**************************************************************************/\r
-\r
-/* Verify the correct ETIMEDOUT value is defined in all compiled files */\r
-#ifndef ETIMEDOUT\r
-#define ETIMEDOUT              (10060)\r
-#endif\r
-\r
-extern char *strdup_expand(const char *);\r
-extern FILE *Fopen(const char *,const char *);\r
-#define fopen Fopen\r
-\r
-/* The following defines replace syslog.h */\r
-\r
-void openlog(char *ident, int option, int facility);\r
-void closelog(void);\r
-#define LOG_CONS       (1<<0)\r
-#define LOG_PID                (1<<2)\r
-#define LOG_USER       (1<<3)\r
-\r
-void syslog(int priority, char *fmt, ... );\r
-\r
-#define LOG_DEBUG 7\r
-#define LOG_INFO 6\r
-#define LOG_NOTICE 5\r
-#define LOG_WARNING 4\r
-#define LOG_ERR 3\r
-#define LOG_CRIT 2\r
-#define LOG_ALTERT 1\r
-#define LOG_EMERG 0\r
-\r
-/*****************************************/\r
-\r
-/****f* OpenSM: osm_common/GetOsmTempPath\r
-* NAME\r
-*      GetOsmTempPath\r
-*\r
-* DESCRIPTION\r
-*      The function retrieves the temp path defined in Windows using its API\r
-*\r
-* SYNOPSIS\r
-*/\r
-char*\r
-GetOsmTempPath(void);\r
-/*\r
-* PARAMETERS\r
-*      NONE\r
-*\r
-* RETURN VALUE\r
-*      This function returns string containing the default temp path in windows\r
-*\r
-* NOTES\r
-*/\r
-\r
-/****f* OpenSM: osm_common/GetOsmCachePath\r
-* NAME\r
-*      GetOsmCachePath\r
-*\r
-* DESCRIPTION\r
-*      The function retrieves the path the cache directory. This directory is \r
-*  the etc dir under the installation directory of the mellanox stack. \r
-*  The installation directory should be pointed out by the WinIB_HOME variable.\r
-*  If WinIB_HOME variable is missing, or there is not /etc/ dir under it - then\r
-*  the function will return the getOsmTempPath() value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-char*\r
-GetOsmCachePath(void);\r
-/*\r
-* PARAMETERS\r
-*      NONE\r
-*\r
-* RETURN VALUE\r
-*      function returns string containing the default cache path for osm use.\r
-*\r
-* NOTES\r
-*/\r
-\r
-/* **** Move this to inc\complib\cl_qlist.h once it works correctly */\r
-\r
-/****d* Component Library: Quick List/cl_item_obj\r
-* NAME\r
-*      cl_item_obj\r
-*\r
-* DESCRIPTION\r
-*      used to extract a 'typed' pointer from Quick List item.\r
-*\r
-* SYNOPSIS\r
-*/\r
-\r
-#define cl_item_obj(item_ptr, obj_ptr, item_field) \\r
-       (void*)((uint8_t*)item_ptr - \\r
-               ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)(obj_ptr)))\r
-/*\r
-* PARAMETERS\r
-*      item_ptr\r
-*              [in] Pointer to a cl_qlist structure.\r
-*\r
-*      obj_ptr\r
-*              [in] object pointer\r
-*\r
-*   item_field\r
-*       [in] object pointer field\r
-*\r
-*   TypeOF_Obj\r
-*\r
-* RETURN VALUE\r
-*      returns a 'TypeOF_Obj ptr\r
-*\r
-* SEE ALSO\r
-*      Quick List\r
-*********/\r
-\r
-#endif         /* _OSM_COMMON_H_ */\r
diff --git a/branches/opensm_3/user/libvendor/Makefile b/branches/opensm_3/user/libvendor/Makefile
deleted file mode 100644 (file)
index 3ad4208..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#\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
-!INCLUDE ..\..\..\..\inc\openib.def\r
-\r
diff --git a/branches/opensm_3/user/libvendor/SOURCES b/branches/opensm_3/user/libvendor/SOURCES
deleted file mode 100644 (file)
index e6c9cd5..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# Build the 'vendor' library for linking opensm.exe\r
-\r
-!if !defined(WINIBHOME)\r
-WINIBHOME=..\..\..\..\r
-!endif\r
-\r
-LIBPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-\r
-!if defined(OSM_TARGET)\r
-TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)\r
-!else\r
-TARGETPATH=$(LIBPATH)\r
-!endif\r
-\r
-!INCLUDE ..\mad-vendor.inc\r
-\r
-TARGETNAME=$(VENDOR_LIB)\r
-TARGETTYPE=LIBRARY\r
-\r
-USE_NTDLL=1\r
-USE_NATIVE_EH=1\r
-OVR_DIR=..\addon\r
-\r
-\r
-SOURCES= complib_files.c \\r
-       winosm_common.c \\r
-       $(VENDOR_SRC)\r
-\r
-\r
-OSM_HOME=..\r
-\r
-TARGETLIBS=\\r
-!if $(FREEBUILD)\r
-       $(LIBPATH)\*\complib.lib \r
-!else\r
-       $(LIBPATH)\*\complibd.lib\r
-!endif\r
-\r
-INCLUDES= \\r
-       $(WINIBHOME)\inc; \\r
-       $(WINIBHOME)\inc\user; \\r
-       $(WINIBHOME)\inc\user\complib; \\r
-       $(WINIBHOME)\inc\user\linux; \\r
-       $(VENDOR_INC) \\r
-       $(OSM_HOME); \\r
-       $(OSM_HOME)\include;\r
-\r
-# Could be any special flag needed for this project \r
-USER_C_FLAGS=$(USER_C_FLAGS) \r
-\r
-#Add preproccessor definitions\r
-C_DEFINES=$(C_DEFINES) -D__WIN__ -DHAVE_CONFIG_H -D$(VENDOR_IF)\r
-\r
-!if !$(FREEBUILD)\r
-C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG\r
-# in cl_types_osd.h '_DEBUG_' is defined by virture of '_DEBUG" being defined.\r
-!endif\r
-\r
-LINKER_FLAGS= $(LINKER_FLAGS) /DEF:$(VENDOR_LIB).exports\r
-\r
-MSC_WARNING_LEVEL= /W2 /wd4242\r
-\r
-#MSC_OPTIMIZATION= /O0\r
-\r
diff --git a/branches/opensm_3/user/libvendor/complib_files.c b/branches/opensm_3/user/libvendor/complib_files.c
deleted file mode 100644 (file)
index 062d1a1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-\r
-#include <..\complib\cl_dispatcher.c>\r
-#include <..\complib\cl_event_wheel.c>\r
diff --git a/branches/opensm_3/user/libvendor/libosmvendor.ver b/branches/opensm_3/user/libvendor/libosmvendor.ver
deleted file mode 100644 (file)
index 132452a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# In this file we track the current API version\r
-# of the vendor interface (and libraries)\r
-# The version is built of the following\r
-# tree numbers:\r
-# API_REV:RUNNING_REV:AGE\r
-# API_REV - advance on any added API\r
-# RUNNING_REV - advance any change to the vendor files\r
-# AGE - number of backward versions the API still supports\r
-LIBVERSION=3:3:0\r
diff --git a/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c b/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c
deleted file mode 100644 (file)
index 6a690e9..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_pkt_randomizer_t.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <vendor/osm_pkt_randomizer.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#ifndef __WIN__\r
-#include <sys/time.h>\r
-#include <unistd.h>\r
-#endif\r
-\r
-/**********************************************************************\r
- * Return TRUE if the path is in a fault path, and FALSE otherwise.\r
- * By in a fault path the meaning is that there is a path in the fault\r
- * paths that the given path includes it.\r
- * E.g: if there is a fault path: 0,1,4\r
- * For the given path: 0,1,4,7 the return value will be TRUE, also for\r
- * the given path: 0,1,4 the return value will be TRUE, but for\r
- * the given paths: 0,1 or 0,3,1,4 - the return value will be FALSE.\r
- **********************************************************************/\r
-boolean_t\r
-__osm_pkt_randomizer_is_path_in_fault_paths(IN osm_log_t * p_log,\r
-                                           IN osm_dr_path_t * p_dr_path,\r
-                                           IN osm_pkt_randomizer_t *\r
-                                           p_pkt_rand)\r
-{\r
-       boolean_t res = FALSE, found_path;\r
-       osm_dr_path_t *p_found_dr_path;\r
-       uint8_t ind1, ind2;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (ind1 = 0; ind1 < p_pkt_rand->num_paths_initialized; ind1++) {\r
-               found_path = TRUE;\r
-               p_found_dr_path = &(p_pkt_rand->fault_dr_paths[ind1]);\r
-               /* if the hop count of the found path is greater than the\r
-                  hop count of the input path - then it is not part of it.\r
-                  Check the next path. */\r
-               if (p_found_dr_path->hop_count > p_dr_path->hop_count)\r
-                       continue;\r
-\r
-               /* go over all the ports in the found path and see if they match\r
-                  the ports in the input path */\r
-               for (ind2 = 0; ind2 <= p_found_dr_path->hop_count; ind2++)\r
-                       if (p_found_dr_path->path[ind2] !=\r
-                           p_dr_path->path[ind2])\r
-                               found_path = FALSE;\r
-\r
-               /* If found_path is TRUE  then there is a full match of the path */\r
-               if (found_path == TRUE) {\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "Given path is in a fault path\n");\r
-                       res = TRUE;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}\r
-\r
-/**********************************************************************\r
- * For a given dr_path - return TRUE if the path should be dropped,\r
- * return FALSE otherwise.\r
- * The check uses random criteria in order to determine whether or not\r
- * the path should be dropped.\r
- * First - if not all paths are initialized, it randomally chooses if\r
- * to use this path as a fault path or not.\r
- * Second - if the path is in the fault paths (meaning - it is equal\r
- * to or includes one of the fault paths) - then it randomally chooses\r
- * if to drop it or not.\r
- **********************************************************************/\r
-boolean_t\r
-__osm_pkt_randomizer_process_path(IN osm_log_t * p_log,\r
-                                 IN osm_pkt_randomizer_t * p_pkt_rand,\r
-                                 IN osm_dr_path_t * p_dr_path)\r
-{\r
-       boolean_t res = FALSE;\r
-       static boolean_t rand_value_init = FALSE;\r
-       static int rand_value;\r
-       boolean_t in_fault_paths;\r
-       uint8_t i;\r
-       char buf[BUF_SIZE];\r
-       char line[BUF_SIZE];\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (rand_value_init == FALSE) {\r
-               int seed;\r
-#ifdef __WIN__\r
-               SYSTEMTIME st;\r
-#else\r
-               struct timeval tv;\r
-               struct timezone tz;\r
-#endif                         /*  __WIN__ */\r
-\r
-               /* initiate the rand_value according to timeofday */\r
-               rand_value_init = TRUE;\r
-\r
-#ifdef __WIN__\r
-               GetLocalTime(&st);\r
-               seed = st.wMilliseconds;\r
-#else\r
-               gettimeofday(&tv, &tz);\r
-               seed = tv.tv_usec;\r
-#endif                         /*  __WIN__ */\r
-\r
-               srand(seed);\r
-       }\r
-\r
-       /* If the hop_count is 1 - then this is a mad down to our local port - don't drop it */\r
-       if (p_dr_path->hop_count <= 1)\r
-               goto Exit;\r
-\r
-       rand_value = rand();\r
-\r
-       sprintf(buf, "Path: ");\r
-       /* update the dr_path into the buf */\r
-       for (i = 0; i <= p_dr_path->hop_count; i++) {\r
-               sprintf(line, "[%X]", p_dr_path->path[i]);\r
-               strcat(buf, line);\r
-       }\r
-\r
-       /* Check if the path given is in one of the fault paths */\r
-       in_fault_paths =\r
-           __osm_pkt_randomizer_is_path_in_fault_paths(p_log, p_dr_path,\r
-                                                       p_pkt_rand);\r
-\r
-       /* Check if all paths are initialized */\r
-       if (p_pkt_rand->num_paths_initialized <\r
-           p_pkt_rand->osm_pkt_num_unstable_links) {\r
-               /* Not all packets are initialized. */\r
-               if (in_fault_paths == FALSE) {\r
-                       /* the path is not in the false paths. Check using the rand value\r
-                          if to update it there or not. */\r
-                       if (rand_value %\r
-                           (p_pkt_rand->osm_pkt_unstable_link_rate) == 0) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "%s added to the fault_dr_paths list\n"\r
-                                       "\t\t\t rand_value:%u, unstable_link_rate:%u \n",\r
-                                       buf, rand_value,\r
-                                       p_pkt_rand->osm_pkt_unstable_link_rate);\r
-\r
-                               /* update the path in the fault paths */\r
-                               memcpy(&\r
-                                      (p_pkt_rand->\r
-                                       fault_dr_paths[p_pkt_rand->\r
-                                                      num_paths_initialized]),\r
-                                      p_dr_path, sizeof(osm_dr_path_t));\r
-                               p_pkt_rand->num_paths_initialized++;\r
-                               in_fault_paths = TRUE;\r
-                       }\r
-               }\r
-       }\r
-\r
-       if (in_fault_paths == FALSE) {\r
-               /* If in_fault_paths is FALSE - just ignore the path */\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE, "%s not in fault paths\n", buf);\r
-               goto Exit;\r
-       }\r
-\r
-       /* The path is in the fault paths. Need to choose (randomally if to drop it\r
-          or not. */\r
-       rand_value = rand();\r
-\r
-       if (rand_value % (p_pkt_rand->osm_pkt_drop_rate) == 0) {\r
-               /* drop the current packet */\r
-               res = TRUE;\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE, "Dropping path:%s\n", buf);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}\r
-\r
-boolean_t\r
-osm_pkt_randomizer_mad_drop(IN osm_log_t * p_log,\r
-                           IN osm_pkt_randomizer_t * p_pkt_randomizer,\r
-                           IN const ib_mad_t * p_mad)\r
-{\r
-       const ib_smp_t *p_smp;\r
-       boolean_t res = FALSE;\r
-       osm_dr_path_t dr_path;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_smp = (ib_smp_t *) p_mad;\r
-\r
-       if (p_smp->mgmt_class != IB_MCLASS_SUBN_DIR)\r
-               /* This is a lid route mad. Don't drop it */\r
-               goto Exit;\r
-\r
-       osm_dr_path_init(&dr_path, 0,   /* The h_bind is not really important for us to save */\r
-                        p_smp->hop_count, p_smp->initial_path);\r
-\r
-       if (__osm_pkt_randomizer_process_path\r
-           (p_log, p_pkt_randomizer, &dr_path)) {\r
-               /* the mad should be dropped o */\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "mad TID: 0x%" PRIx64 " is being dropped\n",\r
-                       cl_ntoh64(p_smp->trans_id));\r
-               res = TRUE;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}\r
-\r
-ib_api_status_t\r
-osm_pkt_randomizer_init(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer,\r
-                       IN osm_log_t * p_log)\r
-{\r
-       uint8_t tmp;\r
-       ib_api_status_t res = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       *pp_pkt_randomizer = malloc(sizeof(osm_pkt_randomizer_t));\r
-       if (*pp_pkt_randomizer == NULL) {\r
-               res = IB_INSUFFICIENT_MEMORY;\r
-               goto Exit;\r
-       }\r
-       memset(*pp_pkt_randomizer, 0, sizeof(osm_pkt_randomizer_t));\r
-       (*pp_pkt_randomizer)->num_paths_initialized = 0;\r
-\r
-       tmp = atol(getenv("OSM_PKT_DROP_RATE"));\r
-       (*pp_pkt_randomizer)->osm_pkt_drop_rate = tmp;\r
-\r
-       if (getenv("OSM_PKT_NUM_UNSTABLE_LINKS") != NULL\r
-           && (tmp = atol(getenv("OSM_PKT_NUM_UNSTABLE_LINKS"))) > 0)\r
-               (*pp_pkt_randomizer)->osm_pkt_num_unstable_links = tmp;\r
-       else\r
-               (*pp_pkt_randomizer)->osm_pkt_num_unstable_links = 1;\r
-\r
-       if (getenv("OSM_PKT_UNSTABLE_LINK_RATE") != NULL\r
-           && (tmp = atol(getenv("OSM_PKT_UNSTABLE_LINK_RATE"))) > 0)\r
-               (*pp_pkt_randomizer)->osm_pkt_unstable_link_rate = tmp;\r
-       else\r
-               (*pp_pkt_randomizer)->osm_pkt_unstable_link_rate = 20;\r
-\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE, "Using OSM_PKT_DROP_RATE=%u \n"\r
-               "\t\t\t\t OSM_PKT_NUM_UNSTABLE_LINKS=%u \n"\r
-               "\t\t\t\t OSM_PKT_UNSTABLE_LINK_RATE=%u \n",\r
-               (*pp_pkt_randomizer)->osm_pkt_drop_rate,\r
-               (*pp_pkt_randomizer)->osm_pkt_num_unstable_links,\r
-               (*pp_pkt_randomizer)->osm_pkt_unstable_link_rate);\r
-\r
-       /* allocate the fault_dr_paths variable */\r
-       /* It is the number of the paths that will be saved as fault = osm_pkt_num_unstable_links */\r
-       (*pp_pkt_randomizer)->fault_dr_paths = malloc(sizeof(osm_dr_path_t) *\r
-                                                     (*pp_pkt_randomizer)->\r
-                                                     osm_pkt_num_unstable_links);\r
-       if ((*pp_pkt_randomizer)->fault_dr_paths == NULL) {\r
-               res = IB_INSUFFICIENT_MEMORY;\r
-               goto Exit;\r
-       }\r
-\r
-       memset((*pp_pkt_randomizer)->fault_dr_paths, 0,\r
-              sizeof(osm_dr_path_t) *\r
-              (*pp_pkt_randomizer)->osm_pkt_num_unstable_links);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return (res);\r
-}\r
-\r
-void\r
-osm_pkt_randomizer_destroy(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer,\r
-                          IN osm_log_t * p_log)\r
-{\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (*pp_pkt_randomizer != NULL) {\r
-               free((*pp_pkt_randomizer)->fault_dr_paths);\r
-               free(*pp_pkt_randomizer);\r
-       }\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_al.c b/branches/opensm_3/user/libvendor/osm_vendor_al.c
deleted file mode 100644 (file)
index d6bad90..0000000
+++ /dev/null
@@ -1,1546 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Portions Copyright (c) 2008 Microsoft Corporation.  All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_req_t.\r
- * This object represents the generic attribute requester.\r
- * This object is part of the opensm family of objects.\r
- *\r
- * Environment:\r
- *    Windows User Mode\r
- *\r
- * $Revision: 1.8 $\r
- */\r
-\r
-#ifdef OSM_VENDOR_INTF_AL\r
-/*\r
-  Next available error code: 0x300\r
-*/\r
-\r
-#ifdef HAVE_CONFIG\r
-#include <config.h>\r
-#endif\r
-\r
-#include <vendor/osm_vendor_al.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-#include <complib/cl_memory.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_thread.h>\r
-#include <complib/cl_math.h>\r
-#include <complib/cl_debug.h>\r
-\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_mad_pool.h>\r
-\r
-/****s* OpenSM: Vendor AL/osm_al_bind_info_t\r
- * NAME\r
- *   osm_al_bind_info_t\r
- *\r
- * DESCRIPTION\r
- *    Structure containing bind information.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osm_al_bind_info\r
-{\r
-  osm_vendor_t                *p_vend;\r
-  void                        *client_context;\r
-  ib_qp_handle_t                 h_qp;\r
-  ib_mad_svc_handle_t               h_svc;\r
-  uint8_t                        port_num;\r
-  ib_pool_key_t                  pool_key;\r
-  osm_vend_mad_recv_callback_t      rcv_callback;\r
-  osm_vend_mad_send_err_callback_t  send_err_callback;\r
-  osm_mad_pool_t                 *p_osm_pool;\r
-  ib_av_handle_t                 h_dr_av;\r
-\r
-} osm_al_bind_info_t;\r
-/*\r
- * FIELDS\r
- * p_vend\r
- *    Pointer to the vendor object.\r
- *\r
- * client_context\r
- *    User's context passed during osm_bind\r
- *\r
- * h_qp\r
- *    Handle the QP for this bind.\r
- *\r
- * h_qp_svc\r
- *    Handle the QP mad service for this bind.\r
- *\r
- * port_num\r
- *    Port number (within the HCA) of the bound port.\r
- *\r
- * pool_key\r
- *    Pool key returned by all for this QP.\r
- *\r
- * h_dr_av\r
- *    Address vector handle used for all directed route SMPs.\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-inline static ib_api_status_t\r
-__osm_al_convert_wcs(\r
-  IN ib_wc_status_t        const wc_status )\r
-{\r
-  switch( wc_status )\r
-  {\r
-  case IB_WCS_SUCCESS:\r
-    return( IB_SUCCESS );\r
-\r
-  case IB_WCS_TIMEOUT_RETRY_ERR:\r
-    return( IB_TIMEOUT );\r
-\r
-  default:\r
-    return( IB_ERROR );\r
-  }\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void AL_API\r
-__osm_set_vend_wrap( IN  osm_al_bind_info_t* const p_bind,\r
-                     IN  ib_mad_element_t* const   p_elem,\r
-                     OUT osm_vend_wrap_t* p_vw)\r
-{\r
-    p_vw->h_bind = p_bind;\r
-    p_vw->size = p_elem->size;\r
-    p_vw->p_elem = p_elem;\r
-    p_vw->h_av = 0;\r
-    p_vw->p_resp_madw = NULL;\r
-\r
-}\r
-            \r
-\r
-static void AL_API\r
-__osm_al_ca_err_callback( IN ib_async_event_rec_t *p_async_rec )\r
-{\r
-  osm_vendor_t *p_vend = (osm_vendor_t*)p_async_rec->context;\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "__osm_al_ca_err_callback: ERR 3B01: "\r
-           "Event on channel adapter (%s).\n",\r
-           ib_get_async_event_str( p_async_rec->code ) );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-static void AL_API\r
-__osm_al_ca_destroy_callback( IN void *context )\r
-{\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t*)context;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  osm_log( p_vend->p_log, OSM_LOG_INFO,\r
-           "__osm_al_ca_destroy_callback: "\r
-           "Closing local channel adapter.\n" );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
-static void AL_API\r
-__osm_al_err_callback( IN ib_async_event_rec_t *p_async_rec )\r
-{\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t*)p_async_rec->context;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "__osm_al_err_callback: ERR 3B02: "\r
-           "Error on QP (%s).\n",\r
-           ib_get_async_event_str( p_async_rec->code ) );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-/* \r
-    Send_cb will handle  the following cases :\r
-    Element Status  |  Send Response (no reponse expected)      | Send Request (response expeceted)  \r
-    ================|===========================================|==========================================\r
-        ERROR       |   Free : AV , madw(send_err_cb)           | Free : AV , madw , resp_madw \r
-        SUCCESS     |   Free : AV , madw                        | Free : AV , madw\r
-\r
-    Element Status  |  Receive Response (no reponse expected)    \r
-    ================|===========================================\r
-        ERROR       |   Free : AV , madw(send_err_cb) \r
-        SUCCESS     |   Free : AV , madw, resp_madw (both through rcv_callback)                        \r
-   \r
-*/    \r
-static void AL_API\r
-__osm_al_send_callback(\r
-  IN const ib_mad_svc_handle_t h_mad_svc,\r
-  IN void *mad_svc_context,\r
-  IN ib_mad_element_t *p_elem )\r
-{\r
-  osm_al_bind_info_t* const p_bind = (osm_al_bind_info_t*)mad_svc_context;\r
-  osm_vendor_t* const p_vend = p_bind->p_vend;\r
-  osm_madw_t* const p_madw = (osm_madw_t*)p_elem->context1;\r
-  osm_vend_wrap_t* p_vw = osm_madw_get_vend_ptr( p_madw );\r
-  ib_mad_t *p_mad = ib_get_mad_buf( p_elem );\r
-  ib_av_attr_t         av_attr;\r
-  ib_pd_handle_t               h_pd;\r
-  ib_api_status_t status_elem,status;\r
-  osm_madw_t *p_new_madw;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-  UNUSED_PARAM(h_mad_svc);\r
-  CL_ASSERT( p_vw );\r
-  CL_ASSERT( p_vw->h_av );\r
-  /* since we use context1 , safely , and its the only place that remove the clean \r
-    p_elem,p_madw , h_av no checks are required */\r
-  status_elem = __osm_al_convert_wcs(p_elem->status);\r
-  osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_send_callback: "\r
-           "Destroying av handle %p.\n", p_elem->h_av );\r
-  /* Check first if its a direct route handle , in this case skip */\r
-  if (p_elem->h_av != p_bind->h_dr_av) \r
-  {\r
-      ib_destroy_av( p_elem->h_av );\r
-  }\r
-  /* Since the free order is first resp_madw then madw (PARENT) we should check\r
-   this case first */\r
-  if (p_elem->resp_expected)\r
-  {\r
-      p_madw->status = status_elem;\r
-      if ( status_elem != IB_SUCCESS )\r
-      {\r
-          /*\r
-              Return any wrappers to the pool that may have been\r
-              pre-emptively allocated to handle a receive.\r
-          */\r
-          osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                  "__osm_al_send_callback: ERR 3333 "\r
-                  " Mad Completed with WQE Error : %s.\n",ib_get_wc_status_str(p_elem->status));\r
-          if( p_vw->p_resp_madw )\r
-          {\r
-              osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
-              p_vw->p_resp_madw = NULL;\r
-          }\r
-\r
-          p_bind->send_err_callback( p_bind->client_context, p_madw );\r
-      }\r
-      else\r
-      {\r
-          /* We are in response flow of receive , need to apply the rcv_callback \r
-                The rcv_callback will free the resp_madw , req_madw , p_elem of receive\r
-                and request */\r
-          osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                  "__osm_al_send_callback: "\r
-                  "The Mad is a response , thus handeled in __osm_al_send_callback\n");\r
-          p_new_madw = p_vw->p_resp_madw;\r
-          p_bind->rcv_callback( p_new_madw, p_bind->client_context,\r
-                                p_madw );\r
-\r
-      }\r
-  }\r
-  else\r
-  {\r
-      osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_send_callback: "\r
-           "Returning MAD to pool, TID = 0x%" PRIx64 ".\n",\r
-           cl_ntoh64( p_mad->trans_id ) );\r
-      osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
-      if ( status_elem != IB_SUCCESS )\r
-          osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "__osm_al_send_callback: ERR 3b0b "\r
-           "request mad had failed.\n");\r
-      goto Exit;\r
-  }\r
-\r
-\r
-\r
-\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-/*\r
-    Receive_cb will be applied in the following cases :\r
-    Element Status  |  Receive Response (no reponse expected)      | Receive Request (response expeceted)  \r
-    ================|==============================================|=======================================\r
-        ERROR       |  NOT APPLIED                                 | NOT_APPLIED\r
-        SUCCESS     |  Free :  Resp_madw , copy_req_madw           | Allocate new_madw (for response then in send_cb free)\r
- */\r
- static void AL_API\r
-__osm_al_rcv_callback(\r
-  IN const ib_mad_svc_handle_t h_mad_svc,\r
-  IN void *mad_svc_context,\r
-  IN ib_mad_element_t *p_elem )\r
-{\r
-  osm_al_bind_info_t* const p_bind = (osm_al_bind_info_t*)mad_svc_context;\r
-  osm_vendor_t* const p_vend = p_bind->p_vend;\r
-  osm_madw_t *p_old_madw,*p_copy_old_madw;\r
-  osm_madw_t *p_new_madw;\r
-  osm_vend_wrap_t* p_old_vw;\r
-  osm_vend_wrap_t* p_new_vw;\r
-  ib_mad_t *p_new_mad;\r
-  osm_mad_addr_t mad_addr;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-  UNUSED_PARAM(h_mad_svc);\r
-  CL_ASSERT( p_elem->context1 == NULL );\r
-  CL_ASSERT( p_elem->context2 == NULL );\r
-    /*\r
-  osm_log( p_vend->p_log, OSM_LOG_VERBOSE,\r
-             "__osm_al_rcv_callback:  "\r
-             "Handling Transaction : 0x%" PRIx64 " .\n",\r
-           cl_ntoh64(p_elem->p_mad_buf->trans_id));\r
-           */\r
-  p_new_mad = ib_get_mad_buf( p_elem );\r
-  osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_rcv_callback: "\r
-           "Acquired implicitly MAD %p.\n", p_new_mad );\r
-\r
-  /*\r
-    In preperation for initializing the new mad wrapper,\r
-    Initialize the mad_addr structure for the received wire MAD.\r
-  */\r
-  mad_addr.dest_lid = p_elem->remote_lid;\r
-  mad_addr.path_bits = p_elem->path_bits;\r
-\r
-  /* TO DO - figure out which #define to use for the 2.5 Gb rate... */\r
-  mad_addr.static_rate = 0;\r
-\r
-  if( p_new_mad->mgmt_class == IB_MCLASS_SUBN_LID ||\r
-      p_new_mad->mgmt_class == IB_MCLASS_SUBN_DIR )\r
-  {\r
-    mad_addr.addr_type.smi.source_lid = p_elem->remote_lid;\r
-  }\r
-  else\r
-  {\r
-    mad_addr.addr_type.gsi.remote_qp = p_elem->remote_qp;\r
-    mad_addr.addr_type.gsi.remote_qkey = p_elem->remote_qkey;\r
-    mad_addr.addr_type.gsi.pkey_ix = p_elem->pkey_index;\r
-    mad_addr.addr_type.gsi.service_level = p_elem->remote_sl;\r
-    mad_addr.addr_type.gsi.global_route = 0;   /* FIXME: handle GRH */\r
-       memset(&mad_addr.addr_type.gsi.grh_info, 0,\r
-              sizeof mad_addr.addr_type.gsi.grh_info);\r
-  }\r
-\r
-  /*\r
-    If this MAD is a response to a previous request,\r
-    then grab our pre-allocated MAD wrapper.\r
-    Otherwise, allocate a new MAD wrapper.\r
-    context1 - contains the request madw\r
-  */\r
-  if( ib_mad_is_response( p_new_mad ) )\r
-  {\r
-    /*\r
-      The acquiring was done in the ib_get_mad_buf function. \r
-      If this is a request - then we impllicitly allocate the MAD.\r
-      In this case - it was allocated in the lower layer. The message\r
-      is for tracking down messages - locate how/where this mad was\r
-      allocated.\r
-    */\r
-    osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__osm_al_rcv_callback: "\r
-               "The Mad is a response , thus handled in __osm_al_send_callback\n");\r
-    CL_ASSERT( p_elem->send_context1 != NULL );\r
-    CL_ASSERT( p_elem->send_context2 == NULL );\r
-\r
-    p_old_madw = (osm_madw_t*)p_elem->send_context1;\r
-    p_old_vw = osm_madw_get_vend_ptr( p_old_madw );\r
-    p_new_madw = p_old_vw->p_resp_madw;\r
-\r
-    CL_ASSERT( p_new_madw );\r
-    osm_madw_init( p_new_madw, p_bind, p_elem->size,\r
-                   &mad_addr );\r
-    osm_madw_set_mad( p_new_madw, p_new_mad );\r
-    p_new_vw = osm_madw_get_vend_ptr( p_new_madw );\r
-    __osm_set_vend_wrap(p_bind,p_elem,p_new_vw);\r
-    goto Exit;\r
-  }\r
-  else\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-                 "__osm_al_rcv_callback: "\r
-                 "The Mad is a request , thus handled in __osm_al_rcv_callback\n");\r
-    CL_ASSERT( p_elem->send_context1 == NULL );\r
-    CL_ASSERT( p_elem->send_context2 == NULL );\r
-\r
-    p_new_madw = osm_mad_pool_get_wrapper( p_bind->p_osm_pool,\r
-                                           p_bind, p_elem->size, p_new_mad, &mad_addr );\r
-    CL_ASSERT(p_new_madw);\r
-    p_new_vw = osm_madw_get_vend_ptr( p_new_madw );\r
-\r
-    __osm_set_vend_wrap(p_bind,p_elem,p_new_vw);\r
-    osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-             "__osm_al_rcv_callback: "\r
-             "Calling receive callback function %p.\n",\r
-             p_bind->rcv_callback );\r
-\r
-\r
-    p_bind->rcv_callback( p_new_madw, p_bind->client_context,\r
-                          ((osm_madw_t*)p_elem->send_context1) );\r
-  }\r
-\r
-\r
-  Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_init(\r
-  IN osm_vendor_t* const p_vend,\r
-  IN osm_log_t* const p_log,\r
-  IN const uint32_t timeout )\r
-{\r
-  ib_api_status_t status;\r
-  OSM_LOG_ENTER( p_log );\r
-\r
-  p_vend->p_log = p_log;\r
-\r
-  /*\r
-    Open our instance of AL.\r
-  */\r
-  status = ib_open_al( &p_vend->h_al );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_init: ERR 3B03: "\r
-             "Error opening AL (%s).\n",\r
-             ib_get_err_str( status ) );\r
-\r
-    goto Exit;\r
-  }\r
-\r
-  p_vend->timeout = timeout;\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_log );\r
-  return( status );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-osm_vendor_t*\r
-osm_vendor_new(\r
-  IN osm_log_t* const p_log,\r
-  IN const uint32_t timeout )\r
-{\r
-  ib_api_status_t    status;\r
-  osm_vendor_t    *p_vend;\r
-\r
-  OSM_LOG_ENTER( p_log );\r
-\r
-  p_vend = cl_zalloc( sizeof(*p_vend) );\r
-  if( p_vend == NULL )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_new: ERR 3B04: "\r
-             "Unable to allocate vendor object.\n" );\r
-    goto Exit;\r
-  }\r
-\r
-  status = osm_vendor_init( p_vend, p_log, timeout );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    cl_free( p_vend );\r
-    p_vend = NULL;\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_log );\r
-  return( p_vend );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void\r
-osm_vendor_delete(\r
-  IN osm_vendor_t** const pp_vend )\r
-{\r
-  /* TO DO - fill this in */\r
-  ib_close_al( (*pp_vend)->h_al );\r
-  cl_free( *pp_vend );\r
-  *pp_vend = NULL;\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__osm_ca_info_init(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN osm_ca_info_t*  const   p_ca_info,\r
-  IN const ib_net64_t      ca_guid )\r
-{\r
-  ib_api_status_t status;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  p_ca_info->guid = ca_guid;\r
-\r
-  if( osm_log_is_active( p_vend->p_log, OSM_LOG_VERBOSE ) )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_VERBOSE,\r
-             "__osm_ca_info_init: "\r
-             "Querying CA 0x%" PRIx64 ".\n",\r
-             cl_ntoh64( ca_guid ) );\r
-  }\r
-/* attr size by verbs definition is required to be (uint32_t *) under opensm is only being set as 1 */\r
-  status = ib_query_ca_by_guid( p_vend->h_al, ca_guid, NULL,\r
-                                (uint32_t*)&p_ca_info->attr_size );\r
-  if( (status != IB_INSUFFICIENT_MEMORY ) && (status != IB_SUCCESS ) )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_ca_info_init: ERR 3B05: "\r
-             "Unexpected status getting CA attributes (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    goto Exit;\r
-  }\r
-\r
-  CL_ASSERT( p_ca_info->attr_size );\r
-\r
-  p_ca_info->p_attr = cl_malloc( p_ca_info->attr_size );\r
-  if( p_ca_info->p_attr == NULL )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_ca_info_init: ERR 3B06: "\r
-             "Unable to allocate attribute storage.\n" );\r
-    goto Exit;\r
-  }\r
-\r
-  status = ib_query_ca_by_guid( p_vend->h_al, ca_guid, p_ca_info->p_attr,\r
-                                (uint32_t*)&p_ca_info->attr_size );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_ca_info_init: ERR 3B07: "\r
-             "Unexpected status getting CA attributes (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    goto Exit;\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( status );\r
-}\r
-\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void\r
-osm_ca_info_destroy(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN osm_ca_info_t*     const p_ca_info )\r
-{\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  if( p_ca_info->p_attr )\r
-    cl_free( p_ca_info->p_attr );\r
-\r
-  cl_free( p_ca_info );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-osm_ca_info_t*\r
-osm_ca_info_new(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN const ib_net64_t      ca_guid )\r
-{\r
-  ib_api_status_t status;\r
-  osm_ca_info_t *p_ca_info;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( ca_guid );\r
-\r
-  p_ca_info = cl_zalloc( sizeof(*p_ca_info) );\r
-  if( p_ca_info == NULL )\r
-    goto Exit;\r
-\r
-  status = __osm_ca_info_init( p_vend, p_ca_info, ca_guid );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_ca_info_destroy( p_vend, p_ca_info );\r
-    p_ca_info = NULL;\r
-    goto Exit;\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( p_ca_info );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__osm_vendor_get_ca_guids(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN ib_net64_t**       const p_guids,\r
-  IN size_t*           const p_num_guids )\r
-{\r
-  ib_api_status_t status;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_guids );\r
-  CL_ASSERT( p_num_guids );\r
-\r
-  status = ib_get_ca_guids( p_vend->h_al, NULL, p_num_guids );\r
-  if( (status != IB_INSUFFICIENT_MEMORY ) && (status != IB_SUCCESS ) )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_get_ca_guids: ERR 3B08: "\r
-             "Unexpected status getting CA GUID array (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    goto Exit;\r
-  }\r
-\r
-  if( *p_num_guids == 0 )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_get_ca_guids: ERR 3B09: "\r
-             "No available channel adapters.\n" );\r
-    status = IB_INSUFFICIENT_RESOURCES;\r
-    goto Exit;\r
-  }\r
-\r
-  *p_guids = cl_malloc( *p_num_guids * sizeof(**p_guids) );\r
-  if( *p_guids == NULL )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_get_ca_guids: ERR 3B10: "\r
-             "Unable to allocate CA GUID array.\n" );\r
-    goto Exit;\r
-  }\r
-\r
-  status = ib_get_ca_guids( p_vend->h_al, *p_guids, p_num_guids );\r
-  CL_ASSERT( *p_num_guids );\r
-\r
-  if( osm_log_is_active( p_vend->p_log, OSM_LOG_VERBOSE ) )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_VERBOSE,\r
-             "__osm_vendor_get_ca_guids: "\r
-             "Detected %u local channel adapters.\n", *p_num_guids );\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( status );\r
-}\r
-\r
-/****f* OpenSM: CA Info/osm_ca_info_get_pi_ptr\r
- * NAME\r
- * osm_ca_info_get_pi_ptr\r
- *\r
- * DESCRIPTION\r
- * Returns a pointer to the port attribute of the specified port\r
- * owned by this CA.\r
- *\r
- * SYNOPSIS\r
- */\r
-static ib_port_attr_t*\r
-__osm_ca_info_get_port_attr_ptr(\r
-  IN const osm_ca_info_t* const p_ca_info,\r
-  IN const uint8_t index )\r
-{\r
-  return( &p_ca_info->p_attr->p_port_attr[index] );\r
-}\r
-/*\r
- * PARAMETERS\r
- * p_ca_info\r
- *    [in] Pointer to a CA Info object.\r
- *\r
- * index\r
- *    [in] Port "index" for which to retrieve the port attribute.\r
- *    The index is the offset into the ca's internal array\r
- *    of port attributes.\r
- *\r
- * RETURN VALUE\r
- * Returns a pointer to the port attribute of the specified port\r
- * owned by this CA.\r
- * Also allocate p_vend->p_ca_info if not allocated and init it .\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_get_all_port_attr(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN ib_port_attr_t*    const p_attr_array,\r
-  IN uint32_t*       const p_num_ports )\r
-{\r
-  ib_api_status_t status;\r
-\r
-  uint32_t ca;\r
-  size_t ca_count;\r
-  uint32_t port_count = 0;\r
-  uint8_t port_num;\r
-  uint32_t total_ports = 0;\r
-  ib_net64_t *p_ca_guid = NULL;\r
-  osm_ca_info_t *p_ca_info;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_vend );\r
\r
-  /*\r
-    1) Determine the number of CA's\r
-    2) If not allready allocated - allocate an array big enough to hold the\r
-         ca info object , the ca info will be overwrite to contain the new ca info\r
-    3) Call again to retrieve the guids.\r
-  */\r
-  status = __osm_vendor_get_ca_guids( p_vend, &p_ca_guid, &ca_count );\r
-\r
-  if (p_vend->p_ca_info == NULL) \r
-  {\r
-      p_vend->p_ca_info = cl_zalloc( ca_count * sizeof(*(p_vend->p_ca_info)) );\r
-      \r
-      if( p_vend->p_ca_info == NULL )\r
-      {\r
-        osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-                 "osm_vendor_get_all_port_attr: ERR 3B11: "\r
-                 "Unable to allocate CA information array.\n" );\r
-        goto Exit;\r
-      }\r
-  }\r
-\r
-  p_vend->ca_count = ca_count;\r
-\r
-  /*\r
-    For each CA, retrieve the port info attributes\r
-  */\r
-  for( ca = 0; ca < ca_count; ca++ )\r
-  {\r
-    p_ca_info = &p_vend->p_ca_info[ca];\r
-\r
-    status = __osm_ca_info_init(\r
-      p_vend,\r
-      p_ca_info,\r
-      p_ca_guid[ca] );\r
-\r
-    if( status != IB_SUCCESS )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_get_all_port_attr: ERR 3B12: "\r
-               "Unable to initialize CA Info object (%s).\n",\r
-               ib_get_err_str( status ) );\r
-    }\r
-\r
-    total_ports += osm_ca_info_get_num_ports( p_ca_info );\r
-  }\r
-\r
-  /*\r
-    If the user supplied enough storage, return the port guids,\r
-    otherwise, return the appropriate error.\r
-  */\r
-  if( *p_num_ports >= total_ports )\r
-  {\r
-    for( ca = 0; ca < ca_count; ca++ )\r
-    {\r
-      uint32_t num_ports;\r
-\r
-      p_ca_info = &p_vend->p_ca_info[ca];\r
-\r
-      num_ports = osm_ca_info_get_num_ports( p_ca_info );\r
-\r
-      for( port_num = 0; port_num < num_ports; port_num++ )\r
-      {\r
-        p_attr_array[port_count] = \r
-          *__osm_ca_info_get_port_attr_ptr( p_ca_info, port_num );\r
-        /* convert lid to host order */\r
-        p_attr_array[port_count].lid = cl_ntoh16(p_attr_array[port_count].lid);\r
-        port_count++;\r
-      }\r
-    }\r
-  }\r
-  else\r
-  {\r
-    status = IB_INSUFFICIENT_MEMORY;\r
-  }\r
-\r
-\r
-  *p_num_ports = total_ports;\r
-\r
-\r
- Exit:\r
-  if( p_ca_guid )\r
-    cl_free( p_ca_guid );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( status );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_net64_t\r
-osm_vendor_get_ca_guid(\r
-  IN osm_vendor_t* const p_vend,\r
-  IN const ib_net64_t port_guid )\r
-{\r
-  uint8_t index;\r
-  uint8_t num_ports;\r
-  uint32_t num_guids = 0;\r
-  osm_ca_info_t *p_ca_info;\r
-  uint32_t ca;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( port_guid );\r
-  /*\r
-    First, locate the HCA that owns this port.\r
-  */\r
-  if( p_vend->p_ca_info == NULL )\r
-  {\r
-    /*\r
-      Initialize the osm_ca_info_t array which allows\r
-      us to match port GUID to CA.\r
-    */\r
-    osm_vendor_get_all_port_attr( p_vend, NULL, &num_guids );\r
-  }\r
-\r
-  CL_ASSERT( p_vend->p_ca_info );\r
-  CL_ASSERT( p_vend->ca_count );\r
-\r
-  for( ca = 0; ca < p_vend->ca_count; ca++ )\r
-  {\r
-    p_ca_info = &p_vend->p_ca_info[ca];\r
-\r
-    num_ports = osm_ca_info_get_num_ports( p_ca_info );\r
-    CL_ASSERT( num_ports );\r
-\r
-    for( index = 0; index < num_ports; index++ )\r
-    {\r
-      if( port_guid ==\r
-          osm_ca_info_get_port_guid( p_ca_info, index ) )\r
-      {\r
-        OSM_LOG_EXIT( p_vend->p_log );\r
-        return( osm_ca_info_get_ca_guid( p_ca_info ) );\r
-      }\r
-    }\r
-  }\r
-\r
-  /*\r
-    No local CA owns this guid!\r
-  */\r
-  osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "osm_vendor_get_ca_guid: ERR 3B13: "\r
-           "Unable to determine CA guid.\n" );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( 0 );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-uint8_t\r
-osm_vendor_get_port_num(\r
-  IN osm_vendor_t* const p_vend,\r
-  IN const ib_net64_t port_guid )\r
-{\r
-  uint8_t index;\r
-  uint8_t num_ports;\r
-  uint32_t num_guids = 0;\r
-  osm_ca_info_t *p_ca_info;\r
-  uint32_t ca;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( port_guid );\r
-  /*\r
-    First, locate the HCA that owns this port.\r
-  */\r
-  if( p_vend->p_ca_info == NULL )\r
-  {\r
-    /*\r
-      Initialize the osm_ca_info_t array which allows\r
-      us to match port GUID to CA.\r
-    */\r
-    osm_vendor_get_all_port_attr( p_vend, NULL, &num_guids );\r
-  }\r
-\r
-  CL_ASSERT( p_vend->p_ca_info );\r
-  CL_ASSERT( p_vend->ca_count );\r
-\r
-  for( ca = 0; ca < p_vend->ca_count; ca++ )\r
-  {\r
-    p_ca_info = &p_vend->p_ca_info[ca];\r
-\r
-    num_ports = osm_ca_info_get_num_ports( p_ca_info );\r
-    CL_ASSERT( num_ports );\r
-\r
-    for( index = 0; index < num_ports; index++ )\r
-    {\r
-      if( port_guid ==\r
-          osm_ca_info_get_port_guid( p_ca_info, index ) )\r
-      {\r
-        OSM_LOG_EXIT( p_vend->p_log );\r
-        return( osm_ca_info_get_port_num( p_ca_info, index ) );\r
-      }\r
-    }\r
-  }\r
\r
-  /*\r
-    No local CA owns this guid!\r
-  */\r
-  osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "osm_vendor_get_port_num: ERR 3B30: "\r
-           "Unable to determine CA guid.\n" );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( 0 );\r
-}\r
-\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__osm_vendor_open_ca(\r
-  IN osm_vendor_t* const p_vend,\r
-  IN const ib_net64_t port_guid )\r
-{\r
-  ib_net64_t ca_guid;\r
-  ib_api_status_t status;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  ca_guid = osm_vendor_get_ca_guid( p_vend, port_guid );\r
-  if( ca_guid == 0 )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_open_ca: ERR 3B31: "\r
-             "Bad port GUID value 0x%" PRIx64 ".\n",\r
-             cl_ntoh64( port_guid ) );\r
-    status = IB_ERROR;\r
-    goto Exit;\r
-  }\r
-\r
-  osm_log( p_vend->p_log, OSM_LOG_VERBOSE,\r
-           "__osm_vendor_open_ca: "\r
-           "Opening HCA 0x%" PRIx64 ".\n",   cl_ntoh64( ca_guid ) );\r
-\r
-  status = ib_open_ca( p_vend->h_al,\r
-                       ca_guid,\r
-                       __osm_al_ca_err_callback,\r
-                       p_vend,\r
-                       &p_vend->h_ca );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_open_ca: ERR 3B15: "\r
-             "Unable to open CA (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    goto Exit;\r
-  }\r
-\r
-  CL_ASSERT( p_vend->h_ca );\r
-\r
-  status = ib_alloc_pd(\r
-    p_vend->h_ca,\r
-    IB_PDT_ALIAS,\r
-    p_vend,\r
-    &p_vend->h_pd );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    ib_close_ca( p_vend->h_ca,__osm_al_ca_destroy_callback  );\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "__osm_vendor_open_ca: ERR 3B16: "\r
-             "Unable to allocate protection domain (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    goto Exit;\r
-  }\r
-\r
-  CL_ASSERT( p_vend->h_pd );\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( status );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-static void\r
-__osm_vendor_init_av(\r
-  IN const osm_al_bind_info_t* p_bind,\r
-  IN ib_av_attr_t* p_av )\r
-{\r
-  cl_memclr( p_av, sizeof(*p_av) );\r
-  p_av->port_num = p_bind->port_num;\r
-  p_av->dlid = IB_LID_PERMISSIVE;\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-osm_bind_handle_t\r
-osm_vendor_bind(\r
-  IN osm_vendor_t* const p_vend,\r
-  IN osm_bind_info_t* const p_user_bind,\r
-  IN osm_mad_pool_t* const p_mad_pool,\r
-  IN osm_vend_mad_recv_callback_t mad_recv_callback,\r
-  IN osm_vend_mad_send_err_callback_t send_err_callback,\r
-  IN void* context )\r
-{\r
-  ib_net64_t port_guid;\r
-  osm_al_bind_info_t *p_bind = 0;\r
-  ib_api_status_t status;\r
-  ib_qp_create_t qp_create;\r
-  ib_mad_svc_t mad_svc;\r
-  ib_av_attr_t av;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_user_bind );\r
-  CL_ASSERT( p_mad_pool );\r
-  CL_ASSERT( mad_recv_callback );\r
-  CL_ASSERT( send_err_callback );\r
-\r
-  port_guid = p_user_bind->port_guid;\r
-  osm_log( p_vend->p_log, OSM_LOG_INFO,\r
-           "osm_vendor_bind: Binding to port 0x%" PRIx64 ".\n",\r
-           cl_ntoh64( port_guid ) );\r
-\r
-  if( p_vend->h_ca == 0 )\r
-  {\r
-       osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-       "osm_vendor_bind: "\r
-          "Opening CA that owns port 0x%" PRIx64 ".\n",\r
-       cl_ntoh64( port_guid ));\r
-\r
-    status = __osm_vendor_open_ca( p_vend, port_guid );\r
-    if( status != IB_SUCCESS )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_bind: ERR 3B17: "\r
-               "Unable to Open CA (%s).\n",\r
-               ib_get_err_str( status ) );\r
-      goto Exit;\r
-    }\r
-  }\r
-\r
-  p_bind = cl_zalloc( sizeof(*p_bind) );\r
-  if( p_bind == NULL )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_bind: ERR 3B18: "\r
-             "Unable to allocate internal bind object.\n" );\r
-    goto Exit;\r
-  }\r
-\r
-  p_bind->p_vend = p_vend;\r
-  p_bind->client_context = context;\r
-  p_bind->port_num = osm_vendor_get_port_num( p_vend, port_guid );\r
-  p_bind->rcv_callback = mad_recv_callback;\r
-  p_bind->send_err_callback = send_err_callback;\r
-  p_bind->p_osm_pool = p_mad_pool;\r
-\r
-  CL_ASSERT( p_bind->port_num );\r
-\r
-  /*\r
-    Get the proper QP.\r
-  */\r
-  cl_memclr( &qp_create, sizeof(qp_create) );\r
-\r
-  switch( p_user_bind->mad_class )\r
-  {\r
-  case IB_MCLASS_SUBN_LID:\r
-  case IB_MCLASS_SUBN_DIR:\r
-    qp_create.qp_type = IB_QPT_QP0_ALIAS;\r
-    break;\r
-\r
-  case IB_MCLASS_SUBN_ADM:\r
-  default:\r
-    qp_create.qp_type = IB_QPT_QP1_ALIAS;\r
-    break;\r
-  }\r
-\r
-  qp_create.sq_depth = p_user_bind->send_q_size;\r
-  qp_create.rq_depth = p_user_bind->recv_q_size;\r
-  qp_create.sq_sge = OSM_AL_SQ_SGE;\r
-  qp_create.rq_sge = OSM_AL_RQ_SGE;\r
-  status = ib_get_spl_qp( p_vend->h_pd,\r
-                                                 port_guid,\r
-                                                 &qp_create,\r
-                                                 p_bind,\r
-                                                 __osm_al_err_callback,\r
-                                                 &p_bind->pool_key,\r
-                                                 &p_bind->h_qp );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_bind: ERR 3B19: "\r
-             "Unable to get QP handle (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    cl_free( p_bind );\r
-    p_bind = 0;\r
-    goto Exit;\r
-  }\r
-\r
-  CL_ASSERT( p_bind->h_qp );\r
-  CL_ASSERT( p_bind->pool_key );\r
-\r
-  cl_memclr( &mad_svc, sizeof(mad_svc) );\r
-\r
-  mad_svc.mad_svc_context = p_bind;\r
-  mad_svc.pfn_mad_send_cb = __osm_al_send_callback; \r
-  mad_svc.pfn_mad_recv_cb = __osm_al_rcv_callback;\r
-  mad_svc.mgmt_class = p_user_bind->mad_class;\r
-  mad_svc.mgmt_version = p_user_bind->class_version;\r
-  mad_svc.support_unsol = p_user_bind->is_responder;\r
-\r
-  mad_svc.method_array[IB_MAD_METHOD_GET] = TRUE;\r
-  mad_svc.method_array[IB_MAD_METHOD_SET] = TRUE;\r
-  mad_svc.method_array[IB_MAD_METHOD_DELETE] = TRUE;\r
-  mad_svc.method_array[IB_MAD_METHOD_TRAP] = TRUE;\r
-  mad_svc.method_array[IB_MAD_METHOD_GETTABLE] = TRUE;\r
-\r
-#ifdef DUAL_SIDED_RMPP\r
-  mad_svc.method_array[IB_MAD_METHOD_GETMULTI] = TRUE;\r
-#endif\r
-  /* Add in IB_MAD_METHOD_GETTRACETABLE */\r
-  /* when supported by OpenSM */\r
-#if 0\r
-  if (p_user_bind->is_report_processor)\r
-       mad_svc.method_array[IB_MAD_METHOD_REPORT] = TRUE;\r
-\r
-  if (p_user_bind->is_trap_processor) {\r
-       mad_svc.method_array[IB_MAD_METHOD_TRAP] = TRUE;\r
-       mad_svc.method_array[IB_MAD_METHOD_TRAP_REPRESS] = TRUE;\r
-  }\r
-#endif\r
-  status = ib_reg_mad_svc( p_bind->h_qp, &mad_svc, &p_bind->h_svc );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_bind: ERR 3B21: "\r
-             "Unable to register QP0 MAD service (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    cl_free( p_bind );\r
-    p_bind = 0;\r
-    goto Exit;\r
-  }\r
-\r
-  __osm_vendor_init_av( p_bind, &av );\r
-\r
-  status = ib_create_av( p_vend->h_pd, &av, &(p_bind->h_dr_av) );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-       osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_bind: ERR 3B22: "\r
-             "Unable to create address vector (%s).\n",\r
-             ib_get_err_str( status ) );\r
-\r
-       cl_free( p_bind );\r
-       p_bind = 0;\r
-       goto Exit;\r
-  }\r
-\r
-  if( osm_log_is_active( p_vend->p_log, OSM_LOG_DEBUG ) )\r
-  {\r
-       osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-             "osm_vendor_bind: "\r
-             "Allocating av handle %p.\n", p_bind->h_dr_av );\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( (osm_bind_handle_t)p_bind );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-/* osm_vendor_unbind is added due to OSM-1.8.0 gen2 merging\r
-    The functionality will be added when the Gen2 osm_vendor_unbind\r
-    will be implemented.\r
-*/    \r
-void\r
-osm_vendor_unbind(\r
-  IN osm_bind_handle_t h_bind)\r
-{\r
-       osm_al_bind_info_t *p_bind = ( osm_al_bind_info_t * ) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-\r
-       OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-       OSM_LOG_EXIT( p_vend->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_mad_t*\r
-osm_vendor_get(\r
-  IN osm_bind_handle_t  h_bind,\r
-  IN const uint32_t     mad_size,\r
-  IN osm_vend_wrap_t*      const p_vw )\r
-{\r
-  ib_mad_t *p_mad;\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t *)h_bind;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-  ib_api_status_t status;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_vw );\r
-\r
-  p_vw->size = mad_size;\r
-  p_vw->h_bind = h_bind;\r
-\r
-  /*\r
-    Retrieve a MAD element from the pool and give the user direct\r
-    access to its buffer.\r
-  */\r
-  status = ib_get_mad( p_bind->pool_key, mad_size, &p_vw->p_elem );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_get: ERR 3B25: "\r
-             "Unable to acquire MAD (%s).\n",\r
-             ib_get_err_str( status ) );\r
-\r
-    p_mad = NULL;\r
-    goto Exit;\r
-  }\r
-\r
-  CL_ASSERT( p_vw->p_elem );\r
-  p_mad = ib_get_mad_buf( p_vw->p_elem );\r
-\r
-  if( osm_log_get_level( p_vend->p_log ) >= OSM_LOG_DEBUG )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-             "osm_vendor_get: "\r
-             "Acquired MAD %p, size = %u.\n", p_mad, mad_size );\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( p_mad );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void\r
-osm_vendor_put(\r
-  IN osm_bind_handle_t h_bind,\r
-  IN osm_vend_wrap_t* const p_vw )\r
-{\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t *)h_bind;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-  ib_api_status_t status;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_vw );\r
-  CL_ASSERT( p_vw->p_elem );\r
-  CL_ASSERT( p_vw->h_bind == h_bind );\r
-\r
-  if( osm_log_get_level( p_vend->p_log ) >= OSM_LOG_DEBUG )\r
-  {\r
-       \r
-    osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-             "osm_vendor_put: "\r
-             "Retiring MAD %p.\n", ib_get_mad_buf( p_vw->p_elem ) );\r
-  //            "Retiring MAD %p.\n", p_mad);\r
-  }\r
-\r
-  status = ib_put_mad( p_vw->p_elem );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_put: ERR 3B26: "\r
-             "Unable to retire MAD (%s).\n",\r
-             ib_get_err_str( status ) );\r
-  }\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_send(\r
-  IN osm_bind_handle_t h_bind,\r
-  IN osm_madw_t* const p_madw,\r
-  IN boolean_t const resp_expected )\r
-{\r
-  osm_al_bind_info_t* const p_bind = h_bind;\r
-  osm_vendor_t* const p_vend = p_bind->p_vend;\r
-  osm_vend_wrap_t* const p_vw = osm_madw_get_vend_ptr( p_madw );\r
-  osm_mad_addr_t* const p_mad_addr = osm_madw_get_mad_addr_ptr( p_madw );\r
-  ib_mad_t* const p_mad = osm_madw_get_mad_ptr( p_madw );\r
-  ib_api_status_t status;\r
-  ib_mad_element_t *p_elem;\r
-  ib_av_attr_t av;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  CL_ASSERT( p_vw->h_bind == h_bind );\r
-  CL_ASSERT( p_vw->p_elem );\r
-\r
-  p_elem = p_vw->p_elem;\r
-\r
-  /*\r
-    If a response is expected to this MAD, then preallocate\r
-    a mad wrapper to contain the wire MAD received in the\r
-    response.  Allocating a wrapper here allows for easier\r
-    failure paths than after we already received the wire mad.\r
-    In order to seperate the receive callback and the send callback\r
-    dependency , we copy the request madw and send it as context2\r
-    Which in time in the receive callback will replace the req_madw \r
-    to allow avoid races with send callback\r
-  */\r
-  if( resp_expected )\r
-  {\r
-    p_vw->p_resp_madw = osm_mad_pool_get_wrapper_raw(\r
-      p_bind->p_osm_pool );\r
-    if( p_vw->p_resp_madw == NULL  )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_send: ERR 3B27: "\r
-               "Unable to allocate MAD wrapper.\n" );\r
-      status = IB_INSUFFICIENT_RESOURCES;\r
-      goto Exit;\r
-    }\r
-    \r
-  }\r
-  else\r
-    p_vw->p_resp_madw = NULL;\r
-\r
-  /*\r
-    For all sends other than directed route SM MADs,\r
-    acquire an address vector for the destination.\r
-  */\r
-  if( p_mad->mgmt_class != IB_MCLASS_SUBN_DIR )\r
-  {\r
-    cl_memclr( &av, sizeof(av) );\r
-    av.port_num = p_bind->port_num;\r
-    av.dlid = p_mad_addr->dest_lid;\r
-    av.static_rate = p_mad_addr->static_rate;\r
-    av.path_bits = p_mad_addr->path_bits;\r
-\r
-    if( (p_mad->mgmt_class != IB_MCLASS_SUBN_LID) &&\r
-        (p_mad->mgmt_class != IB_MCLASS_SUBN_DIR) )\r
-    {\r
-      av.sl = p_mad_addr->addr_type.gsi.service_level;\r
-\r
-\r
-      if(p_mad_addr->addr_type.gsi.global_route)\r
-      {\r
-        av.grh_valid = TRUE;\r
-        /* ANIL */\r
-        /* av.grh = p_mad_addr->addr_type.gsi.grh_info; */\r
-      }\r
-    }\r
-\r
-    if( osm_log_is_active( p_vend->p_log, OSM_LOG_DEBUG ) )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_send: "\r
-               "av.port_num 0x%X, "\r
-               "av.dlid 0x%X, "\r
-               "av.static_rate   %d, "\r
-               "av.path_bits %d.\n",\r
-               av.port_num, cl_ntoh16(av.dlid),\r
-               av.static_rate, av.path_bits);\r
-    }\r
-\r
-    status = ib_create_av( p_vend->h_pd, &av, &(p_vw->h_av) );\r
-    if( status != IB_SUCCESS )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_send: ERR 3B28: "\r
-               "Unable to create address vector (%s).\n",\r
-               ib_get_err_str( status ) );\r
-\r
-      if( p_vw->p_resp_madw )\r
-        osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
-      /* Since we in immediate error the vendor layer is expected to handle the rollback , i.e free of madw */\r
-      if (p_madw) \r
-        osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
-      goto Exit;\r
-    }\r
-\r
-    if( osm_log_is_active( p_vend->p_log, OSM_LOG_DEBUG ) )\r
-    {\r
-      osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_send: "\r
-               "Allocating av handle %p.\n", p_vw->h_av );\r
-    }\r
-  }\r
-  else\r
-  {\r
-    p_vw->h_av = p_bind->h_dr_av;\r
-  }\r
-\r
-  p_elem->h_av = p_vw->h_av;\r
-\r
-  p_elem->context1 = p_madw;\r
-  p_elem->context2 = NULL;\r
-\r
-  p_elem->immediate_data = 0;\r
-  p_elem->p_grh = NULL;\r
-  p_elem->resp_expected = resp_expected;\r
-  p_elem->retry_cnt = OSM_DEFAULT_RETRY_COUNT;\r
-\r
-  p_elem->send_opt = IB_SEND_OPT_SIGNALED;\r
-  p_elem->timeout_ms = p_vend->timeout;\r
-\r
-  /* Completion information. */\r
-  p_elem->status = 0; /* Not trusting AL */\r
-\r
-\r
-  if( (p_mad->mgmt_class == IB_MCLASS_SUBN_LID) ||\r
-      (p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) )\r
-  {\r
-    p_elem->remote_qp = 0;\r
-    p_elem->remote_qkey = 0;\r
-  }\r
-  else\r
-  {\r
-    p_elem->remote_qp = p_mad_addr->addr_type.gsi.remote_qp;\r
-    p_elem->remote_qkey = p_mad_addr->addr_type.gsi.remote_qkey;\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-            "osm_vendor_send: "\r
-            "remote qp = 0x%X, remote qkey = 0x%X.\n",\r
-            cl_ntoh32(p_elem->remote_qp),\r
-            cl_ntoh32(p_elem->remote_qkey) );\r
-  }\r
-\r
-  status = ib_send_mad( p_bind->h_svc, p_elem, NULL );\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_send: ERR 3B29: "\r
-             "Send failed , cleaning up (%s).\n",\r
-             ib_get_err_str( status ) );\r
-    /* When we destroy the av - we should take the pointer from local allocation since\r
-        we do not "trust" IBAL to keep track in p_elem */\r
-\r
-    if (p_vw->h_av && (p_vw->h_av != p_bind->h_dr_av) )\r
-    {\r
-        osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-                   "__osm_al_send: "\r
-                   "Destroying av handle %p.\n", p_vw->h_av );\r
-        ib_destroy_av( p_vw->h_av );\r
-    }\r
-    if( p_vw->p_resp_madw )\r
-      osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
-    /* Since we in immediate error the vendor layer is expected to handle the rollback , i.e free of madw */\r
-    if (p_madw) \r
-      osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
-    goto Exit;\r
-  }\r
-\r
- Exit:\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( status );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_local_lid_change(\r
-  IN osm_bind_handle_t h_bind )\r
-{\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t *)h_bind;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-  return( IB_SUCCESS );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void\r
-osm_vendor_set_sm(\r
-  IN osm_bind_handle_t h_bind,\r
-  IN boolean_t         is_sm_val )\r
-{\r
-  osm_al_bind_info_t *p_bind = (osm_al_bind_info_t *)h_bind;\r
-  osm_vendor_t *p_vend = p_bind->p_vend;\r
-  ib_api_status_t status;\r
-  ib_port_attr_mod_t attr_mod;\r
-\r
-  OSM_LOG_ENTER( p_vend->p_log );\r
-\r
-  cl_memclr( &attr_mod, sizeof(attr_mod) );\r
-\r
-  attr_mod.cap.sm = is_sm_val;\r
-\r
-  status = ib_modify_ca( p_vend->h_ca, p_bind->port_num,\r
-                         IB_CA_MOD_IS_SM, &attr_mod );\r
-\r
-  if( status != IB_SUCCESS )\r
-  {\r
-    osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-             "osm_vendor_set_sm: ERR 3B34: "\r
-             "Unable set 'IS_SM' bit to:%u in port attributes (%s).\n",\r
-             is_sm_val, ib_get_err_str( status ) );\r
-  }\r
-\r
-  OSM_LOG_EXIT( p_vend->p_log );\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)\r
-{\r
-}\r
-\r
-#endif   /* OSM_VENDOR_INTF_AL */\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c b/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c
deleted file mode 100644 (file)
index 79af5b4..0000000
+++ /dev/null
@@ -1,1194 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_vendor_t (for umad).\r
- * This object represents the OpenIB vendor layer.\r
- * This object is part of the opensm family of objects.\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#ifdef OSM_VENDOR_INTF_OPENIB\r
-\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-#include <fcntl.h>\r
-#include <errno.h>\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_math.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-/****s* OpenSM: Vendor UMAD/osm_umad_bind_info_t\r
- * NAME\r
- *   osm_umad_bind_info_t\r
- *\r
- * DESCRIPTION\r
- *    Structure containing bind information.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osm_umad_bind_info {\r
-       osm_vendor_t *p_vend;\r
-       void *client_context;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       osm_vend_mad_recv_callback_t mad_recv_callback;\r
-       osm_vend_mad_send_err_callback_t send_err_callback;\r
-       ib_net64_t port_guid;\r
-       int port_id;\r
-       int agent_id;\r
-       int agent_id1;          /* SMI requires two agents */\r
-       int timeout;\r
-       int max_retries;\r
-} osm_umad_bind_info_t;\r
-\r
-typedef struct _umad_receiver {\r
-       pthread_t tid;\r
-       osm_vendor_t *p_vend;\r
-       osm_log_t *p_log;\r
-} umad_receiver_t;\r
-\r
-static void osm_vendor_close_port(osm_vendor_t * const p_vend);\r
-\r
-static void clear_madw(osm_vendor_t * p_vend)\r
-{\r
-       umad_match_t *m, *e, *old_m;\r
-       ib_net64_t old_tid;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-       pthread_mutex_lock(&p_vend->match_tbl_mutex);\r
-       for (m = p_vend->mtbl.tbl, e = m + p_vend->mtbl.max; m < e; m++) {\r
-               if (m->tid) {\r
-                       old_m = m;\r
-                       old_tid = m->tid;\r
-                       m->tid = 0;\r
-                       osm_mad_pool_put(((osm_umad_bind_info_t\r
-                                          *) ((osm_madw_t *) m->v)->h_bind)->\r
-                                        p_mad_pool, m->v);\r
-                       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5401: "\r
-                               "evicting entry %p (tid was 0x%" PRIx64 ")\n",\r
-                               old_m, cl_ntoh64(old_tid));\r
-                       goto Exit;\r
-               }\r
-       }\r
-       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-static osm_madw_t *get_madw(osm_vendor_t * p_vend, ib_net64_t * tid)\r
-{\r
-       umad_match_t *m, *e;\r
-       ib_net64_t mtid = (*tid & CL_HTON64(0x00000000ffffffffULL));\r
-       osm_madw_t *res;\r
-\r
-       /*\r
-        * Since mtid == 0 is the empty key, we should not\r
-        * waste time looking for it\r
-        */\r
-       if (mtid == 0)\r
-               return 0;\r
-\r
-       pthread_mutex_lock(&p_vend->match_tbl_mutex);\r
-       for (m = p_vend->mtbl.tbl, e = m + p_vend->mtbl.max; m < e; m++) {\r
-               if (m->tid == mtid) {\r
-                       m->tid = 0;\r
-                       *tid = mtid;\r
-                       res = m->v;\r
-                       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-                       return res;\r
-               }\r
-       }\r
-\r
-       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-       return 0;\r
-}\r
-\r
-static void\r
-put_madw(osm_vendor_t * p_vend, osm_madw_t * p_madw, ib_net64_t tid)\r
-{\r
-       umad_match_t *m, *e, *old_lru, *lru = 0;\r
-       osm_madw_t *p_req_madw;\r
-       osm_umad_bind_info_t *p_bind;\r
-       ib_net64_t old_tid;\r
-       uint32_t oldest = ~0;\r
-\r
-       pthread_mutex_lock(&p_vend->match_tbl_mutex);\r
-       for (m = p_vend->mtbl.tbl, e = m + p_vend->mtbl.max; m < e; m++) {\r
-               if (m->tid == 0) {\r
-                       m->tid = tid;\r
-                       m->v = p_madw;\r
-                       m->version =\r
-                           cl_atomic_inc((atomic32_t *) & p_vend->mtbl.\r
-                                         last_version);\r
-                       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-                       return;\r
-               }\r
-               if (oldest > m->version) {\r
-                       oldest = m->version;\r
-                       lru = m;\r
-               }\r
-       }\r
-\r
-       old_lru = lru;\r
-       old_tid = lru->tid;\r
-       p_req_madw = old_lru->v;\r
-       p_bind = p_req_madw->h_bind;\r
-       p_req_madw->status = IB_CANCELED;\r
-       pthread_mutex_lock(&p_vend->cb_mutex);\r
-       (*p_bind->send_err_callback) (p_bind->client_context, p_req_madw);\r
-       pthread_mutex_unlock(&p_vend->cb_mutex);\r
-       lru->tid = tid;\r
-       lru->v = p_madw;\r
-       lru->version =\r
-           cl_atomic_inc((atomic32_t *) & p_vend->mtbl.last_version);\r
-       pthread_mutex_unlock(&p_vend->match_tbl_mutex);\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5402: "\r
-               "evicting entry %p (tid was 0x%" PRIx64 ")\n", old_lru,\r
-               cl_ntoh64(old_tid));\r
-}\r
-\r
-static void\r
-ib_mad_addr_conv(ib_user_mad_t * umad, osm_mad_addr_t * osm_mad_addr,\r
-                int is_smi)\r
-{\r
-       ib_mad_addr_t *ib_mad_addr = umad_get_mad_addr(umad);\r
-       osm_mad_addr->dest_lid = ib_mad_addr->lid;\r
-       osm_mad_addr->path_bits = ib_mad_addr->path_bits;\r
-       osm_mad_addr->static_rate = 0;\r
-\r
-       if (is_smi) {\r
-               osm_mad_addr->addr_type.smi.source_lid = osm_mad_addr->dest_lid;\r
-               osm_mad_addr->addr_type.smi.port_num = 255;     /* not used */\r
-               return;\r
-       }\r
-\r
-       osm_mad_addr->addr_type.gsi.remote_qp = ib_mad_addr->qpn;\r
-       osm_mad_addr->addr_type.gsi.remote_qkey = ib_mad_addr->qkey;\r
-       osm_mad_addr->addr_type.gsi.pkey_ix = umad_get_pkey(umad);\r
-       osm_mad_addr->addr_type.gsi.service_level = ib_mad_addr->sl;\r
-       osm_mad_addr->addr_type.gsi.global_route = 0;   /* FIXME: handle GRH */\r
-       memset(&osm_mad_addr->addr_type.gsi.grh_info, 0,\r
-              sizeof osm_mad_addr->addr_type.gsi.grh_info);\r
-}\r
-\r
-static void *swap_mad_bufs(osm_madw_t * p_madw, void *umad)\r
-{\r
-       void *old;\r
-\r
-       old = p_madw->vend_wrap.umad;\r
-       p_madw->vend_wrap.umad = umad;\r
-       p_madw->p_mad = umad_get_mad(umad);\r
-\r
-       return old;\r
-}\r
-\r
-static void unlock_mutex(void *arg)\r
-{\r
-       pthread_mutex_unlock(arg);\r
-}\r
-\r
-static void * OSM_API umad_receiver(void *p_ptr)\r
-{\r
-       umad_receiver_t *const p_ur = (umad_receiver_t *) p_ptr;\r
-       osm_vendor_t *p_vend = p_ur->p_vend;\r
-       osm_umad_bind_info_t *p_bind;\r
-       ib_mad_addr_t *ib_mad_addr;\r
-       osm_mad_addr_t osm_addr;\r
-       osm_madw_t *p_madw, *p_req_madw;\r
-       ib_mad_t *mad;\r
-       void *umad = 0;\r
-       int mad_agent, length;\r
-\r
-       OSM_LOG_ENTER(p_ur->p_log);\r
-\r
-       for (;;) {\r
-               if (!umad &&\r
-                   !(umad = umad_alloc(1, umad_size() + MAD_BLOCK_SIZE))) {\r
-                       OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5403: "\r
-                               "can't alloc MAD sized umad\n");\r
-                       break;\r
-               }\r
-\r
-               length = MAD_BLOCK_SIZE;\r
-               if ((mad_agent = umad_recv(p_vend->umad_port_id, umad,\r
-                                          &length, -1)) < 0) {\r
-                       if (length <= MAD_BLOCK_SIZE) {\r
-                               OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5404: "\r
-                                       "recv error on MAD sized umad (%m)\n");\r
-                               continue;\r
-                       } else {\r
-                               umad_free(umad);\r
-                               /* Need a larger buffer for RMPP */\r
-                               umad = umad_alloc(1, umad_size() + length);\r
-                               if (!umad) {\r
-                                       OSM_LOG(p_ur->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 5405: "\r
-                                               "can't alloc umad length %d\n",\r
-                                               length);\r
-                                       continue;\r
-                               }\r
-\r
-                               if ((mad_agent = umad_recv(p_vend->umad_port_id,\r
-                                                          umad, &length,\r
-                                                          -1)) < 0) {\r
-                                       OSM_LOG(p_ur->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 5406: "\r
-                                               "recv error on umad length %d (%m)\n",\r
-                                               length);\r
-                                       continue;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if (mad_agent >= OSM_UMAD_MAX_AGENTS ||\r
-                   !(p_bind = p_vend->agents[mad_agent])) {\r
-                       OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5407: "\r
-                               "invalid mad agent %d - dropping\n", mad_agent);\r
-                       continue;\r
-               }\r
-\r
-               mad = (ib_mad_t *) umad_get_mad(umad);\r
-               ib_mad_addr = umad_get_mad_addr(umad);\r
-\r
-               ib_mad_addr_conv(umad, &osm_addr,\r
-                                mad->mgmt_class == IB_MCLASS_SUBN_LID ||\r
-                                mad->mgmt_class == IB_MCLASS_SUBN_DIR);\r
-\r
-               if (!(p_madw = osm_mad_pool_get(p_bind->p_mad_pool,\r
-                                               (osm_bind_handle_t) p_bind,\r
-                                               MAX(length, MAD_BLOCK_SIZE),\r
-                                               &osm_addr))) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5408: "\r
-                               "request for a new madw failed -- dropping packet\n");\r
-                       continue;\r
-               }\r
-\r
-               /* Need to fix up MAD size if short RMPP packet */\r
-               if (length < MAD_BLOCK_SIZE)\r
-                       p_madw->mad_size = length;\r
-\r
-               /*\r
-                * Avoid copying by swapping mad buf pointers.\r
-                * Do not use umad after this line of code.\r
-                */\r
-               umad = swap_mad_bufs(p_madw, umad);\r
-\r
-               /* if status != 0 then we are handling recv timeout on send */\r
-               if (umad_status(p_madw->vend_wrap.umad)) {\r
-\r
-                       if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
-                               /* LID routed */\r
-                               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5410: "\r
-                                       "Send completed with error -- dropping\n"\r
-                                       "\t\t\tClass 0x%x, Method 0x%X, Attr 0x%X, "\r
-                                       "TID 0x%" PRIx64 ", LID %u\n",\r
-                                       mad->mgmt_class, mad->method,\r
-                                       cl_ntoh16(mad->attr_id),\r
-                                       cl_ntoh64(mad->trans_id),\r
-                                       cl_ntoh16(ib_mad_addr->lid));\r
-                       } else {\r
-                               ib_smp_t *smp;\r
-\r
-                               /* Direct routed SMP */\r
-                               smp = (ib_smp_t *) mad;\r
-                               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5411: "\r
-                                       "DR SMP Send completed with error -- dropping\n"\r
-                                       "\t\t\tMethod 0x%X, Attr 0x%X, TID 0x%" PRIx64\r
-                                       ", Hop Ptr: 0x%X\n",\r
-                                       mad->method, cl_ntoh16(mad->attr_id),\r
-                                       cl_ntoh64(mad->trans_id), smp->hop_ptr);\r
-                               osm_dump_smp_dr_path(p_vend->p_log, smp,\r
-                                                    OSM_LOG_ERROR);\r
-                       }\r
-\r
-                       if (!(p_req_madw = get_madw(p_vend, &mad->trans_id))) {\r
-                               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 5412: "\r
-                                       "Failed to obtain request madw for timed out MAD"\r
-                                       " (method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",\r
-                                       mad->method, cl_ntoh16(mad->attr_id),\r
-                                       cl_ntoh64(mad->trans_id));\r
-                       } else {\r
-                               p_req_madw->status = IB_TIMEOUT;\r
-                               /* cb frees req_madw */\r
-#ifdef __WIN__\r
-                               pthread_mutex_lock(&p_vend->cb_mutex);\r
-                               (*p_bind->send_err_callback) (p_bind->\r
-                                                             client_context,\r
-                                                             p_req_madw);\r
-                               pthread_mutex_unlock(&p_vend->cb_mutex);\r
-#else\r
-                               pthread_mutex_lock(&p_vend->cb_mutex);\r
-                               pthread_cleanup_push(unlock_mutex,\r
-                                                    &p_vend->cb_mutex);\r
-                               (*p_bind->send_err_callback) (p_bind->\r
-                                                             client_context,\r
-                                                             p_req_madw);\r
-                               pthread_cleanup_pop(1);\r
-#endif\r
-                       }\r
-\r
-                       osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-                       continue;\r
-               }\r
-\r
-               p_req_madw = 0;\r
-               if (ib_mad_is_response(mad) &&\r
-                   !(p_req_madw = get_madw(p_vend, &mad->trans_id))) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5413: "\r
-                               "Failed to obtain request madw for received MAD"\r
-                               "(method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",\r
-                               mad->method, cl_ntoh16((mad)->attr_id),\r
-                               cl_ntoh64(mad->trans_id));\r
-                       osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-                       continue;\r
-               }\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-               if ((mad->mgmt_class != IB_MCLASS_SUBN_DIR) &&\r
-                   (mad->mgmt_class != IB_MCLASS_SUBN_LID) &&\r
-                   (ib_rmpp_is_flag_set((ib_rmpp_mad_t *) mad,\r
-                                        IB_RMPP_FLAG_ACTIVE))) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5414: "\r
-                               "class 0x%x method 0x%x RMPP version %d type "\r
-                               "%d flags 0x%x received -- dropping\n",\r
-                               mad->mgmt_class, mad->method,\r
-                               ((ib_rmpp_mad_t *) mad)->rmpp_version,\r
-                               ((ib_rmpp_mad_t *) mad)->rmpp_type,\r
-                               ((ib_rmpp_mad_t *) mad)->rmpp_flags);\r
-                       osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-                       continue;\r
-               }\r
-#endif\r
-\r
-               /* call the CB */\r
-#ifdef __WIN__\r
-               pthread_mutex_lock(&p_vend->cb_mutex);\r
-               (*p_bind->mad_recv_callback) (p_madw, p_bind->client_context,\r
-                                             p_req_madw);\r
-               pthread_mutex_unlock(&p_vend->cb_mutex);\r
-#else /* !__WIN__ */\r
-               pthread_mutex_lock(&p_vend->cb_mutex);\r
-               pthread_cleanup_push(unlock_mutex, &p_vend->cb_mutex);\r
-               (*p_bind->mad_recv_callback) (p_madw, p_bind->client_context,\r
-                                             p_req_madw);\r
-               pthread_cleanup_pop(1);\r
-#endif\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return NULL;\r
-}\r
-\r
-static int umad_receiver_start(osm_vendor_t * p_vend)\r
-{\r
-       umad_receiver_t *p_ur = p_vend->receiver;\r
-\r
-       p_ur->p_vend = p_vend;\r
-       p_ur->p_log = p_vend->p_log;\r
-\r
-#ifdef HAVE_LIBPTHREADS\r
-       if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) < 0)\r
-               return -1;\r
-\r
-       return 0;\r
-#else\r
-    {\r
-       ib_api_status_t status;\r
-\r
-       status = cl_thread_init( &p_ur->tid,\r
-                                (void*)umad_receiver,\r
-                                (void*)p_ur,\r
-                                "umad_recvr" );\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_ur->p_log, OSM_LOG_ERROR,\r
-                       "ERR: thread 'umad_recvr' start failure: %s\n",\r
-                       ib_get_err_str(status));\r
-       }\r
-       return (status != IB_SUCCESS ? -1 : 0);\r
-    }\r
-#endif\r
-}\r
-\r
-static void umad_receiver_stop(umad_receiver_t * p_ur)\r
-{\r
-#ifdef HAVE_LIBPTHREADS\r
-       pthread_cancel(p_ur->tid);\r
-       pthread_join(p_ur->tid, NULL);\r
-       p_ur->tid = 0;\r
-#else\r
-       /* XXX hangs current thread - suspect umad_recv() ignoring wakeup.\r
-       cl_thread_destroy(&p_ur->tid);\r
-       */\r
-#endif\r
-       p_ur->p_vend = NULL;\r
-       p_ur->p_log = NULL;\r
-}\r
-\r
-ib_api_status_t\r
-osm_vendor_init(IN osm_vendor_t * const p_vend,\r
-               IN osm_log_t * const p_log, IN const uint32_t timeout)\r
-{\r
-       char *max = NULL;\r
-       int r, n_cas;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_vend->p_log = p_log;\r
-       p_vend->timeout = timeout;\r
-       p_vend->max_retries = OSM_DEFAULT_RETRY_COUNT;\r
-       pthread_mutex_init(&p_vend->cb_mutex, NULL);\r
-       pthread_mutex_init(&p_vend->match_tbl_mutex, NULL);\r
-       p_vend->umad_port_id = -1;\r
-       p_vend->issmfd = -1;\r
-\r
-       /*\r
-        * Open our instance of UMAD.\r
-        */\r
-       if ((r = umad_init()) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "ERR 5415: Error opening UMAD\n");\r
-       }\r
-\r
-       if ((n_cas = umad_get_cas_names(p_vend->ca_names,\r
-                                       OSM_UMAD_MAX_CAS)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "ERR 5416: umad_get_cas_names failed\n");\r
-               r = n_cas;\r
-               goto Exit;\r
-       }\r
-\r
-       p_vend->ca_count = n_cas;\r
-       p_vend->mtbl.max = DEFAULT_OSM_UMAD_MAX_PENDING;\r
-\r
-       if ((max = getenv("OSM_UMAD_MAX_PENDING")) != NULL) {\r
-               int tmp = strtol(max, NULL, 0);\r
-               if (tmp > 0)\r
-                       p_vend->mtbl.max = tmp;\r
-               else\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "Error:"\r
-                               "OSM_UMAD_MAX_PENDING=%d is invalid\n",\r
-                               tmp);\r
-       }\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_INFO, "%d pending umads specified\n",\r
-               p_vend->mtbl.max);\r
-\r
-       p_vend->mtbl.tbl = calloc(p_vend->mtbl.max, sizeof(*(p_vend->mtbl.tbl)));\r
-       if (!p_vend->mtbl.tbl) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "Error:"\r
-                       "failed to allocate vendor match table\n");\r
-               r = IB_INSUFFICIENT_MEMORY;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return (r);\r
-}\r
-\r
-osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log,\r
-                            IN const uint32_t timeout)\r
-{\r
-       osm_vendor_t *p_vend = NULL;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!timeout) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5433: "\r
-                       "transaction timeout cannot be 0\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_vend = malloc(sizeof(*p_vend));\r
-       if (p_vend == NULL) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5417: "\r
-                       "Unable to allocate vendor object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_vend, 0, sizeof(*p_vend));\r
-\r
-       if (osm_vendor_init(p_vend, p_log, timeout) < 0) {\r
-               free(p_vend);\r
-               p_vend = NULL;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return (p_vend);\r
-}\r
-\r
-void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)\r
-{\r
-       osm_vendor_close_port(*pp_vend);\r
-\r
-       clear_madw(*pp_vend);\r
-       /* make sure all ports are closed */\r
-       umad_done();\r
-\r
-       pthread_mutex_destroy(&(*pp_vend)->cb_mutex);\r
-       pthread_mutex_destroy(&(*pp_vend)->match_tbl_mutex);\r
-       free((*pp_vend)->mtbl.tbl);\r
-       free(*pp_vend);\r
-       *pp_vend = NULL;\r
-}\r
-\r
-ib_api_status_t\r
-osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                            IN ib_port_attr_t * const p_attr_array,\r
-                            IN uint32_t * const p_num_ports)\r
-{\r
-       umad_ca_t ca;\r
-       ib_port_attr_t *attr = p_attr_array;\r
-       unsigned done = 0;\r
-       int r = 0, i, j, k;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend && p_num_ports);\r
-\r
-       if (!*p_num_ports) {\r
-               r = IB_INVALID_PARAMETER;\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5418: "\r
-                       "Ports in should be > 0\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (!p_attr_array) {\r
-               r = IB_INSUFFICIENT_MEMORY;\r
-               *p_num_ports = 0;\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < p_vend->ca_count && !done; i++) {\r
-               /* For each CA, retrieve the port attributes */\r
-               if (umad_get_ca(p_vend->ca_names[i], &ca) == 0) {\r
-                       if (ca.node_type < 1 || ca.node_type > 3)\r
-                               continue;\r
-                       for (j = 0; j <= ca.numports; j++) {\r
-                               if (!ca.ports[j])\r
-                                       continue;\r
-                               attr->port_guid = ca.ports[j]->port_guid;\r
-                               attr->lid = ca.ports[j]->base_lid;\r
-                               attr->port_num = ca.ports[j]->portnum;\r
-                               attr->sm_lid = ca.ports[j]->sm_lid;\r
-                               attr->link_state = ca.ports[j]->state;\r
-                               if (attr->num_pkeys && attr->p_pkey_table) {\r
-                                       if (attr->num_pkeys > ca.ports[j]->pkeys_size)\r
-                                               attr->num_pkeys = ca.ports[j]->pkeys_size;\r
-                                       for (k = 0; k < attr->num_pkeys; k++)\r
-                                               attr->p_pkey_table[k] =\r
-                                                       cl_hton16(ca.ports[j]->pkeys[k]);\r
-                               }\r
-                               attr->num_pkeys = ca.ports[j]->pkeys_size;\r
-                               attr++;\r
-                               if (attr - p_attr_array > *p_num_ports) {\r
-                                       done = 1;\r
-                                       break;\r
-                               }\r
-                       }\r
-                       umad_release_ca(&ca);\r
-               }\r
-       }\r
-\r
-       *p_num_ports = attr - p_attr_array;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return r;\r
-}\r
-\r
-static int\r
-osm_vendor_open_port(IN osm_vendor_t * const p_vend,\r
-                    IN const ib_net64_t port_guid)\r
-{\r
-       ib_net64_t portguids[OSM_UMAD_MAX_PORTS_PER_CA + 1];\r
-       umad_ca_t umad_ca;\r
-       int i = 0, umad_port_id = -1;\r
-       char *name;\r
-       int ca, r;\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       if (p_vend->umad_port_id >= 0) {\r
-               umad_port_id = p_vend->umad_port_id;\r
-               goto Exit;\r
-       }\r
-\r
-       if (!port_guid) {\r
-               name = NULL;\r
-               i = 0;\r
-               goto _found;\r
-       }\r
-\r
-       for (ca = 0; ca < p_vend->ca_count; ca++) {\r
-               if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids,\r
-                                              OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5421: "\r
-                               "Unable to get CA %s port guids (%s)\n",\r
-                               p_vend->ca_names[ca], strerror(r));\r
-                       goto Exit;\r
-               }\r
-               for (i = 0; i < r; i++)\r
-                       if (port_guid == portguids[i]) {\r
-                               name = p_vend->ca_names[ca];\r
-                               goto _found;\r
-                       }\r
-       }\r
-\r
-       /*\r
-        * No local CA owns this guid!\r
-        */\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5422: "\r
-               "Unable to find requested CA guid 0x%" PRIx64 "\n",\r
-               cl_ntoh64(port_guid));\r
-       goto Exit;\r
-\r
-_found:\r
-       /* Validate that node is an IB node type (not iWARP) */\r
-       if (umad_get_ca(name, &umad_ca) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 542A: "\r
-                       "umad_get_ca() failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (umad_ca.node_type < 1 || umad_ca.node_type > 3) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 542D: "\r
-                       "Type %d of node \'%s\' is not an IB node type\n",\r
-                       umad_ca.node_type, umad_ca.ca_name);\r
-               fprintf(stderr,\r
-                       "Type %d of node \'%s\' is not an IB node type\n",\r
-                       umad_ca.node_type, umad_ca.ca_name);\r
-               umad_release_ca(&umad_ca);\r
-               goto Exit;\r
-       }\r
-       umad_release_ca(&umad_ca);\r
-\r
-       /* Port found, try to open it */\r
-       if (umad_get_port(name, i, &p_vend->umad_port) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 542B: "\r
-                       "umad_get_port() failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if ((umad_port_id = umad_open_port(p_vend->umad_port.ca_name,\r
-                                          p_vend->umad_port.portnum)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 542C: "\r
-                       "umad_open_port() failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_vend->umad_port_id = umad_port_id;\r
-\r
-       /* start receiver thread */\r
-       if (!(p_vend->receiver = calloc(1, sizeof(umad_receiver_t)))) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5423: "\r
-                       "Unable to alloc receiver struct\n");\r
-               umad_close_port(umad_port_id);\r
-               umad_release_port(&p_vend->umad_port);\r
-               p_vend->umad_port.port_guid = 0;\r
-               p_vend->umad_port_id = umad_port_id = -1;\r
-               goto Exit;\r
-       }\r
-       if (umad_receiver_start(p_vend) != 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5420: "\r
-                       "umad_receiver_init failed\n");\r
-               umad_close_port(umad_port_id);\r
-               umad_release_port(&p_vend->umad_port);\r
-               p_vend->umad_port.port_guid = 0;\r
-               p_vend->umad_port_id = umad_port_id = -1;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return umad_port_id;\r
-}\r
-\r
-static void osm_vendor_close_port(osm_vendor_t * const p_vend)\r
-{\r
-       umad_receiver_t *p_ur;\r
-       int i;\r
-\r
-       p_ur = p_vend->receiver;\r
-       p_vend->receiver = NULL;\r
-       if (p_ur) {\r
-               umad_receiver_stop(p_ur);\r
-               free(p_ur);\r
-       }\r
-\r
-       if (p_vend->umad_port_id >= 0) {\r
-               for (i = 0; i < OSM_UMAD_MAX_AGENTS; i++)\r
-                       if (p_vend->agents[i])\r
-                               umad_unregister(p_vend->umad_port_id, i);\r
-               umad_close_port(p_vend->umad_port_id);\r
-               umad_release_port(&p_vend->umad_port);\r
-               p_vend->umad_port.port_guid = 0;\r
-               p_vend->umad_port_id = -1;\r
-       }\r
-}\r
-\r
-static int set_bit(int nr, void *method_mask)\r
-{\r
-       long mask, *addr = method_mask;\r
-       int retval;\r
-\r
-       addr += nr / (8 * sizeof(long));\r
-       mask = 1L << (nr % (8 * sizeof(long)));\r
-       retval = (mask & *addr) != 0;\r
-       *addr |= mask;\r
-       return retval;\r
-}\r
-\r
-osm_bind_handle_t\r
-osm_vendor_bind(IN osm_vendor_t * const p_vend,\r
-               IN osm_bind_info_t * const p_user_bind,\r
-               IN osm_mad_pool_t * const p_mad_pool,\r
-               IN osm_vend_mad_recv_callback_t mad_recv_callback,\r
-               IN osm_vend_mad_send_err_callback_t send_err_callback,\r
-               IN void *context)\r
-{\r
-       ib_net64_t port_guid;\r
-       osm_umad_bind_info_t *p_bind = 0;\r
-       long method_mask[16 / sizeof(long)];\r
-       int umad_port_id;\r
-       uint8_t rmpp_version;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_user_bind);\r
-       CL_ASSERT(p_mad_pool);\r
-       CL_ASSERT(mad_recv_callback);\r
-       CL_ASSERT(send_err_callback);\r
-\r
-       port_guid = p_user_bind->port_guid;\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_INFO,\r
-               "Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       if ((umad_port_id = osm_vendor_open_port(p_vend, port_guid)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5424: "\r
-                       "Unable to open port 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(port_guid));\r
-               goto Exit;\r
-       }\r
-#ifndef __WIN__\r
-       if (umad_get_issm_path(p_vend->umad_port.ca_name,\r
-                              p_vend->umad_port.portnum,\r
-                              p_vend->issm_path,\r
-                              sizeof(p_vend->issm_path)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 542E: "\r
-                       "Cannot resolve issm path for port %s:%u\n",\r
-                       p_vend->umad_port.ca_name, p_vend->umad_port.portnum);\r
-               goto Exit;\r
-       }\r
-#endif\r
-       if (!(p_bind = malloc(sizeof(*p_bind)))) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5425: "\r
-                       "Unable to allocate internal bind object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_bind, 0, sizeof(*p_bind));\r
-       p_bind->p_vend = p_vend;\r
-       p_bind->port_id = umad_port_id;\r
-       p_bind->client_context = context;\r
-       p_bind->mad_recv_callback = mad_recv_callback;\r
-       p_bind->send_err_callback = send_err_callback;\r
-       p_bind->p_mad_pool = p_mad_pool;\r
-       p_bind->port_guid = port_guid;\r
-       p_bind->timeout = p_user_bind->timeout ? p_user_bind->timeout :\r
-                         p_vend->timeout;\r
-       p_bind->max_retries = p_user_bind->retries ? p_user_bind->retries :\r
-                             p_vend->max_retries;\r
-\r
-       memset(method_mask, 0, sizeof method_mask);\r
-       if (p_user_bind->is_responder) {\r
-               set_bit(IB_MAD_METHOD_GET, &method_mask);\r
-               set_bit(IB_MAD_METHOD_SET, &method_mask);\r
-               if (p_user_bind->mad_class == IB_MCLASS_SUBN_ADM) {\r
-                       set_bit(IB_MAD_METHOD_GETTABLE, &method_mask);\r
-                       set_bit(IB_MAD_METHOD_DELETE, &method_mask);\r
-#ifdef DUAL_SIDED_RMPP\r
-                       set_bit(IB_MAD_METHOD_GETMULTI, &method_mask);\r
-#endif\r
-                       /* Add in IB_MAD_METHOD_GETTRACETABLE */\r
-                       /* when supported by OpenSM */\r
-               }\r
-       }\r
-       if (p_user_bind->is_report_processor)\r
-               set_bit(IB_MAD_METHOD_REPORT, &method_mask);\r
-       if (p_user_bind->is_trap_processor) {\r
-               set_bit(IB_MAD_METHOD_TRAP, &method_mask);\r
-               set_bit(IB_MAD_METHOD_TRAP_REPRESS, &method_mask);\r
-       }\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-       rmpp_version = 0;\r
-#else\r
-       /* If SA class, set rmpp_version */\r
-       if (p_user_bind->mad_class == IB_MCLASS_SUBN_ADM)\r
-               rmpp_version = 1;\r
-       else\r
-               rmpp_version = 0;\r
-#endif\r
-\r
-       if ((p_bind->agent_id = umad_register(p_vend->umad_port_id,\r
-                                             p_user_bind->mad_class,\r
-                                             p_user_bind->class_version,\r
-                                             rmpp_version, method_mask)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5426: "\r
-                       "Unable to register class %u version %u\n",\r
-                       p_user_bind->mad_class, p_user_bind->class_version);\r
-               free(p_bind);\r
-               p_bind = 0;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_bind->agent_id >= OSM_UMAD_MAX_AGENTS ||\r
-           p_vend->agents[p_bind->agent_id]) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5427: "\r
-                       "bad agent id %u or duplicate agent for class %u vers %u\n",\r
-                       p_bind->agent_id, p_user_bind->mad_class,\r
-                       p_user_bind->class_version);\r
-               free(p_bind);\r
-               p_bind = 0;\r
-               goto Exit;\r
-       }\r
-\r
-       p_vend->agents[p_bind->agent_id] = p_bind;\r
-\r
-       /* If Subn Directed Route class, register Subn LID routed class */\r
-       if (p_user_bind->mad_class == IB_MCLASS_SUBN_DIR) {\r
-               if ((p_bind->agent_id1 = umad_register(p_vend->umad_port_id,\r
-                                                      IB_MCLASS_SUBN_LID,\r
-                                                      p_user_bind->\r
-                                                      class_version, 0,\r
-                                                      method_mask)) < 0) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5428: "\r
-                               "Unable to register class 1 version %u\n",\r
-                               p_user_bind->class_version);\r
-                       free(p_bind);\r
-                       p_bind = 0;\r
-                       goto Exit;\r
-               }\r
-\r
-               if (p_bind->agent_id1 >= OSM_UMAD_MAX_AGENTS ||\r
-                   p_vend->agents[p_bind->agent_id1]) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5429: "\r
-                               "bad agent id %u or duplicate agent for class 1 vers %u\n",\r
-                               p_bind->agent_id1, p_user_bind->class_version);\r
-                       free(p_bind);\r
-                       p_bind = 0;\r
-                       goto Exit;\r
-               }\r
-\r
-               p_vend->agents[p_bind->agent_id1] = p_bind;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return ((osm_bind_handle_t) p_bind);\r
-}\r
-\r
-static void\r
-__osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw,\r
-                          IN void *bind_context, IN osm_madw_t * p_req_madw)\r
-{\r
-#ifdef _DEBUG_\r
-       fprintf(stderr,\r
-               "__osm_vendor_recv_dummy_cb: Ignoring received MAD after osm_vendor_unbind\n");\r
-#endif\r
-}\r
-\r
-static void\r
-__osm_vendor_send_err_dummy_cb(IN void *bind_context,\r
-                              IN osm_madw_t * p_req_madw)\r
-{\r
-#ifdef _DEBUG_\r
-       fprintf(stderr,\r
-               "__osm_vendor_send_err_dummy_cb: Ignoring send error after osm_vendor_unbind\n");\r
-#endif\r
-}\r
-\r
-void osm_vendor_unbind(IN osm_bind_handle_t h_bind)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       pthread_mutex_lock(&p_vend->cb_mutex);\r
-       p_bind->mad_recv_callback = __osm_vendor_recv_dummy_cb;\r
-       p_bind->send_err_callback = __osm_vendor_send_err_dummy_cb;\r
-       pthread_mutex_unlock(&p_vend->cb_mutex);\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,\r
-                        IN const uint32_t mad_size,\r
-                        IN osm_vend_wrap_t * const p_vw)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "Acquiring UMAD for p_madw = %p, size = %u\n", p_vw, mad_size);\r
-       CL_ASSERT(p_vw);\r
-       p_vw->size = mad_size;\r
-       p_vw->umad = umad_alloc(1, mad_size + umad_size());\r
-\r
-       /* track locally */\r
-       p_vw->h_bind = h_bind;\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "Acquired UMAD %p, size = %u\n", p_vw->umad, p_vw->size);\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (p_vw->umad ? umad_get_mad(p_vw->umad) : NULL);\r
-}\r
-\r
-void\r
-osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-       osm_madw_t *p_madw;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vw);\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG, "Retiring UMAD %p\n", p_vw->umad);\r
-\r
-       /*\r
-        * We moved the removal of the transaction to immediately after\r
-        * it was looked up.\r
-        */\r
-\r
-       /* free the mad but the wrapper is part of the madw object */\r
-       umad_free(p_vw->umad);\r
-       p_vw->umad = 0;\r
-       p_madw = PARENT_STRUCT(p_vw, osm_madw_t, vend_wrap);\r
-       p_madw->p_mad = NULL;\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-ib_api_status_t\r
-osm_vendor_send(IN osm_bind_handle_t h_bind,\r
-               IN osm_madw_t * const p_madw, IN boolean_t const resp_expected)\r
-{\r
-       osm_umad_bind_info_t *const p_bind = h_bind;\r
-       osm_vendor_t *const p_vend = p_bind->p_vend;\r
-       osm_vend_wrap_t *const p_vw = osm_madw_get_vend_ptr(p_madw);\r
-       osm_mad_addr_t *const p_mad_addr = osm_madw_get_mad_addr_ptr(p_madw);\r
-       ib_mad_t *const p_mad = osm_madw_get_mad_ptr(p_madw);\r
-       ib_sa_mad_t *const p_sa = (ib_sa_mad_t *) p_mad;\r
-       int ret = -1;\r
-       int is_rmpp = 0;\r
-       uint32_t sent_mad_size;\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-       uint32_t paylen = 0;\r
-#endif\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vw->h_bind == h_bind);\r
-       CL_ASSERT(p_mad == umad_get_mad(p_vw->umad));\r
-\r
-       if (p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) {\r
-               umad_set_addr_net(p_vw->umad, 0xffff, 0, 0, 0);\r
-               umad_set_grh(p_vw->umad, 0);\r
-               goto Resp;\r
-       }\r
-       if (p_mad->mgmt_class == IB_MCLASS_SUBN_LID) {\r
-               umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid, 0, 0, 0);\r
-               umad_set_grh(p_vw->umad, 0);\r
-               goto Resp;\r
-       }\r
-       /* GS classes */\r
-       umad_set_addr_net(p_vw->umad, p_mad_addr->dest_lid,\r
-                         p_mad_addr->addr_type.gsi.remote_qp,\r
-                         p_mad_addr->addr_type.gsi.service_level,\r
-                         IB_QP1_WELL_KNOWN_Q_KEY);\r
-       umad_set_grh(p_vw->umad, 0);    /* FIXME: GRH support */\r
-       umad_set_pkey(p_vw->umad, p_mad_addr->addr_type.gsi.pkey_ix);\r
-       if (ib_class_is_rmpp(p_mad->mgmt_class)) {      /* RMPP GS classes     FIXME: no GRH */\r
-               if (!ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,\r
-                                        IB_RMPP_FLAG_ACTIVE)) {\r
-                       /* Clear RMPP header when RMPP not ACTIVE */\r
-                       p_sa->rmpp_version = 0;\r
-                       p_sa->rmpp_type = 0;\r
-                       p_sa->rmpp_flags = 0;\r
-                       p_sa->rmpp_status = 0;\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-               } else\r
-                       is_rmpp = 1;\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_VERBOSE, "RMPP %d length %d\n",\r
-                               ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_sa,\r
-                                                   IB_RMPP_FLAG_ACTIVE),\r
-                               p_madw->mad_size);\r
-#else\r
-               } else {\r
-                       p_sa->rmpp_version = 1;\r
-                       p_sa->seg_num = cl_ntoh32(1);   /* first DATA is seg 1 */\r
-                       p_sa->rmpp_flags |= (uint8_t) 0x70;     /* RRespTime of 14 (high 5 bits) */\r
-                       p_sa->rmpp_status = 0;\r
-                       paylen = p_madw->mad_size - IB_SA_MAD_HDR_SIZE;\r
-                       paylen += (IB_SA_MAD_HDR_SIZE - MAD_RMPP_HDR_SIZE);\r
-                       p_sa->paylen_newwin = cl_ntoh32(paylen);\r
-               }\r
-#endif\r
-       }\r
-\r
-Resp:\r
-       if (resp_expected)\r
-               put_madw(p_vend, p_madw, p_mad->trans_id);\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       sent_mad_size = p_madw->mad_size;\r
-#else\r
-       sent_mad_size = is_rmpp ? p_madw->mad_size - IB_SA_MAD_HDR_SIZE :\r
-           p_madw->mad_size;\r
-#endif\r
-       if ((ret = umad_send(p_bind->port_id, p_bind->agent_id, p_vw->umad,\r
-                            sent_mad_size,\r
-                            resp_expected ? p_bind->timeout : 0,\r
-                            p_bind->max_retries)) < 0) {\r
-               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: "\r
-                       "Send p_madw = %p of size %d TID 0x%" PRIx64 " failed %d (%m)\n",\r
-                       p_madw, sent_mad_size, cl_ntoh64(p_mad->trans_id), ret);\r
-               if (resp_expected) {\r
-                       get_madw(p_vend, &p_mad->trans_id);     /* remove from aging table */\r
-                       p_madw->status = IB_ERROR;\r
-                       pthread_mutex_lock(&p_vend->cb_mutex);\r
-                       (*p_bind->send_err_callback) (p_bind->client_context, p_madw);  /* cb frees madw */\r
-                       pthread_mutex_unlock(&p_vend->cb_mutex);\r
-               } else\r
-                       osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       if (!resp_expected)\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-\r
-       OSM_LOG(p_vend->p_log, OSM_LOG_DEBUG, "Completed sending %s p_madw = %p\n",\r
-               resp_expected ? "request" : "response or unsolicited", p_madw);\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (ret);\r
-}\r
-\r
-ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-       ;\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (0);\r
-}\r
-\r
-#ifndef __WIN__\r
-\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-       if (TRUE == is_sm_val) {\r
-               p_vend->issmfd = open(p_vend->issm_path, O_NONBLOCK);\r
-               if (p_vend->issmfd < 0) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5431: "\r
-                               "setting IS_SM capmask: cannot open file "\r
-                               "\'%s\': %s\n",\r
-                               p_vend->issm_path, strerror(errno));\r
-                       p_vend->issmfd = -1;\r
-               }\r
-       } else if (p_vend->issmfd != -1) {\r
-               if (0 != close(p_vend->issmfd))\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5432: "\r
-                               "clearing IS_SM capmask: cannot close: %s\n",\r
-                               strerror(errno));\r
-               p_vend->issmfd = -1;\r
-       }\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-#else /* ! __WIN__ */\r
-\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)\r
-{\r
-       osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-#endif /* ! __WIN__ */\r
-\r
-void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)\r
-{\r
-       umad_debug(level);\r
-}\r
-\r
-#endif                         /* OSM_VENDOR_INTF_OPENIB */\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c b/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c
deleted file mode 100644 (file)
index 83b44bf..0000000
+++ /dev/null
@@ -1,736 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <sys/time.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_sa_api.h>\r
-#include <complib/cl_event.h>\r
-\r
-/* this struct is the internal rep of the bind handle */\r
-typedef struct _osmv_sa_bind_info {\r
-       osm_bind_handle_t h_bind;\r
-       osm_log_t *p_log;\r
-       osm_vendor_t *p_vendor;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       cl_event_t sync_event;\r
-       time_t last_lids_update_sec;\r
-} osmv_sa_bind_info_t;\r
-\r
-/*\r
-  Call back on new mad received:\r
-\r
-  We basically only need to set the context of the query.\r
-  Or report an error.\r
-\r
-  A pointer to the actual context of the request (a copy of the oriignal\r
-  request structure) is attached as the p_madw->context.ni_context.node_guid\r
-*/\r
-static void\r
-__osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,\r
-                    IN void *bind_context, IN osm_madw_t * p_req_madw)\r
-{\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) bind_context;\r
-       osmv_query_req_t *p_query_req_copy = NULL;\r
-       osmv_query_res_t query_res;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_net16_t mad_status;\r
-\r
-       OSM_LOG_ENTER(p_bind->p_log);\r
-\r
-       if (!p_req_madw) {\r
-               OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,\r
-                       "Ignoring a non-response mad\n");\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /* obtain the sent context since we store it during send in the ni_ctx */\r
-       p_query_req_copy =\r
-           (osmv_query_req_t *) (long *)(long)(p_req_madw->context.ni_context.\r
-                                               node_guid);\r
-\r
-       /* provide the context of the original request in the result */\r
-       query_res.query_context = p_query_req_copy->query_context;\r
-\r
-       /* provide the resulting madw */\r
-       query_res.p_result_madw = p_madw;\r
-\r
-       /* update the req fields */\r
-       p_sa_mad = (ib_sa_mad_t *) p_madw->p_mad;\r
-\r
-       /* if we got a remote error track it in the status */\r
-       mad_status = (ib_net16_t) (p_sa_mad->status & IB_SMP_STATUS_MASK);\r
-       if (mad_status != IB_SUCCESS) {\r
-               OSM_LOG(p_bind->p_log, OSM_LOG_ERROR, "ERR 5501: "\r
-                       "Remote error:0x%04X\n", cl_ntoh16(mad_status));\r
-               query_res.status = IB_REMOTE_ERROR;\r
-       } else\r
-               query_res.status = IB_SUCCESS;\r
-\r
-       /* what if we have got back an empty mad ? */\r
-       if (!p_madw->mad_size) {\r
-               OSM_LOG(p_bind->p_log, OSM_LOG_ERROR, "ERR 5502: "\r
-                       "Got an empty mad\n");\r
-               query_res.status = IB_ERROR;\r
-       }\r
-\r
-       if (IB_SUCCESS == mad_status) {\r
-\r
-               /* if we are in not in a method response of an rmpp nature we must get only 1 */\r
-               /* HACK: in the future we might need to be smarter for other methods... */\r
-               if (p_sa_mad->method != IB_MAD_METHOD_GETTABLE_RESP) {\r
-                       query_res.result_cnt = 1;\r
-               } else {\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-                       if (mad_status != IB_SUCCESS)\r
-                               query_res.result_cnt = 0;\r
-                       else\r
-                               query_res.result_cnt = 1;\r
-#else\r
-                       if (ib_get_attr_size(p_sa_mad->attr_offset)) {\r
-                               /* we used the offset value to calculate the\r
-                                  number of records in here */\r
-                               query_res.result_cnt = (uintn_t)\r
-                                   ((p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /\r
-                                   ib_get_attr_size(p_sa_mad->attr_offset));\r
-                               OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,\r
-                                       "Count = %u = %u / %u (%u)\n",\r
-                                       query_res.result_cnt,\r
-                                       p_madw->mad_size - IB_SA_MAD_HDR_SIZE,\r
-                                       ib_get_attr_size(p_sa_mad->attr_offset),\r
-                                       (p_madw->mad_size -\r
-                                        IB_SA_MAD_HDR_SIZE) %\r
-                                       ib_get_attr_size(p_sa_mad->attr_offset));\r
-                       } else\r
-                               query_res.result_cnt = 0;\r
-#endif\r
-               }\r
-       }\r
-\r
-       query_res.query_type = p_query_req_copy->query_type;\r
-\r
-       p_query_req_copy->pfn_query_cb(&query_res);\r
-\r
-       if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)\r
-               cl_event_signal(&p_bind->sync_event);\r
-\r
-Exit:\r
-\r
-       /* free the copied query request if found */\r
-       if (p_query_req_copy)\r
-               free(p_query_req_copy);\r
-\r
-       /* put back the request madw */\r
-       if (p_req_madw)\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_req_madw);\r
-\r
-       OSM_LOG_EXIT(p_bind->p_log);\r
-}\r
-\r
-/*\r
-  Send Error Callback:\r
-\r
-  Only report the error and get rid of the mad wrapper\r
-*/\r
-static void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)\r
-{\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) bind_context;\r
-       osmv_query_req_t *p_query_req_copy = NULL;\r
-       osmv_query_res_t query_res;\r
-\r
-       OSM_LOG_ENTER(p_bind->p_log);\r
-\r
-       /* Obtain the sent context etc */\r
-       p_query_req_copy =\r
-           (osmv_query_req_t *) (long *)(long)(p_madw->context.ni_context.\r
-                                               node_guid);\r
-\r
-       /* provide the context of the original request in the result */\r
-       query_res.query_context = p_query_req_copy->query_context;\r
-\r
-       query_res.p_result_madw = p_madw;\r
-\r
-       query_res.status = IB_TIMEOUT;\r
-       query_res.result_cnt = 0;\r
-\r
-       query_res.query_type = p_query_req_copy->query_type;\r
-\r
-       p_query_req_copy->pfn_query_cb(&query_res);\r
-\r
-       if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)\r
-               cl_event_signal(&p_bind->sync_event);\r
-\r
-       if (p_query_req_copy)\r
-               free(p_query_req_copy);\r
-       OSM_LOG_EXIT(p_bind->p_log);\r
-}\r
-\r
-/*****************************************************************************\r
- Update lids of vendor umad_port.\r
- *****************************************************************************/\r
-static ib_api_status_t update_umad_port(osm_vendor_t * p_vend)\r
-{\r
-       umad_port_t port;\r
-       if (umad_get_port(p_vend->umad_port.ca_name,\r
-                         p_vend->umad_port.portnum, &port) < 0)\r
-               return IB_ERROR;\r
-       p_vend->umad_port.base_lid = port.base_lid;\r
-       p_vend->umad_port.sm_lid = port.sm_lid;\r
-       umad_release_port(&port);\r
-       return IB_SUCCESS;\r
-}\r
-\r
-osm_bind_handle_t\r
-osmv_bind_sa(IN osm_vendor_t * const p_vend,\r
-            IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid)\r
-{\r
-       osm_bind_info_t bind_info;\r
-       osm_log_t *p_log = p_vend->p_log;\r
-       osmv_sa_bind_info_t *p_sa_bind_info;\r
-       cl_status_t cl_status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       bind_info.port_guid = port_guid;\r
-       bind_info.mad_class = IB_MCLASS_SUBN_ADM;\r
-       bind_info.class_version = 2;\r
-       bind_info.is_responder = FALSE;\r
-       bind_info.is_trap_processor = FALSE;\r
-       bind_info.is_report_processor = FALSE;\r
-       bind_info.send_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;\r
-       bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;\r
-       bind_info.timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;\r
-       bind_info.retries = OSM_DEFAULT_RETRY_COUNT;\r
-\r
-       /* allocate the new sa bind info */\r
-       p_sa_bind_info =\r
-           (osmv_sa_bind_info_t *) malloc(sizeof(osmv_sa_bind_info_t));\r
-       if (!p_sa_bind_info) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5505: "\r
-                       "Failed to allocate new bind structure\n");\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-               goto Exit;\r
-       }\r
-\r
-       /* store some important context */\r
-       p_sa_bind_info->p_log = p_log;\r
-       p_sa_bind_info->p_mad_pool = p_mad_pool;\r
-       p_sa_bind_info->p_vendor = p_vend;\r
-\r
-       /* Bind to the lower level */\r
-       p_sa_bind_info->h_bind = osm_vendor_bind(p_vend, &bind_info, p_mad_pool, __osmv_sa_mad_rcv_cb, __osmv_sa_mad_err_cb, p_sa_bind_info);   /* context provided to CBs */\r
-\r
-       if (p_sa_bind_info->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               free(p_sa_bind_info);\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5506: "\r
-                       "Failed to bind to vendor GSI\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* update time umad_port is initilized now */\r
-       p_sa_bind_info->last_lids_update_sec = time(NULL);\r
-\r
-       /* initialize the sync_event */\r
-       cl_event_construct(&p_sa_bind_info->sync_event);\r
-       cl_status = cl_event_init(&p_sa_bind_info->sync_event, TRUE);\r
-       if (cl_status != CL_SUCCESS) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5508: "\r
-                       "cl_init_event failed: %s\n", ib_get_err_str(cl_status));\r
-               free(p_sa_bind_info);\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return (p_sa_bind_info);\r
-}\r
-\r
-/****t* OSM Vendor SA Client/osmv_sa_mad_data\r
- * NAME\r
- *    osmv_sa_mad_data\r
- *\r
- * DESCRIPTION\r
- * Extra fields required to perform a mad query\r
- *  This struct is passed to the actual send method\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osmv_sa_mad_data {\r
-       /* MAD data. */\r
-       uint8_t method;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t attr_offset;\r
-       ib_net32_t attr_mod;\r
-       ib_net64_t comp_mask;\r
-       void *p_attr;\r
-} osmv_sa_mad_data_t;\r
-/*\r
- * method\r
- *    The method of the mad to be sent\r
- *\r
- *  attr_id\r
- *     Attribute ID\r
- *\r
- *  attr_offset\r
- *     Offset as defined by RMPP\r
- *\r
- *  attr_mod\r
- *     Attribute modifier\r
- *\r
- *  comp_mask\r
- *     The component mask of the query\r
- *\r
- *  p_attr\r
- *     A pointer to the record of the attribute to be sent.\r
- *\r
- *****/\r
-\r
-/* Send a MAD out on the GSI interface */\r
-static ib_api_status_t\r
-__osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,\r
-                  IN const osmv_sa_mad_data_t * const p_sa_mad_data,\r
-                  IN const osmv_query_req_t * const p_query_req)\r
-{\r
-       ib_api_status_t status;\r
-       ib_mad_t *p_mad_hdr;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       osm_madw_t *p_madw;\r
-       osm_log_t *p_log = p_bind->p_log;\r
-       static atomic32_t trans_id;\r
-       boolean_t sync;\r
-       osmv_query_req_t *p_query_req_copy;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /*\r
-          since the sm_lid might change we obtain it every send\r
-          (actually it is cached in the bind object and refreshed\r
-          every 30sec by this proc)\r
-        */\r
-       if (time(NULL) > p_bind->last_lids_update_sec + 30) {\r
-               status = update_umad_port(p_bind->p_vendor);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5509: "\r
-                               "Failed to obtain the SM lid\n");\r
-                       goto Exit;\r
-               }\r
-               p_bind->last_lids_update_sec = time(NULL);\r
-       }\r
-\r
-       /* Get a MAD wrapper for the send */\r
-       p_madw = osm_mad_pool_get(p_bind->p_mad_pool,\r
-                                 p_bind->h_bind, MAD_BLOCK_SIZE, NULL);\r
-\r
-       if (p_madw == NULL) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5510: "\r
-                       "Unable to acquire MAD\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Initialize the Sent MAD: */\r
-\r
-       /* Initialize the MAD buffer for the send operation. */\r
-       p_mad_hdr = osm_madw_get_mad_ptr(p_madw);\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       /* Get a new transaction Id */\r
-       cl_atomic_inc(&trans_id);\r
-\r
-       /* Cleanup the MAD from any residue */\r
-       memset(p_sa_mad, 0, MAD_BLOCK_SIZE);\r
-\r
-       /* Initialize the standard MAD header. */\r
-       ib_mad_init_new(p_mad_hdr,      /* mad pointer */\r
-                       IB_MCLASS_SUBN_ADM,     /* class */\r
-                       (uint8_t) 2,    /* version */\r
-                       p_sa_mad_data->method,  /* method */\r
-                       cl_hton64((uint64_t) trans_id), /* tid */\r
-                       p_sa_mad_data->attr_id, /* attr id */\r
-                       p_sa_mad_data->attr_mod /* attr mod */);\r
-\r
-       /* Set the query information. */\r
-       p_sa_mad->sm_key = p_query_req->sm_key;\r
-       p_sa_mad->attr_offset = 0;\r
-       p_sa_mad->comp_mask = p_sa_mad_data->comp_mask;\r
-#ifdef DUAL_SIDED_RMPP\r
-       if (p_sa_mad->method == IB_MAD_METHOD_GETMULTI)\r
-               p_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;\r
-#endif\r
-       if (p_sa_mad->comp_mask) {\r
-               memcpy(p_sa_mad->data, p_sa_mad_data->p_attr,\r
-                      ib_get_attr_size(p_sa_mad_data->attr_offset));\r
-       }\r
-\r
-       /*\r
-          Provide the address to send to\r
-        */\r
-       p_madw->mad_addr.dest_lid =\r
-           cl_hton16(p_bind->p_vendor->umad_port.sm_lid);\r
-       p_madw->mad_addr.addr_type.smi.source_lid =\r
-           cl_hton16(p_bind->p_vendor->umad_port.base_lid);\r
-       p_madw->mad_addr.addr_type.gsi.remote_qp = CL_HTON32(1);\r
-       p_madw->resp_expected = TRUE;\r
-       p_madw->fail_msg = CL_DISP_MSGID_NONE;\r
-\r
-       /*\r
-          Provide MAD context such that the call back will know what to do.\r
-          We have to keep the entire request structure so we know the CB.\r
-          Since we can not rely on the client to keep it around until\r
-          the response - we duplicate it and will later dispose it (in CB).\r
-          To store on the MADW we cast it into what opensm has:\r
-          p_madw->context.ni_context.node_guid\r
-        */\r
-       p_query_req_copy = malloc(sizeof(*p_query_req_copy));\r
-       if (!p_query_req_copy) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 5511: "\r
-                       "Unable to acquire memory for query copy\n");\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-       *p_query_req_copy = *p_query_req;\r
-       p_madw->context.ni_context.node_guid =\r
-           (ib_net64_t) (long)p_query_req_copy;\r
-\r
-       /* we can support async as well as sync calls */\r
-       sync = ((p_query_req->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC);\r
-\r
-       /* send the mad asynchronously */\r
-       status = osm_vendor_send(osm_madw_get_bind_handle(p_madw),\r
-                                p_madw, p_madw->resp_expected);\r
-\r
-       /* if synchronous - wait on the event */\r
-       if (sync) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "Waiting for async event\n");\r
-               cl_event_wait_on(&p_bind->sync_event, EVENT_NO_TIMEOUT, FALSE);\r
-               cl_event_reset(&p_bind->sync_event);\r
-               status = p_madw->status;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Query the SA based on the user's request.\r
- */\r
-ib_api_status_t\r
-osmv_query_sa(IN osm_bind_handle_t h_bind,\r
-             IN const osmv_query_req_t * const p_query_req)\r
-{\r
-       union {\r
-               ib_service_record_t svc_rec;\r
-               ib_node_record_t node_rec;\r
-               ib_portinfo_record_t port_info;\r
-               ib_path_rec_t path_rec;\r
-#ifdef DUAL_SIDED_RMPP\r
-               ib_multipath_rec_t multipath_rec;\r
-#endif\r
-               ib_class_port_info_t class_port_info;\r
-       } u;\r
-       osmv_sa_mad_data_t sa_mad_data;\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;\r
-       osmv_user_query_t *p_user_query;\r
-#ifdef DUAL_SIDED_RMPP\r
-       osmv_multipath_req_t *p_mpr_req;\r
-       int i, j;\r
-#endif\r
-       osm_log_t *p_log = p_bind->p_log;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* Set the request information. */\r
-       sa_mad_data.method = IB_MAD_METHOD_GETTABLE;\r
-       sa_mad_data.attr_mod = 0;\r
-\r
-       /* Set the MAD attributes and component mask correctly. */\r
-       switch (p_query_req->query_type) {\r
-\r
-       case OSMV_QUERY_USER_DEFINED:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 USER_DEFINED\n");\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               if (p_user_query->method)\r
-                       sa_mad_data.method = p_user_query->method;\r
-               sa_mad_data.attr_offset = p_user_query->attr_offset;\r
-               sa_mad_data.attr_id = p_user_query->attr_id;\r
-               sa_mad_data.attr_mod = p_user_query->attr_mod;\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_ALL_SVC_RECS:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_NAME\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.comp_mask = 0;\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               break;\r
-\r
-       case OSMV_QUERY_SVC_REC_BY_NAME:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_NAME\n");\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.comp_mask = IB_SR_COMPMASK_SNAME;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               memcpy(u.svc_rec.service_name, p_query_req->p_query_input,\r
-                      sizeof(ib_svc_name_t));\r
-               break;\r
-\r
-       case OSMV_QUERY_SVC_REC_BY_ID:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 SVC_REC_BY_ID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.comp_mask = IB_SR_COMPMASK_SID;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               u.svc_rec.service_id =\r
-                   *(ib_net64_t *) (p_query_req->p_query_input);\r
-               break;\r
-\r
-       case OSMV_QUERY_CLASS_PORT_INFO:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 CLASS_PORT_INFO\n");\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_CLASS_PORT_INFO;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_class_port_info_t));\r
-               sa_mad_data.comp_mask = 0;\r
-               sa_mad_data.p_attr = &u.class_port_info;\r
-               break;\r
-\r
-       case OSMV_QUERY_NODE_REC_BY_NODE_GUID:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 NODE_REC_BY_NODE_GUID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_NODE_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_node_record_t));\r
-               sa_mad_data.comp_mask = IB_NR_COMPMASK_NODEGUID;\r
-               sa_mad_data.p_attr = &u.node_rec;\r
-               u.node_rec.node_info.node_guid =\r
-                   *(ib_net64_t *) (p_query_req->p_query_input);\r
-               break;\r
-\r
-       case OSMV_QUERY_PORT_REC_BY_LID:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_portinfo_record_t));\r
-               sa_mad_data.comp_mask = IB_PIR_COMPMASK_LID;\r
-               sa_mad_data.p_attr = &u.port_info;\r
-               u.port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);\r
-               break;\r
-\r
-       case OSMV_QUERY_PORT_REC_BY_LID_AND_NUM:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PORT_REC_BY_LID_AND_NUM\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_portinfo_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_PORTNUM;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_VLARB_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_vl_arb_table_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_VLA_COMPMASK_LID | IB_VLA_COMPMASK_OUT_PORT |\r
-                   IB_VLA_COMPMASK_BLOCK;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_SLVL_BY_LID_AND_PORTS:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SLVL_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_slvl_table_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_SLVL_COMPMASK_LID | IB_SLVL_COMPMASK_OUT_PORT |\r
-                   IB_SLVL_COMPMASK_IN_PORT;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_PORT_GUIDS:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_PORT_GUIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                   (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);\r
-               u.path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               ib_gid_set_default(&u.path_rec.dgid,\r
-                                  ((osmv_guid_pair_t *) (p_query_req->\r
-                                                         p_query_input))->\r
-                                  dest_guid);\r
-               ib_gid_set_default(&u.path_rec.sgid,\r
-                                  ((osmv_guid_pair_t *) (p_query_req->\r
-                                                         p_query_input))->\r
-                                  src_guid);\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_GIDS:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_GIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                   (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);\r
-               u.path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               memcpy(&u.path_rec.dgid,\r
-                      &((osmv_gid_pair_t *) (p_query_req->p_query_input))->\r
-                      dest_gid, sizeof(ib_gid_t));\r
-               memcpy(&u.path_rec.sgid,\r
-                      &((osmv_gid_pair_t *) (p_query_req->p_query_input))->\r
-                      src_gid, sizeof(ib_gid_t));\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_LIDS:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 PATH_REC_BY_LIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                   (IB_PR_COMPMASK_DLID | IB_PR_COMPMASK_SLID);\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               u.path_rec.dlid =\r
-                   ((osmv_lid_pair_t *) (p_query_req->p_query_input))->\r
-                   dest_lid;\r
-               u.path_rec.slid =\r
-                   ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid;\r
-               break;\r
-\r
-       case OSMV_QUERY_UD_MULTICAST_SET:\r
-               sa_mad_data.method = IB_MAD_METHOD_SET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_SET\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_UD_MULTICAST_DELETE:\r
-               sa_mad_data.method = IB_MAD_METHOD_DELETE;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 OSMV_QUERY_UD_MULTICAST_DELETE\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-#ifdef DUAL_SIDED_RMPP\r
-       case OSMV_QUERY_MULTIPATH_REC:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 MULTIPATH_REC\n");\r
-               /* Validate sgid/dgid counts against SA client limit */\r
-               p_mpr_req = (osmv_multipath_req_t *) p_query_req->p_query_input;\r
-               if (p_mpr_req->sgid_count + p_mpr_req->dgid_count >\r
-                   IB_MULTIPATH_MAX_GIDS) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 MULTIPATH_REC "\r
-                               "SGID count %d DGID count %d max count %d\n",\r
-                               p_mpr_req->sgid_count, p_mpr_req->dgid_count,\r
-                               IB_MULTIPATH_MAX_GIDS);\r
-                       CL_ASSERT(0);\r
-                       return IB_ERROR;\r
-               }\r
-               memset(&u.multipath_rec, 0, sizeof(ib_multipath_rec_t));\r
-               sa_mad_data.method = IB_MAD_METHOD_GETMULTI;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_multipath_rec_t));\r
-               sa_mad_data.p_attr = &u.multipath_rec;\r
-               sa_mad_data.comp_mask = p_mpr_req->comp_mask;\r
-               u.multipath_rec.num_path = p_mpr_req->num_path;\r
-               if (p_mpr_req->reversible)\r
-                       u.multipath_rec.num_path |= 0x80;\r
-               else\r
-                       u.multipath_rec.num_path &= ~0x80;\r
-               u.multipath_rec.pkey = p_mpr_req->pkey;\r
-               ib_multipath_rec_set_sl(&u.multipath_rec, p_mpr_req->sl);\r
-               ib_multipath_rec_set_qos_class(&u.multipath_rec, 0);\r
-               u.multipath_rec.independence = p_mpr_req->independence;\r
-               u.multipath_rec.sgid_count = p_mpr_req->sgid_count;\r
-               u.multipath_rec.dgid_count = p_mpr_req->dgid_count;\r
-               j = 0;\r
-               for (i = 0; i < p_mpr_req->sgid_count; i++, j++)\r
-                       u.multipath_rec.gids[j] = p_mpr_req->gids[j];\r
-               for (i = 0; i < p_mpr_req->dgid_count; i++, j++)\r
-                       u.multipath_rec.gids[j] = p_mpr_req->gids[j];\r
-               break;\r
-#endif\r
-\r
-       default:\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 UNKNOWN 0x%x (%d)\n",\r
-                               p_query_req->query_type, p_query_req->query_type);\r
-               CL_ASSERT(0);\r
-               return IB_ERROR;\r
-       }\r
-\r
-       status = __osmv_send_sa_req(h_bind, &sa_mad_data, p_query_req);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx.c
deleted file mode 100644 (file)
index 4486f00..0000000
+++ /dev/null
@@ -1,768 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <vendor/osm_vendor_mlx.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <vendor/osm_vendor_mlx_sender.h>\r
-#include <vendor/osm_vendor_mlx_hca.h>\r
-#include <vendor/osm_pkt_randomizer.h>\r
-\r
-/**\r
- *      FORWARD REFERENCES\r
- */\r
-static ib_api_status_t\r
-__osmv_get_send_txn(IN osm_bind_handle_t h_bind,\r
-                   IN osm_madw_t * const p_madw,\r
-                   IN boolean_t is_rmpp,\r
-                   IN boolean_t resp_expected, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-static void __osm_vendor_internal_unbind(osm_bind_handle_t h_bind);\r
-\r
-/*\r
- *  NAME            osm_vendor_new\r
- *\r
- *  DESCRIPTION     Create and Initialize the osm_vendor_t Object\r
- */\r
-\r
-osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log,\r
-                            IN const uint32_t timeout)\r
-{\r
-       ib_api_status_t status;\r
-       osm_vendor_t *p_vend;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       CL_ASSERT(p_log);\r
-\r
-       p_vend = malloc(sizeof(*p_vend));\r
-       if (p_vend != NULL) {\r
-               memset(p_vend, 0, sizeof(*p_vend));\r
-\r
-               status = osm_vendor_init(p_vend, p_log, timeout);\r
-               if (status != IB_SUCCESS) {\r
-                       osm_vendor_delete(&p_vend);\r
-               }\r
-       } else {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_new: ERR 7301: "\r
-                       "Fail to allocate vendor object.\n");\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return (p_vend);\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_delete\r
- *\r
- *  DESCRIPTION     Delete all the binds behind the vendor + free the vendor object\r
- */\r
-\r
-void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)\r
-{\r
-       cl_list_item_t *p_item;\r
-       cl_list_obj_t *p_obj;\r
-       osm_bind_handle_t bind_h;\r
-       osm_log_t *p_log;\r
-\r
-       OSM_LOG_ENTER((*pp_vend)->p_log);\r
-       p_log = (*pp_vend)->p_log;\r
-\r
-       /* go over the bind handles , unbind them and remove from list */\r
-       p_item = cl_qlist_remove_head(&((*pp_vend)->bind_handles));\r
-       while (p_item != cl_qlist_end(&((*pp_vend)->bind_handles))) {\r
-\r
-               p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-               bind_h = (osm_bind_handle_t *) cl_qlist_obj(p_obj);\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osm_vendor_delete: unbinding bind_h:%p \n", bind_h);\r
-\r
-               __osm_vendor_internal_unbind(bind_h);\r
-\r
-               free(p_obj);\r
-               /*removing from list */\r
-               p_item = cl_qlist_remove_head(&((*pp_vend)->bind_handles));\r
-       }\r
-\r
-       if (NULL != ((*pp_vend)->p_transport_info)) {\r
-               free((*pp_vend)->p_transport_info);\r
-               (*pp_vend)->p_transport_info = NULL;\r
-       }\r
-\r
-       /* remove the packet randomizer object */\r
-       if ((*pp_vend)->run_randomizer == TRUE)\r
-               osm_pkt_randomizer_destroy(&((*pp_vend)->p_pkt_randomizer),\r
-                                          p_log);\r
-\r
-       free(*pp_vend);\r
-       *pp_vend = NULL;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_init\r
- *\r
- *  DESCRIPTION     Initialize the vendor object\r
- */\r
-\r
-ib_api_status_t\r
-osm_vendor_init(IN osm_vendor_t * const p_vend,\r
-               IN osm_log_t * const p_log, IN const uint32_t timeout)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_vend->p_transport_info = NULL;\r
-       p_vend->p_log = p_log;\r
-       p_vend->resp_timeout = timeout;\r
-       p_vend->ttime_timeout = timeout * OSMV_TXN_TIMEOUT_FACTOR;\r
-\r
-       cl_qlist_init(&p_vend->bind_handles);\r
-\r
-       /* update the run_randomizer flag */\r
-       if (getenv("OSM_PKT_DROP_RATE") != NULL\r
-           && atol(getenv("OSM_PKT_DROP_RATE")) != 0) {\r
-               /* if the OSM_PKT_DROP_RATE global variable is defined to a non-zero value -\r
-                  then the randomizer should be called.\r
-                  Need to create the packet randomizer object */\r
-               p_vend->run_randomizer = TRUE;\r
-               status =\r
-                   osm_pkt_randomizer_init(&(p_vend->p_pkt_randomizer), p_log);\r
-               if (status != IB_SUCCESS)\r
-                       return status;\r
-       } else {\r
-               p_vend->run_randomizer = FALSE;\r
-               p_vend->p_pkt_randomizer = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return (IB_SUCCESS);\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_bind\r
- *\r
- *  DESCRIPTION     Create a new bind object under the vendor object\r
- */\r
-\r
-osm_bind_handle_t\r
-osm_vendor_bind(IN osm_vendor_t * const p_vend,\r
-               IN osm_bind_info_t * const p_bind_info,\r
-               IN osm_mad_pool_t * const p_mad_pool,\r
-               IN osm_vend_mad_recv_callback_t mad_recv_callback,\r
-               IN osm_vend_mad_send_err_callback_t send_err_callback,\r
-               IN void *context)\r
-{\r
-       osmv_bind_obj_t *p_bo;\r
-       ib_api_status_t status;\r
-       char hca_id[32];\r
-       cl_status_t cl_st;\r
-       cl_list_obj_t *p_obj;\r
-       uint8_t hca_index;\r
-\r
-       if (NULL == p_vend || NULL == p_bind_info || NULL == p_mad_pool\r
-           || NULL == mad_recv_callback || NULL == send_err_callback) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7302: "\r
-                       "NULL parameter passed in: p_vend=%p p_bind_info=%p p_mad_pool=%p recv_cb=%p send_err_cb=%p\n",\r
-                       p_vend, p_bind_info, p_mad_pool, mad_recv_callback,\r
-                       send_err_callback);\r
-\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       p_bo = malloc(sizeof(osmv_bind_obj_t));\r
-       if (NULL == p_bo) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7303: could not allocate the bind object\n");\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       memset(p_bo, 0, sizeof(osmv_bind_obj_t));\r
-       p_bo->p_vendor = p_vend;\r
-       p_bo->recv_cb = mad_recv_callback;\r
-       p_bo->send_err_cb = send_err_callback;\r
-       p_bo->cb_context = context;\r
-       p_bo->p_osm_pool = p_mad_pool;\r
-\r
-       /* obtain the hca name and port num from the guid */\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_bind: "\r
-               "Finding CA and Port that owns port guid 0x%" PRIx64 ".\n",\r
-               cl_ntoh64(p_bind_info->port_guid));\r
-\r
-       status = osm_vendor_get_guid_ca_and_port(p_bo->p_vendor,\r
-                                                p_bind_info->port_guid,\r
-                                                &(p_bo->hca_hndl),\r
-                                                hca_id,\r
-                                                &hca_index, &(p_bo->port_num));\r
-       if (status != IB_SUCCESS) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7304: "\r
-                       "Fail to find port number of port guid:0x%016" PRIx64\r
-                       "\n", p_bind_info->port_guid);\r
-               free(p_bo);\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       /* Initialize the magic_ptr to the pointer of the p_bo info.\r
-          This will be used to signal when the object is being destroyed, so no\r
-          real action will be done then. */\r
-       p_bo->magic_ptr = p_bo;\r
-\r
-       p_bo->is_closing = FALSE;\r
-\r
-       cl_spinlock_construct(&(p_bo->lock));\r
-       cl_st = cl_spinlock_init(&(p_bo->lock));\r
-       if (cl_st != CL_SUCCESS) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7305: "\r
-                       "could not initialize the spinlock ...\n");\r
-               free(p_bo);\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_bind: osmv_txnmgr_init ... \n");\r
-       if (osmv_txnmgr_init(&p_bo->txn_mgr, p_vend->p_log, &(p_bo->lock)) !=\r
-           IB_SUCCESS) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7306: "\r
-                       "osmv_txnmgr_init failed \n");\r
-               cl_spinlock_destroy(&p_bo->lock);\r
-               free(p_bo);\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       /* Do the real job! (Transport-dependent) */\r
-       if (IB_SUCCESS !=\r
-           osmv_transport_init(p_bind_info, hca_id, hca_index, p_bo)) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7307: "\r
-                       "osmv_transport_init failed \n");\r
-               osmv_txnmgr_done((osm_bind_handle_t) p_bo);\r
-               cl_spinlock_destroy(&p_bo->lock);\r
-               free(p_bo);\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-       /* insert bind handle into db */\r
-       p_obj = malloc(sizeof(cl_list_obj_t));\r
-       if (NULL == p_obj) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_bind: ERR 7308: "\r
-                       "osm_vendor_bind: could not allocate the list object\n");\r
-\r
-               osmv_transport_done(p_bo->p_transp_mgr);\r
-               osmv_txnmgr_done((osm_bind_handle_t) p_bo);\r
-               cl_spinlock_destroy(&p_bo->lock);\r
-               free(p_bo);\r
-               return OSM_BIND_INVALID_HANDLE;\r
-       }\r
-       memset(p_obj, 0, sizeof(cl_list_obj_t));\r
-       cl_qlist_set_obj(p_obj, p_bo);\r
-\r
-       cl_qlist_insert_head(&p_vend->bind_handles, &p_obj->list_item);\r
-\r
-       return (osm_bind_handle_t) p_bo;\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_unbind\r
- *\r
- *  DESCRIPTION     Destroy the bind object and remove it from the vendor's list\r
- */\r
-\r
-void osm_vendor_unbind(IN osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-       cl_list_obj_t *p_obj = NULL;\r
-       cl_list_item_t *p_item, *p_item_tmp;\r
-       cl_qlist_t *const p_bh_list =\r
-           (cl_qlist_t * const)&p_bo->p_vendor->bind_handles;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* go over all the items in the list and remove the specific item */\r
-       p_item = cl_qlist_head(p_bh_list);\r
-       while (p_item != cl_qlist_end(p_bh_list)) {\r
-               p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-               if (cl_qlist_obj(p_obj) == h_bind) {\r
-                       break;\r
-               }\r
-               p_item_tmp = cl_qlist_next(p_item);\r
-               p_item = p_item_tmp;\r
-       }\r
-\r
-       CL_ASSERT(p_item != cl_qlist_end(p_bh_list));\r
-\r
-       cl_qlist_remove_item(p_bh_list, p_item);\r
-       if (p_obj)\r
-               free(p_obj);\r
-\r
-       if (h_bind != 0) {\r
-               __osm_vendor_internal_unbind(h_bind);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_get\r
- *\r
- *  DESCRIPTION     Allocate the space for a new MAD\r
- */\r
-\r
-ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,\r
-                        IN const uint32_t mad_size,\r
-                        IN osm_vend_wrap_t * const p_vw)\r
-{\r
-       ib_mad_t *p_mad;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       uint32_t act_mad_size;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vw);\r
-\r
-       if (mad_size < MAD_BLOCK_SIZE) {\r
-               /* Stupid, but the applications want that! */\r
-               act_mad_size = MAD_BLOCK_SIZE;\r
-       } else {\r
-               act_mad_size = mad_size;\r
-       }\r
-\r
-       /* allocate it */\r
-       p_mad = (ib_mad_t *) malloc(act_mad_size);\r
-       if (p_mad == NULL) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get: ERR 7309: "\r
-                       "Error Obtaining MAD buffer.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_mad, 0, act_mad_size);\r
-\r
-       if (osm_log_get_level(p_vend->p_log) >= OSM_LOG_DEBUG) {\r
-               osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                       "osm_vendor_get: "\r
-                       "Allocated MAD %p, size = %u.\n", p_mad, act_mad_size);\r
-       }\r
-       p_vw->p_mad = p_mad;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (p_mad);\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_send\r
- *\r
- *  DESCRIPTION     Send a MAD buffer (RMPP or simple send).\r
- *\r
- *                  Semantics:\r
- *                   (1) The RMPP send completes when every segment\r
- *                       is acknowledged (synchronous)\r
- *                   (2) The simple send completes when the send completion\r
- *                       is received (asynchronous)\r
- */\r
-\r
-ib_api_status_t\r
-osm_vendor_send(IN osm_bind_handle_t h_bind,\r
-               IN osm_madw_t * const p_madw, IN boolean_t const resp_expected)\r
-{\r
-       ib_api_status_t ret = IB_SUCCESS;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       boolean_t is_rmpp = FALSE, is_rmpp_ds = FALSE;\r
-       osmv_txn_ctx_t *p_txn = NULL;\r
-       ib_mad_t *p_mad;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-       osm_mad_pool_t *p_mad_pool = p_bo->p_osm_pool;\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (NULL == h_bind || NULL == p_madw ||\r
-           NULL == (p_mad = osm_madw_get_mad_ptr(p_madw)) ||\r
-           NULL == osm_madw_get_mad_addr_ptr(p_madw)) {\r
-\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-\r
-       is_rmpp = (p_madw->mad_size > MAD_BLOCK_SIZE\r
-                  || osmv_mad_is_rmpp(p_mad));\r
-       /* is this rmpp double sided? This means we expect a response that can be\r
-          an rmpp or not */\r
-       is_rmpp_ds = (TRUE == is_rmpp && TRUE == resp_expected);\r
-\r
-       /* Make our operations with the send context atomic */\r
-       osmv_txn_lock(p_bo);\r
-\r
-       if (TRUE == p_bo->is_closing) {\r
-\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_send: ERR 7310: "\r
-                       "The handle %p is being unbound, cannot send.\n",\r
-                       h_bind);\r
-               ret = IB_INTERRUPTED;\r
-               /* When closing p_bo could be detroyed or is going to , thus could not refer to it */\r
-               goto send_done;\r
-       }\r
-\r
-       if (TRUE == resp_expected || TRUE == is_rmpp) {\r
-\r
-               /* We must run under a transaction framework.\r
-                * Get the transaction object (old or new) */\r
-               ret = __osmv_get_send_txn(h_bind, p_madw, is_rmpp,\r
-                                         resp_expected, &p_txn);\r
-               if (IB_SUCCESS != ret) {\r
-                       goto send_done;\r
-               }\r
-       }\r
-\r
-       if (TRUE == is_rmpp) {\r
-               /* Do the job - RMPP!\r
-                * The call returns as all the packets are ACK'ed/upon error\r
-                * The txn lock will be released each time the function sleeps\r
-                * and re-acquired when it wakes up\r
-                */\r
-               ret = osmv_rmpp_send_madw(h_bind, p_madw, p_txn, is_rmpp_ds);\r
-       } else {\r
-\r
-               /* Do the job - single MAD!\r
-                * The call returns as soon as the MAD is put on the wire\r
-                */\r
-               ret = osmv_simple_send_madw(h_bind, p_madw, p_txn, FALSE);\r
-       }\r
-\r
-       if (IB_SUCCESS == ret) {\r
-\r
-               if ((TRUE == is_rmpp) && (FALSE == is_rmpp_ds)) {\r
-                       /* For double-sided sends, the txn continues to live */\r
-                       osmv_txn_done(h_bind, osmv_txn_get_key(p_txn),\r
-                                     FALSE /*not in callback */ );\r
-               }\r
-\r
-               if (FALSE == resp_expected) {\r
-                       osm_mad_pool_put(p_mad_pool, p_madw);\r
-               }\r
-       } else if (IB_INTERRUPTED != ret) {\r
-               if (NULL != p_txn) {\r
-                       osmv_txn_done(h_bind, osmv_txn_get_key(p_txn),\r
-                                     FALSE /*not in callback */ );\r
-               }\r
-\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_send: ERR 7311: failed to send MADW %p\n",\r
-                       p_madw);\r
-\r
-               if (TRUE == resp_expected) {\r
-                       /* Change the status on the p_madw */\r
-                       p_madw->status = ret;\r
-                       /* Only the requester expects the error callback */\r
-                       p_bo->send_err_cb(p_bo->cb_context, p_madw);\r
-               } else {\r
-                       /* put back the mad - it is useless ... */\r
-                       osm_mad_pool_put(p_mad_pool, p_madw);\r
-               }\r
-       } else {                /* the transaction was aborted due to p_bo exit */\r
-\r
-               osm_mad_pool_put(p_mad_pool, p_madw);\r
-               goto aborted;\r
-       }\r
-send_done:\r
-\r
-       osmv_txn_unlock(p_bo);\r
-aborted:\r
-       OSM_LOG_EXIT(p_log);\r
-       return ret;\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_put\r
- *\r
- *  DESCRIPTION     Free the MAD's memory\r
- */\r
-\r
-void\r
-osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw)\r
-{\r
-\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-\r
-       if (p_bo->is_closing != TRUE) {\r
-               OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-               CL_ASSERT(p_vw);\r
-               CL_ASSERT(p_vw->p_mad);\r
-\r
-               if (osm_log_get_level(p_vend->p_log) >= OSM_LOG_DEBUG) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                               "osm_vendor_put: " "Retiring MAD %p.\n",\r
-                               p_vw->p_mad);\r
-               }\r
-\r
-               free(p_vw->p_mad);\r
-               p_vw->p_mad = NULL;\r
-\r
-               OSM_LOG_EXIT(p_vend->p_log);\r
-       }\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_local_lid_change\r
- *\r
- *  DESCRIPTION     Notifies the vendor transport layer that the local address\r
- *                  has changed.  This allows the vendor layer to perform\r
- *                  housekeeping functions such as address vector updates.\r
- */\r
-\r
-ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind)\r
-{\r
-       osm_vendor_t const *p_vend = ((osmv_bind_obj_t *) h_bind)->p_vendor;\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_local_lid_change: " "Change of LID.\n");\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-\r
-       return (IB_SUCCESS);\r
-\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_set_sm\r
- *\r
- *  DESCRIPTION     Modifies the port info for the bound port to set the "IS_SM" bit\r
- *                  according to the value given (TRUE or FALSE).\r
- */\r
-#if !(defined(OSM_VENDOR_INTF_TS_NO_VAPI) || defined(OSM_VENDOR_INTF_SIM) || defined(OSM_VENDOR_INTF_TS))\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       VAPI_ret_t status;\r
-       VAPI_hca_attr_t attr_mod;\r
-       VAPI_hca_attr_mask_t attr_mask;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       memset(&attr_mod, 0, sizeof(attr_mod));\r
-       memset(&attr_mask, 0, sizeof(attr_mask));\r
-\r
-       attr_mod.is_sm = is_sm_val;\r
-       attr_mask = HCA_ATTR_IS_SM;\r
-\r
-       status =\r
-           VAPI_modify_hca_attr(p_bo->hca_hndl, p_bo->port_num, &attr_mod,\r
-                                &attr_mask);\r
-       if (status != VAPI_OK) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_set_sm: ERR 7312: "\r
-                       "Unable set 'IS_SM' bit to:%u in port attributes (%d).\n",\r
-                       is_sm_val, status);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-#endif\r
-\r
-/*\r
- *  NAME            __osm_vendor_internal_unbind\r
- *\r
- *  DESCRIPTION     Destroying a bind:\r
- *                    (1) Wait for the completion of the sends in flight\r
- *                    (2) Destroy the associated data structures\r
- */\r
-\r
-static void __osm_vendor_internal_unbind(osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* "notifying" all that from now on no new sends can be done */\r
-       p_bo->txn_mgr.p_event_wheel->closing = TRUE;\r
-\r
-       osmv_txn_lock(p_bo);\r
-\r
-       /*\r
-          the is_closing is set under lock we we know we only need to\r
-          check for it after obtaining the lock\r
-        */\r
-       p_bo->is_closing = TRUE;\r
-\r
-       /* notifying all sleeping rmpp sends to exit */\r
-       osmv_txn_abort_rmpp_txns(h_bind);\r
-\r
-       /* unlock the bo to allow for any residual mads to be dispatched */\r
-       osmv_txn_unlock(p_bo);\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "__osm_vendor_internal_unbind: destroying transport mgr.. \n");\r
-       /* wait for the receiver thread to exit */\r
-       osmv_transport_done(h_bind);\r
-\r
-       /* lock to avoid any collissions while we cleanup the structs */\r
-       osmv_txn_lock(p_bo);\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "__osm_vendor_internal_unbind: destroying txn mgr.. \n");\r
-       osmv_txnmgr_done(h_bind);\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "__osm_vendor_internal_unbind: destroying bind lock.. \n");\r
-       osmv_txn_unlock(p_bo);\r
-\r
-       /*\r
-          we intentionally let the p_bo and its lock leak -\r
-          as we did not implement a way to track active bind handles provided to\r
-          the client - and the client might use them\r
-\r
-          cl_spinlock_destroy(&p_bo->lock);\r
-          free(p_bo);\r
-        */\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_get_send_txn\r
- *\r
- *  DESCRIPTION     Return a transaction object that corresponds to this MAD.\r
- *                  Optionally, create it, if the new request (query) is sent or received.\r
- */\r
-\r
-static ib_api_status_t\r
-__osmv_get_send_txn(IN osm_bind_handle_t h_bind,\r
-                   IN osm_madw_t * const p_madw,\r
-                   IN boolean_t is_rmpp,\r
-                   IN boolean_t resp_expected, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       ib_api_status_t ret;\r
-       uint64_t tid, key;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       ib_mad_t *p_mad = osm_madw_get_mad_ptr(p_madw);\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-       CL_ASSERT(NULL != pp_txn);\r
-\r
-       key = tid = cl_ntoh64(p_mad->trans_id);\r
-       if (TRUE == resp_expected) {\r
-               /* Create a unique identifier at the requester side */\r
-               key = osmv_txn_uniq_key(tid);\r
-       }\r
-\r
-       /* We must run under a transaction framework */\r
-       ret = osmv_txn_lookup(h_bind, key, pp_txn);\r
-       if (IB_NOT_FOUND == ret) {\r
-               /* Generally, we start a new transaction */\r
-               ret = osmv_txn_init(h_bind, tid, key, pp_txn);\r
-               if (IB_SUCCESS != ret) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_get_send_txn: ERR 7313: "\r
-                               "The transaction id=0x%llX failed to init.\n",\r
-                               tid);\r
-                       goto get_send_txn_done;\r
-               }\r
-       } else {\r
-               CL_ASSERT(NULL != *pp_txn);\r
-               /* The transaction context exists.\r
-                * This is legal only if I am going to return an\r
-                * (RMPP?) reply to an RMPP request sent by the other part\r
-                * (double-sided RMPP transfer)\r
-                */\r
-               if (FALSE == is_rmpp\r
-                   || FALSE == osmv_txn_is_rmpp_init_by_peer(*pp_txn)) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_get_send_txn: ERR 7314: "\r
-                               "The transaction id=0x%llX is not unique. Send failed.\n",\r
-                               tid);\r
-\r
-                       ret = IB_INVALID_SETTING;\r
-                       goto get_send_txn_done;\r
-               }\r
-\r
-               if (TRUE == resp_expected) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_get_send_txn: ERR 7315: "\r
-                               "The transaction id=%llX can't expect a response. Send failed.\n",\r
-                               tid);\r
-\r
-                       ret = IB_INVALID_PARAMETER;\r
-                       goto get_send_txn_done;\r
-               }\r
-       }\r
-\r
-       if (TRUE == is_rmpp) {\r
-               ret = osmv_txn_init_rmpp_sender(h_bind, *pp_txn, p_madw);\r
-               if (IB_SUCCESS != ret) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_get_send_txn: ERR 7316: "\r
-                               "The transaction id=%llX failed to init the rmpp mad. Send failed.\n",\r
-                               tid);\r
-                       osmv_txn_done(h_bind, tid, FALSE);\r
-                       goto get_send_txn_done;\r
-               }\r
-       }\r
-\r
-       /* Save a reference to the MAD in the txn context\r
-        * We'll need to match it in two cases:\r
-        *  (1) When the response is returned, if I am the requester\r
-        *  (2) In RMPP retransmissions\r
-        */\r
-       osmv_txn_set_madw(*pp_txn, p_madw);\r
-\r
-get_send_txn_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-\r
-       return ret;\r
-}\r
-\r
-void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)\r
-{\r
-\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_dispatcher.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_dispatcher.c
deleted file mode 100644 (file)
index ad6ed83..0000000
+++ /dev/null
@@ -1,710 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <vendor/osm_vendor_mlx.h>\r
-#include <vendor/osm_vendor_mlx_defs.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_sender.h>\r
-#include <vendor/osm_pkt_randomizer.h>\r
-\r
-typedef enum _osmv_disp_route {\r
-\r
-       OSMV_ROUTE_DROP,\r
-       OSMV_ROUTE_SIMPLE,\r
-       OSMV_ROUTE_RMPP,\r
-\r
-} osmv_disp_route_t;\r
-\r
-/**\r
- *   FORWARD REFERENCES TO PRIVATE FUNCTIONS\r
- */\r
-\r
-static osmv_disp_route_t\r
-__osmv_dispatch_route(IN osm_bind_handle_t h_bind,\r
-                     IN const ib_mad_t * p_mad, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-static void\r
-__osmv_dispatch_simple_mad(IN osm_bind_handle_t h_bind,\r
-                          IN const ib_mad_t * p_mad,\r
-                          IN osmv_txn_ctx_t * p_txn,\r
-                          IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-static void\r
-__osmv_dispatch_rmpp_mad(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-static void\r
-__osmv_dispatch_rmpp_snd(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-static ib_api_status_t\r
-__osmv_dispatch_rmpp_rcv(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-static ib_api_status_t\r
-__osmv_dispatch_accept_seg(IN osm_bind_handle_t h_bind,\r
-                          IN osmv_txn_ctx_t * p_txn,\r
-                          IN const ib_mad_t * p_mad);\r
-static void\r
-__osmv_dispatch_send_ack(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_req_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr);\r
-\r
-/*\r
- * NAME\r
- *   osmv_dispatch_mad\r
- *\r
- * DESCRIPTION\r
- *   Lower-level MAD dispatcher.\r
- *   Implements a switch between the following MAD consumers:\r
- *   (1) Non-RMPP consumer (DATA)\r
- *   (2) RMPP receiver     (DATA/ABORT/STOP)\r
- *   (3) RMPP sender       (ACK/ABORT/STOP)\r
- *\r
- * PARAMETERS\r
- *   h_bind                The bind handle\r
- *   p_mad_buf             The 256 byte buffer of individual MAD\r
- *   p_mad_addr            The MAD originator's address\r
- */\r
-\r
-ib_api_status_t\r
-osmv_dispatch_mad(IN osm_bind_handle_t h_bind,\r
-                 IN const void *p_mad_buf,\r
-                 IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       ib_api_status_t ret = IB_SUCCESS;\r
-       const ib_mad_t *p_mad = (ib_mad_t *) p_mad_buf;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osmv_txn_ctx_t *p_txn = NULL;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       CL_ASSERT(NULL != h_bind && NULL != p_mad && NULL != p_mad_addr);\r
-\r
-       osmv_txn_lock(p_bo);\r
-\r
-       if (TRUE == p_bo->is_closing) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "The bind handle %p is being closed. "\r
-                       "The MAD will not be dispatched.\n", p_bo);\r
-\r
-               ret = IB_INTERRUPTED;\r
-               goto dispatch_mad_done;\r
-       }\r
-\r
-       /*\r
-          Add call for packet drop randomizer.\r
-          This is a testing feature. If run_randomizer flag is set to TRUE,\r
-          the randomizer will be called, and randomally will drop\r
-          a packet. This is used for simulating unstable fabric.\r
-        */\r
-       if (p_bo->p_vendor->run_randomizer == TRUE) {\r
-               /* Try the randomizer */\r
-               if (osm_pkt_randomizer_mad_drop(p_bo->p_vendor->p_log,\r
-                                               p_bo->p_vendor->\r
-                                               p_pkt_randomizer,\r
-                                               p_mad) == TRUE) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "The MAD will not be dispatched.\n");\r
-                       goto dispatch_mad_done;\r
-               }\r
-       }\r
-\r
-       switch (__osmv_dispatch_route(h_bind, p_mad, &p_txn)) {\r
-\r
-       case OSMV_ROUTE_DROP:\r
-               break;          /* Do nothing */\r
-\r
-       case OSMV_ROUTE_SIMPLE:\r
-               __osmv_dispatch_simple_mad(h_bind, p_mad, p_txn, p_mad_addr);\r
-               break;\r
-\r
-       case OSMV_ROUTE_RMPP:\r
-               __osmv_dispatch_rmpp_mad(h_bind, p_mad, p_txn, p_mad_addr);\r
-               break;\r
-\r
-       default:\r
-               CL_ASSERT(FALSE);\r
-       }\r
-\r
-dispatch_mad_done:\r
-       osmv_txn_unlock(p_bo);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return ret;\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_dispatch_route()\r
- *\r
- *  DESCRIPTION     Decide which way to handle the received MAD: simple txn/RMPP/drop\r
- */\r
-\r
-static osmv_disp_route_t\r
-__osmv_dispatch_route(IN osm_bind_handle_t h_bind,\r
-                     IN const ib_mad_t * p_mad, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       ib_api_status_t ret;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       boolean_t is_resp = ib_mad_is_response(p_mad);\r
-       boolean_t is_txn;\r
-       uint64_t key = cl_ntoh64(p_mad->trans_id);\r
-\r
-       CL_ASSERT(NULL != pp_txn);\r
-\r
-       ret = osmv_txn_lookup(h_bind, key, pp_txn);\r
-       is_txn = (IB_SUCCESS == ret);\r
-\r
-       if (FALSE == is_txn && TRUE == is_resp) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Received a response to a non-started/aged-out transaction (tid=0x%llX). "\r
-                       "Dropping the MAD.\n", key);\r
-               return OSMV_ROUTE_DROP;\r
-       }\r
-\r
-       if (TRUE == osmv_mad_is_rmpp(p_mad)) {\r
-               /* An RMPP transaction. The filtering is more delicate there */\r
-               return OSMV_ROUTE_RMPP;\r
-       }\r
-\r
-       if (TRUE == is_txn && FALSE == is_resp) {\r
-               /* Does this MAD try to start a transaction with duplicate tid? */\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Duplicate TID 0x%llX received (not a response). "\r
-                       "Dropping the MAD.\n", key);\r
-\r
-               return OSMV_ROUTE_DROP;\r
-       }\r
-\r
-       return OSMV_ROUTE_SIMPLE;\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_dispatch_simple_mad()\r
- *\r
- *  DESCRIPTION     Handle a MAD that is part of non-RMPP transfer\r
- */\r
-\r
-static void\r
-__osmv_dispatch_simple_mad(IN osm_bind_handle_t h_bind,\r
-                          IN const ib_mad_t * p_mad,\r
-                          IN osmv_txn_ctx_t * p_txn,\r
-                          IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osm_madw_t *p_madw;\r
-       ib_mad_t *p_mad_buf;\r
-       osm_madw_t *p_req_madw = NULL;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       /* Build the MAD wrapper to be returned to the user.\r
-        * The actual storage for the MAD is allocated there.\r
-        */\r
-       p_madw =\r
-           osm_mad_pool_get(p_bo->p_osm_pool, h_bind, MAD_BLOCK_SIZE,\r
-                            p_mad_addr);\r
-\r
-       if (NULL == p_madw) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_simple_mad: ERR 6501: "\r
-                       "Out Of Memory - could not allocate a buffer of size %d\n",\r
-                       MAD_BLOCK_SIZE);\r
-\r
-               goto dispatch_simple_mad_done;\r
-       }\r
-\r
-       p_mad_buf = osm_madw_get_mad_ptr(p_madw);\r
-       /* Copy the payload to the MAD buffer */\r
-       memcpy((void *)p_mad_buf, (void *)p_mad, MAD_BLOCK_SIZE);\r
-\r
-       if (NULL != p_txn) {\r
-               /* This is a RESPONSE MAD. Pair it with the REQUEST MAD, pass upstream */\r
-               p_req_madw = p_txn->p_madw;\r
-               CL_ASSERT(NULL != p_req_madw);\r
-\r
-               p_mad_buf->trans_id = cl_hton64(osmv_txn_get_tid(p_txn));\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Restoring the original TID to 0x%llX\n",\r
-                       cl_ntoh64(p_mad_buf->trans_id));\r
-\r
-               /* Reply matched, transaction complete */\r
-               osmv_txn_done(h_bind, osmv_txn_get_key(p_txn), FALSE);\r
-       } else {\r
-               /* This is a REQUEST  MAD. Don't create a context, pass upstream */\r
-       }\r
-\r
-       /* Do the job ! */\r
-       p_bo->recv_cb(p_madw, p_bo->cb_context, p_req_madw);\r
-\r
-dispatch_simple_mad_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_dispatch_rmpp_mad()\r
- *\r
- *  DESCRIPTION     Handle a MAD that is part of RMPP transfer\r
- */\r
-\r
-static void\r
-__osmv_dispatch_rmpp_mad(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint64_t key = cl_ntoh64(p_mad->trans_id);\r
-       boolean_t is_init_by_peer = FALSE;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_madw_t *p_madw;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       if (NULL == p_txn) {\r
-               if (FALSE == osmv_rmpp_is_data(p_mad)\r
-                   || FALSE == osmv_rmpp_is_first(p_mad)) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "The MAD does not match any transaction "\r
-                               "and does not start a sender-initiated RMPP transfer.\n");\r
-                       goto dispatch_rmpp_mad_done;\r
-               }\r
-\r
-               /* IB Spec 13.6.2.2. This is a Sender Initiated Transfer.\r
-                  My peer is the requester and RMPP Sender. I am the RMPP Receiver.\r
-                */\r
-               status = osmv_txn_init(h_bind, /*tid==key */ key, key, &p_txn);\r
-               if (IB_SUCCESS != status) {\r
-                       goto dispatch_rmpp_mad_done;\r
-               }\r
-\r
-               is_init_by_peer = TRUE;\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "A new sender-initiated transfer (TID=0x%llX) started\n",\r
-                       key);\r
-       }\r
-\r
-       if (OSMV_TXN_RMPP_NONE == osmv_txn_get_rmpp_state(p_txn)) {\r
-               /* Case 1: Fall through from above.\r
-                * Case 2: When the transaction was initiated by me\r
-                *         (a single request MAD), there was an uncertainty\r
-                *         whether the reply will be RMPP. Now it's resolved,\r
-                *         since the reply is RMPP!\r
-                */\r
-               status =\r
-                   osmv_txn_init_rmpp_receiver(h_bind, p_txn, is_init_by_peer);\r
-               if (IB_SUCCESS != status) {\r
-                       goto dispatch_rmpp_mad_done;\r
-               }\r
-       }\r
-\r
-       switch (osmv_txn_get_rmpp_state(p_txn)) {\r
-\r
-       case OSMV_TXN_RMPP_RECEIVER:\r
-               status =\r
-                   __osmv_dispatch_rmpp_rcv(h_bind, p_mad, p_txn, p_mad_addr);\r
-               if (IB_SUCCESS != status) {\r
-                       if (FALSE == osmv_txn_is_rmpp_init_by_peer(p_txn)) {\r
-                               /* This is a requester, still waiting for the reply. Apply the callback */\r
-                               /* update the status of the p_madw */\r
-                               p_madw = osmv_txn_get_madw(p_txn);\r
-                               p_madw->status = status;\r
-                               p_bo->send_err_cb(p_bo->cb_context, p_madw);\r
-                       }\r
-\r
-                       /* ABORT/STOP/LOCAL ERROR */\r
-                       osmv_txn_done(h_bind, osmv_txn_get_key(p_txn), FALSE);\r
-               }\r
-               break;\r
-\r
-       case OSMV_TXN_RMPP_SENDER:\r
-               __osmv_dispatch_rmpp_snd(h_bind, p_mad, p_txn, p_mad_addr);\r
-               /* If an error happens here, it's the sender thread to cleanup the txn */\r
-               break;\r
-\r
-       default:\r
-               CL_ASSERT(FALSE);\r
-       }\r
-\r
-dispatch_rmpp_mad_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_dispatch_rmpp_snd()\r
- *\r
- *  DESCRIPTION     MAD handling by an RMPP sender (ACK/ABORT/STOP)\r
- */\r
-\r
-static void\r
-__osmv_dispatch_rmpp_snd(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osmv_rmpp_send_ctx_t *p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);\r
-\r
-       uint32_t old_wl = p_send_ctx->window_last;\r
-       uint32_t total_segs = osmv_rmpp_send_ctx_get_num_segs(p_send_ctx);\r
-       uint32_t seg_num = cl_ntoh32(((ib_rmpp_mad_t *) p_mad)->seg_num);\r
-       uint32_t new_wl = cl_ntoh32(((ib_rmpp_mad_t *) p_mad)->paylen_newwin);\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       if (TRUE == osmv_rmpp_is_abort_stop(p_mad)) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_rmpp_snd: ERR 6502: "\r
-                       "The remote side sent an ABORT/STOP indication.\n");\r
-               osmv_rmpp_snd_error(p_send_ctx, IB_REMOTE_ERROR);\r
-               goto dispatch_rmpp_snd_done;\r
-       }\r
-\r
-       if (FALSE == osmv_rmpp_is_ack(p_mad)) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Not supposed to receive DATA packets --> dropping the MAD\n");\r
-               goto dispatch_rmpp_snd_done;\r
-       }\r
-\r
-       /* Continue processing the ACK */\r
-       if (seg_num > old_wl) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_rmpp_snd: ERR 6503: "\r
-                       "ACK received for a non-sent segment %d\n", seg_num);\r
-\r
-               osmv_rmpp_send_nak(h_bind, p_mad, p_mad_addr,\r
-                                  IB_RMPP_TYPE_ABORT, IB_RMPP_STATUS_S2B);\r
-\r
-               osmv_rmpp_snd_error(p_send_ctx, IB_REMOTE_ERROR);\r
-               goto dispatch_rmpp_snd_done;\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "__osmv_dispatch_rmpp_snd: "\r
-               "New WL = %u Old WL = %u Total Segs = %u\n",\r
-               new_wl, old_wl, total_segs);\r
-\r
-       if (new_wl < old_wl) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_rmpp_snd: ERR 6508: "\r
-                       "The receiver requests a smaller WL (%d) than before (%d)\n",\r
-                       new_wl, old_wl);\r
-\r
-               osmv_rmpp_send_nak(h_bind, p_mad, p_mad_addr,\r
-                                  IB_RMPP_TYPE_ABORT, IB_RMPP_STATUS_W2S);\r
-\r
-               osmv_rmpp_snd_error(p_send_ctx, IB_REMOTE_ERROR);\r
-               goto dispatch_rmpp_snd_done;\r
-       }\r
-\r
-       /* Update the sender's window, and optionally wake up the sender thread\r
-        * Note! A single ACK can acknowledge a whole range of segments: [WF..SEG_NUM]\r
-        */\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "ACK for seg_num #%d accepted.\n", seg_num);\r
-\r
-       if (seg_num == old_wl) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "The send window [%d:%d] is totally acknowledged.\n",\r
-                       p_send_ctx->window_first, old_wl);\r
-\r
-               p_send_ctx->window_first = seg_num + 1;\r
-               p_send_ctx->window_last =\r
-                   (new_wl < total_segs) ? new_wl : total_segs;\r
-\r
-               /* Remove the response timeout event for the window */\r
-               osmv_txn_remove_timeout_ev(h_bind, osmv_txn_get_key(p_txn));\r
-\r
-               /* Wake up the sending thread */\r
-               cl_event_signal(&p_send_ctx->event);\r
-       }\r
-\r
-dispatch_rmpp_snd_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-/*\r
- *  NAME           __osmv_dispatch_rmpp_rcv()\r
- *\r
- *  DESCRIPTION    MAD handling by an RMPP receiver (DATA/ABORT/STOP)\r
- */\r
-\r
-static ib_api_status_t\r
-__osmv_dispatch_rmpp_rcv(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_rmpp_recv_ctx_t *p_recv_ctx = osmv_txn_get_rmpp_recv_ctx(p_txn);\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       boolean_t is_last1 = FALSE, is_last2 = FALSE;\r
-       osm_madw_t *p_new_madw = NULL, *p_req_madw = NULL;\r
-       ib_mad_t *p_mad_buf;\r
-       uint32_t size = 0;\r
-       uint64_t key = osmv_txn_get_key(p_txn);\r
-       uint64_t tid = osmv_txn_get_tid(p_txn);\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       if (TRUE == osmv_rmpp_is_ack(p_mad)) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Not supposed to receive ACK's --> dropping the MAD\n");\r
-\r
-               goto dispatch_rmpp_rcv_done;\r
-       }\r
-\r
-       if (TRUE == osmv_rmpp_is_abort_stop(p_mad)) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_dispatch_rmpp_rcv: ERR 6504: "\r
-                       "The Remote Side stopped sending\n");\r
-\r
-               status = IB_REMOTE_ERROR;\r
-               goto dispatch_rmpp_rcv_done;\r
-       }\r
-\r
-       status = __osmv_dispatch_accept_seg(h_bind, p_txn, p_mad);\r
-       switch (status) {\r
-\r
-       case IB_SUCCESS:\r
-\r
-               /* Check wheter this is the legal last MAD */\r
-               /* Criteria #1: the received MAD is marked last */\r
-               is_last1 = osmv_rmpp_is_last(p_mad);\r
-\r
-               /* Criteria #2: the total accumulated length hits the advertised one */\r
-               is_last2 = is_last1;\r
-\r
-               size = osmv_rmpp_recv_ctx_get_byte_num_from_first(p_recv_ctx);\r
-               if (size > 0) {\r
-                       is_last2 =\r
-                           (osmv_rmpp_recv_ctx_get_cur_byte_num(p_recv_ctx) >=\r
-                            size);\r
-               }\r
-\r
-               if (is_last1 != is_last2) {\r
-\r
-                       osmv_rmpp_send_nak(h_bind, p_mad, p_mad_addr,\r
-                                          IB_RMPP_TYPE_ABORT,\r
-                                          IB_RMPP_STATUS_BAD_LEN);\r
-\r
-                       status = IB_ERROR;\r
-                       goto dispatch_rmpp_rcv_done;\r
-               }\r
-\r
-               /* TBD Consider an optimization - sending an ACK\r
-                * only for the last segment in the window\r
-                */\r
-               __osmv_dispatch_send_ack(h_bind, p_mad, p_txn, p_mad_addr);\r
-               break;\r
-\r
-       case IB_INSUFFICIENT_RESOURCES:\r
-               /* An out-of-order segment received. Send the ACK anyway */\r
-               __osmv_dispatch_send_ack(h_bind, p_mad, p_txn, p_mad_addr);\r
-               status = IB_SUCCESS;\r
-               goto dispatch_rmpp_rcv_done;\r
-\r
-       case IB_INSUFFICIENT_MEMORY:\r
-               osmv_rmpp_send_nak(h_bind, p_mad, p_mad_addr,\r
-                                  IB_RMPP_TYPE_STOP, IB_RMPP_STATUS_RESX);\r
-               goto dispatch_rmpp_rcv_done;\r
-\r
-       default:\r
-               /* Illegal return code */\r
-               CL_ASSERT(FALSE);\r
-       }\r
-\r
-       if (TRUE != is_last1) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "RMPP MADW assembly continues, TID=0x%llX\n", tid);\r
-               goto dispatch_rmpp_rcv_done;\r
-       }\r
-\r
-       /* This is the last packet. */\r
-       if (0 == size) {\r
-               /* The total size was not advertised in the first packet */\r
-               size = osmv_rmpp_recv_ctx_get_byte_num_from_last(p_recv_ctx);\r
-       }\r
-\r
-       /*\r
-          NOTE: the received mad might not be >= 256 bytes.\r
-          some MADs might contain several SA records but still be\r
-          less then a full MAD.\r
-          We have to use RMPP to send them over since on a regular\r
-          "simple" MAD there is no way to know how many records were sent\r
-        */\r
-\r
-       /* Build the MAD wrapper to be returned to the user.\r
-        * The actual storage for the MAD is allocated there.\r
-        */\r
-       p_new_madw =\r
-           osm_mad_pool_get(p_bo->p_osm_pool, h_bind, size, p_mad_addr);\r
-       if (NULL == p_new_madw) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_rmpp_rcv: ERR 6506: "\r
-                       "Out Of Memory - could not allocate %d bytes for the MADW\n",\r
-                       size);\r
-\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto dispatch_rmpp_rcv_done;\r
-       }\r
-\r
-       p_req_madw = osmv_txn_get_madw(p_txn);\r
-       p_mad_buf = osm_madw_get_mad_ptr(p_new_madw);\r
-       status = osmv_rmpp_recv_ctx_reassemble_arbt_mad(p_recv_ctx, size,\r
-                                                       (uint8_t *) p_mad_buf);\r
-       if (IB_SUCCESS != status) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_dispatch_rmpp_rcv: ERR 6507: "\r
-                       "Internal error - could not reassemble the result MAD\n");\r
-               goto dispatch_rmpp_rcv_done;    /* What can happen here? */\r
-       }\r
-\r
-       /* The MAD is assembled, we are about to apply the callback.\r
-        * Delete the transaction context, unless the transaction is double sided */\r
-       if (FALSE == osmv_txn_is_rmpp_init_by_peer(p_txn)\r
-           || FALSE == osmv_mad_is_multi_resp(p_mad)) {\r
-\r
-               osmv_txn_done(h_bind, key, FALSE);\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "RMPP MADW %p assembly complete, TID=0x%llX\n", p_new_madw,\r
-               tid);\r
-\r
-       p_mad_buf->trans_id = cl_hton64(tid);\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "Restoring the original TID to 0x%llX\n",\r
-               cl_ntoh64(p_mad_buf->trans_id));\r
-\r
-       /* Finally, do the job! */\r
-       p_bo->recv_cb(p_new_madw, p_bo->cb_context, p_req_madw);\r
-\r
-dispatch_rmpp_rcv_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- *  NAME            __osmv_dispatch_accept_seg()\r
- *\r
- *  DESCRIPTION     Store a DATA segment at the RMPP receiver side,\r
- *                  if one is received in order.\r
- */\r
-\r
-static ib_api_status_t\r
-__osmv_dispatch_accept_seg(IN osm_bind_handle_t h_bind,\r
-                          IN osmv_txn_ctx_t * p_txn, IN const ib_mad_t * p_mad)\r
-{\r
-       ib_api_status_t ret = IB_SUCCESS;\r
-       uint32_t seg_num = cl_ntoh32(((ib_rmpp_mad_t *) p_mad)->seg_num);\r
-       osmv_rmpp_recv_ctx_t *p_recv_ctx = osmv_txn_get_rmpp_recv_ctx(p_txn);\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       uint64_t tid = osmv_txn_get_tid(p_txn);\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       if (seg_num != p_recv_ctx->expected_seg) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "TID 0x%llX: can't accept this segment (%d) - "\r
-                       "this is a Go-Back-N implementation\n", tid, seg_num);\r
-               return IB_INSUFFICIENT_RESOURCES;\r
-       }\r
-\r
-       /* Store the packet's copy in the reassembly list.\r
-        * Promote the expected segment counter.\r
-        */\r
-       ret = osmv_rmpp_recv_ctx_store_mad_seg(p_recv_ctx, (uint8_t *) p_mad);\r
-       if (IB_SUCCESS != ret) {\r
-               return ret;\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "TID 0x%llX: segment %d accepted\n", tid, seg_num);\r
-       p_recv_ctx->expected_seg = seg_num + 1;\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return IB_SUCCESS;\r
-}\r
-\r
-/*\r
- *  NAME              __osmv_dispatch_send_ack()\r
- *\r
- *  DESCRIPTION\r
- *\r
- *  ISSUES\r
- *    Consider sending the ACK from an async thread\r
- *    if problems with the receiving side processing arise.\r
- */\r
-\r
-static void\r
-__osmv_dispatch_send_ack(IN osm_bind_handle_t h_bind,\r
-                        IN const ib_mad_t * p_req_mad,\r
-                        IN osmv_txn_ctx_t * p_txn,\r
-                        IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osmv_rmpp_recv_ctx_t *p_recv_ctx = osmv_txn_get_rmpp_recv_ctx(p_txn);\r
-\r
-       /* ACK the segment # that was accepted */\r
-       uint32_t seg_num = cl_ntoh32(((ib_rmpp_mad_t *) p_req_mad)->seg_num);\r
-\r
-       /* NOTE! The receiver can publish the New Window Last (NWL) value\r
-        * that is greater than the total number of segments to be sent.\r
-        * It's the sender's responsibility to compute the correct number\r
-        * of segments to send in the next burst.\r
-        */\r
-       uint32_t nwl = p_recv_ctx->expected_seg + OSMV_RMPP_RECV_WIN - 1;\r
-\r
-       osmv_rmpp_send_ack(h_bind, p_req_mad, seg_num, nwl, p_mad_addr);\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c
deleted file mode 100644 (file)
index fa168ce..0000000
+++ /dev/null
@@ -1,522 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#if defined(OSM_VENDOR_INTF_MTL) | defined(OSM_VENDOR_INTF_TS)\r
-#undef IN\r
-#undef OUT\r
-#include <vapi_types.h>\r
-#include <evapi.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_log.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-\r
-/********************************************************************************\r
- *\r
- * Provide the functionality for selecting an HCA Port and Obtaining it's guid.\r
- *\r
- ********************************************************************************/\r
-\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-} osm_ca_info_t;\r
-\r
-/**********************************************************************\r
- * Convert the given GID to GUID by copy of it's upper 8 bytes\r
- **********************************************************************/\r
-ib_api_status_t\r
-__osm_vendor_gid_to_guid(IN u_int8_t * gid, OUT VAPI_gid_t * guid)\r
-{\r
-       memcpy(guid, gid + 8, 8);\r
-       return (IB_SUCCESS);\r
-}\r
-\r
-/**********************************************************************\r
- * Returns a pointer to the port attribute of the specified port\r
- * owned by this CA.\r
- ************************************************************************/\r
-static ib_port_attr_t *__osm_ca_info_get_port_attr_ptr(IN const osm_ca_info_t *\r
-                                                      const p_ca_info,\r
-                                                      IN const uint8_t index)\r
-{\r
-       return (&p_ca_info->p_attr->p_port_attr[index]);\r
-}\r
-\r
-/********************************************************************************\r
- * get the CA names available on the system\r
- * NOTE: user of this function needs to deallocate p_hca_ids after usage.\r
- ********************************************************************************/\r
-static ib_api_status_t\r
-__osm_vendor_get_ca_ids(IN osm_vendor_t * const p_vend,\r
-                       IN VAPI_hca_id_t ** const p_hca_ids,\r
-                       IN uint32_t * const p_num_guids)\r
-{\r
-       ib_api_status_t status;\r
-       VAPI_ret_t vapi_res;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_hca_ids);\r
-       CL_ASSERT(p_num_guids);\r
-\r
-       /* first call is just to get the number */\r
-       vapi_res = EVAPI_list_hcas(0, p_num_guids, NULL);\r
-\r
-       /* fail ? */\r
-       if (vapi_res == VAPI_EINVAL_PARAM) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_vendor_get_ca_ids: ERR 3D08: : "\r
-                       "Bad parameter in calling: EVAPI_list_hcas. (%d)\n",\r
-                       vapi_res);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* NO HCA ? */\r
-       if (*p_num_guids == 0) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_vendor_get_ca_ids: ERR 3D09: "\r
-                       "No available channel adapters.\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       /* allocate and really call - user of this function needs to deallocate it */\r
-       *p_hca_ids =\r
-           (VAPI_hca_id_t *) malloc(*p_num_guids * sizeof(VAPI_hca_id_t));\r
-\r
-       /* now call it really */\r
-       vapi_res = EVAPI_list_hcas(*p_num_guids, p_num_guids, *p_hca_ids);\r
-\r
-       /* too many ? */\r
-       if (vapi_res == VAPI_EAGAIN) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_vendor_get_ca_ids: ERR 3D10: "\r
-                       "More CA GUIDs than allocated array (%d).\n",\r
-                       *p_num_guids);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* fail ? */\r
-       if (vapi_res != VAPI_OK) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_vendor_get_ca_ids: ERR 3D11: : "\r
-                       "Bad parameter in calling: EVAPI_list_hcas.\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(p_vend->p_log, OSM_LOG_DEBUG)) {\r
-               osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                       "__osm_vendor_get_ca_ids: "\r
-                       "Detected %u local channel adapters.\n", *p_num_guids);\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Initialize an Info Struct for the Given HCA by its Id\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__osm_ca_info_init(IN osm_vendor_t * const p_vend,\r
-                  IN VAPI_hca_id_t ca_id, OUT osm_ca_info_t * const p_ca_info)\r
-{\r
-       ib_api_status_t status = IB_ERROR;\r
-       VAPI_ret_t vapi_res;\r
-       VAPI_hca_hndl_t hca_hndl;\r
-       VAPI_hca_vendor_t hca_vendor;\r
-       VAPI_hca_cap_t hca_cap;\r
-       VAPI_hca_port_t hca_port;\r
-       uint8_t port_num;\r
-       IB_gid_t *p_port_gid;\r
-       uint16_t maxNumGids;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       /* get the HCA handle */\r
-       vapi_res = EVAPI_get_hca_hndl(ca_id, &hca_hndl);\r
-       if (vapi_res != VAPI_OK) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_ca_info_init: ERR 3D05: "\r
-                       "Fail to get HCA handle (%u).\n", vapi_res);\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(p_vend->p_log, OSM_LOG_DEBUG)) {\r
-               osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                       "__osm_ca_info_init: " "Querying CA %s.\n", ca_id);\r
-       }\r
-\r
-       /* query and get the HCA capability */\r
-       vapi_res = VAPI_query_hca_cap(hca_hndl, &hca_vendor, &hca_cap);\r
-       if (vapi_res != VAPI_OK) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osm_ca_info_init: ERR 3D06: "\r
-                       "Fail to get HCA Capabilities (%u).\n", vapi_res);\r
-               goto Exit;\r
-       }\r
-\r
-       /* get the guid of the HCA */\r
-       memcpy(&(p_ca_info->guid), hca_cap.node_guid, 8 * sizeof(u_int8_t));\r
-       p_ca_info->attr_size = 1;\r
-       p_ca_info->p_attr = (ib_ca_attr_t *) malloc(sizeof(ib_ca_attr_t));\r
-       memcpy(&(p_ca_info->p_attr->ca_guid), hca_cap.node_guid,\r
-              8 * sizeof(u_int8_t));\r
-\r
-       /* now obtain the attributes of the ports */\r
-       p_ca_info->p_attr->num_ports = hca_cap.phys_port_num;\r
-       p_ca_info->p_attr->p_port_attr =\r
-           (ib_port_attr_t *) malloc(hca_cap.phys_port_num *\r
-                                     sizeof(ib_port_attr_t));\r
-\r
-       for (port_num = 0; port_num < p_ca_info->p_attr->num_ports; port_num++) {\r
-\r
-               /* query the port attributes */\r
-               vapi_res =\r
-                   VAPI_query_hca_port_prop(hca_hndl, port_num + 1, &hca_port);\r
-               if (vapi_res != VAPI_OK) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "__osm_ca_info_init: ERR 3D07: "\r
-                               "Fail to get HCA Port Attributes (%d).\n",\r
-                               vapi_res);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* first call to know the size of the gid table */\r
-               vapi_res =\r
-                   VAPI_query_hca_gid_tbl(hca_hndl, port_num + 1, 0,\r
-                                          &maxNumGids, NULL);\r
-               p_port_gid = (IB_gid_t *) malloc(maxNumGids * sizeof(IB_gid_t));\r
-\r
-               vapi_res =\r
-                   VAPI_query_hca_gid_tbl(hca_hndl, port_num + 1, maxNumGids,\r
-                                          &maxNumGids, p_port_gid);\r
-               if (vapi_res != VAPI_OK) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "__osm_ca_info_init: ERR 3D12: "\r
-                               "Fail to get HCA Port GID (%d).\n", vapi_res);\r
-                       goto Exit;\r
-               }\r
-\r
-               __osm_vendor_gid_to_guid(p_port_gid[0],\r
-                                        (IB_gid_t *) & p_ca_info->p_attr->\r
-                                        p_port_attr[port_num].port_guid);\r
-               p_ca_info->p_attr->p_port_attr[port_num].lid = hca_port.lid;\r
-               p_ca_info->p_attr->p_port_attr[port_num].link_state =\r
-                   hca_port.state;\r
-               p_ca_info->p_attr->p_port_attr[port_num].sm_lid =\r
-                   hca_port.sm_lid;\r
-\r
-               free(p_port_gid);\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-void\r
-osm_ca_info_destroy(IN osm_vendor_t * const p_vend,\r
-                   IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca)\r
-{\r
-       osm_ca_info_t *p_ca;\r
-       uint8_t i;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       for (i = 0; i < num_ca; i++) {\r
-               p_ca = &p_ca_info[i];\r
-\r
-               if (NULL != p_ca->p_attr) {\r
-                       if (0 != p_ca->p_attr->num_ports) {\r
-                               free(p_ca->p_attr->p_port_attr);\r
-                       }\r
-\r
-                       free(p_ca->p_attr);\r
-               }\r
-       }\r
-\r
-       free(p_ca_info);\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Fill in the array of port_attr with all available ports on ALL the\r
- * avilable CAs on this machine.\r
- * ALSO -\r
- * Update the vendor object list of ca_info structs\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                            IN ib_port_attr_t * const p_attr_array,\r
-                            IN uint32_t * const p_num_ports)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       uint32_t ca;\r
-       uint32_t ca_count = 0;\r
-       uint32_t port_count = 0;\r
-       uint8_t port_num;\r
-       uint32_t total_ports = 0;\r
-       VAPI_hca_id_t *p_ca_ids = NULL;\r
-       osm_ca_info_t *p_ca_infos = NULL;\r
-       uint32_t attr_array_sz = *p_num_ports;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       /* determine the number of CA's */\r
-       status = __osm_vendor_get_ca_ids(p_vend, &p_ca_ids, &ca_count);\r
-       if (status != IB_SUCCESS) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_all_port_attr: ERR 3D13: "\r
-                       "Fail to get CA Ids.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* Allocate an array big enough to hold the ca info objects */\r
-       p_ca_infos = malloc(ca_count * sizeof(osm_ca_info_t));\r
-       if (p_ca_infos == NULL) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_all_port_attr: ERR 3D14: "\r
-                       "Unable to allocate CA information array.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_ca_infos, 0, ca_count * sizeof(osm_ca_info_t));\r
-\r
-       /*\r
-        * For each CA, retrieve the CA info attributes\r
-        */\r
-       for (ca = 0; ca < ca_count; ca++) {\r
-               status =\r
-                   __osm_ca_info_init(p_vend, p_ca_ids[ca], &p_ca_infos[ca]);\r
-               if (status != IB_SUCCESS) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "osm_vendor_get_all_port_attr: ERR 3D15: "\r
-                               "Unable to initialize CA Info object (%s).\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               total_ports += p_ca_infos[ca].p_attr->num_ports;\r
-       }\r
-\r
-       *p_num_ports = total_ports;\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_get_all_port_attr: total ports:%u \n", total_ports);\r
-\r
-       /*\r
-        * If the user supplied enough storage, return the port guids,\r
-        * otherwise, return the appropriate error.\r
-        */\r
-       if (attr_array_sz >= total_ports) {\r
-               for (ca = 0; ca < ca_count; ca++) {\r
-                       uint32_t num_ports;\r
-\r
-                       num_ports = p_ca_infos[ca].p_attr->num_ports;\r
-\r
-                       for (port_num = 0; port_num < num_ports; port_num++) {\r
-                               p_attr_array[port_count] =\r
-                                   *__osm_ca_info_get_port_attr_ptr(&p_ca_infos\r
-                                                                    [ca],\r
-                                                                    port_num);\r
-                               port_count++;\r
-                       }\r
-               }\r
-       } else {\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto Exit;\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       if (p_ca_ids)\r
-               free(p_ca_ids);\r
-\r
-       if (p_ca_infos) {\r
-               osm_ca_info_destroy(p_vend, p_ca_infos, ca_count);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Given the vendor obj and a guid\r
- * return the ca id and port number that have that guid\r
- **********************************************************************/\r
-\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT VAPI_hca_hndl_t * p_hca_hndl,\r
-                               OUT VAPI_hca_id_t * p_hca_id,\r
-                               OUT uint8_t * p_hca_idx,\r
-                               OUT uint32_t * p_port_num)\r
-{\r
-\r
-       ib_api_status_t status;\r
-       VAPI_hca_id_t *p_ca_ids = NULL;\r
-       VAPI_ret_t vapi_res;\r
-       VAPI_hca_hndl_t hca_hndl;\r
-       VAPI_hca_vendor_t hca_vendor;\r
-       VAPI_hca_cap_t hca_cap;\r
-       IB_gid_t *p_port_gid = NULL;\r
-       uint16_t maxNumGids;\r
-       ib_net64_t port_guid;\r
-       uint32_t ca, portIdx, ca_count;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       /*\r
-        * 1) Determine the number of CA's\r
-        * 2) Allocate an array big enough to hold the ca info objects.\r
-        * 3) Call again to retrieve the guids.\r
-        */\r
-       status = __osm_vendor_get_ca_ids(p_vend, &p_ca_ids, &ca_count);\r
-       if (status != IB_SUCCESS) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_guid_ca_and_port: ERR 3D16: "\r
-                       "Fail to get CA Ids.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * For each CA, retrieve the CA info attributes\r
-        */\r
-       for (ca = 0; ca < ca_count; ca++) {\r
-               /* get the HCA handle */\r
-               vapi_res = EVAPI_get_hca_hndl(p_ca_ids[ca], &hca_hndl);\r
-               if (vapi_res != VAPI_OK) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "osm_vendor_get_guid_ca_and_port: ERR 3D17: "\r
-                               "Fail to get HCA handle (%u).\n", vapi_res);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* get the CA attributes - to know how many ports it has: */\r
-               if (osm_log_is_active(p_vend->p_log, OSM_LOG_DEBUG)) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                               "osm_vendor_get_guid_ca_and_port: "\r
-                               "Querying CA %s.\n", p_ca_ids[ca]);\r
-               }\r
-\r
-               /* query and get the HCA capability */\r
-               vapi_res = VAPI_query_hca_cap(hca_hndl, &hca_vendor, &hca_cap);\r
-               if (vapi_res != VAPI_OK) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "osm_vendor_get_guid_ca_and_port: ERR 3D18: "\r
-                               "Fail to get HCA Capabilities (%u).\n",\r
-                               vapi_res);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* go over all ports - to obtail their guids */\r
-               for (portIdx = 0; portIdx < hca_cap.phys_port_num; portIdx++) {\r
-                       vapi_res =\r
-                           VAPI_query_hca_gid_tbl(hca_hndl, portIdx + 1, 0,\r
-                                                  &maxNumGids, NULL);\r
-                       p_port_gid =\r
-                           (IB_gid_t *) malloc(maxNumGids * sizeof(IB_gid_t));\r
-\r
-                       /* get the port guid */\r
-                       vapi_res =\r
-                           VAPI_query_hca_gid_tbl(hca_hndl, portIdx + 1,\r
-                                                  maxNumGids, &maxNumGids,\r
-                                                  p_port_gid);\r
-                       if (vapi_res != VAPI_OK) {\r
-                               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                                       "osm_vendor_get_guid_ca_and_port: ERR 3D19: "\r
-                                       "Fail to get HCA Port GID (%d).\n",\r
-                                       vapi_res);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       /* convert to SF style */\r
-                       __osm_vendor_gid_to_guid(p_port_gid[0],\r
-                                                (VAPI_gid_t *) & port_guid);\r
-\r
-                       /* finally did we find it ? */\r
-                       if (port_guid == guid) {\r
-                               *p_hca_hndl = hca_hndl;\r
-                               memcpy(p_hca_id, p_ca_ids[ca],\r
-                                      sizeof(VAPI_hca_id_t));\r
-                               *p_hca_idx = ca;\r
-                               *p_port_num = portIdx + 1;\r
-                               status = IB_SUCCESS;\r
-                               goto Exit;\r
-                       }\r
-\r
-                       free(p_port_gid);\r
-                       p_port_gid = NULL;\r
-               }               /*  ALL PORTS  */\r
-       }                       /*  all HCAs */\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_get_guid_ca_and_port: ERR 3D20: "\r
-               "Fail to find HCA and Port for Port Guid 0x%" PRIx64 "\n",\r
-               cl_ntoh64(guid));\r
-       status = IB_INVALID_GUID;\r
-\r
-Exit:\r
-       if (p_ca_ids != NULL)\r
-               free(p_ca_ids);\r
-       if (p_port_gid != NULL)\r
-               free(p_port_gid);\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c
deleted file mode 100644 (file)
index 91efafa..0000000
+++ /dev/null
@@ -1,862 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#if defined(OSM_VENDOR_INTF_SIM)\r
-#undef IN\r
-#undef OUT\r
-\r
-#include <unistd.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_log.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <sys/types.h>\r
-#include <dirent.h>\r
-#include <stdlib.h>\r
-#include <sys/stat.h>\r
-#include <stdint.h>\r
-#include <fcntl.h>\r
-\r
-/******************************************************************************\r
-*\r
-* Provides the functionality for selecting an HCA Port and Obtaining it's guid.\r
-* This version is based on $IBMGTSIM_DIR/$IBMGTSIM_NODE file system.\r
-* This is a mimic of the OpenIB gen1 file system\r
-*\r
-******************************************************************************/\r
-\r
-char *__get_simulator_dir(void)\r
-{\r
-       static char *ibmgtSimDir = NULL;\r
-       static char *defaultIbmgtSimDir = "/tmp/ibmgtsim";\r
-       static char *ibmgtSimNode = NULL;\r
-       static char dirName[1024];\r
-\r
-       /* we use the first pointer to know if we were here */\r
-       if (ibmgtSimDir == NULL) {\r
-               /* obtain the simulator directory */\r
-               ibmgtSimDir = getenv("IBMGTSIM_DIR");\r
-               if (ibmgtSimDir == NULL) {\r
-                       printf\r
-                           ("-W- Environment variable: IBMGTSIM_DIR does not exist.\n");\r
-                       printf\r
-                           ("    Please create one used by the simulator.\n");\r
-                       printf("    Using /tmp/ibmgtsim as default.\n");\r
-                       ibmgtSimDir = defaultIbmgtSimDir;\r
-               }\r
-\r
-               /* obtain the node name we simulate */\r
-               ibmgtSimNode = getenv("IBMGTSIM_NODE");\r
-               if (ibmgtSimNode == NULL) {\r
-                       printf\r
-                           ("-W- Environment variable: IBMGTSIM_NODE does not exist.\n");\r
-                       printf\r
-                           ("    This variable should be the name of the node you wish to simulate.\n");\r
-                       printf("    Using H-1 as default.\n");\r
-                       ibmgtSimNode = "H-1";\r
-               }\r
-               sprintf(dirName, "%s/%s", ibmgtSimDir, ibmgtSimNode);\r
-       }\r
-\r
-       return dirName;\r
-}\r
-\r
-typedef struct _osm_ca_info {\r
-       ib_net64_t guid;\r
-       size_t attr_size;\r
-       ib_ca_attr_t *p_attr;\r
-\r
-} osm_ca_info_t;\r
-\r
-/**********************************************************************\r
- * Returns a pointer to the port attribute of the specified port\r
- * owned by this CA.\r
- ************************************************************************/\r
-static ib_port_attr_t *__osm_ca_info_get_port_attr_ptr(IN const osm_ca_info_t *\r
-                                                      const p_ca_info,\r
-                                                      IN const uint8_t index)\r
-{\r
-       return (&p_ca_info->p_attr->p_port_attr[index]);\r
-}\r
-\r
-/**********************************************************************\r
- * Obtain the number of local CAs by scanning /proc/infiniband/core\r
- **********************************************************************/\r
-int __hca_sim_get_num_cas(void)\r
-{\r
-       int num_cas = 0;\r
-       DIR *dp;\r
-       struct dirent *ep;\r
-\r
-       dp = opendir(__get_simulator_dir());\r
-\r
-       if (dp != NULL) {\r
-               while ((ep = readdir(dp))) {\r
-                       /* CAs are directories with the format ca[1-9][0-9]* */\r
-                       /*  if ((ep->d_type == DT_DIR) && !strncmp(ep->d_name, "ca", 2)) */\r
-                       if (!strncmp(ep->d_name, "ca", 2)) {\r
-                               num_cas++;\r
-                       }\r
-               }\r
-               closedir(dp);\r
-       } else {\r
-               printf("__hca_sim_get_num_cas: ERROR : ail to open dir %s\n",\r
-                      __get_simulator_dir());\r
-               exit(1);\r
-       }\r
-\r
-       if (!num_cas)\r
-               exit(1);\r
-       return num_cas;\r
-}\r
-\r
-/*\r
-  name:          InfiniHost0\r
-  provider:      tavor\r
-  node GUID:     0002:c900:0120:3470\r
-  ports:         2\r
-  vendor ID:     0x2c9\r
-  device ID:     0x5a44\r
-  HW revision:   0xa1\r
-  FW revision:   0x300020080\r
-*/\r
-typedef struct _sim_ca_info {\r
-       char name[32];\r
-       char provider[32];\r
-       uint64_t guid;\r
-       uint8_t num_ports;\r
-       uint32_t vend_id;\r
-       uint16_t dev_id;\r
-       uint16_t rev_id;\r
-       uint64_t fw_rev;\r
-} sim_ca_info_t;\r
-\r
-/**********************************************************************\r
- * Parse the CA Info file available in ibmgtSimDir/caN/info\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__parse_ca_info_file(IN osm_vendor_t * const p_vend,\r
-                    IN uint32_t idx, OUT sim_ca_info_t * sim_ca_info)\r
-{\r
-       ib_api_status_t status = IB_ERROR;\r
-       int info_file;\r
-       char file_name[256];\r
-       char file_buffer[3200];\r
-       char *p_ch;\r
-       int g1, g2, g3, g4;\r
-       int num_ports;\r
-       uint32_t len;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__parse_ca_info_file: " "Querying CA %d.\n", idx);\r
-\r
-       /* we use the proc file system so we must be able to open the info file .. */\r
-       sprintf(file_name, "%s/ca%d/info", __get_simulator_dir(), idx);\r
-       info_file = open(file_name, O_RDONLY);\r
-       if (!info_file) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5105: "\r
-                       "Fail to open HCA:%d info file:(%s).\n", idx,\r
-                       file_name);\r
-               goto Exit;\r
-       }\r
-\r
-       /* read in the file */\r
-       len = read(info_file, file_buffer, 3200);\r
-       close(info_file);\r
-       file_buffer[len] = '\0';\r
-\r
-       /*\r
-          parse the file ...\r
-          name:          InfiniHost0\r
-          provider:      tavor\r
-          node GUID:     0002:c900:0120:3470\r
-          ports:         2\r
-          vendor ID:     0x2c9\r
-          device ID:     0x5a44\r
-          HW revision:   0xa1\r
-          FW revision:   0x300020080\r
-        */\r
-       if (!(p_ch = strstr(file_buffer, "name:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5106: "\r
-                       "Fail to obtain HCA name. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "name: %s", sim_ca_info->name) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5107: "\r
-                       "Fail to parse name in info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-\r
-       /* get the guid of the HCA */\r
-       if (!(p_ch = strstr(file_buffer, "node GUID:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5108: "\r
-                       "Fail to obtain GUID in info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "node GUID: %x:%x:%x:%x", &g1, &g2, &g3, &g4) != 4) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5109: "\r
-                       "Fail to parse GUID in info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_ca_info->guid = (uint64_t) g1 << 48 | (uint64_t) g1 << 32\r
-           | (uint64_t) g1 << 16 | (uint64_t) g3;\r
-\r
-       /* obtain number of ports */\r
-       if (!(p_ch = strstr(file_buffer, "ports:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5110: "\r
-                       "Fail to obtain number of ports in info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "ports: %d", &num_ports) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_ca_info_file: ERR 5111: "\r
-                       "Fail to parse num ports in info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_ca_info->num_ports = num_ports;\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__parse_ca_info_file: "\r
-               "CA1 = name:%s guid:0x%016llx ports:%d\n",\r
-               sim_ca_info->name, sim_ca_info->guid, sim_ca_info->num_ports);\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
-  state:         ACTIVE\r
-  LID:           0x0001\r
-  LMC:           0x0000\r
-  SM LID:        0x0001\r
-  SM SL:         0x0000\r
-  Capabilities:  IsSM\r
-  IsTrapSupported\r
-  IsAutomaticMigrationSupported\r
-  IsSLMappingSupported\r
-  IsLEDInfoSupported\r
-  IsSystemImageGUIDSupported\r
-  IsVendorClassSupported\r
-  IsCapabilityMaskNoticeSupported\r
-*/\r
-typedef struct _sim_port_info {\r
-       uint8_t state;\r
-       uint16_t lid;\r
-       uint8_t lmc;\r
-       uint16_t sm_lid;\r
-       uint8_t sm_sl;\r
-} sim_port_info_t;\r
-\r
-/**********************************************************************\r
- * Parse the Port Info file available in ibmgtSimDir/caN/portM/info\r
- * Port num is 1..N\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__parse_port_info_file(IN osm_vendor_t * const p_vend,\r
-                      IN uint32_t hca_idx,\r
-                      IN uint8_t port_num, OUT sim_port_info_t * sim_port_info)\r
-{\r
-       ib_api_status_t status = IB_ERROR;\r
-       int info_file;\r
-       char file_name[256];\r
-       char file_buffer[3200];\r
-       char state[12];\r
-       char *p_ch;\r
-       int lid, sm_lid, lmc, sm_sl;\r
-       uint32_t len;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__parse_port_info_file: "\r
-               "Parsing Proc File System Port Info CA %d Port %d.\n", hca_idx,\r
-               port_num);\r
-\r
-       /* we use the proc file system so we must be able to open the info file .. */\r
-       sprintf(file_name, "%s/ca%d/port%d/info", __get_simulator_dir(),\r
-               hca_idx, port_num);\r
-       info_file = open(file_name, O_RDONLY);\r
-       if (!info_file) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5112: "\r
-                       "Fail to open HCA:%d Port:%d info file:(%s).\n",\r
-                       hca_idx, port_num, file_name);\r
-               goto Exit;\r
-       }\r
-\r
-       /* read in the file */\r
-       len = read(info_file, file_buffer, 3200);\r
-       close(info_file);\r
-       file_buffer[len] = '\0';\r
-\r
-       /*\r
-          parse the file ...\r
-          state:         ACTIVE\r
-          LID:           0x0001\r
-          LMC:           0x0000\r
-          SM LID:        0x0001\r
-          SM SL:         0x0000\r
-          ...\r
-        */\r
-       if (!(p_ch = strstr(file_buffer, "state:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5113: "\r
-                       "Fail to obtain port state. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "state: %s", state) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5114: "\r
-                       "Fail to parse state from info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-\r
-       if (!strcmp(state, "ACTIVE"))\r
-               sim_port_info->state = IB_LINK_ACTIVE;\r
-       else if (!strcmp(state, "DOWN"))\r
-               sim_port_info->state = IB_LINK_DOWN;\r
-       else if (!strcmp(state, "INIT"))\r
-               sim_port_info->state = IB_LINK_INIT;\r
-       else if (!strcmp(state, "ARMED"))\r
-               sim_port_info->state = IB_LINK_ARMED;\r
-       else\r
-               sim_port_info->state = 0;\r
-\r
-       /* get lid */\r
-       if (!(p_ch = strstr(file_buffer, "LID:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5115: "\r
-                       "Fail to obtain port lid. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "LID: %x", &lid) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5116: "\r
-                       "Fail to parse lid from info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_port_info->lid = lid;\r
-       /* get LMC */\r
-       if (!(p_ch = strstr(file_buffer, "LMC:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5117: "\r
-                       "Fail to obtain port LMC. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "LMC: %x", &lmc) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5118: "\r
-                       "Fail to parse LMC from info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_port_info->lmc = lmc;\r
-\r
-       /* get SM LID */\r
-       if (!(p_ch = strstr(file_buffer, "SM LID:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5119: "\r
-                       "Fail to obtain port SM LID. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "SM LID: %x", &sm_lid) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5120: "\r
-                       "Fail to parse SM LID from info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_port_info->sm_lid = sm_lid;\r
-\r
-       /* get SM LID */\r
-       if (!(p_ch = strstr(file_buffer, "SM SL:"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5121: "\r
-                       "Fail to obtain port SM SL. In info file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch, "SM SL: %x", &sm_sl) != 1) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__parse_port_info_file: ERR 5122: "\r
-                       "Fail to parse SM SL from info file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-       sim_port_info->sm_sl = sm_sl;\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__parse_port_info_file:  "\r
-               "Obtained Port:%d = state:%d, lid:0x%04X, lmc:%d, sm_lid:0x%04X, sm_sl:%d\n",\r
-               port_num, sim_port_info->state, sim_port_info->lid,\r
-               sim_port_info->lmc, sim_port_info->sm_lid,\r
-               sim_port_info->sm_sl);\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * Parse the port guid_tbl file to obtain the port guid.\r
- * File format is:\r
- * [  0] fe80:0000:0000:0000:0002:c900:0120:3472\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__get_port_guid_from_port_gid_tbl(IN osm_vendor_t * const p_vend,\r
-                                 IN uint32_t hca_idx,\r
-                                 IN uint8_t port_num, OUT uint64_t * port_guid)\r
-{\r
-       ib_api_status_t status = IB_ERROR;\r
-       int info_file;\r
-       char file_name[256];\r
-       char file_buffer[3200];\r
-       char *p_ch;\r
-       int g[8];\r
-       uint32_t len;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__get_port_guid_from_port_gid_tbl: "\r
-               "Parsing Proc File System Port Guid Table CA %d Port %d.\n",\r
-               hca_idx, port_num);\r
-\r
-       /* we use the proc file system so we must be able to open the info file .. */\r
-       sprintf(file_name, "%s/ca%d/port%d/gid_table",\r
-               __get_simulator_dir(), hca_idx, port_num);\r
-       info_file = open(file_name, O_RDONLY);\r
-       if (!info_file) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__get_port_guid_from_port_gid_tbl: ERR 5123: "\r
-                       "Fail to open HCA:%d Port:%d gid_table file:(%s).\n",\r
-                       hca_idx, port_num, file_name);\r
-               goto Exit;\r
-       }\r
-\r
-       /* read in the file */\r
-       len = read(info_file, file_buffer, 3200);\r
-       close(info_file);\r
-       file_buffer[len] = '\0';\r
-\r
-       /*\r
-          parse the file ...\r
-          [  0] fe80:0000:0000:0000:0002:c900:0120:3472\r
-          ...\r
-        */\r
-       if (!(p_ch = strstr(file_buffer, "[  0]"))) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__get_port_guid_from_port_gid_tbl: ERR 5124: "\r
-                       "Fail to obtain first gid index. In gid_table file:(%s).\n",\r
-                       file_buffer);\r
-               goto Exit;\r
-       }\r
-       if (sscanf(p_ch + 6, "%x:%x:%x:%x:%x:%x:%x:%x",\r
-                  &g[7], &g[6], &g[5], &g[4], &g[3], &g[2], &g[1], &g[0]) != 8)\r
-       {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__get_port_guid_from_port_gid_tbl: ERR 5125: "\r
-                       "Fail to parse gid from gid_table file:(%s).\n", p_ch);\r
-               goto Exit;\r
-       }\r
-\r
-       *port_guid =\r
-           (uint64_t) g[3] << 48 | (uint64_t) g[2] << 32 | (uint64_t) g[1] <<\r
-           16 | g[0];\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * Initialize an Info Struct for the Given HCA by its index 1..N\r
- **********************************************************************/\r
-static ib_api_status_t\r
-__osm_ca_info_init(IN osm_vendor_t * const p_vend,\r
-                  IN uint32_t const idx, OUT osm_ca_info_t * const p_ca_info)\r
-{\r
-       ib_api_status_t status = IB_ERROR;\r
-       uint8_t port_num;\r
-       uint64_t port_guid;\r
-\r
-       sim_ca_info_t sim_ca_info;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       /* parse the CA info file */\r
-       if (__parse_ca_info_file(p_vend, idx, &sim_ca_info) != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_ca_info->guid = cl_hton64(sim_ca_info.guid);\r
-\r
-       /* set size of attributes and allocate them */\r
-       p_ca_info->attr_size = 1;\r
-       p_ca_info->p_attr = (ib_ca_attr_t *) malloc(sizeof(ib_ca_attr_t));\r
-\r
-       p_ca_info->p_attr->ca_guid = p_ca_info->guid;\r
-       p_ca_info->p_attr->num_ports = sim_ca_info.num_ports;\r
-\r
-       /* now obtain the attributes of the ports */\r
-       p_ca_info->p_attr->p_port_attr =\r
-           (ib_port_attr_t *) malloc(sim_ca_info.num_ports *\r
-                                     sizeof(ib_port_attr_t));\r
-\r
-       /* get all the ports info */\r
-       for (port_num = 1; port_num <= sim_ca_info.num_ports; port_num++) {\r
-               sim_port_info_t sim_port_info;\r
-               /* query the port attributes */\r
-               if (__parse_port_info_file\r
-                   (p_vend, idx, port_num, &sim_port_info)) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "__osm_ca_info_init: ERR 5126: "\r
-                               "Fail to get HCA:%d Port:%d Attributes.\n", idx,\r
-                               port_num);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* HACK: the lids should have been converted to network but the rest of the code\r
-                  is wrong and provdes them as is (host order) - so we stick with it. */\r
-               p_ca_info->p_attr->p_port_attr[port_num - 1].lid =\r
-                   sim_port_info.lid;\r
-               p_ca_info->p_attr->p_port_attr[port_num - 1].link_state =\r
-                   sim_port_info.state;\r
-               p_ca_info->p_attr->p_port_attr[port_num - 1].sm_lid =\r
-                   sim_port_info.sm_lid;\r
-\r
-               /* get the port guid */\r
-               if (__get_port_guid_from_port_gid_tbl\r
-                   (p_vend, idx, port_num, &port_guid)) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "__osm_ca_info_init: ERR 5127: "\r
-                               "Fail to get HCA:%d Port:%d Guid.\n", idx,\r
-                               port_num);\r
-                       goto Exit;\r
-               }\r
-               p_ca_info->p_attr->p_port_attr[port_num - 1].port_guid =\r
-                   cl_hton64(port_guid);\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-void\r
-osm_ca_info_destroy(IN osm_vendor_t * const p_vend,\r
-                   IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca)\r
-{\r
-       osm_ca_info_t *p_ca;\r
-       uint8_t i;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       for (i = 0; i < num_ca; i++) {\r
-               p_ca = &p_ca_info[i];\r
-\r
-               if (NULL != p_ca->p_attr) {\r
-                       if (0 != p_ca->p_attr->num_ports) {\r
-                               free(p_ca->p_attr->p_port_attr);\r
-                       }\r
-\r
-                       free(p_ca->p_attr);\r
-               }\r
-       }\r
-\r
-       free(p_ca_info);\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Fill in the array of port_attr with all available ports on ALL the\r
- * avilable CAs on this machine.\r
- **********************************************************************/\r
-ib_api_status_t\r
-osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,\r
-                            IN ib_port_attr_t * const p_attr_array,\r
-                            IN uint32_t * const p_num_ports)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       uint32_t caIdx;\r
-       uint32_t ca_count = 0;\r
-       uint32_t port_count = 0;\r
-       uint8_t port_num;\r
-       uint32_t total_ports = 0;\r
-       osm_ca_info_t *p_ca_infos = NULL;\r
-       uint32_t attr_array_sz = *p_num_ports;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       /* determine the number of CA's */\r
-       ca_count = __hca_sim_get_num_cas();\r
-       if (!ca_count) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_all_port_attr: ERR 5128: "\r
-                       "Fail to get Any CA Ids.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* Allocate an array big enough to hold the ca info objects */\r
-       p_ca_infos = malloc(ca_count * sizeof(osm_ca_info_t));\r
-       if (p_ca_infos == NULL) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_all_port_attr: ERR 5129: "\r
-                       "Unable to allocate CA information array.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_ca_infos, 0, ca_count * sizeof(osm_ca_info_t));\r
-\r
-       /*\r
-        * For each CA, retrieve the CA info attributes\r
-        */\r
-       for (caIdx = 1; caIdx <= ca_count; caIdx++) {\r
-               status =\r
-                   __osm_ca_info_init(p_vend, caIdx, &p_ca_infos[caIdx - 1]);\r
-               if (status != IB_SUCCESS) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "osm_vendor_get_all_port_attr: ERR 5130: "\r
-                               "Unable to initialize CA Info object (%s).\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               total_ports += p_ca_infos[caIdx - 1].p_attr->num_ports;\r
-       }\r
-\r
-       *p_num_ports = total_ports;\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "osm_vendor_get_all_port_attr: total ports:%u \n", total_ports);\r
-\r
-       /*\r
-        * If the user supplied enough storage, return the port guids,\r
-        * otherwise, return the appropriate error.\r
-        */\r
-       if (attr_array_sz >= total_ports) {\r
-               for (caIdx = 1; caIdx <= ca_count; caIdx++) {\r
-                       uint32_t num_ports;\r
-\r
-                       num_ports = p_ca_infos[caIdx - 1].p_attr->num_ports;\r
-\r
-                       for (port_num = 0; port_num < num_ports; port_num++) {\r
-                               p_attr_array[port_count] =\r
-                                   *__osm_ca_info_get_port_attr_ptr(&p_ca_infos\r
-                                                                    [caIdx -\r
-                                                                     1],\r
-                                                                    port_num);\r
-                               port_count++;\r
-                       }\r
-               }\r
-       } else {\r
-               status = IB_INSUFFICIENT_MEMORY;\r
-               goto Exit;\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       if (p_ca_infos) {\r
-               osm_ca_info_destroy(p_vend, p_ca_infos, ca_count);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Given the vendor obj and a port guid\r
- * return the ca id and port number that have that guid\r
- **********************************************************************/\r
-\r
-ib_api_status_t\r
-osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                               IN ib_net64_t const guid,\r
-                               OUT uint32_t * p_hca_hndl,\r
-                               OUT char *p_hca_id,\r
-                               OUT uint8_t * p_hca_idx,\r
-                               OUT uint32_t * p_port_num)\r
-{\r
-       uint32_t caIdx;\r
-       uint32_t ca_count = 0;\r
-       uint8_t port_num;\r
-       ib_api_status_t status = IB_ERROR;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       /* determine the number of CA's */\r
-       ca_count = __hca_sim_get_num_cas();\r
-       if (!ca_count) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_guid_ca_and_port: ERR 5131: "\r
-                       "Fail to get Any CA Ids.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * For each CA, retrieve the CA info attributes\r
-        */\r
-       for (caIdx = 1; caIdx <= ca_count; caIdx++) {\r
-               sim_ca_info_t sim_ca_info;\r
-               if (__parse_ca_info_file(p_vend, caIdx, &sim_ca_info) ==\r
-                   IB_SUCCESS) {\r
-                       /* get all the ports info */\r
-                       for (port_num = 1; port_num <= sim_ca_info.num_ports;\r
-                            port_num++) {\r
-                               uint64_t port_guid;\r
-                               if (!__get_port_guid_from_port_gid_tbl\r
-                                   (p_vend, caIdx, port_num, &port_guid)) {\r
-                                       if (cl_hton64(port_guid) == guid) {\r
-                                               osm_log(p_vend->p_log,\r
-                                                       OSM_LOG_DEBUG,\r
-                                                       "osm_vendor_get_guid_ca_and_port: "\r
-                                                       "Found Matching guid on HCA:%d Port:%d.\n",\r
-                                                       caIdx, port_num);\r
-                                               strcpy(p_hca_id,\r
-                                                      sim_ca_info.name);\r
-                                               *p_port_num = port_num;\r
-                                               *p_hca_idx = caIdx - 1;\r
-                                               *p_hca_hndl = 0;\r
-                                               status = IB_SUCCESS;\r
-                                               goto Exit;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_get_guid_ca_and_port: ERR 5132: "\r
-               "Fail to find HCA and Port for Port Guid 0x%" PRIx64 "\n",\r
-               cl_ntoh64(guid));\r
-       status = IB_INVALID_GUID;\r
-\r
-Exit:\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Given the vendor obj HCA ID and Port Num\r
- * update the given port guid if found. Return 0 on success.\r
- **********************************************************************/\r
-\r
-ib_api_status_t\r
-osm_vendor_get_guid_by_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                                  IN char *hca_id,\r
-                                  IN uint32_t port_num,\r
-                                  OUT uint64_t * p_port_guid)\r
-{\r
-       uint32_t caIdx;\r
-       uint32_t ca_count = 0;\r
-       ib_api_status_t status = IB_ERROR;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_vend);\r
-\r
-       /* determine the number of CA's */\r
-       ca_count = __hca_sim_get_num_cas();\r
-       if (!ca_count) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_get_guid_by_ca_and_port: ERR 5133: "\r
-                       "Fail to get Any CA Ids.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * For each CA, retrieve the CA info attributes\r
-        */\r
-       for (caIdx = 1; caIdx <= ca_count; caIdx++) {\r
-               sim_ca_info_t sim_ca_info;\r
-               if (__parse_ca_info_file(p_vend, caIdx, &sim_ca_info) ==\r
-                   IB_SUCCESS) {\r
-                       /* if not identical by id - go to next one */\r
-                       if (strcmp(sim_ca_info.name, hca_id))\r
-                               continue;\r
-\r
-                       if ((port_num < 1)\r
-                           || (port_num > sim_ca_info.num_ports)) {\r
-                               return 1;\r
-                       }\r
-\r
-                       if (!__get_port_guid_from_port_gid_tbl\r
-                           (p_vend, caIdx, port_num, p_port_guid)) {\r
-                               osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                                       "osm_vendor_get_guid_by_ca_and_port: "\r
-                                       "Found Matching guid on HCA:%d Port:%d.\n",\r
-                                       caIdx, port_num);\r
-                               status = IB_SUCCESS;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-               "osm_vendor_get_guid_by_ca_and_port: ERR 5134: "\r
-               "Fail to find HCA:%s\n", hca_id);\r
-       status = IB_INVALID_GUID;\r
-\r
-Exit:\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_ibmgt.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_ibmgt.c
deleted file mode 100644 (file)
index d54296f..0000000
+++ /dev/null
@@ -1,783 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*  AUTHOR                 Edward Bortnikov\r
- *\r
- *  DESCRIPTION\r
- *     The lower-level MAD transport interface implementation\r
- *     that allows sending a single MAD/receiving a callback\r
- *     when a single MAD is received.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ib_mgt.h>\r
-#include <complib/cl_event.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_dispatcher.h>\r
-#include <opensm/osm_log.h>\r
-\r
-typedef struct _osmv_IBMGT_transport_mgr_ {\r
-       IB_MGT_mad_type_t mad_type;\r
-       uint8_t mgmt_class;     /* for gsi */\r
-       /* for communication between send call back and send mad */\r
-       boolean_t is_send_ok;\r
-       cl_event_t send_done;\r
-} osmv_IBMGT_transport_mgr_t;\r
-\r
-typedef struct _osmv_IBMGT_transport_info_ {\r
-       IB_MGT_mad_hndl_t smi_h;\r
-       cl_qlist_t *p_smi_list;\r
-\r
-       IB_MGT_mad_hndl_t gsi_h;\r
-       /* holds bind object list for every binded mgmt class */\r
-       cl_qlist_t *gsi_mgmt_lists[15];\r
-} osmv_IBMGT_transport_info_t;\r
-\r
-static void\r
-__osmv_IBMGT_rcv_desc_to_osm_addr(IN IB_MGT_mad_rcv_desc_t * p_rcv_desc,\r
-                                 IN uint8_t is_smi,\r
-                                 OUT osm_mad_addr_t * p_mad_addr);\r
-\r
-static void\r
-__osmv_IBMGT_osm_addr_to_ibmgt_addr(IN const osm_mad_addr_t * p_mad_addr,\r
-                                   IN uint8_t is_smi, OUT IB_ud_av_t * p_av);\r
-\r
-void\r
-__osmv_IBMGT_send_cb(IN IB_MGT_mad_hndl_t mad_hndl,\r
-                    IN u_int64_t wrid,\r
-                    IN IB_comp_status_t status, IN void *private_ctx_p);\r
-\r
-void\r
-__osmv_IBMGT_rcv_cb(IN IB_MGT_mad_hndl_t mad_hndl,\r
-                   IN void *private_ctx_p,\r
-                   IN void *payload_p,\r
-                   IN IB_MGT_mad_rcv_desc_t * rcv_remote_info_p);\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_init\r
- *\r
- * DESCRIPTION\r
- *   Setup the MAD transport infrastructure (filters, callbacks etc).\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_init(IN osm_bind_info_t * p_info,\r
-                   IN char hca_id[VENDOR_HCA_MAXNAMES],\r
-                   IN uint8_t hca_idx, IN osmv_bind_obj_t * p_bo)\r
-{\r
-       ib_api_status_t st = IB_SUCCESS;\r
-       IB_MGT_ret_t ret;\r
-       IB_MGT_mad_type_t mad_type;\r
-       osmv_IBMGT_transport_mgr_t *p_mgr;\r
-       osmv_IBMGT_transport_info_t *p_tpot_info;\r
-       cl_list_obj_t *p_obj = NULL;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-       int i;\r
-\r
-       UNUSED_PARAM(hca_idx);\r
-\r
-       /* if first bind, allocate tranport_info at vendor */\r
-       if (NULL == p_bo->p_vendor->p_transport_info) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "osmv_transport_init: first bind() for the vendor\n");\r
-               p_bo->p_vendor->p_transport_info\r
-                   = (osmv_IBMGT_transport_info_t *)\r
-                   malloc(sizeof(osmv_IBMGT_transport_info_t));\r
-               if (NULL == p_bo->p_vendor->p_transport_info) {\r
-                       return IB_INSUFFICIENT_MEMORY;\r
-               }\r
-               memset(p_bo->p_vendor->p_transport_info, 0,\r
-                      sizeof(osmv_IBMGT_transport_info_t));\r
-               p_tpot_info =\r
-                   (osmv_IBMGT_transport_info_t *) (p_bo->p_vendor->\r
-                                                    p_transport_info);\r
-\r
-               p_tpot_info->smi_h = 0xffffffff;\r
-               p_tpot_info->p_smi_list = NULL;\r
-\r
-               p_tpot_info->gsi_h = 0xffffffff;\r
-               for (i = 0; i < 15; i++) {\r
-\r
-                       p_tpot_info->gsi_mgmt_lists[i] = NULL;\r
-               }\r
-\r
-       } else {\r
-\r
-               p_tpot_info =\r
-                   (osmv_IBMGT_transport_info_t *) (p_bo->p_vendor->\r
-                                                    p_transport_info);\r
-       }\r
-\r
-       /* Initialize the magic_ptr to the pointer of the p_bo info.\r
-          This will be used to signal when the object is being destroyed, so no\r
-          real action will be done then. */\r
-       p_bo->magic_ptr = p_bo;\r
-\r
-       /* allocate transport mgr */\r
-       p_mgr = malloc(sizeof(osmv_IBMGT_transport_mgr_t));\r
-       if (NULL == p_mgr) {\r
-               free(p_tpot_info);\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osmv_transport_init: ERR 7201: " "alloc failed \n");\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_mgr, 0, sizeof(osmv_IBMGT_transport_mgr_t));\r
-\r
-       p_bo->p_transp_mgr = p_mgr;\r
-\r
-       switch (p_info->mad_class) {\r
-       case IB_MCLASS_SUBN_LID:\r
-       case IB_MCLASS_SUBN_DIR:\r
-               mad_type = IB_MGT_SMI;\r
-               break;\r
-\r
-       case IB_MCLASS_SUBN_ADM:\r
-       default:\r
-               mad_type = IB_MGT_GSI;\r
-               break;\r
-       }\r
-\r
-       /* we only support one class registration per SMI/GSI !!! */\r
-       switch (mad_type) {\r
-       case IB_MGT_SMI:\r
-               /* we do not need to bind the handle if already available */\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "osmv_transport_init: SMI bind\n");\r
-\r
-               if (p_tpot_info->smi_h == 0xffffffff) {\r
-                       ret = IB_MGT_get_handle(hca_id,\r
-                                               p_bo->port_num,\r
-                                               IB_MGT_SMI,\r
-                                               &(p_tpot_info->smi_h));\r
-                       if (IB_MGT_OK != ret) {\r
-                               osm_log(p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7202: "\r
-                                       "IB_MGT_get_handle for smi failed \n");\r
-                               st = IB_ERROR;\r
-                               free(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "osmv_transport_init: got smi handle:%d \n",\r
-                               p_tpot_info->smi_h);\r
-\r
-                       ret = IB_MGT_bind_sm(p_tpot_info->smi_h);\r
-                       if (IB_MGT_OK != ret) {\r
-                               osm_log(p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7203: "\r
-                                       "IB_MGT_bind_sm failed \n");\r
-                               st = IB_ERROR;\r
-                               free(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       /* init smi list */\r
-                       p_tpot_info->p_smi_list = malloc(sizeof(cl_qlist_t));\r
-                       if (NULL == p_tpot_info->p_smi_list) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7204: "\r
-                                       "alloc failed \n");\r
-                               IB_MGT_unbind_sm(p_tpot_info->smi_h);\r
-                               IB_MGT_release_handle(p_tpot_info->smi_h);\r
-                               free(p_mgr);\r
-                               return IB_INSUFFICIENT_MEMORY;\r
-                       }\r
-                       memset(p_tpot_info->p_smi_list, 0, sizeof(cl_qlist_t));\r
-                       cl_qlist_init(p_tpot_info->p_smi_list);\r
-\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "osmv_transport_init: before reg_cb\n");\r
-                       ret = IB_MGT_reg_cb(p_tpot_info->smi_h,\r
-                                           &__osmv_IBMGT_rcv_cb,\r
-                                           p_bo,\r
-                                           &__osmv_IBMGT_send_cb,\r
-                                           p_tpot_info->p_smi_list,\r
-                                           IB_MGT_RCV_CB_MASK |\r
-                                           IB_MGT_SEND_CB_MASK);\r
-                       if (ret != IB_SUCCESS) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7205: "\r
-                                       "reg_cb failed with return code:%x \n",\r
-                                       ret);\r
-                               IB_MGT_unbind_sm(p_tpot_info->smi_h);\r
-                               IB_MGT_release_handle(p_tpot_info->smi_h);\r
-                               free(p_tpot_info->p_smi_list);\r
-                               free(p_mgr);\r
-                               st = IB_ERROR;\r
-                               goto Exit;\r
-                       }\r
-\r
-               }\r
-               /* insert to list of smi's - for raising callbacks later on */\r
-               p_obj = malloc(sizeof(cl_list_obj_t));\r
-               if (p_obj)\r
-                       memset(p_obj, 0, sizeof(cl_list_obj_t));\r
-               cl_qlist_set_obj(p_obj, p_bo);\r
-               cl_qlist_insert_tail(p_tpot_info->p_smi_list,\r
-                                    &p_obj->list_item);\r
-\r
-               break;\r
-\r
-       case IB_MGT_GSI:\r
-               /* we do not need to bind the handle if already available */\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "osmv_transport_init: ERR 7206: GSI bind\n");\r
-               if (p_tpot_info->gsi_h == 0xffffffff) {\r
-                       ret = IB_MGT_get_handle(hca_id,\r
-                                               p_bo->port_num,\r
-                                               IB_MGT_GSI,\r
-                                               &(p_tpot_info->gsi_h));\r
-                       if (IB_MGT_OK != ret) {\r
-                               osm_log(p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7207: "\r
-                                       "IB_MGT_get_handle for gsi failed \n");\r
-                               st = IB_ERROR;\r
-                               free(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-               }\r
-\r
-               /* this mgmt class was not binded yet */\r
-               if (p_tpot_info->gsi_mgmt_lists[p_info->mad_class] == NULL) {\r
-                       ret =\r
-                           IB_MGT_bind_gsi_class(p_tpot_info->gsi_h,\r
-                                                 p_info->mad_class);\r
-                       if (IB_MGT_OK != ret) {\r
-                               osm_log(p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_init: ERR 7208: "\r
-                                       "IB_MGT_bind_gsi_class failed \n");\r
-                               st = IB_ERROR;\r
-                               free(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       p_tpot_info->gsi_mgmt_lists[p_info->mad_class] =\r
-                           malloc(sizeof(cl_qlist_t));\r
-                       if (NULL ==\r
-                           p_tpot_info->gsi_mgmt_lists[p_info->mad_class]) {\r
-                               IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,\r
-                                                       p_info->mad_class);\r
-                               free(p_mgr);\r
-                               return IB_INSUFFICIENT_MEMORY;\r
-                       }\r
-                       memset(p_tpot_info->gsi_mgmt_lists[p_info->mad_class],\r
-                              0, sizeof(cl_qlist_t));\r
-                       cl_qlist_init(p_tpot_info->\r
-                                     gsi_mgmt_lists[p_info->mad_class]);\r
-               }\r
-               /* insert to list of smi's - for raising callbacks later on */\r
-               p_obj = malloc(sizeof(cl_list_obj_t));\r
-               if (p_obj)\r
-                       memset(p_obj, 0, sizeof(cl_list_obj_t));\r
-               cl_qlist_set_obj(p_obj, p_bo);\r
-               cl_qlist_insert_tail(p_tpot_info->\r
-                                    gsi_mgmt_lists[p_info->mad_class],\r
-                                    &p_obj->list_item);\r
-\r
-               p_mgr->mgmt_class = p_info->mad_class;\r
-               ret = IB_MGT_reg_cb(p_tpot_info->gsi_h,\r
-                                   &__osmv_IBMGT_rcv_cb,\r
-                                   p_bo,\r
-                                   &__osmv_IBMGT_send_cb,\r
-                                   p_bo,\r
-                                   IB_MGT_RCV_CB_MASK | IB_MGT_SEND_CB_MASK);\r
-\r
-               if (ret != IB_SUCCESS) {\r
-                       IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,\r
-                                               p_mgr->mgmt_class);\r
-                       free(p_tpot_info->gsi_mgmt_lists[p_mgr->mgmt_class]);\r
-                       free(p_mgr);\r
-                       st = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               break;\r
-\r
-       default:\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_transport_init: ERR 7209: unrecognized mgmt class \n");\r
-               st = IB_ERROR;\r
-               free(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "osmv_transport_init: GSI bind\n");\r
-       cl_event_construct(&p_mgr->send_done);\r
-       cl_event_init(&p_mgr->send_done, TRUE);\r
-       p_mgr->is_send_ok = FALSE;\r
-       p_mgr->mad_type = mad_type;\r
-\r
-Exit:\r
-       /* OSM_LOG_EXIT(p_log ); */\r
-       return (ib_api_status_t) st;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_send_mad\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 byte)\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_mad_send(IN const osm_bind_handle_t h_bind,\r
-                       IN void *p_ib_mad, IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osmv_IBMGT_transport_info_t *p_tpot_info =\r
-           (osmv_IBMGT_transport_info_t *) (p_bo->p_vendor->p_transport_info);\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       ib_api_status_t status;\r
-       IB_ud_av_t av;\r
-       IB_MGT_ret_t ret;\r
-       ib_mad_t *p_mad = p_ib_mad;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       CL_ASSERT(p_bo->p_vendor->p_transport_info);\r
-\r
-       /*\r
-        * For all sends other than directed route SM MADs,\r
-        * acquire an address vector for the destination.\r
-        */\r
-       if (p_mad->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
-               __osmv_IBMGT_osm_addr_to_ibmgt_addr(p_mad_addr,\r
-                                                   p_mad->mgmt_class ==\r
-                                                   IB_MCLASS_SUBN_LID, &av);\r
-       } else {\r
-               /* is a directed route - we need to construct a permissive address */\r
-               memset(&av, 0, sizeof(av));\r
-               /* we do not need port number since it is part of the mad_hndl */\r
-               av.dlid = IB_LID_PERMISSIVE;\r
-       }\r
-\r
-       /* send it */\r
-       if ((p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) ||\r
-           (p_mad->mgmt_class == IB_MCLASS_SUBN_LID)) {\r
-\r
-               /* SMI CASE */\r
-               if (osm_log_is_active(p_vend->p_log, OSM_LOG_DEBUG)) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                               "osmv_transport_mad_send: "\r
-                               "av.dlid:0x%X, "\r
-                               "av.static_rate:%d, "\r
-                               "av.path_bits:%d.\n",\r
-                               cl_ntoh16(av.dlid), av.static_rate,\r
-                               av.src_path_bits);\r
-               }\r
-\r
-               ret = IB_MGT_send_mad(p_tpot_info->smi_h, p_mad,        /*  actual payload */\r
-                                     &av,      /*  address vector */\r
-                                     (u_int64_t) CAST_P2LONG(p_bo),\r
-                                     IB_MGT_DEFAULT_SEND_TIME);\r
-       } else {\r
-               /* GSI CASE - Support Remote QP */\r
-               if (osm_log_is_active(p_vend->p_log, OSM_LOG_DEBUG)) {\r
-                       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                               "osmv_transport_mad_send: "\r
-                               "av.dlid:0x%X, av.static_rate:%d, av.path_bits:%d, remote qp:%d \n",\r
-                               cl_ntoh16(av.dlid), av.static_rate,\r
-                               av.src_path_bits,\r
-                               cl_ntoh32(p_mad_addr->addr_type.gsi.remote_qp)\r
-                           );\r
-               }\r
-\r
-               ret = IB_MGT_send_mad_to_qp(p_tpot_info->gsi_h, p_mad,  /*  actual payload */\r
-                                           &av,        /*  address vector */\r
-                                           (u_int64_t) CAST_P2LONG(p_bo),\r
-                                           IB_MGT_DEFAULT_SEND_TIME,\r
-                                           cl_ntoh32(p_mad_addr->addr_type.gsi.\r
-                                                     remote_qp));\r
-\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-       if (ret != IB_MGT_OK) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osmv_transport_mad_send: ERR 7210: "\r
-                       "Error sending mad (%d).\n", ret);\r
-               status = IB_ERROR;\r
-       } else {\r
-               osmv_IBMGT_transport_mgr_t *p_mgr =\r
-                   (osmv_IBMGT_transport_mgr_t *) (p_bo->p_transp_mgr);\r
-\r
-               /* Let the others work when I am sleeping ... */\r
-               osmv_txn_unlock(p_bo);\r
-\r
-               cl_event_wait_on(&(p_mgr->send_done), 0xffffffff, TRUE);\r
-\r
-               /* Re-acquire the lock */\r
-               osmv_txn_lock(p_bo);\r
-\r
-               if (TRUE == p_bo->is_closing) {\r
-\r
-                       osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                               "osmv_transport_mad_send: ERR 7211: "\r
-                               "The handle %p is being unbound, cannot send.\n",\r
-                               h_bind);\r
-                       status = IB_ERROR;\r
-               }\r
-\r
-               if (p_mgr->is_send_ok == FALSE) {\r
-                       status = IB_ERROR;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-void osmv_transport_done(IN const osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-       osmv_IBMGT_transport_mgr_t *p_mgr;\r
-       osmv_IBMGT_transport_info_t *p_tpot_info;\r
-       IB_MGT_ret_t ret;\r
-       cl_list_obj_t *p_obj = NULL;\r
-       cl_list_item_t *p_item, *p_item_tmp;\r
-       int i;\r
-       cl_qlist_t *p_list = NULL;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       CL_ASSERT(p_bo);\r
-\r
-       /* First of all - zero out the magic_ptr, so if a callback is called -\r
-          it'll know that we are currently closing down, and will not handle the\r
-          mad. */\r
-       p_bo->magic_ptr = 0;\r
-\r
-       p_mgr = (osmv_IBMGT_transport_mgr_t *) (p_bo->p_transp_mgr);\r
-       p_tpot_info =\r
-           (osmv_IBMGT_transport_info_t *) (p_bo->p_vendor->p_transport_info);\r
-\r
-       switch (p_mgr->mad_type) {\r
-       case IB_MGT_SMI:\r
-               p_list = p_tpot_info->p_smi_list;\r
-\r
-               /* remove from the bindings list */\r
-               p_item = cl_qlist_head(p_list);\r
-               while (p_item != cl_qlist_end(p_list)) {\r
-                       p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-                       if (cl_qlist_obj(p_obj) == h_bind) {\r
-                               break;\r
-                       }\r
-                       p_item_tmp = cl_qlist_next(p_item);\r
-                       p_item = p_item_tmp;\r
-               }\r
-\r
-               CL_ASSERT(p_item != cl_qlist_end(p_list));\r
-               cl_qlist_remove_item(p_list, p_item);\r
-               if (p_obj)\r
-                       free(p_obj);\r
-\r
-               /* no one is binded to smi anymore - we can free the list, unbind & realease the hndl */\r
-               if (cl_is_qlist_empty(p_list) == TRUE) {\r
-                       free(p_list);\r
-                       p_list = NULL;\r
-\r
-                       ret = IB_MGT_unbind_sm(p_tpot_info->smi_h);\r
-                       if (ret != IB_MGT_OK) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_done: ERR 7212: "\r
-                                       "Failed to unbind sm\n");\r
-                       }\r
-\r
-                       ret = IB_MGT_release_handle(p_tpot_info->smi_h);\r
-                       if (ret != IB_MGT_OK) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_done: ERR 7213: "\r
-                                       "Failed to release smi handle\n");\r
-                       }\r
-                       p_tpot_info->smi_h = 0xffffffff;\r
-               }\r
-               break;\r
-\r
-       case IB_MGT_GSI:\r
-               p_list = p_tpot_info->gsi_mgmt_lists[p_mgr->mgmt_class];\r
-               /* remove from the bindings list */\r
-               p_item = cl_qlist_head(p_list);\r
-               while (p_item != cl_qlist_end(p_list)) {\r
-                       p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-                       if (cl_qlist_obj(p_obj) == h_bind) {\r
-                               break;\r
-                       }\r
-                       p_item_tmp = cl_qlist_next(p_item);\r
-                       p_item = p_item_tmp;\r
-               }\r
-\r
-               CL_ASSERT(p_item != cl_qlist_end(p_list));\r
-               cl_qlist_remove_item(p_list, p_item);\r
-               if (p_obj)\r
-                       free(p_obj);\r
-\r
-               /* no one is binded to this class anymore - we can free the list and unbind this class */\r
-               if (cl_is_qlist_empty(p_list) == TRUE) {\r
-                       free(p_list);\r
-                       p_list = NULL;\r
-\r
-                       ret =\r
-                           IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,\r
-                                                   p_mgr->mgmt_class);\r
-                       if (ret != IB_MGT_OK) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_done: ERR 7214: "\r
-                                       "Failed to unbind gsi class\n");\r
-                       }\r
-               }\r
-\r
-               /* all the mgmt classes are unbinded - release gsi handle */\r
-               for (i = 0; i < 15; i++) {\r
-                       if (p_tpot_info->gsi_mgmt_lists[i] != NULL) {\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               if (i == 15) {\r
-                       ret = IB_MGT_release_handle(p_tpot_info->gsi_h);\r
-                       if (ret != IB_MGT_OK) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "osmv_transport_done: ERR 7215: "\r
-                                       "Failed to release gsi handle\n");\r
-                       }\r
-                       p_tpot_info->gsi_h = 0xffffffff;\r
-               }\r
-       }                       /* end switch */\r
-\r
-       free(p_mgr);\r
-}\r
-\r
-/**********************************************************************\r
- * IB_MGT Receive callback : invoked after each receive\r
- **********************************************************************/\r
-void\r
-__osmv_IBMGT_rcv_cb(IN IB_MGT_mad_hndl_t mad_hndl,\r
-                   IN void *private_ctx_p,\r
-                   IN void *payload_p,\r
-                   IN IB_MGT_mad_rcv_desc_t * rcv_remote_info_p)\r
-{\r
-       osmv_bind_obj_t *p_bo;\r
-       osm_mad_addr_t mad_addr;\r
-       cl_list_item_t *p_item;\r
-       cl_list_obj_t *p_obj;\r
-       cl_qlist_t *p_list;\r
-       ib_mad_t *p_mad = (ib_mad_t *) payload_p;\r
-       osm_vendor_t *p_vendor;\r
-       osmv_IBMGT_transport_info_t *p_tinfo;\r
-\r
-       __osmv_IBMGT_rcv_desc_to_osm_addr(rcv_remote_info_p,\r
-                                         ((p_mad->mgmt_class ==\r
-                                           IB_MCLASS_SUBN_LID)\r
-                                          || (p_mad->mgmt_class ==\r
-                                              IB_MCLASS_SUBN_DIR)), &mad_addr);\r
-\r
-       /* different handling of SMI and GSI */\r
-       if ((p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) ||\r
-           (p_mad->mgmt_class == IB_MCLASS_SUBN_LID)) {\r
-               /* SMI CASE */\r
-               p_bo = (osmv_bind_obj_t *) private_ctx_p;\r
-               /* Make sure the p_bo object is still relevant */\r
-               if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                       return;\r
-\r
-               p_vendor = p_bo->p_vendor;\r
-               p_tinfo =\r
-                   (osmv_IBMGT_transport_info_t *) p_vendor->p_transport_info;\r
-               p_list = p_tinfo->p_smi_list;\r
-       } else {\r
-               /* GSI CASE */\r
-               p_bo = (osmv_bind_obj_t *) private_ctx_p;\r
-               /* Make sure the p_bo object is still relevant */\r
-               if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                       return;\r
-\r
-               p_vendor = p_bo->p_vendor;\r
-               p_tinfo =\r
-                   (osmv_IBMGT_transport_info_t *) p_vendor->p_transport_info;\r
-               p_list = p_tinfo->gsi_mgmt_lists[p_mad->mgmt_class];\r
-       }\r
-\r
-       /* go over the bindings list and send the mad, one of them will accept it,\r
-          the others will drope\r
-        */\r
-       p_item = cl_qlist_head(p_list);\r
-       while (p_item != cl_qlist_end(p_list)) {\r
-               p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-               p_bo = cl_qlist_obj(p_obj);\r
-               /* give upper layer the mad */\r
-               osmv_dispatch_mad((osm_bind_handle_t) p_bo, payload_p,\r
-                                 &mad_addr);\r
-               /* Make sure the p_bo object is still relevant */\r
-               if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                       return;\r
-\r
-               p_item = cl_qlist_next(p_item);\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * IB_MGT Send callback : invoked after each send\r
- **********************************************************************/\r
-void\r
-__osmv_IBMGT_send_cb(IN IB_MGT_mad_hndl_t mad_hndl,\r
-                    IN u_int64_t wrid,\r
-                    IN IB_comp_status_t status, IN void *private_ctx_p)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) CAST_P2LONG(wrid);\r
-\r
-       osmv_IBMGT_transport_mgr_t *p_mgr =\r
-           (osmv_IBMGT_transport_mgr_t *) p_bo->p_transp_mgr;\r
-\r
-       /* Make sure the p_bo object is still relevant */\r
-       if (p_bo->magic_ptr != p_bo)\r
-               return;\r
-\r
-       /* we assume that each send on a bind object is synchronized, and no paralel sends\r
-          from diffrent threads with same object can be made */\r
-       if (status == IB_COMP_SUCCESS) {\r
-               p_mgr->is_send_ok = TRUE;\r
-       } else\r
-               p_mgr->is_send_ok = FALSE;\r
-       cl_event_signal(&p_mgr->send_done);\r
-\r
-}\r
-\r
-/**********************************************************************\r
- * IB_MGT to OSM ADDRESS VECTOR\r
- **********************************************************************/\r
-static void\r
-__osmv_IBMGT_rcv_desc_to_osm_addr(IN IB_MGT_mad_rcv_desc_t * p_rcv_desc,\r
-                                 IN uint8_t is_smi,\r
-                                 OUT osm_mad_addr_t * p_mad_addr)\r
-{\r
-       /*  p_mad_addr->dest_lid = p_osm->subn.sm_base_lid; - for resp we use the dest lid ... */\r
-       p_mad_addr->dest_lid = cl_hton16(p_rcv_desc->remote_lid);\r
-       p_mad_addr->static_rate = 0;    /*  HACK - we do not  know the rate ! */\r
-       p_mad_addr->path_bits = p_rcv_desc->local_path_bits;\r
-       /* Clear the grh any way to avoid unset fields */\r
-       memset(&p_mad_addr->addr_type.gsi.grh_info, 0,\r
-              sizeof(p_mad_addr->addr_type.gsi.grh_info));\r
-\r
-       if (is_smi) {\r
-               /* SMI */\r
-               p_mad_addr->addr_type.smi.source_lid =\r
-                   cl_hton16(p_rcv_desc->remote_lid);\r
-               p_mad_addr->addr_type.smi.port_num = 99;        /*  HACK - if used - should fail */\r
-       } else {\r
-               /* GSI */\r
-               /* seems to me there is a IBMGT bug reversing the QPN ... */\r
-               /* Does IBMGT supposed to provide the QPN is network or HOST ? */\r
-               p_mad_addr->addr_type.gsi.remote_qp = cl_hton32(p_rcv_desc->qp);\r
-\r
-               p_mad_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-               /*  we do have the p_mad_addr->pkey_ix but how to get the PKey by index ? */\r
-               /*  the only way seems to be to use VAPI_query_hca_pkey_tbl and obtain */\r
-               /*  the full PKey table - than go by the index. */\r
-               /*  since this does not seem reasonable to me I simply use the default */\r
-               /*  There is a TAVOR limitation that only one P_KEY is supported per  */\r
-               /*  QP - so QP1 must use IB_DEFAULT_PKEY */\r
-               p_mad_addr->addr_type.gsi.pkey_ix = 0;\r
-               p_mad_addr->addr_type.gsi.service_level = p_rcv_desc->sl;\r
-\r
-               p_mad_addr->addr_type.gsi.global_route = p_rcv_desc->grh_flag;\r
-               /* copy the GRH data if relevant */\r
-               if (p_mad_addr->addr_type.gsi.global_route) {\r
-                       p_mad_addr->addr_type.gsi.grh_info.ver_class_flow =\r
-                           ib_grh_set_ver_class_flow(p_rcv_desc->grh.\r
-                                                     IP_version,\r
-                                                     p_rcv_desc->grh.\r
-                                                     traffic_class,\r
-                                                     p_rcv_desc->grh.\r
-                                                     flow_label);\r
-                       p_mad_addr->addr_type.gsi.grh_info.hop_limit =\r
-                           p_rcv_desc->grh.hop_limit;\r
-                       memcpy(&p_mad_addr->addr_type.gsi.grh_info.src_gid.raw,\r
-                              &p_rcv_desc->grh.sgid, sizeof(ib_net64_t));\r
-                       memcpy(&p_mad_addr->addr_type.gsi.grh_info.dest_gid.raw,\r
-                              p_rcv_desc->grh.dgid, sizeof(ib_net64_t));\r
-               }\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * OSM ADDR VECTOR TO IB_MGT\r
- **********************************************************************/\r
-void\r
-__osmv_IBMGT_osm_addr_to_ibmgt_addr(IN const osm_mad_addr_t * p_mad_addr,\r
-                                   IN uint8_t is_smi, OUT IB_ud_av_t * p_av)\r
-{\r
-\r
-       /* For global destination or Multicast address: */\r
-       u_int8_t ver;\r
-\r
-       memset(p_av, 0, sizeof(IB_ud_av_t));\r
-\r
-       p_av->src_path_bits = p_mad_addr->path_bits;\r
-       p_av->static_rate = p_mad_addr->static_rate;\r
-       p_av->dlid = cl_ntoh16(p_mad_addr->dest_lid);\r
-\r
-       if (is_smi) {\r
-               p_av->sl = 0;   /*  Just to note we use 0 here. */\r
-       } else {\r
-               p_av->sl = p_mad_addr->addr_type.gsi.service_level;\r
-               p_av->grh_flag = p_mad_addr->addr_type.gsi.global_route;\r
-\r
-               if (p_mad_addr->addr_type.gsi.global_route) {\r
-                       ib_grh_get_ver_class_flow(p_mad_addr->addr_type.gsi.\r
-                                                 grh_info.ver_class_flow, &ver,\r
-                                                 &p_av->traffic_class,\r
-                                                 &p_av->flow_label);\r
-                       p_av->hop_limit =\r
-                           p_mad_addr->addr_type.gsi.grh_info.hop_limit;\r
-                       p_av->sgid_index = 0;   /*  we always use source GID 0 */\r
-                       memcpy(&p_av->dgid,\r
-                              &p_mad_addr->addr_type.gsi.grh_info.dest_gid.raw,\r
-                              sizeof(ib_net64_t));\r
-\r
-               }\r
-       }\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_rmpp_ctx.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_rmpp_ctx.c
deleted file mode 100644 (file)
index 6d2ddd3..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qlist.h>\r
-\r
-#include <vendor/osm_vendor_mlx_rmpp_ctx.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_ctx_init(osmv_rmpp_send_ctx_t * p_ctx, void *p_arbt_mad,\r
-                       uint32_t mad_sz, osm_log_t * p_log)\r
-{\r
-       ib_api_status_t st = IB_SUCCESS;\r
-       cl_status_t cl_st;\r
-\r
-       CL_ASSERT(p_ctx);\r
-       if (NULL == p_arbt_mad) {\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-\r
-       if (osmv_mad_is_sa((ib_mad_t *) p_arbt_mad)) {\r
-               p_ctx->is_sa_mad = TRUE;\r
-       } else\r
-               p_ctx->is_sa_mad = FALSE;\r
-\r
-       p_ctx->mad_sz = mad_sz;\r
-\r
-       cl_event_construct(&p_ctx->event);\r
-       cl_st = cl_event_init(&p_ctx->event, FALSE);\r
-       if (cl_st != CL_SUCCESS) {\r
-               return IB_ERROR;\r
-       }\r
-\r
-       st = osmv_rmpp_sar_init(&p_ctx->sar, p_arbt_mad, p_ctx->mad_sz,\r
-                               p_ctx->is_sa_mad);\r
-       if (st == IB_SUCCESS) {\r
-               p_ctx->window_first = 1;\r
-               p_ctx->window_last = 1;\r
-       }\r
-\r
-       p_ctx->p_log = p_log;\r
-       return st;\r
-}\r
-\r
-void osmv_rmpp_send_ctx_done(IN osmv_rmpp_send_ctx_t * p_ctx)\r
-{\r
-       CL_ASSERT(p_ctx);\r
-       cl_event_destroy(&p_ctx->event);\r
-       osmv_rmpp_sar_done(&p_ctx->sar);\r
-       free(p_ctx);\r
-}\r
-\r
-uint32_t osmv_rmpp_send_ctx_get_num_segs(IN osmv_rmpp_send_ctx_t * p_send_ctx)\r
-{\r
-       uint32_t data_len, data_sz, num;\r
-\r
-       CL_ASSERT(p_send_ctx);\r
-\r
-       if (p_send_ctx->is_sa_mad) {\r
-               data_len = p_send_ctx->mad_sz - IB_SA_MAD_HDR_SIZE;\r
-               data_sz = IB_SA_DATA_SIZE;\r
-       } else {\r
-               data_len = p_send_ctx->mad_sz - MAD_RMPP_HDR_SIZE;\r
-               data_sz = MAD_RMPP_DATA_SIZE;\r
-       }\r
-\r
-       num = data_len / data_sz;\r
-       if (0 == data_len || (data_len % data_sz) > 0) {\r
-               num++;\r
-       }\r
-\r
-       return num;\r
-}\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_ctx_get_seg(IN osmv_rmpp_send_ctx_t * p_send_ctx,\r
-                          IN uint32_t seg_idx,\r
-                          IN uint32_t resp_timeout, OUT void *p_buf)\r
-{\r
-       ib_api_status_t st = IB_SUCCESS;\r
-       uint32_t num_segs, paylen = 0;\r
-       ib_rmpp_mad_t *p_rmpp_mad;\r
-\r
-       OSM_LOG_ENTER(p_send_ctx->p_log);\r
-       CL_ASSERT(p_send_ctx);\r
-\r
-       st = osmv_rmpp_sar_get_mad_seg(&p_send_ctx->sar, seg_idx, p_buf);\r
-       if (st != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       p_rmpp_mad = (ib_rmpp_mad_t *) p_buf;\r
-       /* Set the relevant bits in the RMPP hdr */\r
-       p_rmpp_mad->rmpp_status = IB_RMPP_STATUS_SUCCESS;\r
-       p_rmpp_mad->rmpp_flags |= IB_RMPP_FLAG_ACTIVE;\r
-       p_rmpp_mad->rmpp_flags |= resp_timeout << 3;\r
-\r
-       num_segs = osmv_rmpp_send_ctx_get_num_segs(p_send_ctx);\r
-\r
-       if (1 == seg_idx) {\r
-               p_rmpp_mad->rmpp_flags |= IB_RMPP_FLAG_FIRST;\r
-\r
-               /* This is the first segment -\r
-                  the reported paylen is the total amount of data.\r
-                */\r
-               if (p_send_ctx->is_sa_mad) {\r
-                       /* sa mad hdr sz */\r
-                       paylen = p_send_ctx->mad_sz - IB_SA_MAD_HDR_SIZE;\r
-                       paylen +=\r
-                           num_segs * (IB_SA_MAD_HDR_SIZE - MAD_RMPP_HDR_SIZE);\r
-               } else {\r
-                       /* mad hdr sz */\r
-                       paylen = p_send_ctx->mad_sz - MAD_RMPP_HDR_SIZE;\r
-               }\r
-       }\r
-\r
-       if (seg_idx == num_segs) {\r
-               p_rmpp_mad->rmpp_flags |= IB_RMPP_FLAG_LAST;\r
-\r
-               /*\r
-                  This is the last segment -\r
-                  the reported paylen is only the amount of data left on this segment.\r
-                */\r
-               if (p_send_ctx->is_sa_mad) {\r
-                       paylen = p_send_ctx->mad_sz - IB_SA_MAD_HDR_SIZE;\r
-                       paylen -= (num_segs - 1) * IB_SA_DATA_SIZE;\r
-                       paylen += (IB_SA_MAD_HDR_SIZE - MAD_RMPP_HDR_SIZE);\r
-               } else {\r
-                       paylen = p_send_ctx->mad_sz - MAD_RMPP_HDR_SIZE;\r
-                       paylen -=\r
-                           (num_segs - 1) * (MAD_BLOCK_SIZE -\r
-                                             MAD_RMPP_HDR_SIZE);\r
-               }\r
-       }\r
-\r
-       p_rmpp_mad->rmpp_type = IB_RMPP_TYPE_DATA;\r
-       p_rmpp_mad->rmpp_version = 1;\r
-       p_rmpp_mad->paylen_newwin = cl_ntoh32(paylen);\r
-       p_rmpp_mad->seg_num = cl_ntoh32(seg_idx);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_send_ctx->p_log);\r
-       return st;\r
-}\r
-\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_init(osmv_rmpp_recv_ctx_t * p_ctx, osm_log_t * p_log)\r
-{\r
-       ib_api_status_t st = IB_SUCCESS;\r
-\r
-       CL_ASSERT(p_ctx);\r
-\r
-       p_ctx->is_sa_mad = FALSE;\r
-\r
-       p_ctx->p_rbuf = malloc(sizeof(cl_qlist_t));\r
-       if (p_ctx->p_rbuf) {\r
-               memset(p_ctx->p_rbuf, 0, sizeof(cl_qlist_t));\r
-               cl_qlist_init(p_ctx->p_rbuf);\r
-               p_ctx->expected_seg = 1;\r
-       } else\r
-               st = IB_INSUFFICIENT_MEMORY;\r
-\r
-       p_ctx->p_log = p_log;\r
-\r
-       return st;\r
-}\r
-\r
-void osmv_rmpp_recv_ctx_done(IN osmv_rmpp_recv_ctx_t * p_ctx)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-       cl_list_obj_t *p_obj;\r
-\r
-       CL_ASSERT(p_ctx);\r
-\r
-       /* go over all the items in the list and remove them */\r
-       p_list_item = cl_qlist_remove_head(p_ctx->p_rbuf);\r
-       while (p_list_item != cl_qlist_end(p_ctx->p_rbuf)) {\r
-\r
-               p_obj = PARENT_STRUCT(p_list_item, cl_list_obj_t, list_item);\r
-\r
-               free(cl_qlist_obj(p_obj));\r
-               free(p_obj);\r
-\r
-               p_list_item = cl_qlist_remove_head(p_ctx->p_rbuf);\r
-       }\r
-\r
-       osmv_rmpp_sar_done(&p_ctx->sar);\r
-\r
-       free(p_ctx->p_rbuf);\r
-       free(p_ctx);\r
-}\r
-\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_store_mad_seg(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,\r
-                                IN void *p_mad)\r
-{\r
-       cl_list_obj_t *p_obj = NULL;\r
-       void *p_list_mad;\r
-\r
-       OSM_LOG_ENTER(p_recv_ctx->p_log);\r
-\r
-       CL_ASSERT(p_recv_ctx);\r
-       p_list_mad = malloc(MAD_BLOCK_SIZE);\r
-       if (NULL == p_list_mad) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-       memset(p_list_mad, 0, MAD_BLOCK_SIZE);\r
-       memcpy(p_list_mad, p_mad, MAD_BLOCK_SIZE);\r
-\r
-       p_obj = malloc(sizeof(cl_list_obj_t));\r
-       if (NULL == p_obj) {\r
-               free(p_list_mad);\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-       memset(p_obj, 0, sizeof(cl_list_obj_t));\r
-       cl_qlist_set_obj(p_obj, p_list_mad);\r
-\r
-       cl_qlist_insert_tail(p_recv_ctx->p_rbuf, &p_obj->list_item);\r
-\r
-       if (osmv_mad_is_sa((ib_mad_t *) p_mad)) {\r
-               p_recv_ctx->is_sa_mad = TRUE;\r
-       }\r
-\r
-       return IB_SUCCESS;\r
-\r
-}\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_cur_byte_num(IN osmv_rmpp_recv_ctx_t * p_recv_ctx)\r
-{\r
-       uint32_t num_segs;\r
-\r
-       num_segs = cl_qlist_count(p_recv_ctx->p_rbuf);\r
-       if (p_recv_ctx->is_sa_mad)\r
-               return ((num_segs * IB_SA_DATA_SIZE) + IB_SA_MAD_HDR_SIZE);\r
-       else\r
-               return ((num_segs * MAD_RMPP_DATA_SIZE) + MAD_RMPP_HDR_SIZE);\r
-}\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_byte_num_from_first(IN osmv_rmpp_recv_ctx_t * p_recv_ctx)\r
-{\r
-       cl_list_item_t *p_item;\r
-       cl_list_obj_t *p_obj;\r
-       void *p_list_mad;\r
-       uint32_t num_bytes, num_segs;\r
-\r
-       p_item = cl_qlist_head(p_recv_ctx->p_rbuf);\r
-       p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-       p_list_mad = cl_qlist_obj(p_obj);\r
-\r
-       /* mad data sz */\r
-       num_bytes = cl_ntoh32(((ib_rmpp_mad_t *) p_list_mad)->paylen_newwin);\r
-       if (0 != num_bytes) {\r
-               if (p_recv_ctx->is_sa_mad) {\r
-                       /* sa mad hdr sz */\r
-                       num_segs = cl_qlist_count(p_recv_ctx->p_rbuf);\r
-                       num_bytes -=\r
-                           num_segs * (IB_SA_MAD_HDR_SIZE - MAD_RMPP_HDR_SIZE);\r
-                       num_bytes += IB_SA_MAD_HDR_SIZE;\r
-               } else {\r
-                       /* mad hdr sz */\r
-                       num_bytes += MAD_RMPP_HDR_SIZE;\r
-               }\r
-       }\r
-\r
-       return num_bytes;\r
-}\r
-\r
-uint32_t\r
-osmv_rmpp_recv_ctx_get_byte_num_from_last(IN osmv_rmpp_recv_ctx_t * p_recv_ctx)\r
-{\r
-       cl_list_item_t *p_item;\r
-       cl_list_obj_t *p_obj;\r
-       void *p_list_mad;\r
-       uint32_t num_bytes, num_segs;\r
-\r
-       p_item = cl_qlist_tail(p_recv_ctx->p_rbuf);\r
-       p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-       p_list_mad = cl_qlist_obj(p_obj);\r
-\r
-       /* mad data sz */\r
-       num_segs = cl_qlist_count(p_recv_ctx->p_rbuf);\r
-       num_bytes = cl_ntoh32(((ib_rmpp_mad_t *) p_list_mad)->paylen_newwin);\r
-\r
-       if (0 != num_bytes) {\r
-               if (p_recv_ctx->is_sa_mad) {\r
-                       /* sa mad hdr sz */\r
-                       num_bytes += MAD_RMPP_HDR_SIZE;\r
-                       num_bytes += (num_segs - 1) * IB_SA_DATA_SIZE;\r
-               } else {\r
-                       /* mad hdr sz */\r
-                       num_bytes += MAD_RMPP_HDR_SIZE;\r
-                       num_bytes += (num_segs - 1) * MAD_RMPP_DATA_SIZE;\r
-               }\r
-       }\r
-\r
-       return num_bytes;\r
-}\r
-\r
-/* assuming that the last rmpp pkt arrived so that data member: total_bytes has the right value */\r
-ib_api_status_t\r
-osmv_rmpp_recv_ctx_reassemble_arbt_mad(IN osmv_rmpp_recv_ctx_t * p_recv_ctx,\r
-                                      IN uint32_t size, IN void *p_arbt_mad)\r
-{\r
-       ib_api_status_t st = IB_SUCCESS;\r
-\r
-       CL_ASSERT(p_recv_ctx);\r
-\r
-       st = osmv_rmpp_sar_init(&p_recv_ctx->sar, p_arbt_mad, size,\r
-                               p_recv_ctx->is_sa_mad);\r
-       if (st != IB_SUCCESS) {\r
-               return st;\r
-       }\r
-\r
-       st = osmv_rmpp_sar_reassemble_arbt_mad(&p_recv_ctx->sar,\r
-                                              p_recv_ctx->p_rbuf);\r
-\r
-       osmv_rmpp_sar_done(&p_recv_ctx->sar);\r
-\r
-       return st;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c
deleted file mode 100644 (file)
index 461ad27..0000000
+++ /dev/null
@@ -1,874 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_timer.h>\r
-#include <complib/cl_event.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_sa_api.h>\r
-\r
-/* this struct is the internal rep of the bind handle */\r
-typedef struct _osmv_sa_bind_info {\r
-       osm_bind_handle_t h_bind;\r
-       osm_log_t *p_log;\r
-       osm_vendor_t *p_vendor;\r
-       osm_mad_pool_t *p_mad_pool;\r
-       uint64_t port_guid;\r
-       cl_event_t sync_event;\r
-       uint64_t last_lids_update_sec;\r
-       uint16_t lid;\r
-       uint16_t sm_lid;\r
-} osmv_sa_bind_info_t;\r
-\r
-/*\r
-  Call back on new mad received:\r
-\r
-  We basically only need to set the context of the query.\r
-  Or report an error.\r
-\r
-  A pointer to the actual context of the request (a copy of the oriignal\r
-  request structure) is attached as the p_madw->context.ni_context.node_guid\r
-*/\r
-void\r
-__osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,\r
-                    IN void *bind_context, IN osm_madw_t * p_req_madw)\r
-{\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) bind_context;\r
-       osmv_query_req_t *p_query_req_copy = NULL;\r
-       osmv_query_res_t query_res;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_net16_t mad_status;\r
-\r
-       OSM_LOG_ENTER(p_bind->p_log);\r
-\r
-       if (!p_req_madw) {\r
-               osm_log(p_bind->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_sa_mad_rcv_cb: "\r
-                       "Ignoring a non-response mad\n");\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /* obtain the sent context */\r
-       p_query_req_copy =\r
-           (osmv_query_req_t *) (p_req_madw->context.arb_context.context1);\r
-\r
-       /* provide the context of the original request in the result */\r
-       query_res.query_context = p_query_req_copy->query_context;\r
-\r
-       /* provide the resulting madw */\r
-       query_res.p_result_madw = p_madw;\r
-\r
-       /* update the req fields */\r
-       p_sa_mad = (ib_sa_mad_t *) p_madw->p_mad;\r
-\r
-       /* if we got a remote error track it in the status */\r
-       mad_status = (ib_net16_t) (p_sa_mad->status & IB_SMP_STATUS_MASK);\r
-       if (mad_status != IB_SUCCESS) {\r
-               osm_log(p_bind->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_sa_mad_rcv_cb: ERR 0501: "\r
-                       "Remote error:0x%04X .\n", mad_status);\r
-               query_res.status = IB_REMOTE_ERROR;\r
-       } else {\r
-               query_res.status = IB_SUCCESS;\r
-       }\r
-\r
-       /* what if we have got back an empty mad ? */\r
-       if (!p_madw->mad_size) {\r
-               osm_log(p_bind->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_sa_mad_rcv_cb: ERR 0502: "\r
-                       "Got an empty mad.\n");\r
-               query_res.status = IB_ERROR;\r
-       }\r
-\r
-       if (IB_SUCCESS == mad_status) {\r
-\r
-               /* if we are in not in a method response of an rmpp nature we must get only 1 */\r
-               /* HACK: in the future we might need to be smarter for other methods... */\r
-               if (p_sa_mad->method != IB_MAD_METHOD_GETTABLE_RESP) {\r
-                       query_res.result_cnt = 1;\r
-               } else {\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-                       if (mad_status != IB_SUCCESS)\r
-                               query_res.result_cnt = 0;\r
-                       else\r
-                               query_res.result_cnt = 1;\r
-#else\r
-                       /* we used the offset value to calculate the number of\r
-                          records in here */\r
-                       if (ib_get_attr_size(p_sa_mad->attr_offset) == 0) {\r
-                               query_res.result_cnt = 0;\r
-                               osm_log(p_bind->p_log, OSM_LOG_DEBUG,\r
-                                       "__osmv_sa_mad_rcv_cb: Count = 0\n");\r
-                       }\r
-                       else {\r
-                               query_res.result_cnt =\r
-                                       (p_madw->mad_size - IB_SA_MAD_HDR_SIZE) /\r
-                                       ib_get_attr_size(p_sa_mad->attr_offset);\r
-                               osm_log(p_bind->p_log, OSM_LOG_DEBUG,\r
-                                       "__osmv_sa_mad_rcv_cb: "\r
-                                       "Count = %u = %u / %u (%u)\n",\r
-                                       query_res.result_cnt,\r
-                                       p_madw->mad_size - IB_SA_MAD_HDR_SIZE,\r
-                                       ib_get_attr_size(p_sa_mad->attr_offset),\r
-                                       (p_madw->mad_size - IB_SA_MAD_HDR_SIZE) %\r
-                                       ib_get_attr_size(p_sa_mad->attr_offset));\r
-                       }\r
-#endif\r
-               }\r
-       }\r
-\r
-       query_res.query_type = p_query_req_copy->query_type;\r
-\r
-       p_query_req_copy->pfn_query_cb(&query_res);\r
-\r
-       if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)\r
-               cl_event_signal(&p_bind->sync_event);\r
-\r
-Exit:\r
-\r
-       /* free the copied query request if found */\r
-       if (p_query_req_copy)\r
-               free(p_query_req_copy);\r
-\r
-       /* put back the request madw */\r
-       if (p_req_madw)\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_req_madw);\r
-\r
-       OSM_LOG_EXIT(p_bind->p_log);\r
-}\r
-\r
-/*\r
-  Send Error Callback:\r
-\r
-  Only report the error and get rid of the mad wrapper\r
-*/\r
-void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)\r
-{\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) bind_context;\r
-       osmv_query_req_t *p_query_req_copy = NULL;\r
-       osmv_query_res_t query_res;\r
-\r
-       OSM_LOG_ENTER(p_bind->p_log);\r
-\r
-       /* Obtain the sent context etc */\r
-       p_query_req_copy =\r
-           (osmv_query_req_t *) (p_madw->context.arb_context.context1);\r
-\r
-       /* provide the context of the original request in the result */\r
-       query_res.query_context = p_query_req_copy->query_context;\r
-\r
-       query_res.p_result_madw = p_madw;\r
-\r
-       query_res.status = IB_TIMEOUT;\r
-       query_res.result_cnt = 0;\r
-       query_res.p_result_madw->status = IB_TIMEOUT;\r
-       p_madw->status = IB_TIMEOUT;\r
-       query_res.query_type = p_query_req_copy->query_type;\r
-\r
-       p_query_req_copy->pfn_query_cb(&query_res);\r
-\r
-       if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)\r
-               cl_event_signal(&p_bind->sync_event);\r
-\r
-       if (p_query_req_copy)\r
-               free(p_query_req_copy);\r
-       OSM_LOG_EXIT(p_bind->p_log);\r
-}\r
-\r
-/*****************************************************************************\r
- This routine needs to be invoked on every send - since the SM LID and Local\r
- lid might change. To do that without any major perfoermance impact we cache\r
- the results and time they were obtained. Refresh only twice a minute.\r
- To avoid the need to use statics and risk a race - we require the refresh time\r
- to be stored in the context of the results. Also this coveres cases were\r
- we query for multiple guids.\r
- *****************************************************************************/\r
-ib_api_status_t\r
-__osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,\r
-                                      IN ib_net64_t port_guid,\r
-                                      IN OUT uint64_t * p_lids_update_time_sec,\r
-                                      OUT uint16_t * lid,\r
-                                      OUT uint16_t * sm_lid)\r
-{\r
-\r
-       ib_api_status_t status;\r
-       ib_port_attr_t *p_attr_array;\r
-       uint32_t num_ports;\r
-       uint32_t port_num;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       /* use prevous values if current time is close enough to previous query */\r
-       if (cl_get_time_stamp_sec() <= *p_lids_update_time_sec + 30) {\r
-               osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_get_lid_and_sm_lid_by_port_guid: "\r
-                       "Using previously stored lid:0x%04x sm_lid:0x%04x\n",\r
-                       *lid, *sm_lid);\r
-               status = IB_SUCCESS;\r
-               goto Exit;\r
-       }\r
-\r
-       /* obtain the number of available ports */\r
-       num_ports = 0;\r
-       status = osm_vendor_get_all_port_attr(p_vend, NULL, &num_ports);\r
-       if (status != IB_INSUFFICIENT_MEMORY) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_get_lid_and_sm_lid_by_port_guid: ERR 0503: "\r
-                       "expected to get the IB_INSUFFICIENT_MEMORY but got: %s\n",\r
-                       ib_get_err_str(status)\r
-                   );\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__osmv_get_lid_and_sm_lid_by_port_guid: "\r
-               "Found total of %u ports. Looking for guid:0x%016" PRIx64 "\n",\r
-               num_ports, cl_ntoh64(port_guid)\r
-           );\r
-\r
-       /* allocate the attributes */\r
-       p_attr_array =\r
-           (ib_port_attr_t *) malloc(sizeof(ib_port_attr_t) * num_ports);\r
-\r
-       /* obtain the attributes */\r
-       status = osm_vendor_get_all_port_attr(p_vend, p_attr_array, &num_ports);\r
-       if (status != IB_SUCCESS) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_get_lid_and_sm_lid_by_port_guid: ERR 0504: "\r
-                       "Fail to get port attributes (error: %s)\n",\r
-                       ib_get_err_str(status)\r
-                   );\r
-               free(p_attr_array);\r
-               goto Exit;\r
-       }\r
-\r
-       status = IB_ERROR;\r
-       /* find the port requested in the list */\r
-       for (port_num = 0; (port_num < num_ports) && (status == IB_ERROR);\r
-            port_num++) {\r
-               if (p_attr_array[port_num].port_guid == port_guid) {\r
-                       *lid = p_attr_array[port_num].lid;\r
-                       *sm_lid = p_attr_array[port_num].sm_lid;\r
-                       *p_lids_update_time_sec = cl_get_time_stamp_sec();\r
-                       status = IB_SUCCESS;\r
-                       osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                               "__osmv_get_lid_and_sm_lid_by_port_guid: "\r
-                               "Found guid:0x%016" PRIx64 " with idx:%d\n",\r
-                               cl_ntoh64(port_guid), port_num);\r
-               }\r
-       }\r
-\r
-       free(p_attr_array);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-osm_bind_handle_t\r
-osmv_bind_sa(IN osm_vendor_t * const p_vend,\r
-            IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid)\r
-{\r
-       osm_bind_info_t bind_info;\r
-       osm_log_t *p_log = p_vend->p_log;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_sa_bind_info_t *p_sa_bind_info;\r
-       cl_status_t cl_status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "osmv_bind_sa: "\r
-               "Binding to port 0x%" PRIx64 ".\n", cl_ntoh64(port_guid));\r
-\r
-       bind_info.port_guid = port_guid;\r
-       bind_info.mad_class = IB_MCLASS_SUBN_ADM;\r
-       bind_info.class_version = 2;\r
-       bind_info.is_responder = TRUE;\r
-       bind_info.is_trap_processor = FALSE;\r
-       bind_info.is_report_processor = TRUE;\r
-       bind_info.send_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;\r
-       bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;\r
-       bind_info.timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;\r
-       bind_info.retries = OSM_DEFAULT_RETRY_COUNT;\r
-\r
-       /* allocate the new sa bind info */\r
-       p_sa_bind_info =\r
-           (osmv_sa_bind_info_t *) malloc(sizeof(osmv_sa_bind_info_t));\r
-       if (!p_sa_bind_info) {\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_bind_sa: ERR 0505: "\r
-                       "Fail to allocate new bidn structure\n");\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-               goto Exit;\r
-       }\r
-\r
-       /* store some important context */\r
-       p_sa_bind_info->p_log = p_log;\r
-       p_sa_bind_info->port_guid = port_guid;\r
-       p_sa_bind_info->p_mad_pool = p_mad_pool;\r
-       p_sa_bind_info->p_vendor = p_vend;\r
-       p_sa_bind_info->last_lids_update_sec = 0;\r
-\r
-       /* Bind to the lower level */\r
-       p_sa_bind_info->h_bind = osm_vendor_bind(p_vend, &bind_info, p_mad_pool, __osmv_sa_mad_rcv_cb, __osmv_sa_mad_err_cb, p_sa_bind_info);   /* context provided to CBs */\r
-\r
-       if (p_sa_bind_info->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               free(p_sa_bind_info);\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_bind_sa: ERR 0506: "\r
-                       "Fail to bind to vendor SMI.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* obtain the sm_lid from the vendor */\r
-       status =\r
-           __osmv_get_lid_and_sm_lid_by_port_guid(p_vend, port_guid,\r
-                                                  &p_sa_bind_info->\r
-                                                  last_lids_update_sec,\r
-                                                  &p_sa_bind_info->lid,\r
-                                                  &p_sa_bind_info->sm_lid);\r
-       if (status != IB_SUCCESS) {\r
-               free(p_sa_bind_info);\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_bind_sa: ERR 0507: "\r
-                       "Fail to obtain the sm lid.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* initialize the sync_event */\r
-       cl_event_construct(&p_sa_bind_info->sync_event);\r
-       cl_status = cl_event_init(&p_sa_bind_info->sync_event, TRUE);\r
-       if (cl_status != CL_SUCCESS) {\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_bind_sa: ERR 0508: "\r
-                       "cl_init_event failed: %s\n", ib_get_err_str(cl_status)\r
-                   );\r
-               free(p_sa_bind_info);\r
-               p_sa_bind_info = OSM_BIND_INVALID_HANDLE;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return (p_sa_bind_info);\r
-}\r
-\r
-/****t* OSM Vendor SA Client/osmv_sa_mad_data\r
- * NAME\r
- *    osmv_sa_mad_data\r
- *\r
- * DESCRIPTION\r
- * Extra fields required to perform a mad query\r
- *  This struct is passed to the actual send method\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osmv_sa_mad_data {\r
-       /* MAD data. */\r
-       uint8_t method;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t attr_offset;\r
-       ib_net32_t attr_mod;\r
-       ib_net64_t comp_mask;\r
-       void *p_attr;\r
-} osmv_sa_mad_data_t;\r
-/*\r
- * method\r
- *    The method of the mad to be sent\r
- *\r
- *  attr_id\r
- *     Attribute ID\r
- *\r
- *  attr_offset\r
- *     Offset as defined by RMPP\r
- *\r
- *  attr_mod\r
- *     Attribute modifier\r
- *\r
- *  comp_mask\r
- *     The component mask of the query\r
- *\r
- *  p_attr\r
- *     A pointer to the record of the attribute to be sent.\r
- *\r
- *****/\r
-\r
-/* Send a MAD out on the GSI interface */\r
-ib_api_status_t\r
-__osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,\r
-                  IN const osmv_sa_mad_data_t * const p_sa_mad_data,\r
-                  IN const osmv_query_req_t * const p_query_req)\r
-{\r
-       ib_api_status_t status;\r
-       ib_mad_t *p_mad_hdr;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       osm_madw_t *p_madw;\r
-       osm_log_t *p_log = p_bind->p_log;\r
-       static atomic32_t trans_id;\r
-       boolean_t sync;\r
-       osmv_query_req_t *p_query_req_copy;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /*\r
-          since the sm_lid might change we obtain it every send\r
-          (actually it is cached in the bind object and refreshed\r
-          every 30sec by this proc )\r
-        */\r
-       status =\r
-           __osmv_get_lid_and_sm_lid_by_port_guid(p_bind->p_vendor,\r
-                                                  p_bind->port_guid,\r
-                                                  &p_bind->\r
-                                                  last_lids_update_sec,\r
-                                                  &p_bind->lid,\r
-                                                  &p_bind->sm_lid);\r
-       if (status != IB_SUCCESS) {\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "__osmv_send_sa_req: ERR 0509: "\r
-                       "Fail to obtain the sm lid.\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* Get a MAD wrapper for the send */\r
-       p_madw = osm_mad_pool_get(p_bind->p_mad_pool,\r
-                                 p_bind->h_bind, MAD_BLOCK_SIZE, NULL);\r
-\r
-       if (p_madw == NULL) {\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "__osmv_send_sa_req: ERR 0510: "\r
-                       "Unable to acquire MAD.\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Initialize the Sent MAD: */\r
-\r
-       /* Initialize the MAD buffer for the send operation. */\r
-       p_mad_hdr = osm_madw_get_mad_ptr(p_madw);\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       /* Get a new transaction Id */\r
-       cl_atomic_inc(&trans_id);\r
-\r
-       /* Cleanup the MAD from any residue */\r
-       memset(p_sa_mad, 0, MAD_BLOCK_SIZE);\r
-\r
-       /* Initialize the standard MAD header. */\r
-       ib_mad_init_new(p_mad_hdr,      /* mad pointer */\r
-                       IB_MCLASS_SUBN_ADM,     /* class */\r
-                       (uint8_t) 2,    /* version */\r
-                       p_sa_mad_data->method,  /* method */\r
-                       cl_hton64((uint64_t) trans_id), /* tid */\r
-                       p_sa_mad_data->attr_id, /* attr id */\r
-                       p_sa_mad_data->attr_mod /* attr mod */\r
-           );\r
-\r
-       /* Set the query information. */\r
-       p_sa_mad->sm_key = p_query_req->sm_key;\r
-       p_sa_mad->attr_offset = 0;\r
-       p_sa_mad->comp_mask = p_sa_mad_data->comp_mask;\r
-       if (p_sa_mad->comp_mask) {\r
-               memcpy(p_sa_mad->data, p_sa_mad_data->p_attr,\r
-                      ib_get_attr_size(p_sa_mad_data->attr_offset));\r
-       }\r
-\r
-       /*\r
-          Provide the address to send to\r
-        */\r
-       /* Patch to handle IBAL - host order , where it should take destination lid in network order */\r
-#ifdef OSM_VENDOR_INTF_AL\r
-       p_madw->mad_addr.dest_lid = p_bind->sm_lid;\r
-#else\r
-       p_madw->mad_addr.dest_lid = cl_hton16(p_bind->sm_lid);\r
-#endif\r
-       p_madw->mad_addr.addr_type.smi.source_lid = cl_hton16(p_bind->lid);\r
-       p_madw->mad_addr.addr_type.gsi.remote_qp = CL_HTON32(1);\r
-       p_madw->mad_addr.addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-       p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;\r
-       p_madw->resp_expected = TRUE;\r
-       p_madw->fail_msg = CL_DISP_MSGID_NONE;\r
-\r
-       /*\r
-          Provide MAD context such that the call back will know what to do.\r
-          We have to keep the entire request structure so we know the CB.\r
-          Since we can not rely on the client to keep it arroud until\r
-          the response - we duplicate it and will later dispose it (in CB).\r
-          To store on the MADW we cast it into what opensm has:\r
-          p_madw->context.arb_context.context1\r
-        */\r
-       p_query_req_copy = malloc(sizeof(*p_query_req_copy));\r
-       if (!p_query_req_copy) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "\r
-                       "Unable to acquire memory for query copy\n");\r
-               osm_mad_pool_put(p_bind->p_mad_pool, p_madw);\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-       *p_query_req_copy = *p_query_req;\r
-       p_madw->context.arb_context.context1 = p_query_req_copy;\r
-\r
-       /* we can support async as well as sync calls */\r
-       sync = ((p_query_req->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC);\r
-\r
-       /* send the mad asynchronously */\r
-       status = osm_vendor_send(osm_madw_get_bind_handle(p_madw),\r
-                                p_madw, p_madw->resp_expected);\r
-\r
-       /* if synchronous - wait on the event */\r
-       if (sync) {\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_send_sa_req: " "Waiting for async event.\n");\r
-               cl_event_wait_on(&p_bind->sync_event, EVENT_NO_TIMEOUT, FALSE);\r
-               cl_event_reset(&p_bind->sync_event);\r
-               status = p_madw->status;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Query the SA based on the user's request.\r
- */\r
-ib_api_status_t\r
-osmv_query_sa(IN osm_bind_handle_t h_bind,\r
-             IN const osmv_query_req_t * const p_query_req)\r
-{\r
-       union {\r
-               ib_service_record_t svc_rec;\r
-               ib_node_record_t node_rec;\r
-               ib_portinfo_record_t port_info;\r
-               ib_path_rec_t path_rec;\r
-#ifdef DUAL_SIDED_RMPP\r
-               ib_multipath_rec_t multipath_rec;\r
-#endif\r
-               ib_class_port_info_t class_port_info;\r
-       } u;\r
-       osmv_sa_mad_data_t sa_mad_data;\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;\r
-       osmv_user_query_t *p_user_query;\r
-#ifdef DUAL_SIDED_RMPP\r
-       osmv_multipath_req_t *p_mpr_req;\r
-       int i, j;\r
-#endif\r
-       osm_log_t *p_log = p_bind->p_log;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* Set the request information. */\r
-       sa_mad_data.method = IB_MAD_METHOD_GETTABLE;\r
-       sa_mad_data.attr_mod = 0;\r
-\r
-       memset((void*)&u, 0, sizeof(u));\r
-\r
-       /* Set the MAD attributes and component mask correctly. */\r
-       switch (p_query_req->query_type) {\r
-\r
-       case OSMV_QUERY_USER_DEFINED:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "USER_DEFINED\n");\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               if (p_user_query->method)\r
-                       sa_mad_data.method = p_user_query->method;\r
-               sa_mad_data.attr_offset = p_user_query->attr_offset;\r
-               sa_mad_data.attr_id = p_user_query->attr_id;\r
-               sa_mad_data.attr_mod = p_user_query->attr_mod;\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_ALL_SVC_RECS:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "SVC_REC_BY_NAME\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.comp_mask = 0;\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               break;\r
-\r
-       case OSMV_QUERY_SVC_REC_BY_NAME:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "SVC_REC_BY_NAME\n");\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.comp_mask = IB_SR_COMPMASK_SNAME;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               memcpy(u.svc_rec.service_name, p_query_req->p_query_input,\r
-                      sizeof(ib_svc_name_t));\r
-               break;\r
-\r
-       case OSMV_QUERY_SVC_REC_BY_ID:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "SVC_REC_BY_ID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-               sa_mad_data.comp_mask = IB_SR_COMPMASK_SID;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_service_record_t));\r
-               sa_mad_data.p_attr = &u.svc_rec;\r
-               u.svc_rec.service_id =\r
-                   *(ib_net64_t *) (p_query_req->p_query_input);\r
-               break;\r
-\r
-       case OSMV_QUERY_CLASS_PORT_INFO:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "CLASS_PORT_INFO\n");\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_CLASS_PORT_INFO;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_class_port_info_t));\r
-               sa_mad_data.comp_mask = 0;\r
-               sa_mad_data.p_attr = &u.class_port_info;\r
-\r
-               break;\r
-\r
-       case OSMV_QUERY_NODE_REC_BY_NODE_GUID:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "NODE_REC_BY_NODE_GUID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_NODE_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_node_record_t));\r
-               sa_mad_data.comp_mask = IB_NR_COMPMASK_NODEGUID;\r
-               sa_mad_data.p_attr = &u.node_rec;\r
-               u.node_rec.node_info.node_guid =\r
-                   *(ib_net64_t *) (p_query_req->p_query_input);\r
-\r
-               break;\r
-\r
-       case OSMV_QUERY_PORT_REC_BY_LID:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "PORT_REC_BY_LID\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_portinfo_record_t));\r
-               sa_mad_data.comp_mask = IB_PIR_COMPMASK_LID;\r
-               sa_mad_data.p_attr = &u.port_info;\r
-               u.port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);\r
-               break;\r
-\r
-       case OSMV_QUERY_PORT_REC_BY_LID_AND_NUM:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s",\r
-                       "PORT_REC_BY_LID_AND_NUM\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_portinfo_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_PORTNUM;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s",\r
-                       "OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_VLARB_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_vl_arb_table_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_VLA_COMPMASK_LID | IB_VLA_COMPMASK_OUT_PORT |\r
-                   IB_VLA_COMPMASK_BLOCK;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_SLVL_BY_LID_AND_PORTS:\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s",\r
-                       "OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_SLVL_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_slvl_table_record_t));\r
-               sa_mad_data.comp_mask =\r
-                   IB_SLVL_COMPMASK_LID | IB_SLVL_COMPMASK_OUT_PORT |\r
-                   IB_SLVL_COMPMASK_IN_PORT;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_PORT_GUIDS:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "PATH_REC_BY_PORT_GUIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                   (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);\r
-               u.path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               ib_gid_set_default(&u.path_rec.dgid,\r
-                                  ((osmv_guid_pair_t *) (p_query_req->\r
-                                                         p_query_input))->dest_guid);\r
-               ib_gid_set_default(&u.path_rec.sgid,\r
-                                  ((osmv_guid_pair_t *) (p_query_req->\r
-                                                         p_query_input))->src_guid);\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_GIDS:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "PATH_REC_BY_GIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                 (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);\r
-               u.path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               memcpy(&u.path_rec.dgid,\r
-                      &((osmv_gid_pair_t *) (p_query_req->p_query_input))->\r
-                      dest_gid, sizeof(ib_gid_t));\r
-               memcpy(&u.path_rec.sgid,\r
-                      &((osmv_gid_pair_t *) (p_query_req->p_query_input))->\r
-                      src_gid, sizeof(ib_gid_t));\r
-               break;\r
-\r
-       case OSMV_QUERY_PATH_REC_BY_LIDS:\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s", "PATH_REC_BY_LIDS\n");\r
-               memset(&u.path_rec, 0, sizeof(ib_path_rec_t));\r
-               sa_mad_data.method = IB_MAD_METHOD_GET;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_path_rec_t));\r
-               sa_mad_data.comp_mask =\r
-                   (IB_PR_COMPMASK_DLID | IB_PR_COMPMASK_SLID);\r
-               sa_mad_data.p_attr = &u.path_rec;\r
-               u.path_rec.dlid =\r
-                   ((osmv_lid_pair_t *) (p_query_req->p_query_input))->\r
-                   dest_lid;\r
-               u.path_rec.slid =\r
-                   ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid;\r
-               break;\r
-\r
-       case OSMV_QUERY_UD_MULTICAST_SET:\r
-               sa_mad_data.method = IB_MAD_METHOD_SET;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s",\r
-                       "OSMV_QUERY_UD_MULTICAST_SET\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-       case OSMV_QUERY_UD_MULTICAST_DELETE:\r
-               sa_mad_data.method = IB_MAD_METHOD_DELETE;\r
-               p_user_query = (osmv_user_query_t *) p_query_req->p_query_input;\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "osmv_query_sa DBG:001 %s",\r
-                       "OSMV_QUERY_UD_MULTICAST_DELETE\n");\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-               sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-               sa_mad_data.p_attr = p_user_query->p_attr;\r
-               break;\r
-\r
-#ifdef DUAL_SIDED_RMPP\r
-       case OSMV_QUERY_MULTIPATH_REC:\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 MULTIPATH_REC\n");\r
-               /* Validate sgid/dgid counts against SA client limit */\r
-               p_mpr_req = (osmv_multipath_req_t *) p_query_req->p_query_input;\r
-               if (p_mpr_req->sgid_count + p_mpr_req->dgid_count >\r
-                   IB_MULTIPATH_MAX_GIDS) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 MULTIPATH_REC "\r
-                               "SGID count %d DGID count %d max count %d\n",\r
-                               p_mpr_req->sgid_count, p_mpr_req->dgid_count,\r
-                               IB_MULTIPATH_MAX_GIDS);\r
-                       CL_ASSERT(0);\r
-                       return IB_ERROR;\r
-               }\r
-               memset(&u.multipath_rec, 0, sizeof(ib_multipath_rec_t));\r
-               sa_mad_data.method = IB_MAD_METHOD_GETMULTI;\r
-               sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD;\r
-               sa_mad_data.attr_offset =\r
-                   ib_get_attr_offset(sizeof(ib_multipath_rec_t));\r
-               sa_mad_data.p_attr = &u.multipath_rec;\r
-               sa_mad_data.comp_mask = p_mpr_req->comp_mask;\r
-               u.multipath_rec.num_path = p_mpr_req->num_path;\r
-               if (p_mpr_req->reversible)\r
-                       u.multipath_rec.num_path |= 0x80;\r
-               else\r
-                       u.multipath_rec.num_path &= ~0x80;\r
-               u.multipath_rec.pkey = p_mpr_req->pkey;\r
-               ib_multipath_rec_set_sl(&u.multipath_rec, p_mpr_req->sl);\r
-               ib_multipath_rec_set_qos_class(&u.multipath_rec, 0);\r
-               u.multipath_rec.independence = p_mpr_req->independence;\r
-               u.multipath_rec.sgid_count = p_mpr_req->sgid_count;\r
-               u.multipath_rec.dgid_count = p_mpr_req->dgid_count;\r
-               j = 0;\r
-               for (i = 0; i < p_mpr_req->sgid_count; i++, j++)\r
-                       u.multipath_rec.gids[j] = p_mpr_req->gids[j];\r
-               for (i = 0; i < p_mpr_req->dgid_count; i++, j++)\r
-                       u.multipath_rec.gids[j] = p_mpr_req->gids[j];\r
-               break;\r
-#endif\r
-\r
-       default:\r
-               osm_log(p_log, OSM_LOG_ERROR,\r
-                       "osmv_query_sa DBG:001 UNKNOWN 0x%x (%d)\n",\r
-                       p_query_req->query_type,p_query_req->query_type);\r
-               CL_ASSERT(0);\r
-               return IB_ERROR;\r
-       }\r
-\r
-       status = __osmv_send_sa_req(h_bind, &sa_mad_data, p_query_req);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sar.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sar.c
deleted file mode 100644 (file)
index e944476..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <stdio.h>\r
-#include <vendor/osm_vendor_mlx_sar.h>\r
-\r
-ib_api_status_t\r
-osmv_rmpp_sar_init(osmv_rmpp_sar_t * p_sar, void *p_arbt_mad,\r
-                  uint32_t mad_size, boolean_t is_sa_mad)\r
-{\r
-       CL_ASSERT(p_sar);\r
-       p_sar->p_arbt_mad = p_arbt_mad;\r
-       if (is_sa_mad) {\r
-               p_sar->data_len = mad_size - IB_SA_MAD_HDR_SIZE;\r
-               p_sar->hdr_sz = IB_SA_MAD_HDR_SIZE;\r
-               p_sar->data_sz = IB_SA_DATA_SIZE;\r
-       } else {\r
-               p_sar->data_len = mad_size - MAD_RMPP_HDR_SIZE;\r
-               p_sar->hdr_sz = MAD_RMPP_HDR_SIZE;\r
-               p_sar->data_sz = MAD_RMPP_DATA_SIZE;\r
-       }\r
-       return IB_SUCCESS;\r
-}\r
-\r
-void osmv_rmpp_sar_done(osmv_rmpp_sar_t * p_sar)\r
-{\r
-       p_sar->p_arbt_mad = NULL;\r
-}\r
-\r
-/* the big mad should be with mad header, rmpp header ( &sa hdr) space */\r
-ib_api_status_t\r
-osmv_rmpp_sar_get_mad_seg(IN osmv_rmpp_sar_t * p_sar,\r
-                         IN uint32_t seg_idx, OUT void *p_buf)\r
-{\r
-       void *p_seg;\r
-       uint32_t sz_left;\r
-       uint32_t num_segs;\r
-\r
-       CL_ASSERT(p_sar);\r
-\r
-       num_segs = p_sar->data_len / p_sar->data_sz;\r
-       if ((p_sar->data_len % p_sar->data_sz) > 0) {\r
-               num_segs++;\r
-       }\r
-\r
-       if ((seg_idx > num_segs) && (seg_idx != 1)) {\r
-               return IB_NOT_FOUND;\r
-       }\r
-\r
-       /* cleanup */\r
-       memset(p_buf, 0, MAD_BLOCK_SIZE);\r
-\r
-       /* attach header */\r
-       memcpy(p_buf, p_sar->p_arbt_mad, p_sar->hdr_sz);\r
-\r
-       /* fill data */\r
-       p_seg =\r
-           (char *)p_sar->p_arbt_mad + p_sar->hdr_sz +\r
-           ((seg_idx - 1) * p_sar->data_sz);\r
-       sz_left = p_sar->data_len - ((seg_idx - 1) * p_sar->data_sz);\r
-       if (sz_left > p_sar->data_sz)\r
-               memcpy((char *)p_buf + p_sar->hdr_sz, (char *)p_seg,\r
-                      p_sar->data_sz);\r
-       else\r
-               memcpy((char *)p_buf + p_sar->hdr_sz, (char *)p_seg, sz_left);\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-/* turns a list of mads to one big mad - including header */\r
-/* ALSO - deallocates the list                              */\r
-ib_api_status_t\r
-osmv_rmpp_sar_reassemble_arbt_mad(osmv_rmpp_sar_t * p_sar, cl_qlist_t * p_bufs)\r
-{\r
-       void *buf_tmp, *p_mad;\r
-       cl_list_item_t *p_item;\r
-       cl_list_obj_t *p_obj;\r
-       uint32_t space_left = p_sar->data_len + p_sar->hdr_sz;\r
-\r
-       CL_ASSERT(p_sar);\r
-       CL_ASSERT(FALSE == cl_is_qlist_empty(p_bufs));\r
-\r
-       /* attach header */\r
-       p_mad = p_sar->p_arbt_mad;\r
-       p_item = cl_qlist_head(p_bufs);\r
-       p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-       buf_tmp = cl_qlist_obj(p_obj);\r
-       memcpy(p_mad, buf_tmp, p_sar->hdr_sz);\r
-       p_mad = (char *)p_mad + p_sar->hdr_sz;\r
-       space_left -= p_sar->hdr_sz;\r
-\r
-       /* reassemble data */\r
-       while (FALSE == cl_is_qlist_empty(p_bufs)) {\r
-\r
-               p_item = cl_qlist_remove_head(p_bufs);\r
-               p_obj = PARENT_STRUCT(p_item, cl_list_obj_t, list_item);\r
-               buf_tmp = cl_qlist_obj(p_obj);\r
-\r
-               if (FALSE == cl_is_qlist_empty(p_bufs)) {\r
-                       memcpy((char *)p_mad, (char *)buf_tmp + p_sar->hdr_sz,\r
-                              p_sar->data_sz);\r
-                       p_mad = (char *)p_mad + p_sar->data_sz;\r
-                       space_left -= p_sar->data_sz;\r
-               } else {\r
-                       /* the last mad on the list */\r
-                       memcpy((char *)p_mad, (char *)buf_tmp + p_sar->hdr_sz,\r
-                              space_left);\r
-                       p_mad = (char *)p_mad + space_left;\r
-               }\r
-\r
-               free(buf_tmp);\r
-               free(p_obj);\r
-       }\r
-\r
-       return IB_SUCCESS;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sender.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sender.c
deleted file mode 100644 (file)
index 69d25b3..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <vendor/osm_vendor_mlx_sender.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <vendor/osm_pkt_randomizer.h>\r
-\r
-static ib_api_status_t\r
-__osmv_rmpp_send_segment(IN osm_bind_handle_t h_bind,\r
-                        IN osmv_txn_ctx_t * p_txn, IN uint32_t seg_num);\r
-\r
-/****d* OSM Vendor/osmv_simple_send_madw\r
- * NAME\r
- *   osmv_simple_send_madw\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 bytes).\r
- *\r
- *   If this MAD requires a response, set the timeout event.\r
- *   The function call returns when the MAD's send completion is received.\r
- *\r
- */\r
-\r
-ib_api_status_t\r
-osmv_simple_send_madw(IN osm_bind_handle_t h_bind,\r
-                     IN osm_madw_t * const p_madw,\r
-                     IN osmv_txn_ctx_t * p_txn, IN boolean_t is_retry)\r
-{\r
-       ib_api_status_t ret;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_mad_addr_t *p_mad_addr = osm_madw_get_mad_addr_ptr(p_madw);\r
-       uint8_t mad_buf[MAD_BLOCK_SIZE];\r
-       ib_mad_t *p_mad = (ib_mad_t *) mad_buf;\r
-       uint64_t key = 0;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       CL_ASSERT(p_madw->mad_size <= MAD_BLOCK_SIZE);\r
-\r
-       memset(p_mad, 0, MAD_BLOCK_SIZE);\r
-       memcpy(p_mad, osm_madw_get_mad_ptr(p_madw), p_madw->mad_size);\r
-\r
-       if (NULL != p_txn) {\r
-               /* Push a fake txn id to the MAD */\r
-               key = osmv_txn_get_key(p_txn);\r
-               p_mad->trans_id = cl_hton64(key);\r
-       }\r
-\r
-       /*\r
-          Add call for packet drop randomizer.\r
-          This is a testing feature. If run_randomizer flag is set to TRUE,\r
-          the randomizer will be called, and randomally will drop\r
-          a packet. This is used for simulating unstable fabric.\r
-        */\r
-       if (p_bo->p_vendor->run_randomizer == TRUE) {\r
-               /* Try the randomizer */\r
-               if (osm_pkt_randomizer_mad_drop(p_bo->p_vendor->p_log,\r
-                                               p_bo->p_vendor->\r
-                                               p_pkt_randomizer,\r
-                                               p_mad) == TRUE) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "The MAD will not be sent. \n");\r
-                       ret = IB_SUCCESS;\r
-               } else {\r
-                       ret =\r
-                           osmv_transport_mad_send(h_bind, p_mad, p_mad_addr);\r
-               }\r
-       } else {\r
-               ret = osmv_transport_mad_send(h_bind, p_mad, p_mad_addr);\r
-       }\r
-\r
-       if ((IB_SUCCESS == ret) && (NULL != p_txn) && (!is_retry)) {\r
-               /* Set the timeout for receiving the response MAD */\r
-               ret = osmv_txn_set_timeout_ev(h_bind, key,\r
-                                             p_bo->p_vendor->resp_timeout);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return ret;\r
-}\r
-\r
-/***** OSM Vendor/osmv_rmpp_send_madw\r
- * NAME\r
- *   osmv_rmpp_send_madw\r
- *\r
- * DESCRIPTION\r
- * Send a single message (MAD wrapper of arbitrary length).\r
- *      Follow the RMPP semantics\r
- *      (segmentation, send window, timeouts etc).\r
- *\r
- *      The function call returns either when the whole message\r
- *      has been acknowledged, or upon error.\r
- *\r
- *  ASSUMPTIONS\r
- *      The RMPP sender context is set up\r
- */\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_madw(IN osm_bind_handle_t h_bind,\r
-                   IN osm_madw_t * const p_madw,\r
-                   IN osmv_txn_ctx_t * p_txn, IN boolean_t is_rmpp_ds)\r
-{\r
-       ib_api_status_t ret = IB_SUCCESS;\r
-       uint32_t i, total_segs;\r
-\r
-       osmv_rmpp_send_ctx_t *p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       total_segs = osmv_rmpp_send_ctx_get_num_segs(p_send_ctx);\r
-       CL_ASSERT(total_segs >= 1);\r
-\r
-       /* In the double-sided transfer, wait for ACK 0 */\r
-\r
-       for (;;) {\r
-\r
-               if (p_send_ctx->window_first > total_segs) {\r
-\r
-                       /* Every segment is acknowledged */\r
-                       break;\r
-               }\r
-\r
-               /* Send the next burst. */\r
-               for (i = p_send_ctx->window_first; i <= p_send_ctx->window_last;\r
-                    i++) {\r
-\r
-                       /* Send a segment and setup a timeout timer */\r
-                       ret = __osmv_rmpp_send_segment(h_bind, p_txn, i);\r
-                       if (IB_SUCCESS != ret) {\r
-                               goto send_done;\r
-                       }\r
-               }\r
-\r
-               /* Set the Response Timeout for the ACK on the last DATA segment */\r
-               ret = osmv_txn_set_timeout_ev(h_bind, osmv_txn_get_key(p_txn),\r
-                                             p_bo->p_vendor->resp_timeout);\r
-               if (IB_SUCCESS != ret) {\r
-                       goto send_done;\r
-               }\r
-\r
-               /* Going to sleep. Let the others access the transaction DB */\r
-               osmv_txn_unlock(p_bo);\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "RMPP Sender thread (madw=%p) going to sleep ...\n",\r
-                       p_madw);\r
-\r
-               /* Await the next event to happen */\r
-               cl_event_wait_on(&p_send_ctx->event,\r
-                                EVENT_NO_TIMEOUT, TRUE /* interruptible */ );\r
-\r
-               /* Got a signal from the MAD dispatcher/timeout handler */\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "RMPP Sender thread (madw=%p) waking up on a signal ...\n",\r
-                       p_madw);\r
-\r
-               /* Let's see what changed... Make this atomic - re-acquire the lock. */\r
-               osmv_txn_lock(p_bo);\r
-\r
-               if (TRUE == p_bo->is_closing) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "osmv_rmpp_send_madw: ERR 6601: "\r
-                               "The bind handle %p is being closed. "\r
-                               "Stopping the RMPP Send of MADW %p\n",\r
-                               h_bind, p_madw);\r
-\r
-                       ret = IB_TIMEOUT;\r
-                       return IB_INTERRUPTED;\r
-               }\r
-\r
-               /* STOP? ABORT? TIMEOUT? */\r
-               if (IB_SUCCESS != p_send_ctx->status) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "osmv_rmpp_send_madw: ERR 6602: "\r
-                               "An error (%s) happened during the RMPP send of %p. Bailing out.\n",\r
-                               ib_get_err_str(p_send_ctx->status), p_madw);\r
-                       ret = p_send_ctx->status;\r
-                       goto send_done;\r
-               }\r
-       }\r
-\r
-       if (TRUE == is_rmpp_ds) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Double-sided RMPP - switching to be the receiver.\n");\r
-\r
-               ret = osmv_txn_init_rmpp_receiver(h_bind, p_txn, FALSE\r
-                                                 /*Send was initiated by me */\r
-                                                 );\r
-\r
-               if (IB_SUCCESS == ret) {\r
-                       /* Send ACK on the 0 segment */\r
-                       ret = __osmv_rmpp_send_segment(h_bind, p_txn, 0);\r
-               }\r
-       }\r
-\r
-send_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return ret;\r
-}\r
-\r
-/*\r
- *  NAME                osmv_rmpp_send_ack\r
- *\r
- *  DESCRIPTION\r
- *\r
- */\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_ack(IN osm_bind_handle_t h_bind,\r
-                  IN const ib_mad_t * p_req_mad,\r
-                  IN uint32_t seg_num,\r
-                  IN uint32_t nwl, IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       uint8_t resp_mad[MAD_BLOCK_SIZE];\r
-       ib_rmpp_mad_t *p_resp_mad = (ib_rmpp_mad_t *) resp_mad;\r
-\r
-#ifdef OSMV_RANDOM_DROP\r
-       if (TRUE == osmv_random_drop()) {\r
-               osm_log(((osmv_bind_obj_t *) h_bind)->p_vendor->p_log,\r
-                       OSM_LOG_DEBUG,\r
-                       "Error injection - dropping the RMPP ACK\n");\r
-               return IB_SUCCESS;\r
-       }\r
-#endif\r
-\r
-       memcpy(p_resp_mad, p_req_mad, MAD_BLOCK_SIZE);\r
-\r
-       p_resp_mad->common_hdr.method = osmv_invert_method(p_req_mad->method);\r
-       p_resp_mad->rmpp_type = IB_RMPP_TYPE_ACK;\r
-       p_resp_mad->seg_num = cl_hton32(seg_num);\r
-       p_resp_mad->paylen_newwin = cl_hton32(nwl);\r
-       p_resp_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;\r
-\r
-       return osmv_transport_mad_send(h_bind, p_resp_mad, p_mad_addr);\r
-}\r
-\r
-/*\r
- *  NAME            osmv_rmpp_send_nak\r
- *\r
- *  DESCRIPTION     Send the RMPP ABORT or STOP packet\r
- */\r
-\r
-ib_api_status_t\r
-osmv_rmpp_send_nak(IN osm_bind_handle_t h_bind,\r
-                  IN const ib_mad_t * p_req_mad,\r
-                  IN const osm_mad_addr_t * p_mad_addr,\r
-                  IN uint8_t nak_type, IN uint8_t status)\r
-{\r
-       uint8_t resp_mad[MAD_BLOCK_SIZE];\r
-       ib_rmpp_mad_t *p_resp_mad = (ib_rmpp_mad_t *) resp_mad;\r
-\r
-       memcpy(p_resp_mad, p_req_mad, MAD_BLOCK_SIZE);\r
-\r
-       p_resp_mad->common_hdr.method = osmv_invert_method(p_req_mad->method);\r
-       p_resp_mad->rmpp_type = nak_type;\r
-       p_resp_mad->rmpp_status = status;\r
-\r
-       return osmv_transport_mad_send(h_bind, p_resp_mad, p_mad_addr);\r
-}\r
-\r
-/*\r
- *  NAME              __osmv_rmpp_send_segment\r
- *\r
- *  DESCRIPTION       Build a MAD for a specific segment and send it\r
- */\r
-\r
-static ib_api_status_t\r
-__osmv_rmpp_send_segment(IN osm_bind_handle_t h_bind,\r
-                        IN osmv_txn_ctx_t * p_txn, IN uint32_t seg_num)\r
-{\r
-       ib_api_status_t ret;\r
-       osmv_rmpp_send_ctx_t *p_send_ctx;\r
-       uint8_t mad_buf[MAD_BLOCK_SIZE];\r
-       ib_mad_t *p_mad = (ib_mad_t *) mad_buf;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_mad_addr_t *p_mad_addr =\r
-           osm_madw_get_mad_addr_ptr(osmv_txn_get_madw(p_txn));\r
-       uint32_t timeout = p_bo->p_vendor->resp_timeout;\r
-       uint64_t key;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-#ifdef OSMV_RANDOM_DROP\r
-       if (TRUE == osmv_random_drop()) {\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Error injection - simulating the RMPP segment drop\n");\r
-               return IB_SUCCESS;\r
-       }\r
-#endif\r
-\r
-       p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);\r
-       key = osmv_txn_get_key(p_txn);\r
-\r
-       if (0 != seg_num) {\r
-               ret =\r
-                   osmv_rmpp_send_ctx_get_seg(p_send_ctx, seg_num, timeout,\r
-                                              p_mad);\r
-               CL_ASSERT(IB_SUCCESS == ret);\r
-\r
-               /* Put the segment to the wire ! */\r
-               p_mad->trans_id = cl_hton64(key);\r
-\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Sending RMPP segment #%d, on-wire TID=0x%llX\n",\r
-                       seg_num, p_mad->trans_id);\r
-\r
-               /*\r
-                  Add call for packet drop randomizer.\r
-                  This is a testing feature. If run_randomizer flag is set to TRUE,\r
-                  the randomizer will be called, and randomally will drop\r
-                  a packet. This is used for simulating unstable fabric.\r
-                */\r
-               if (p_bo->p_vendor->run_randomizer == TRUE) {\r
-                       /* Try the randomizer */\r
-                       if (osm_pkt_randomizer_mad_drop(p_bo->p_vendor->p_log,\r
-                                                       p_bo->p_vendor->\r
-                                                       p_pkt_randomizer,\r
-                                                       p_mad) == TRUE) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                                       "The MAD will not be sent. \n");\r
-                               ret = IB_SUCCESS;\r
-                       } else {\r
-                               ret =\r
-                                   osmv_transport_mad_send((osm_bind_handle_t)\r
-                                                           p_bo, p_mad,\r
-                                                           p_mad_addr);\r
-                       }\r
-               } else {\r
-                       ret =\r
-                           osmv_transport_mad_send((osm_bind_handle_t) p_bo,\r
-                                                   p_mad, p_mad_addr);\r
-               }\r
-       } else {\r
-               /* This is an ACK for double-sided handshake. Give it a special treatment. */\r
-\r
-               /* It doesn't really matter which data to put. Only the header matters. */\r
-               ret = osmv_rmpp_send_ctx_get_seg(p_send_ctx, 1, timeout, p_mad);\r
-               CL_ASSERT(IB_SUCCESS == ret);\r
-\r
-               p_mad->trans_id = cl_hton64(key);\r
-               ret =\r
-                   osmv_rmpp_send_ack((osm_bind_handle_t) p_bo, p_mad,\r
-                                      0 /* segnum */ ,\r
-                                      OSMV_RMPP_RECV_WIN /* NWL */ ,\r
-                                      p_mad_addr);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sim.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sim.c
deleted file mode 100644 (file)
index 9266198..0000000
+++ /dev/null
@@ -1,439 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*  AUTHOR                 Eitan Zahavi\r
- *\r
- *  DESCRIPTION\r
- *     The lower-level MAD transport interface implementation\r
- *     that allows sending a single MAD/receiving a callback\r
- *     when a single MAD is received.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <sys/ioctl.h>\r
-#include <fcntl.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_dispatcher.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <complib/cl_thread.h>\r
-\r
-/* the simulator messages definition */\r
-#include <ibmgtsim/ibms_client_api.h>\r
-\r
-typedef struct _osmv_ibms_transport_mgr {\r
-       ibms_conn_handle_t conHdl;      /* the connection handle we talk to */\r
-       ibms_bind_msg_t filter; /* the bind message defining the filtering */\r
-       cl_thread_t receiver;   /* the thread waiting for incomming messages */\r
-} osmv_ibms_transport_mgr_t;\r
-\r
-static void\r
-__osmv_ibms_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,\r
-                                IN struct _ibms_mad_addr *p_ibms_addr,\r
-                                IN uint8_t is_smi,\r
-                                OUT osm_mad_addr_t * p_osm_addr);\r
-\r
-static void\r
-__osmv_ibms_osm_addr_to_mad_addr(IN const osm_mad_addr_t * p_osm_addr,\r
-                                IN uint8_t is_smi,\r
-                                OUT struct _ibms_mad_addr *p_ibms_addr);\r
-\r
-/* this is the callback function the "server" will call on incoming\r
-   messages */\r
-void __osmv_ibms_receiver_callback(void *p_ctx, ibms_mad_msg_t * p_mad)\r
-{\r
-       osm_mad_addr_t mad_addr;\r
-       osmv_bind_obj_t *const p_bo = (osmv_bind_obj_t *) p_ctx;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       /* Make sure the p_bo object is still relevant */\r
-       if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-               return;\r
-\r
-       {\r
-               OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-               /* some logging */\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_ibms_receiver_callback: "\r
-                       "MAD QPN:%d SLID:0x%04x class:0x%02x "\r
-                       "method:0x%02x attr:0x%04x status:0x%04x "\r
-                       "tid:0x%016" PRIx64 "\n",\r
-                       p_mad->addr.dqpn,\r
-                       cl_ntoh16(p_mad->addr.slid),\r
-                       p_mad->header.mgmt_class,\r
-                       p_mad->header.method,\r
-                       cl_ntoh16(p_mad->header.attr_id),\r
-                       cl_ntoh16(p_mad->header.status),\r
-                       cl_ntoh64(p_mad->header.trans_id));\r
-\r
-               /* first arrange an address */\r
-               __osmv_ibms_mad_addr_to_osm_addr(p_bo->p_vendor,\r
-                                                &p_mad->addr,\r
-                                                (((ib_mad_t *) & p_mad->\r
-                                                  header)->mgmt_class ==\r
-                                                 IB_MCLASS_SUBN_LID)\r
-                                                ||\r
-                                                (((ib_mad_t *) & p_mad->\r
-                                                  header)->mgmt_class ==\r
-                                                 IB_MCLASS_SUBN_DIR),\r
-                                                &mad_addr);\r
-\r
-               /* call the receiver callback */\r
-\r
-               status =\r
-                   osmv_dispatch_mad((osm_bind_handle_t) p_bo,\r
-                                     (void *)&p_mad->header, &mad_addr);\r
-\r
-               OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       }\r
-}\r
-\r
-ib_api_status_t\r
-osm_vendor_get_guid_by_ca_and_port(IN osm_vendor_t * const p_vend,\r
-                                  IN char *hca_id,\r
-                                  IN uint32_t port_num,\r
-                                  OUT uint64_t * p_port_guid);\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_init\r
- *\r
- * DESCRIPTION\r
- *   Setup the MAD transport infrastructure (filters, callbacks etc).\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_init(IN osm_bind_info_t * p_info,\r
-                   IN char hca_id[VENDOR_HCA_MAXNAMES],\r
-                   IN uint8_t hca_idx, IN osmv_bind_obj_t * p_bo)\r
-{\r
-       ibms_conn_handle_t conHdl;      /* the connection we talk to the simulator through */\r
-       osmv_ibms_transport_mgr_t *p_mgr =\r
-           malloc(sizeof(osmv_ibms_transport_mgr_t));\r
-       int qpn;\r
-       int ibms_status;\r
-       uint64_t port_guid;\r
-\r
-       if (!p_mgr) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_mgr, 0, sizeof(osmv_ibms_transport_mgr_t));\r
-\r
-       /* create the client socket connected to the simulator */\r
-       /* also perform the "connect" message - such that we\r
-          validate the target guid */\r
-       if (osm_vendor_get_guid_by_ca_and_port\r
-           (p_bo->p_vendor, hca_id, p_bo->port_num, &port_guid)) {\r
-               return IB_INVALID_GUID;\r
-       }\r
-\r
-       conHdl =\r
-           ibms_connect(port_guid, __osmv_ibms_receiver_callback,\r
-                        (void *)p_bo);\r
-       if (!conHdl) {\r
-               printf("fail to connect to the server.\n");\r
-               exit(1);\r
-       }\r
-\r
-       /*\r
-        * Create the MAD filter on this file handle.\r
-        */\r
-\r
-       p_mgr->filter.port = p_bo->port_num;\r
-       p_mgr->filter.only_input = 1;\r
-       p_mgr->filter.mask =\r
-           IBMS_BIND_MASK_PORT |\r
-           IBMS_BIND_MASK_INPUT | IBMS_BIND_MASK_QP | IBMS_BIND_MASK_CLASS;\r
-\r
-       switch (p_info->mad_class) {\r
-       case IB_MCLASS_SUBN_LID:\r
-       case IB_MCLASS_SUBN_DIR:\r
-               qpn = 0;\r
-               p_mgr->filter.qpn = qpn;\r
-               p_mgr->filter.mgt_class = IB_MCLASS_SUBN_LID;\r
-               ibms_status = ibms_bind(conHdl, &p_mgr->filter);\r
-               if (ibms_status) {\r
-                       return IB_ERROR;\r
-               }\r
-\r
-               p_mgr->filter.mgt_class = IB_MCLASS_SUBN_DIR;\r
-               ibms_status = ibms_bind(conHdl, &p_mgr->filter);\r
-               if (ibms_status) {\r
-                       return IB_ERROR;\r
-               }\r
-\r
-               break;\r
-\r
-       case IB_MCLASS_SUBN_ADM:\r
-       default:\r
-               qpn = 1;\r
-               p_mgr->filter.qpn = qpn;\r
-               p_mgr->filter.mgt_class = p_info->mad_class;\r
-               ibms_status = ibms_bind(conHdl, &p_mgr->filter);\r
-               if (ibms_status) {\r
-                       return IB_ERROR;\r
-               }\r
-               break;\r
-       }\r
-\r
-       p_mgr->conHdl = conHdl;\r
-\r
-       p_bo->p_transp_mgr = p_mgr;\r
-\r
-       /* Initialize the magic_ptr to the pointer of the p_bo info.\r
-          This will be used to signal when the object is being destroyed, so no\r
-          real action will be done then. */\r
-       p_bo->magic_ptr = p_bo;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_send_mad\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 byte)\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_mad_send(IN const osm_bind_handle_t h_bind,\r
-                       IN void *p_mad, IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       int ret;\r
-       ibms_mad_msg_t mad_msg;\r
-       ib_api_status_t status;\r
-\r
-       const ib_mad_t *p_mad_hdr = p_mad;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       memset(&mad_msg, 0, sizeof(mad_msg));\r
-\r
-       /* Make sure the p_bo object is still relevant */\r
-       if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-               return IB_INVALID_CALLBACK;\r
-\r
-       /*\r
-        * Copy the MAD over to the sent mad\r
-        */\r
-       memcpy(&mad_msg.header, p_mad_hdr, MAD_BLOCK_SIZE);\r
-\r
-       /*\r
-        * For all sends other than directed route SM MADs,\r
-        * acquire an address vector for the destination.\r
-        */\r
-       if (p_mad_hdr->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
-\r
-               __osmv_ibms_osm_addr_to_mad_addr(p_mad_addr,\r
-                                                p_mad_hdr->mgmt_class ==\r
-                                                IB_MCLASS_SUBN_LID,\r
-                                                &mad_msg.addr);\r
-       } else {\r
-               /* is a directed route - we need to construct a permissive address */\r
-               /* we do not need port number since it is part of the mad_hndl */\r
-               mad_msg.addr.dlid = IB_LID_PERMISSIVE;\r
-               mad_msg.addr.slid = IB_LID_PERMISSIVE;\r
-               mad_msg.addr.sqpn = 0;\r
-               mad_msg.addr.dqpn = 0;\r
-       }\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "osmv_transport_mad_send: "\r
-               "Sending QPN:%d DLID:0x%04x class:0x%02x "\r
-               "method:0x%02x attr:0x%04x status:0x%04x "\r
-               "tid:0x%016" PRIx64 "\n",\r
-               mad_msg.addr.dqpn,\r
-               cl_ntoh16(mad_msg.addr.dlid),\r
-               mad_msg.header.mgmt_class,\r
-               mad_msg.header.method,\r
-               cl_ntoh16(mad_msg.header.attr_id),\r
-               cl_ntoh16(mad_msg.header.status),\r
-               cl_ntoh64(mad_msg.header.trans_id)\r
-           );\r
-\r
-       /* send it */\r
-       ret =\r
-           ibms_send(((osmv_ibms_transport_mgr_t *) (p_bo->p_transp_mgr))->\r
-                     conHdl, &mad_msg);\r
-       if (ret) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osmv_transport_mad_send: ERR 5304: "\r
-                       "Error sending mad (%d).\n", ret);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-void osmv_transport_done(IN const osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osmv_ibms_transport_mgr_t *p_tpot_mgr =\r
-           (osmv_ibms_transport_mgr_t *) (p_bo->p_transp_mgr);\r
-\r
-       CL_ASSERT(p_bo);\r
-\r
-       /* First of all - zero out the magic_ptr, so if a callback is called -\r
-          it'll know that we are currently closing down, and will not handle the\r
-          mad. */\r
-       p_bo->magic_ptr = 0;\r
-       /* usleep(3000000); */\r
-\r
-       ibms_disconnect(p_tpot_mgr->conHdl);\r
-\r
-       /* seems the only way to abort a blocking read is to make it read something */\r
-       free(p_tpot_mgr);\r
-}\r
-\r
-static void\r
-__osmv_ibms_osm_addr_to_mad_addr(IN const osm_mad_addr_t * p_osm_addr,\r
-                                IN uint8_t is_smi,\r
-                                OUT struct _ibms_mad_addr *p_ibms_addr)\r
-{\r
-\r
-       /* For global destination or Multicast address: */\r
-       p_ibms_addr->dlid = cl_ntoh16(p_osm_addr->dest_lid);\r
-       p_ibms_addr->sl = p_osm_addr->addr_type.gsi.service_level;\r
-       if (is_smi) {\r
-               p_ibms_addr->sqpn = 0;\r
-               p_ibms_addr->dqpn = 0;\r
-       } else {\r
-               p_ibms_addr->sqpn = 1;\r
-               p_ibms_addr->dqpn =\r
-                   cl_ntoh32(p_osm_addr->addr_type.gsi.remote_qp);\r
-       }\r
-       /*\r
-          HACK we limit to the first PKey Index assuming it will\r
-          always be the default PKey\r
-        */\r
-       p_ibms_addr->pkey_index = 0;\r
-}\r
-\r
-static void\r
-__osmv_ibms_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,\r
-                                IN struct _ibms_mad_addr *p_ibms_addr,\r
-                                IN uint8_t is_smi,\r
-                                OUT osm_mad_addr_t * p_osm_addr)\r
-{\r
-       memset(p_osm_addr, 0, sizeof(osm_mad_addr_t));\r
-       p_osm_addr->dest_lid = cl_hton16(p_ibms_addr->slid);\r
-       p_osm_addr->static_rate = 0;\r
-       p_osm_addr->path_bits = 0;\r
-       if (is_smi) {\r
-               /* SMI */\r
-               p_osm_addr->addr_type.smi.source_lid =\r
-                   cl_hton16(p_ibms_addr->slid);\r
-               p_osm_addr->addr_type.smi.port_num = 1; /* TODO add if required p_ibms_addr->port; */\r
-       } else {\r
-               /* GSI */\r
-               p_osm_addr->addr_type.gsi.remote_qp =\r
-                   cl_ntoh32(p_ibms_addr->sqpn);\r
-               p_osm_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-               p_osm_addr->addr_type.gsi.pkey_ix = p_ibms_addr->pkey_index;\r
-               p_osm_addr->addr_type.gsi.service_level = p_ibms_addr->sl;\r
-\r
-               p_osm_addr->addr_type.gsi.global_route = FALSE;\r
-               /* copy the GRH data if relevant - TopSpin imp doesnt relate to GRH!!! */\r
-               /*\r
-                  if (p_osm_addr->addr_type.gsi.global_route)\r
-                  {\r
-                  p_osm_addr->addr_type.gsi.grh_info.ver_class_flow =\r
-                  ib_grh_set_ver_class_flow(p_rcv_desc->grh.IP_version,\r
-                  p_rcv_desc->grh.traffic_class,\r
-                  p_rcv_desc->grh.flow_label);\r
-                  p_osm_addr->addr_type.gsi.grh_info.hop_limit =  p_rcv_desc->grh.hop_limit;\r
-                  memcpy(&p_osm_addr->addr_type.gsi.grh_info.src_gid.raw,\r
-                  &p_rcv_desc->grh.sgid, sizeof(ib_net64_t));\r
-                  memcpy(&p_osm_addr->addr_type.gsi.grh_info.dest_gid.raw,\r
-                  p_rcv_desc->grh.dgid,  sizeof(ib_net64_t));\r
-                  }\r
-                */\r
-       }\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_set_sm\r
- *\r
- *  DESCRIPTION     Modifies the port info for the bound port to set the "IS_SM" bit\r
- *                  according to the value given (TRUE or FALSE).\r
- */\r
-\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       int ret;\r
-       ibms_cap_msg_t cap_msg;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       cap_msg.mask = IB_PORT_CAP_IS_SM;\r
-       if (is_sm_val)\r
-               cap_msg.capabilities = IB_PORT_CAP_IS_SM;\r
-       else\r
-               cap_msg.capabilities = 0;\r
-\r
-       ret = ibms_set_cap(((osmv_ibms_transport_mgr_t *) (p_bo->\r
-                                                          p_transp_mgr))->\r
-                          conHdl, &cap_msg);\r
-\r
-       if (ret) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_set_sm: ERR 5312: "\r
-                       "Unable set 'IS_SM' bit to:%u in port attributes.\n",\r
-                       is_sm_val);\r
-       }\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_ts.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_ts.c
deleted file mode 100644 (file)
index 3966aac..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*  AUTHOR                 Edward Bortnikov\r
- *\r
- *  DESCRIPTION\r
- *     The lower-level MAD transport interface implementation\r
- *     that allows sending a single MAD/receiving a callback\r
- *     when a single MAD is received.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <sys/ioctl.h>\r
-#include <fcntl.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_mlx_transport.h>\r
-#include <vendor/osm_vendor_mlx_dispatcher.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <vendor/osm_ts_useraccess.h>\r
-\r
-typedef struct _osmv_TOPSPIN_transport_mgr_ {\r
-       int device_fd;\r
-       osm_ts_user_mad_filter filter;\r
-       cl_thread_t receiver;\r
-} osmv_TOPSPIN_transport_mgr_t;\r
-\r
-static void\r
-__osmv_TOPSPIN_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,\r
-                                   IN struct ib_mad *p_mad,\r
-                                   IN uint8_t is_smi,\r
-                                   OUT osm_mad_addr_t * p_mad_addr);\r
-\r
-static void\r
-__osmv_TOPSPIN_osm_addr_to_mad_addr(IN const osm_mad_addr_t * p_mad_addr,\r
-                                   IN uint8_t is_smi,\r
-                                   OUT struct ib_mad *p_mad);\r
-\r
-void __osmv_TOPSPIN_receiver_thr(void *p_ctx)\r
-{\r
-       int ts_ret_code;\r
-       struct ib_mad mad;\r
-       osm_mad_addr_t mad_addr;\r
-       osmv_bind_obj_t *const p_bo = (osmv_bind_obj_t *) p_ctx;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       /* Make sure the p_bo object is still relevant */\r
-       if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-               return;\r
-\r
-       /* we set the type of cancelation for this thread */\r
-       /* pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); */\r
-\r
-       while (1) {\r
-               /* Make sure the p_bo object is still relevant */\r
-               if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                       return;\r
-\r
-               /* we read one mad at a time and pass it to the read callback function */\r
-               ts_ret_code =\r
-                   read(((osmv_TOPSPIN_transport_mgr_t *) (p_bo->\r
-                                                           p_transp_mgr))->\r
-                        device_fd, &mad, sizeof(mad));\r
-               /* Make sure the p_bo object is still relevant */\r
-               if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                       return;\r
-\r
-               if (ts_ret_code != sizeof(mad)) {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_TOPSPIN_receiver_thr: ERR 6803: "\r
-                               "error with read, bytes = %d, errno = %d\n",\r
-                               ts_ret_code, errno);\r
-                       break;\r
-               } else {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "__osmv_TOPSPIN_receiver_thr: "\r
-                               "MAD QPN:%d SLID:0x%04x class:0x%02x "\r
-                               "method:0x%02x attr:0x%04x status:0x%04x "\r
-                               "tid:0x%016" PRIx64 "\n",\r
-                               mad.dqpn,\r
-                               cl_ntoh16(mad.slid),\r
-                               mad.mgmt_class,\r
-                               mad.r_method,\r
-                               cl_ntoh16(mad.attribute_id),\r
-                               cl_ntoh16(mad.status),\r
-                               cl_ntoh64(mad.transaction_id));\r
-\r
-                       /* first arrange an address */\r
-                       __osmv_TOPSPIN_mad_addr_to_osm_addr(p_bo->p_vendor,\r
-                                                           &mad,\r
-                                                           (((ib_mad_t *) &\r
-                                                             mad)->\r
-                                                            mgmt_class ==\r
-                                                            IB_MCLASS_SUBN_LID)\r
-                                                           ||\r
-                                                           (((ib_mad_t *) &\r
-                                                             mad)->\r
-                                                            mgmt_class ==\r
-                                                            IB_MCLASS_SUBN_DIR),\r
-                                                           &mad_addr);\r
-\r
-                       /* call the receiver callback */\r
-\r
-                       status =\r
-                           osmv_dispatch_mad((osm_bind_handle_t) p_bo,\r
-                                             (void *)&mad, &mad_addr);\r
-\r
-                       /* Make sure the p_bo object is still relevant */\r
-                       if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-                               return;\r
-\r
-                       if (IB_INTERRUPTED == status) {\r
-\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                                       "__osmv_TOPSPIN_receiver_thr: "\r
-                                       "The bind handle %p is being closed. "\r
-                                       "Breaking the loop.\n", p_bo);\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_init\r
- *\r
- * DESCRIPTION\r
- *   Setup the MAD transport infrastructure (filters, callbacks etc).\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_init(IN osm_bind_info_t * p_info,\r
-                   IN char hca_id[VENDOR_HCA_MAXNAMES],\r
-                   IN uint8_t hca_idx, IN osmv_bind_obj_t * p_bo)\r
-{\r
-       cl_status_t cl_st;\r
-       char device_file[16];\r
-       int device_fd;\r
-       int ts_ioctl_ret;\r
-       osmv_TOPSPIN_transport_mgr_t *p_mgr =\r
-           malloc(sizeof(osmv_TOPSPIN_transport_mgr_t));\r
-       int qpn;\r
-\r
-       if (!p_mgr) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_mgr, 0, sizeof(osmv_TOPSPIN_transport_mgr_t));\r
-\r
-       /* open TopSpin file device */\r
-       /* HACK: assume last char in hostid is the HCA index */\r
-       sprintf(device_file, "/dev/ts_ua%u", hca_idx);\r
-       device_fd = open(device_file, O_RDWR);\r
-       if (device_fd < 0) {\r
-               fprintf(stderr, "Fatal: Fail to open the file:%s err:%d\n",\r
-                       device_file, errno);\r
-               return IB_ERROR;\r
-       }\r
-\r
-       /*\r
-        * Create the MAD filter on this file handle.\r
-        */\r
-\r
-       p_mgr->filter.port = p_bo->port_num;\r
-       p_mgr->filter.direction = TS_IB_MAD_DIRECTION_IN;\r
-       p_mgr->filter.mask =\r
-           TS_IB_MAD_FILTER_DIRECTION |\r
-           TS_IB_MAD_FILTER_PORT |\r
-           TS_IB_MAD_FILTER_QPN | TS_IB_MAD_FILTER_MGMT_CLASS;\r
-\r
-       switch (p_info->mad_class) {\r
-       case IB_MCLASS_SUBN_LID:\r
-       case IB_MCLASS_SUBN_DIR:\r
-               qpn = 0;\r
-               p_mgr->filter.qpn = qpn;\r
-               p_mgr->filter.mgmt_class = IB_MCLASS_SUBN_LID;\r
-               ts_ioctl_ret =\r
-                   ioctl(device_fd, TS_IB_IOCSMADFILTADD, &p_mgr->filter);\r
-               if (ts_ioctl_ret < 0) {\r
-                       return IB_ERROR;\r
-               }\r
-\r
-               p_mgr->filter.mgmt_class = IB_MCLASS_SUBN_DIR;\r
-               ts_ioctl_ret =\r
-                   ioctl(device_fd, TS_IB_IOCSMADFILTADD, &p_mgr->filter);\r
-               if (ts_ioctl_ret < 0) {\r
-                       return IB_ERROR;\r
-               }\r
-\r
-               break;\r
-\r
-       case IB_MCLASS_SUBN_ADM:\r
-       default:\r
-               qpn = 1;\r
-               p_mgr->filter.qpn = qpn;\r
-               p_mgr->filter.mgmt_class = p_info->mad_class;\r
-               ts_ioctl_ret =\r
-                   ioctl(device_fd, TS_IB_IOCSMADFILTADD, &p_mgr->filter);\r
-               if (ts_ioctl_ret < 0) {\r
-                       return IB_ERROR;\r
-               }\r
-               break;\r
-       }\r
-\r
-       p_mgr->device_fd = device_fd;\r
-\r
-       p_bo->p_transp_mgr = p_mgr;\r
-\r
-       /* Initialize the magic_ptr to the pointer of the p_bo info.\r
-          This will be used to signal when the object is being destroyed, so no\r
-          real action will be done then. */\r
-       p_bo->magic_ptr = p_bo;\r
-\r
-       /* init receiver thread */\r
-       cl_st =\r
-           cl_thread_init(&p_mgr->receiver, __osmv_TOPSPIN_receiver_thr,\r
-                          (void *)p_bo, "osmv TOPSPIN rcv thr");\r
-\r
-       return (ib_api_status_t) cl_st;\r
-}\r
-\r
-/*\r
- * NAME\r
- *   osmv_transport_send_mad\r
- *\r
- * DESCRIPTION\r
- *   Send a single MAD (256 byte)\r
- */\r
-\r
-ib_api_status_t\r
-osmv_transport_mad_send(IN const osm_bind_handle_t h_bind,\r
-                       IN void *p_mad, IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       struct ib_mad ts_mad;\r
-       int ret;\r
-       ib_api_status_t status;\r
-\r
-       const ib_mad_t *p_mad_hdr = p_mad;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       memset(&ts_mad, 0, sizeof(ts_mad));\r
-\r
-       /* Make sure the p_bo object is still relevant */\r
-       if ((p_bo->magic_ptr != p_bo) || p_bo->is_closing)\r
-               return IB_INVALID_CALLBACK;\r
-\r
-       /*\r
-        * Copy the MAD over to the sent mad\r
-        */\r
-       memcpy(&ts_mad, p_mad_hdr, MAD_BLOCK_SIZE);\r
-\r
-       /*\r
-        * For all sends other than directed route SM MADs,\r
-        * acquire an address vector for the destination.\r
-        */\r
-       if (p_mad_hdr->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
-\r
-               __osmv_TOPSPIN_osm_addr_to_mad_addr(p_mad_addr,\r
-                                                   p_mad_hdr->mgmt_class ==\r
-                                                   IB_MCLASS_SUBN_LID,\r
-                                                   &ts_mad);\r
-       } else {\r
-               /* is a directed route - we need to construct a permissive address */\r
-               /* we do not need port number since it is part of the mad_hndl */\r
-               ts_mad.dlid = IB_LID_PERMISSIVE;\r
-               ts_mad.slid = IB_LID_PERMISSIVE;\r
-               ts_mad.sqpn = 0;\r
-               ts_mad.dqpn = 0;\r
-       }\r
-\r
-       ts_mad.port = p_bo->port_num;\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "osmv_transport_mad_send: "\r
-               "Sending QPN:%d DLID:0x%04x class:0x%02x "\r
-               "method:0x%02x attr:0x%04x status:0x%04x "\r
-               "tid:0x%016" PRIx64 "\n",\r
-               ts_mad.dqpn,\r
-               cl_ntoh16(ts_mad.dlid),\r
-               ts_mad.mgmt_class,\r
-               ts_mad.r_method,\r
-               cl_ntoh16(ts_mad.attribute_id),\r
-               cl_ntoh16(ts_mad.status), cl_ntoh64(ts_mad.transaction_id)\r
-           );\r
-\r
-       /* send it */\r
-       ret =\r
-           write(((osmv_TOPSPIN_transport_mgr_t *) (p_bo->p_transp_mgr))->\r
-                 device_fd, &ts_mad, sizeof(ts_mad));\r
-\r
-       if (ret != sizeof(ts_mad)) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osmv_transport_mad_send: ERR 6804: "\r
-                       "Error sending mad (%d).\n", ret);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-       return (status);\r
-}\r
-\r
-/*\r
-   register a new mad type to the opened device file\r
-   and send a mad through - the main idea is to make\r
-   the filter catch it such that the read unblocks\r
-*/\r
-void __osm_transport_gen_dummy_mad(osmv_bind_obj_t * p_bo)\r
-{\r
-       struct ib_mad ts_mad;\r
-       osmv_TOPSPIN_transport_mgr_t *p_mgr =\r
-           (osmv_TOPSPIN_transport_mgr_t *) (p_bo->p_transp_mgr);\r
-       struct ib_get_port_info_ioctl port_data;\r
-       int ts_ioctl_ret;\r
-\r
-       /* prepare the mad fields following the stored filter on the bind */\r
-       memset(&ts_mad, 0, sizeof(ts_mad));\r
-       ts_mad.format_version = 1;\r
-       ts_mad.mgmt_class = p_mgr->filter.mgmt_class;\r
-       ts_mad.attribute_id = 0x2;\r
-       ts_mad.class_version = 1;\r
-       ts_mad.r_method = cl_ntoh16(0x2);\r
-       ts_mad.port = p_bo->port_num;\r
-       ts_mad.sqpn = p_mgr->filter.qpn;\r
-       ts_mad.dqpn = p_mgr->filter.qpn;\r
-       ts_mad.slid = 0xffff;\r
-       /* we must send to our local lid ... */\r
-       port_data.port = p_bo->port_num;\r
-       ts_ioctl_ret = ioctl(p_mgr->device_fd, TS_IB_IOCGPORTINFO, &port_data);\r
-       ts_mad.dlid = port_data.port_info.lid;\r
-       ts_mad.transaction_id = 0x9999;\r
-       write(p_mgr->device_fd, &ts_mad, sizeof(ts_mad));\r
-}\r
-\r
-void osmv_transport_done(IN const osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osmv_TOPSPIN_transport_mgr_t *p_tpot_mgr =\r
-           (osmv_TOPSPIN_transport_mgr_t *) (p_bo->p_transp_mgr);\r
-\r
-       CL_ASSERT(p_bo);\r
-\r
-       /* First of all - zero out the magic_ptr, so if a callback is called -\r
-          it'll know that we are currently closing down, and will not handle the\r
-          mad. */\r
-       p_bo->magic_ptr = 0;\r
-       /* usleep(3000000); */\r
-\r
-       /* seems the only way to abort a blocking read is to make it read something */\r
-       __osm_transport_gen_dummy_mad(p_bo);\r
-       cl_thread_destroy(&(p_tpot_mgr->receiver));\r
-       free(p_tpot_mgr);\r
-}\r
-\r
-static void\r
-__osmv_TOPSPIN_osm_addr_to_mad_addr(IN const osm_mad_addr_t * p_mad_addr,\r
-                                   IN uint8_t is_smi, OUT struct ib_mad *p_mad)\r
-{\r
-\r
-       /* For global destination or Multicast address: */\r
-       p_mad->dlid = cl_ntoh16(p_mad_addr->dest_lid);\r
-       p_mad->sl = p_mad_addr->addr_type.gsi.service_level;\r
-       if (is_smi) {\r
-               p_mad->sqpn = 0;\r
-               p_mad->dqpn = 0;\r
-       } else {\r
-               p_mad->sqpn = 1;\r
-               p_mad->dqpn = cl_ntoh32(p_mad_addr->addr_type.gsi.remote_qp);\r
-       }\r
-       /*\r
-          HACK we limit to the first PKey Index assuming it will\r
-          always be the default PKey\r
-        */\r
-       p_mad->pkey_index = 0;\r
-}\r
-\r
-static void\r
-__osmv_TOPSPIN_mad_addr_to_osm_addr(IN osm_vendor_t const *p_vend,\r
-                                   IN struct ib_mad *p_mad,\r
-                                   IN uint8_t is_smi,\r
-                                   OUT osm_mad_addr_t * p_mad_addr)\r
-{\r
-       p_mad_addr->dest_lid = cl_hton16(p_mad->slid);\r
-       p_mad_addr->static_rate = 0;\r
-       p_mad_addr->path_bits = 0;\r
-       if (is_smi) {\r
-               /* SMI */\r
-               p_mad_addr->addr_type.smi.source_lid = cl_hton16(p_mad->slid);\r
-               p_mad_addr->addr_type.smi.port_num = p_mad->port;\r
-       } else {\r
-               /* GSI */\r
-               p_mad_addr->addr_type.gsi.remote_qp = cl_ntoh32(p_mad->sqpn);\r
-               p_mad_addr->addr_type.gsi.remote_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-               /*  There is a TAVOR limitation that only one P_KEY is supported per */\r
-               /*  QP - so QP1 must use IB_DEFAULT_PKEY */\r
-               p_mad_addr->addr_type.gsi.pkey_ix = p_mad->pkey_index;\r
-               p_mad_addr->addr_type.gsi.service_level = p_mad->sl;\r
-\r
-               p_mad_addr->addr_type.gsi.global_route = FALSE;\r
-               /* copy the GRH data if relevant - TopSpin imp doesnt relate to GRH!!! */\r
-               /*\r
-                  if (p_mad_addr->addr_type.gsi.global_route)\r
-                  {\r
-                  p_mad_addr->addr_type.gsi.grh_info.ver_class_flow =\r
-                  ib_grh_set_ver_class_flow(p_rcv_desc->grh.IP_version,\r
-                  p_rcv_desc->grh.traffic_class,\r
-                  p_rcv_desc->grh.flow_label);\r
-                  p_mad_addr->addr_type.gsi.grh_info.hop_limit =  p_rcv_desc->grh.hop_limit;\r
-                  memcpy(&p_mad_addr->addr_type.gsi.grh_info.src_gid.raw,\r
-                  &p_rcv_desc->grh.sgid, sizeof(ib_net64_t));\r
-                  memcpy(&p_mad_addr->addr_type.gsi.grh_info.dest_gid.raw,\r
-                  p_rcv_desc->grh.dgid,  sizeof(ib_net64_t));\r
-                  }\r
-                */\r
-       }\r
-}\r
-\r
-/*\r
- *  NAME            osm_vendor_set_sm\r
- *\r
- *  DESCRIPTION     Modifies the port info for the bound port to set the "IS_SM" bit\r
- *                  according to the value given (TRUE or FALSE).\r
- */\r
-#if (defined(OSM_VENDOR_INTF_TS_NO_VAPI) || defined(OSM_VENDOR_INTF_TS))\r
-\r
-void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       osm_vendor_t const *p_vend = p_bo->p_vendor;\r
-       int ts_ioctl_ret;\r
-       int device_fd =\r
-           ((osmv_TOPSPIN_transport_mgr_t *) (p_bo->p_transp_mgr))->device_fd;\r
-       struct ib_set_port_info_ioctl set_port_data;\r
-\r
-       OSM_LOG_ENTER(p_vend->p_log);\r
-\r
-       memset(&set_port_data, 0, sizeof(set_port_data));\r
-\r
-       set_port_data.port = p_bo->port_num;\r
-       set_port_data.port_info.valid_fields = IB_PORT_IS_SM;\r
-       set_port_data.port_info.is_sm = is_sm_val;\r
-       ts_ioctl_ret = ioctl(device_fd, TS_IB_IOCSPORTINFO, &set_port_data);\r
-       if (ts_ioctl_ret < 0) {\r
-               osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                       "osm_vendor_set_sm: ERR 6805: "\r
-                       "Unable set 'IS_SM' bit to:%u in port attributes (%d).\n",\r
-                       is_sm_val, ts_ioctl_ret);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vend->p_log);\r
-}\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c
deleted file mode 100644 (file)
index 55c312a..0000000
+++ /dev/null
@@ -1,680 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-\r
-#include <vendor/osm_vendor_mlx.h>\r
-#include <vendor/osm_vendor_mlx_defs.h>\r
-#include <vendor/osm_vendor_mlx_txn.h>\r
-#include <vendor/osm_vendor_mlx_svc.h>\r
-#include <vendor/osm_vendor_mlx_sender.h>\r
-\r
-static ib_api_status_t\r
-__osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                    IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-static ib_api_status_t\r
-__osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                        IN osmv_txn_ctx_t * p_txn, IN uint64_t key);\r
-\r
-static ib_api_status_t\r
-__osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                        IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn);\r
-\r
-static void __osmv_txn_all_done(osm_bind_handle_t h_bind);\r
-\r
-static uint64_t\r
-__osmv_txn_timeout_cb(IN uint64_t key,\r
-                     IN uint32_t num_regs, IN void *cb_context);\r
-\r
-ib_api_status_t\r
-osmv_txn_init(IN osm_bind_handle_t h_bind,\r
-             IN uint64_t tid, IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       ib_api_status_t st;\r
-       osmv_txn_ctx_t *p_txn;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       CL_ASSERT(NULL != h_bind && NULL != pp_txn);\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "Starting transaction 0x%016" PRIx64\r
-               " (key=0x%016" PRIx64 ")\n", tid, key);\r
-\r
-       p_txn = malloc(sizeof(osmv_txn_ctx_t));\r
-       if (!p_txn) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_txn, 0, sizeof(osmv_txn_ctx_t));\r
-       p_txn->p_log = p_bo->txn_mgr.p_log;\r
-       p_txn->tid = tid;\r
-       p_txn->key = key;\r
-       p_txn->p_madw = NULL;\r
-       p_txn->rmpp_txfr.rmpp_state = OSMV_TXN_RMPP_NONE;\r
-\r
-       /* insert into transaction manager DB */\r
-       st = __osmv_txnmgr_insert_txn(&p_bo->txn_mgr, p_txn, key);\r
-       if (IB_SUCCESS != st) {\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                       "osmv_txn_init: ERR 6703: "\r
-                       "Failed to insert to transaction 0x%016" PRIx64\r
-                       " (key=0x%016" PRIx64 ") to manager DB\n",\r
-                       tid, key);\r
-               goto insert_txn_failed;\r
-       }\r
-\r
-       *pp_txn = p_txn;\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return IB_SUCCESS;\r
-\r
-insert_txn_failed:\r
-       free(p_txn);\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return st;\r
-}\r
-\r
-ib_api_status_t\r
-osmv_txn_init_rmpp_sender(IN osm_bind_handle_t h_bind,\r
-                         IN osmv_txn_ctx_t * p_txn, IN osm_madw_t * p_madw)\r
-{\r
-       ib_api_status_t st;\r
-\r
-       CL_ASSERT(p_txn);\r
-\r
-       /* Double-Sided RMPP Direction Switch */\r
-       osmv_txn_remove_timeout_ev(h_bind, osmv_txn_get_key(p_txn));\r
-\r
-       p_txn->rmpp_txfr.rmpp_state = OSMV_TXN_RMPP_SENDER;\r
-       p_txn->rmpp_txfr.p_rmpp_send_ctx = malloc(sizeof(osmv_rmpp_send_ctx_t));\r
-\r
-       if (!p_txn->rmpp_txfr.p_rmpp_send_ctx) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_txn->rmpp_txfr.p_rmpp_send_ctx, 0,\r
-              sizeof(osmv_rmpp_send_ctx_t));\r
-\r
-       st = osmv_rmpp_send_ctx_init(p_txn->rmpp_txfr.p_rmpp_send_ctx,\r
-                                    (void *)p_madw->p_mad,\r
-                                    p_madw->mad_size, p_txn->p_log);\r
-       return st;\r
-}\r
-\r
-ib_api_status_t\r
-osmv_txn_init_rmpp_receiver(IN osm_bind_handle_t h_bind,\r
-                           IN osmv_txn_ctx_t * p_txn,\r
-                           IN boolean_t is_init_by_peer)\r
-{\r
-       ib_api_status_t st;\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       uint64_t key = osmv_txn_get_key(p_txn);\r
-\r
-       CL_ASSERT(p_txn);\r
-\r
-       /* Double-Sided RMPP Direction Switch */\r
-       osmv_txn_remove_timeout_ev(h_bind, key);\r
-\r
-       /* Set the Transaction Timeout value */\r
-       st = osmv_txn_set_timeout_ev(h_bind, key,\r
-                                    p_bo->p_vendor->ttime_timeout);\r
-       if (IB_SUCCESS != st) {\r
-\r
-               return st;\r
-       }\r
-\r
-       p_txn->rmpp_txfr.rmpp_state = OSMV_TXN_RMPP_RECEIVER;\r
-       p_txn->rmpp_txfr.is_rmpp_init_by_peer = is_init_by_peer;\r
-\r
-       p_txn->rmpp_txfr.p_rmpp_recv_ctx = malloc(sizeof(osmv_rmpp_recv_ctx_t));\r
-\r
-       if (!p_txn->rmpp_txfr.p_rmpp_recv_ctx) {\r
-\r
-               osmv_txn_remove_timeout_ev(h_bind, key);\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_txn->rmpp_txfr.p_rmpp_recv_ctx, 0,\r
-              sizeof(osmv_rmpp_recv_ctx_t));\r
-\r
-       st = osmv_rmpp_recv_ctx_init(p_txn->rmpp_txfr.p_rmpp_recv_ctx,\r
-                                    p_txn->p_log);\r
-\r
-       return st;\r
-}\r
-\r
-/*\r
- * NAME\r
- *  osmv_txn_set_timeout_ev\r
- *\r
- * DESCRIPTION\r
- *\r
- * SEE ALSO\r
- *\r
- */\r
-ib_api_status_t\r
-osmv_txn_set_timeout_ev(IN osm_bind_handle_t h_bind,\r
-                       IN uint64_t key, IN uint64_t msec)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       cl_event_wheel_t *p_event_wheel = p_bo->txn_mgr.p_event_wheel;\r
-       cl_status_t status;\r
-\r
-       status = cl_event_wheel_reg(p_event_wheel, key, cl_get_time_stamp() + 1000 * msec,      /* TTL */\r
-                                   __osmv_txn_timeout_cb,\r
-                                   p_bo /* The context */ );\r
-\r
-       return (ib_api_status_t) status;\r
-}\r
-\r
-/*\r
- * NAME\r
- *  osmv_txn_remove_timeout_ev\r
- *\r
- * DESCRIPTION\r
-\r
- * SEE ALSO\r
- *\r
- */\r
-void osmv_txn_remove_timeout_ev(IN osm_bind_handle_t h_bind, IN uint64_t key)\r
-{\r
-       cl_event_wheel_t *p_event_wheel =\r
-           ((osmv_bind_obj_t *) h_bind)->txn_mgr.p_event_wheel;\r
-       cl_event_wheel_unreg(p_event_wheel, key);\r
-}\r
-\r
-void\r
-osmv_txn_done(IN osm_bind_handle_t h_bind,\r
-             IN uint64_t key, IN boolean_t is_in_cb)\r
-{\r
-       osmv_txn_ctx_t *p_ctx;\r
-       osmv_bind_obj_t *const p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       CL_ASSERT(h_bind);\r
-\r
-       /* Cancel the (single) timeout possibly outstanding for this txn\r
-        * Don't do this if you are in the callback context, for 2 reasons:\r
-        * (1) The event wheel will remove the context itself.\r
-        * (2) If we try to, there is a deadlock in the event wheel\r
-        */\r
-       if (FALSE == is_in_cb) {\r
-               osmv_txn_remove_timeout_ev(h_bind, key);\r
-       }\r
-\r
-       /* Remove from DB */\r
-       if (IB_NOT_FOUND ==\r
-           __osmv_txnmgr_remove_txn(&p_bo->txn_mgr, key, &p_ctx)) {\r
-               return;\r
-       }\r
-\r
-       /* Destroy the transaction's RMPP contexts\r
-        * (can be more than one in the case of double sided transfer)\r
-        */\r
-\r
-       if (p_ctx->rmpp_txfr.p_rmpp_send_ctx) {\r
-               osmv_rmpp_send_ctx_done(p_ctx->rmpp_txfr.p_rmpp_send_ctx);\r
-       }\r
-\r
-       if (p_ctx->rmpp_txfr.p_rmpp_recv_ctx) {\r
-               osmv_rmpp_recv_ctx_done(p_ctx->rmpp_txfr.p_rmpp_recv_ctx);\r
-       }\r
-\r
-       free(p_ctx);\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-ib_api_status_t\r
-osmv_txn_lookup(IN osm_bind_handle_t h_bind,\r
-               IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       return __osmv_txnmgr_lookup(&(((osmv_bind_obj_t *) h_bind)->txn_mgr),\r
-                                   key, pp_txn);\r
-}\r
-\r
-void osmv_txn_abort_rmpp_txns(osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       cl_map_item_t *p_item;\r
-       cl_map_obj_t *p_obj;\r
-       osmv_txn_ctx_t *p_txn;\r
-       osmv_rmpp_send_ctx_t *p_send_ctx;\r
-       cl_qmap_t *p_map = p_bo->txn_mgr.p_txn_map;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       while (FALSE == cl_is_qmap_empty(p_map)) {\r
-\r
-               p_item = cl_qmap_head(p_map);\r
-               p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item);\r
-               p_txn = (osmv_txn_ctx_t *) cl_qmap_obj(p_obj);\r
-               p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);\r
-\r
-               if (NULL != p_send_ctx) {\r
-\r
-                       p_send_ctx->status = IB_INTERRUPTED;\r
-\r
-                       /* Wake up the sender thread to let it break out */\r
-                       cl_event_signal(&p_send_ctx->event);\r
-               }\r
-\r
-               cl_qmap_remove_item(p_map, p_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-ib_api_status_t\r
-osmv_txnmgr_init(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                IN osm_log_t * p_log, IN cl_spinlock_t * p_lock)\r
-{\r
-       cl_status_t cl_st = CL_SUCCESS;\r
-\r
-       p_tx_mgr->p_event_wheel = malloc(sizeof(cl_event_wheel_t));\r
-       if (!p_tx_mgr->p_event_wheel) {\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_tx_mgr->p_event_wheel, 0, sizeof(cl_event_wheel_t));\r
-\r
-       cl_event_wheel_construct(p_tx_mgr->p_event_wheel);\r
-\r
-       /* NOTE! We are using an extended constructor.\r
-        * We tell the Event Wheel run in a non-protected manner in the reg/unreg calls,\r
-        * and acquire an external lock in the asynchronous callback.\r
-        */\r
-       cl_st = cl_event_wheel_init_ex(p_tx_mgr->p_event_wheel, p_lock);\r
-       if (cl_st != CL_SUCCESS) {\r
-               free(p_tx_mgr->p_event_wheel);\r
-               return (ib_api_status_t) cl_st;\r
-       }\r
-\r
-       p_tx_mgr->p_txn_map = malloc(sizeof(cl_qmap_t));\r
-       if (!p_tx_mgr->p_txn_map) {\r
-               cl_event_wheel_destroy(p_tx_mgr->p_event_wheel);\r
-               free(p_tx_mgr->p_event_wheel);\r
-               return IB_INSUFFICIENT_MEMORY;\r
-       }\r
-\r
-       memset(p_tx_mgr->p_txn_map, 0, sizeof(cl_qmap_t));\r
-\r
-       cl_qmap_init(p_tx_mgr->p_txn_map);\r
-       p_tx_mgr->p_log = p_log;\r
-\r
-       return cl_st;\r
-}\r
-\r
-void osmv_txnmgr_done(IN osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       __osmv_txn_all_done(h_bind);\r
-       free(p_bo->txn_mgr.p_txn_map);\r
-\r
-       cl_event_wheel_destroy(p_bo->txn_mgr.p_event_wheel);\r
-       free(p_bo->txn_mgr.p_event_wheel);\r
-}\r
-\r
-ib_api_status_t\r
-__osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                    IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       cl_map_item_t *p_item;\r
-       cl_map_obj_t *p_obj;\r
-\r
-       uint64_t tmp_key;\r
-\r
-       OSM_LOG_ENTER(p_tx_mgr->p_log);\r
-\r
-       CL_ASSERT(p_tx_mgr);\r
-       CL_ASSERT(pp_txn);\r
-\r
-       osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
-               "__osmv_txnmgr_lookup: "\r
-               "Looking for key: 0x%016" PRIx64 " in map ptr:%p\n", key,\r
-               p_tx_mgr->p_txn_map);\r
-\r
-       p_item = cl_qmap_head(p_tx_mgr->p_txn_map);\r
-       while (p_item != cl_qmap_end(p_tx_mgr->p_txn_map)) {\r
-               tmp_key = cl_qmap_key(p_item);\r
-               osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_txnmgr_lookup: "\r
-                       "Found key 0x%016" PRIx64 "\n", tmp_key);\r
-               p_item = cl_qmap_next(p_item);\r
-       }\r
-\r
-       p_item = cl_qmap_get(p_tx_mgr->p_txn_map, key);\r
-       if (cl_qmap_end(p_tx_mgr->p_txn_map) == p_item) {\r
-               status = IB_NOT_FOUND;\r
-       } else {\r
-               p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item);\r
-               *pp_txn = cl_qmap_obj(p_obj);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_tx_mgr->p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-__osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                        IN osmv_txn_ctx_t * p_txn, IN uint64_t key)\r
-{\r
-       cl_map_obj_t *p_obj = NULL;\r
-       cl_map_item_t *p_item;\r
-       uint64_t tmp_key;\r
-\r
-       CL_ASSERT(p_tx_mgr);\r
-       CL_ASSERT(p_txn);\r
-\r
-       key = osmv_txn_get_key(p_txn);\r
-       p_obj = malloc(sizeof(cl_map_obj_t));\r
-       if (NULL == p_obj)\r
-               return IB_INSUFFICIENT_MEMORY;\r
-\r
-       osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
-               "__osmv_txnmgr_insert_txn: "\r
-               "Inserting key: 0x%016" PRIx64 " to map ptr:%p\n", key,\r
-               p_tx_mgr->p_txn_map);\r
-\r
-       memset(p_obj, 0, sizeof(cl_map_obj_t));\r
-\r
-       cl_qmap_set_obj(p_obj, p_txn);\r
-       /* assuming lookup with this key was made and the result was IB_NOT_FOUND */\r
-       cl_qmap_insert(p_tx_mgr->p_txn_map, key, &p_obj->item);\r
-\r
-       p_item = cl_qmap_head(p_tx_mgr->p_txn_map);\r
-       while (p_item != cl_qmap_end(p_tx_mgr->p_txn_map)) {\r
-               tmp_key = cl_qmap_key(p_item);\r
-               osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "__osmv_txnmgr_insert_txn: "\r
-                       "Found key 0x%016" PRIx64 "\n", tmp_key);\r
-               p_item = cl_qmap_next(p_item);\r
-       }\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-ib_api_status_t\r
-__osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr,\r
-                        IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn)\r
-{\r
-       cl_map_obj_t *p_obj;\r
-       cl_map_item_t *p_item;\r
-\r
-       OSM_LOG_ENTER(p_tx_mgr->p_log);\r
-\r
-       CL_ASSERT(p_tx_mgr);\r
-       CL_ASSERT(pp_txn);\r
-\r
-       p_item = cl_qmap_remove(p_tx_mgr->p_txn_map, key);\r
-\r
-       if (p_item == cl_qmap_end(p_tx_mgr->p_txn_map)) {\r
-\r
-               osm_log(p_tx_mgr->p_log, OSM_LOG_ERROR,\r
-                       "__osmv_txnmgr_remove_txn: ERR 6701: "\r
-                       "Could not remove the transaction 0x%016" PRIx64 " - "\r
-                       "something is really wrong!\n", key);\r
-               OSM_LOG_EXIT(p_tx_mgr->p_log);\r
-               return IB_NOT_FOUND;\r
-       }\r
-\r
-       p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item);\r
-       *pp_txn = cl_qmap_obj(p_obj);\r
-\r
-       free(p_obj);\r
-\r
-       OSM_LOG_EXIT(p_tx_mgr->p_log);\r
-       return IB_SUCCESS;\r
-}\r
-\r
-void __osmv_txn_all_done(osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       cl_map_item_t *p_item;\r
-       cl_map_obj_t *p_obj;\r
-       osmv_txn_ctx_t *p_txn;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       p_item = cl_qmap_head(p_bo->txn_mgr.p_txn_map);\r
-       while (p_item != cl_qmap_end(p_bo->txn_mgr.p_txn_map)) {\r
-\r
-               p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item);\r
-               p_txn = (osmv_txn_ctx_t *) cl_qmap_obj(p_obj);\r
-               osmv_txn_done(h_bind, osmv_txn_get_key(p_txn), FALSE);\r
-               free(p_obj);\r
-               /* assuming osmv_txn_done has removed the txn from the map */\r
-               p_item = cl_qmap_head(p_bo->txn_mgr.p_txn_map);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-}\r
-\r
-/******************************************************************************/\r
-\r
-void osmv_txn_lock(IN osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "--> Acquiring lock %p on bind handle %p\n", &p_bo->lock, p_bo);\r
-\r
-       cl_spinlock_acquire(&p_bo->lock);\r
-\r
-       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-               "--> Acquired lock %p on bind handle %p\n", &p_bo->lock, p_bo);\r
-}\r
-\r
-void osmv_txn_unlock(IN osm_bind_handle_t h_bind)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) h_bind;\r
-       cl_spinlock_t *p_lock = &p_bo->lock;\r
-       osm_log_t *p_log = p_bo->p_vendor->p_log;\r
-\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "<-- Releasing lock %p on bind handle %p\n", p_lock, p_bo);\r
-\r
-       cl_spinlock_release(&p_bo->lock);\r
-\r
-       /* We'll use the saved ptrs, since now the p_bo can be destroyed already */\r
-       osm_log(p_log, OSM_LOG_DEBUG,\r
-               "<-- Released lock %p on bind handle %p\n", p_lock, p_bo);\r
-\r
-}\r
-\r
-static uint64_t\r
-__osmv_txn_timeout_cb(IN uint64_t key,\r
-                     IN uint32_t num_regs, IN void *cb_context)\r
-{\r
-       osmv_bind_obj_t *p_bo = (osmv_bind_obj_t *) cb_context;\r
-       uint64_t ret = 0;\r
-       osmv_txn_ctx_t *p_txn;\r
-       osmv_rmpp_send_ctx_t *p_send_ctx;\r
-       osm_madw_t *p_madw = NULL;\r
-       ib_mad_t *p_mad;\r
-       osm_mad_addr_t *p_mad_addr;\r
-       boolean_t invoke_err_cb = FALSE;\r
-\r
-       OSM_LOG_ENTER(p_bo->p_vendor->p_log);\r
-\r
-       /* Don't try to acquire a lock on the Bind Object -\r
-        * it's taken by the mechanism that drives the timeout based events!\r
-        * (Recall the special constructor that the Event Wheel is applied with)\r
-        */\r
-       if (p_bo->is_closing) {\r
-               goto txn_done;\r
-       }\r
-\r
-       ret = osmv_txn_lookup(p_bo, key, &p_txn);\r
-       if (IB_NOT_FOUND == ret) {\r
-               /* Prevent a race - the transaction is already destroyed */\r
-               goto txn_done;\r
-       }\r
-\r
-       p_madw = p_txn->p_madw;\r
-\r
-       switch (osmv_txn_get_rmpp_state(p_txn)) {\r
-\r
-       case OSMV_TXN_RMPP_NONE:\r
-               if (num_regs <= OSM_DEFAULT_RETRY_COUNT) {\r
-                       /* We still did not exceed the limit of retransmissions.\r
-                        * Set the next timeout's value.\r
-                        */\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                               "__osmv_txn_timeout_cb: "\r
-                               "The transaction request (tid=0x%016" PRIx64 ")"\r
-                               " timed out %d times. Retrying the send.\n",\r
-                               osmv_txn_get_tid(p_txn), num_regs);\r
-\r
-                       /* resend this mad */\r
-                       ret = osmv_simple_send_madw((osm_bind_handle_t *) p_bo,\r
-                                                   p_madw, p_txn, TRUE);\r
-                       if (ret != IB_SUCCESS) {\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                                       "__osmv_txn_timeout_cb: "\r
-                                       "Fail to send retry for transaction"\r
-                                       "request (tid=0x%016" PRIx64 ").\n",\r
-                                       osmv_txn_get_tid(p_txn));\r
-\r
-                               osmv_txn_done((osm_bind_handle_t) p_bo, key,\r
-                                             TRUE /*in timeout callback */ );\r
-\r
-                               /* This is a requester. Always apply the callback */\r
-                               invoke_err_cb = TRUE;\r
-                       } else {\r
-                               uint64_t next_timeout_ms;\r
-                               next_timeout_ms =\r
-                                   p_bo->p_vendor->resp_timeout * (num_regs +\r
-                                                                   1) *\r
-                                   (num_regs + 1);\r
-                               /* when do we need to timeout again */\r
-                               ret =\r
-                                   cl_get_time_stamp() +\r
-                                   (uint64_t) (1000 * next_timeout_ms);\r
-\r
-                               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                                       "__osmv_txn_timeout_cb: "\r
-                                       "Retry request timout in : %lu [msec].\n",\r
-                                       next_timeout_ms);\r
-                       }\r
-               } else {\r
-                       osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
-                               "__osmv_txn_timeout_cb: ERR 6702: "\r
-                               "The transaction request (0x%016" PRIx64 ") "\r
-                               "timed out (after %d retries). "\r
-                               "Invoking the error callback.\n",\r
-                               osmv_txn_get_tid(p_txn), num_regs);\r
-\r
-                       osmv_txn_done((osm_bind_handle_t) p_bo, key,\r
-                                     TRUE /*in timeout callback */ );\r
-\r
-                       /* This is a requester. Always apply the callback */\r
-                       invoke_err_cb = TRUE;\r
-               }\r
-               break;\r
-\r
-       case OSMV_TXN_RMPP_SENDER:\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "RMPP sender (tid=0x%016" PRIx64 ") did not receive ACK "\r
-                       "on every segment in the current send window.\n",\r
-                       osmv_txn_get_tid(p_txn));\r
-\r
-               p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn);\r
-               if (num_regs <= OSM_DEFAULT_RETRY_COUNT) {\r
-                       /* We still did not exceed the limit of retransmissions.\r
-                        * Set the next timeout's value.\r
-                        */\r
-                       ret =\r
-                           cl_get_time_stamp() +\r
-                           1000 * p_bo->p_vendor->resp_timeout;\r
-               } else {\r
-                       p_send_ctx->status = IB_TIMEOUT;\r
-\r
-                       p_mad = osm_madw_get_mad_ptr(p_madw);\r
-                       p_mad_addr = osm_madw_get_mad_addr_ptr(p_madw);\r
-\r
-                       /* Send an ABORT to the other side */\r
-                       osmv_rmpp_send_nak((osm_bind_handle_t) p_bo, p_mad,\r
-                                          p_mad_addr, IB_RMPP_TYPE_ABORT,\r
-                                          IB_RMPP_STATUS_T2L);\r
-               }\r
-\r
-               /* Wake the RMPP sender thread up */\r
-               cl_event_signal(&p_send_ctx->event);\r
-               break;\r
-\r
-       case OSMV_TXN_RMPP_RECEIVER:\r
-               osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "Transaction timeout on an RMPP receiver "\r
-                       "(tid=0x%016" PRIx64 "). Dropping the transaction.\n",\r
-                       osmv_txn_get_tid(p_txn));\r
-\r
-               osmv_txn_done((osm_bind_handle_t) p_bo, key,\r
-                             TRUE /*in timeout callback */ );\r
-\r
-               if (FALSE == osmv_txn_is_rmpp_init_by_peer(p_txn)) {\r
-                       /* This is a requester, still waiting for the reply. Apply the callback */\r
-                       invoke_err_cb = TRUE;\r
-               }\r
-\r
-               break;\r
-\r
-       default:\r
-               CL_ASSERT(FALSE);\r
-       }\r
-\r
-       if (TRUE == invoke_err_cb) {\r
-               CL_ASSERT(NULL != p_madw);\r
-               /* update the status in the p_madw */\r
-               p_madw->status = IB_TIMEOUT;\r
-               p_bo->send_err_cb(p_bo->cb_context, p_madw);\r
-               /* no re-registration */\r
-               ret = 0;\r
-       }\r
-\r
-txn_done:\r
-       OSM_LOG_EXIT(p_bo->p_vendor->p_log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/libvendor/osmv_ibal.exports b/branches/opensm_3/user/libvendor/osmv_ibal.exports
deleted file mode 100644 (file)
index f77a1e9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#if DBG\r
-LIBRARY osmv_ibald.lib\r
-#else\r
-LIBRARY osmv_ibal.lib\r
-#endif\r
-\r
-\r
-EXPORTS\r
-osm_vendor_set_debug\r
-cl_disp_init\r
-cl_disp_destroy\r
-cl_disp_shutdown\r
-cl_event_wheel_init\r
-cl_event_wheel_destroy\r
-cl_event_wheel_construct\r
-cl_event_wheel_reg\r
-cl_event_wheel_num_regs\r
-umad_receiver\r
-osm_vendor_init\r
-osm_vendor_new\r
-osm_vendor_delete\r
-osm_vendor_get_all_port_attr\r
-osm_vendor_bind\r
-osm_vendor_unbind\r
-osm_vendor_get\r
-osm_vendor_put\r
-osm_vendor_send\r
-osm_vendor_local_lid_change\r
-osm_vendor_set_sm\r
-osm_vendor_set_debug\r
-osmv_bind_sa\r
-osmv_query_sa\r
-osm_vendor_get_guid_ca_and_port\r
-getopt_long_only\r
diff --git a/branches/opensm_3/user/libvendor/osmv_openib.exports b/branches/opensm_3/user/libvendor/osmv_openib.exports
deleted file mode 100644 (file)
index 1bb39fa..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#if DBG\r
-LIBRARY osmv_openibd.lib\r
-#else\r
-LIBRARY osmv_openib.lib\r
-#endif\r
-\r
-\r
-EXPORTS\r
-osm_vendor_set_debug\r
-cl_disp_init\r
-cl_disp_destroy\r
-cl_disp_shutdown\r
-cl_event_wheel_init\r
-cl_event_wheel_destroy\r
-cl_event_wheel_construct\r
-cl_event_wheel_reg\r
-cl_event_wheel_num_regs\r
-umad_receiver\r
-osm_vendor_init\r
-osm_vendor_new\r
-osm_vendor_delete\r
-osm_vendor_get_all_port_attr\r
-osm_vendor_bind\r
-osm_vendor_unbind\r
-osm_vendor_get\r
-osm_vendor_put\r
-osm_vendor_send\r
-osm_vendor_local_lid_change\r
-osm_vendor_set_sm\r
-osm_vendor_set_debug\r
-osmv_bind_sa\r
-osmv_query_sa\r
-osm_vendor_get_guid_ca_and_port\r
diff --git a/branches/opensm_3/user/libvendor/vendor-ibal.inc b/branches/opensm_3/user/libvendor/vendor-ibal.inc
deleted file mode 100644 (file)
index 473e9f8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# vendor IBAL\r
-VENDOR_LIB=osmv_ibal\r
-VENDOR_IF=OSM_VENDOR_INTF_AL\r
-VENDOR_SRC=osm_vendor_al.c osm_vendor_mlx_sa.c\r
-VENDOR_INC=\r
-\r
diff --git a/branches/opensm_3/user/libvendor/vendor-umad.inc b/branches/opensm_3/user/libvendor/vendor-umad.inc
deleted file mode 100644 (file)
index b927e79..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Vendor UMAD\r
-VENDOR_LIB=osmv_openib\r
-VENDOR_IF=OSM_VENDOR_INTF_OPENIB\r
-VENDOR_SRC=osm_vendor_ibumad.c osm_vendor_ibumad_sa.c\r
-VENDOR_INC=$(WINIBHOME)\ulp\libibmad\include; $(WINIBHOME)\ulp\libibumad\include;\r
diff --git a/branches/opensm_3/user/libvendor/winosm_common.c b/branches/opensm_3/user/libvendor/winosm_common.c
deleted file mode 100644 (file)
index 517ef54..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-
-#include <vendor/winosm_common.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <complib/cl_memory.h>
-#include <opensm/osm_base.h>
-
-#include <..\..\..\..\etc\user\inet.c>
-
-/*
- * Just like fopen() except the filename string is env var expanded prior
- * to opening the file. Allows %TEMP%\osm.log to work.
- */
-#undef fopen
-
-FILE *Fopen( 
-   const char *filename,
-   const char *mode )
-{
-       FILE *pFile;
-       char *fname;
-
-       fname = strdup_expand(filename);
-       pFile = fopen(fname,mode);
-       free(fname);
-       return pFile;
-}
-
-#define OSM_MAX_LOG_NAME_SIZE 512
-
-static char *syslog_fname;
-static FILE *syslog_file;
-static char *syslog_id;
-
-void openlog(char *ident, int option, int facility)
-{
-       if (!syslog_fname)
-               syslog_fname = strdup(OSM_DEFAULT_TMP_DIR "osm.syslog");        
-
-       if (!syslog_file) {
-               syslog_file = Fopen(syslog_fname,"w");
-               if (syslog_file)
-                       syslog_id = strdup(ident);
-       }
-}
-
-void closelog(void)
-{
-       if (syslog_file) {
-               fprintf(syslog_file, "\n[%s] Closing syslog\n",syslog_id);
-               fflush(syslog_file);
-               fclose(syslog_file);
-               syslog_file = NULL;
-               if (syslog_id) {
-                       free((void*)syslog_id);
-                       syslog_id = NULL;
-               }
-               if (syslog_fname) {
-                       free((void*)syslog_fname);
-                       syslog_fname = NULL;
-               }
-       }
-}
-
-/* output to user-mode DebugView monitor if running */
-void syslog(int prio, char *fmt, ... )
-{
-       char Buffer[1024];
-       SYSTEMTIME st;
-       uint32_t pid = GetCurrentThreadId();
-       va_list args;
-
-       va_start(args,fmt);
-       _vsnprintf(Buffer, 1024, (LPSTR)fmt, args); 
-       va_end(args);
-
-       if (!syslog_file) {
-               OutputDebugStringA(Buffer);
-               return;
-       }
-
-       GetLocalTime(&st);
-       fprintf(syslog_file, "[%s][%02d:%02d:%02d:%03d][%04X] %s", syslog_id,
-               st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pid,
-               Buffer);
-       fflush(syslog_file);
-}
-
-
-#if 0
-/* Mellanox specific WinIB_HOME env var override of %TEMP% from previous
- * openSM port; Not currently utilized pending feedback.
- */
-
-char*
-GetOsmTempPath(void)
-{
-       char* temp_path;
-       int length;
-
-       temp_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE);
-       if (!temp_path)
-               return temp_path;
-
-       length = GetTempPath(OSM_MAX_LOG_NAME_SIZE,temp_path);
-       if (length > OSM_MAX_LOG_NAME_SIZE)
-       {
-               cl_free(temp_path);
-               temp_path = (char*)cl_malloc(length+1);
-               GetTempPath(length+1,temp_path);
-       }
-       return  temp_path;
-}
-
-char*
-GetOsmCachePath(void)
-{
-   char* cache_path;
-   char* tmp_file_name;
-   char* winib_home, tmp;
-   HANDLE hFile;
-
-   winib_home = getenv("WinIB_HOME");
-   if (winib_home == NULL)
-   {
-     /* The WinIB_HOME variable isn't defined. Use the 
-        default temp path */
-     return GetOsmTempPath();
-   }
-   cache_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE);
-   strcpy(cache_path, winib_home);
-
-   strcat(cache_path, "\\etc\\");
-   tmp_file_name = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE);
-   strcpy(tmp_file_name, cache_path);
-   strcat(tmp_file_name, "opensm.opts");
-   hFile = CreateFile(tmp_file_name,
-                      GENERIC_READ,
-                      0,
-                      NULL,
-                      OPEN_EXISTING,
-                      FILE_ATTRIBUTE_NORMAL,
-                      NULL);
-   if (hFile == INVALID_HANDLE_VALUE) 
-   { 
-     cl_free(cache_path);
-     return GetOsmTempPath();
-   }
-   /* Such file exists. This means the directory is usable */
-   CloseHandle(hFile);
-
-   return cache_path;
-}
-#endif
-
-
-/*
- * Like _strdup() with Environment varible expansion.
- * Example: str '%windir%\temp\osm.log' --> 'C:\windows\temp\osm.log'
- * Multiple Env vars are supported.
- */
-
-char *strdup_expand(const char *base)
-{
-       char *str,*p,*s,*es,*xs,*rc,*n;
-       char p_env[80];
-
-       str = _strdup(base);
-
-       while( (s = strchr(str,'%')) )
-       {
-               p = strchr((++s),'%');
-               if (!p)
-                       return str;
-
-               memcpy(p_env,s,p-s);
-               p_env[p-s] = '\0';
-               
-               es = getenv(p_env);
-               if (!es)
-                       return str;
-
-               xs = (char*)malloc(strlen(str)+strlen(es));
-               for(rc=str,n=xs; rc < (s-1);rc++) *n++ = *rc; 
-               *n='\0';
-               strcat(n,es);
-               strcat(n,(p+1));
-               free(str);
-               str = xs;
-       }
-       return str;
-}
-
-
-/****************************************************************************/
-
-#include <..\..\..\etc\user\getopt.c>
-
-int getopt_long_only(int argc, char *const*argv, const char *optstring,
-                       const struct option *longopts, int *longindex)
-{
-       return getopt_long( argc, argv, optstring, longopts, longindex );
-}
-
-/* getimeofday() */
-#include <..\..\..\etc\user\gtod.c>
-
diff --git a/branches/opensm_3/user/mad-vendor.inc b/branches/opensm_3/user/mad-vendor.inc
deleted file mode 100644 (file)
index b5fc920..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-\r
-# include only 'one' mad vendor.\r
-\r
-!INCLUDE vendor-ibal.inc\r
-\r
-#!INCLUDE vendor-umad.inc\r
diff --git a/branches/opensm_3/user/man/opensm.8 b/branches/opensm_3/user/man/opensm.8
deleted file mode 100644 (file)
index a45d678..0000000
+++ /dev/null
@@ -1,1105 +0,0 @@
-.TH OPENSM 8 "October 22, 2009" "OpenIB" "OpenIB Management"\r
-\r
-.SH NAME\r
-opensm \- InfiniBand subnet manager and administration (SM/SA)\r
-\r
-.SH SYNOPSIS\r
-.B opensm\r
-[\-\-version]]\r
-[\-F | \-\-config <file_name>]\r
-[\-c(reate-config) <file_name>]\r
-[\-g(uid) <GUID in hex>]\r
-[\-l(mc) <LMC>]\r
-[\-p(riority) <PRIORITY>]\r
-[\-smkey <SM_Key>]\r
-[\-\-sm_sl <SL number>]\r
-[\-r(eassign_lids)]\r
-[\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]\r
-[\-\-do_mesh_analysis]\r
-[\-\-lash_start_vl <vl number>]\r
-[\-A | \-\-ucast_cache]\r
-[\-z | \-\-connect_roots]\r
-[\-M <file name> | \-\-lid_matrix_file <file name>]\r
-[\-U <file name> | \-\-lfts_file <file name>]\r
-[\-S | \-\-sadb_file <file name>]\r
-[\-a | \-\-root_guid_file <path to file>]\r
-[\-u | \-\-cn_guid_file <path to file>]\r
-[\-G | \-\-io_guid_file <path to file>]\r
-[\-H | \-\-max_reverse_hops <max reverse hops allowed>]\r
-[\-X | \-\-guid_routing_order_file <path to file>]\r
-[\-m | \-\-ids_guid_file <path to file>]\r
-[\-o(nce)]\r
-[\-s(weep) <interval>]\r
-[\-t(imeout) <milliseconds>]\r
-[\-\-retries <number>]\r
-[\-maxsmps <number>]\r
-[\-console [off | local | socket | loopback]]\r
-[\-console-port <port>]\r
-[\-i(gnore-guids) <equalize-ignore-guids-file>]\r
-[\-w | \-\-hop_weights_file <path to file>]\r
-[\-f <log file path> | \-\-log_file <log file path> ]\r
-[\-L | \-\-log_limit <size in MB>] [\-e(rase_log_file)]\r
-[\-P(config) <partition config file> ]\r
-[\-N | \-\-no_part_enforce]\r
-[\-Q | \-\-qos [\-Y | \-\-qos_policy_file <file name>]]\r
-[\-y | \-\-stay_on_fatal]\r
-[\-B | \-\-daemon]\r
-[\-I | \-\-inactive]\r
-[\-\-perfmgr]\r
-[\-\-perfmgr_sweep_time_s <seconds>]\r
-[\-\-prefix_routes_file <path>]\r
-[\-\-consolidate_ipv6_snm_req]\r
-[\-v(erbose)] [\-V] [\-D <flags>] [\-d(ebug) <number>]\r
-[\-h(elp)] [\-?]\r
-\r
-.SH DESCRIPTION\r
-.PP\r
-opensm is an InfiniBand compliant Subnet Manager and Administration,\r
-and runs on top of OpenIB.\r
-\r
-opensm provides an implementation of an InfiniBand Subnet Manager and\r
-Administration. Such a software entity is required to run for in order\r
-to initialize the InfiniBand hardware (at least one per each\r
-InfiniBand subnet).\r
-\r
-opensm also now contains an experimental version of a performance\r
-manager as well.\r
-\r
-opensm defaults were designed to meet the common case usage on clusters with up to a few hundred nodes. Thus, in this default mode, opensm will scan the IB\r
-fabric, initialize it, and sweep occasionally for changes.\r
-\r
-opensm attaches to a specific IB port on the local machine and configures only\r
-the fabric connected to it. (If the local machine has other IB ports,\r
-opensm will ignore the fabrics connected to those other ports). If no port is\r
-specified, it will select the first "best" available port.\r
-\r
-opensm can present the available ports and prompt for a port number to\r
-attach to.\r
-\r
-By default, the run is logged to two files: /var/log/messages and /var/log/opensm.log.\r
-The first file will register only general major events, whereas the second\r
-will include details of reported errors. All errors reported in this second\r
-file should be treated as indicators of IB fabric health issues.\r
-(Note that when a fatal and non-recoverable error occurs, opensm will exit.)\r
-Both log files should include the message "SUBNET UP" if opensm was able to\r
-setup the subnet correctly.\r
-\r
-.SH OPTIONS\r
-\r
-.PP\r
-.TP\r
-\fB\-\-version\fR\r
-Prints OpenSM version and exits.\r
-.TP\r
-\fB\-F\fR, \fB\-\-config\fR <config file>\r
-The name of the OpenSM config file. When not specified\r
-\fB\% /usr/local/etc/opensm/opensm.conf\fP will be used (if exists).\r
-.TP\r
-\fB\-c\fR, \fB\-\-create-config\fR <file name>\r
-OpenSM will dump its configuration to the specified file and exit.\r
-This is a way to generate OpenSM configuration file template.\r
-.TP\r
-\fB\-g\fR, \fB\-\-guid\fR <GUID in hex>\r
-This option specifies the local port GUID value\r
-with which OpenSM should bind.  OpenSM may be\r
-bound to 1 port at a time.\r
-If GUID given is 0, OpenSM displays a list\r
-of possible port GUIDs and waits for user input.\r
-Without -g, OpenSM tries to use the default port.\r
-.TP\r
-\fB\-l\fR, \fB\-\-lmc\fR <LMC value>\r
-This option specifies the subnet's LMC value.\r
-The number of LIDs assigned to each port is 2^LMC.\r
-The LMC value must be in the range 0-7.\r
-LMC values > 0 allow multiple paths between ports.\r
-LMC values > 0 should only be used if the subnet\r
-topology actually provides multiple paths between\r
-ports, i.e. multiple interconnects between switches.\r
-Without -l, OpenSM defaults to LMC = 0, which allows\r
-one path between any two ports.\r
-.TP\r
-\fB\-p\fR, \fB\-\-priority\fR <Priority value>\r
-This option specifies the SM\'s PRIORITY.\r
-This will effect the handover cases, where master\r
-is chosen by priority and GUID.  Range goes from 0\r
-(default and lowest priority) to 15 (highest).\r
-.TP\r
-\fB\-smkey\fR <SM_Key value>\r
-This option specifies the SM\'s SM_Key (64 bits).\r
-This will effect SM authentication.\r
-Note that OpenSM version 3.2.1 and below used the default value '1'\r
-in a host byte order, it is fixed now but you may need this option to\r
-interoperate with old OpenSM running on a little endian machine.\r
-.TP\r
-\fB\-\-sm_sl\fR <SL number>\r
-This option sets the SL to use for communication with the SM/SA.\r
-Defaults to 0.\r
-.TP\r
-\fB\-r\fR, \fB\-\-reassign_lids\fR\r
-This option causes OpenSM to reassign LIDs to all\r
-end nodes. Specifying -r on a running subnet\r
-may disrupt subnet traffic.\r
-Without -r, OpenSM attempts to preserve existing\r
-LID assignments resolving multiple use of same LID.\r
-.TP\r
-\fB\-R\fR, \fB\-\-routing_engine\fR <Routing engine names>\r
-This option chooses routing engine(s) to use instead of Min Hop\r
-algorithm (default).  Multiple routing engines can be specified\r
-separated by commas so that specific ordering of routing algorithms\r
-will be tried if earlier routing engines fail.\r
-Supported engines: minhop, updn, file, ftree, lash, dor\r
-.TP\r
-\fB\-\-do_mesh_analysis\fR\r
-This option enables additional analysis for the lash routing engine to\r
-precondition switch port assignments in regular cartesian meshes which\r
-may reduce the number of SLs required to give a deadlock free routing.\r
-.TP\r
-\fB\-\-lash_start_vl\fR <vl number>\r
-This option sets the starting VL to use for the lash routing algorithm.\r
-Defaults to 0.\r
-.TP\r
-\fB\-A\fR, \fB\-\-ucast_cache\fR\r
-This option enables unicast routing cache and prevents routing\r
-recalculation (which is a heavy task in a large cluster) when\r
-there was no topology change detected during the heavy sweep, or\r
-when the topology change does not require new routing calculation,\r
-e.g. when one or more CAs/RTRs/leaf switches going down, or one or\r
-more of these nodes coming back after being down.\r
-A very common case that is handled by the unicast routing cache\r
-is host reboot, which otherwise would cause two full routing\r
-recalculations: one when the host goes down, and the other when\r
-the host comes back online.\r
-.TP\r
-\fB\-z\fR, \fB\-\-connect_roots\fR\r
-This option enforces routing engines (up/down and\r
-fat-tree) to make connectivity between root switches and in\r
-this way to be fully IBA complaint. In many cases this can\r
-violate "pure" deadlock free algorithm, so use it carefully.\r
-.TP\r
-\fB\-M\fR, \fB\-\-lid_matrix_file\fR <file name>\r
-This option specifies the name of the lid matrix dump file\r
-from where switch lid matrices (min hops tables will be\r
-loaded.\r
-.TP\r
-\fB\-U\fR, \fB\-\-lfts_file\fR <file name>\r
-This option specifies the name of the LFTs file\r
-from where switch forwarding tables will be loaded.\r
-.TP\r
-\fB\-S\fR, \fB\-\-sadb_file\fR <file name>\r
-This option specifies the name of the SA DB dump file\r
-from where SA database will be loaded.\r
-.TP\r
-\fB\-a\fR, \fB\-\-root_guid_file\fR <file name>\r
-Set the root nodes for the Up/Down or Fat-Tree routing\r
-algorithm to the guids provided in the given file (one to a line).\r
-.TP\r
-\fB\-u\fR, \fB\-\-cn_guid_file\fR <file name>\r
-Set the compute nodes for the Fat-Tree routing algorithm\r
-to the guids provided in the given file (one to a line).\r
-.TP\r
-\fB\-G\fR, \fB\-\-io_guid_file\fR <file name>\r
-Set the I/O nodes for the Fat-Tree routing algorithm\r
-to the guids provided in the given file (one to a line).\r
-I/O nodes are non-CN nodes allowed to use up to max_reverse_hops switches\r
-the wrong way around to improve connectivity.\r
-.TP\r
-\fB\-H\fR, \fB\-\-max_reverse_hops\fR <file name>\r
-Set the maximum number of reverse hops an I/O node is allowed\r
-to make. A reverse hop is the use of a switch the wrong way around.\r
-.TP\r
-\fB\-m\fR, \fB\-\-ids_guid_file\fR <file name>\r
-Name of the map file with set of the IDs which will be used\r
-by Up/Down routing algorithm instead of node GUIDs\r
-(format: <guid> <id> per line).\r
-.TP\r
-\fB\-X\fR, \fB\-\-guid_routing_order_file\fR <file name>\r
-Set the order port guids will be routed for the MinHop\r
-and Up/Down routing algorithms to the guids provided in the\r
-given file (one to a line).\r
-.TP\r
-\fB\-o\fR, \fB\-\-once\fR\r
-This option causes OpenSM to configure the subnet\r
-once, then exit.  Ports remain in the ACTIVE state.\r
-.TP\r
-\fB\-s\fR, \fB\-\-sweep\fR <interval value>\r
-This option specifies the number of seconds between\r
-subnet sweeps.  Specifying -s 0 disables sweeping.\r
-Without -s, OpenSM defaults to a sweep interval of\r
-10 seconds.\r
-.TP\r
-\fB\-t\fR, \fB\-\-timeout\fR <value>\r
-This option specifies the time in milliseconds\r
-used for transaction timeouts.\r
-Specifying -t 0 disables timeouts.\r
-Without -t, OpenSM defaults to a timeout value of\r
-200 milliseconds.\r
-.TP\r
-\fB\-\-retries\fR <number>\r
-This option specifies the number of retries used\r
-for transactions.\r
-Without --retries, OpenSM defaults to 3 retries\r
-for transactions.\r
-.TP\r
-\fB\-maxsmps\fR <number>\r
-This option specifies the number of VL15 SMP MADs\r
-allowed on the wire at any one time.\r
-Specifying -maxsmps 0 allows unlimited outstanding\r
-SMPs.\r
-Without -maxsmps, OpenSM defaults to a maximum of\r
-4 outstanding SMPs.\r
-.TP\r
-\fB\-console [off | local | socket | loopback]\fR\r
-This option brings up the OpenSM console (default off).\r
-Note that the socket and loopback options will only be available\r
-if OpenSM was built with --enable-console-socket.\r
-.TP\r
-\fB\-console-port\fR <port>\r
-Specify an alternate telnet port for the socket console (default 10000).\r
-Note that this option only appears if OpenSM was built with\r
---enable-console-socket.\r
-.TP\r
-\fB\-i\fR, \fB\-ignore-guids\fR <equalize-ignore-guids-file>\r
-This option provides the means to define a set of ports\r
-(by node guid and port number) that will be ignored by the link load\r
-equalization algorithm.\r
-.TP\r
-\fB\-w\fR, \fB\-\-hop_weights_file\fR <path to file>\r
-This option provides weighting factors per port representing a hop cost in\r
-computing the lid matrix.  The file consists of lines containing a switch port\r
-GUID (specified as a 64 bit hex number, with leading 0x), output port number,\r
-and weighting factor.  Any port not listed in the file defaults to a weighting\r
-factor of 1.  Lines starting with # are comments.  Weights affect only the\r
-output route from the port, so many useful configurations will require weights\r
-to be specified in pairs.\r
-.TP\r
-\fB\-x\fR, \fB\-\-honor_guid2lid\fR\r
-This option forces OpenSM to honor the guid2lid file,\r
-when it comes out of Standby state, if such file exists\r
-under OSM_CACHE_DIR, and is valid.\r
-By default, this is FALSE.\r
-.TP\r
-\fB\-f\fR, \fB\-\-log_file\fR <file name>\r
-This option defines the log to be the given file.\r
-By default, the log goes to /var/log/opensm.log.\r
-For the log to go to standard output use -f stdout.\r
-.TP\r
-\fB\-L\fR, \fB\-\-log_limit\fR <size in MB>\r
-This option defines maximal log file size in MB. When\r
-specified the log file will be truncated upon reaching\r
-this limit.\r
-.TP\r
-\fB\-e\fR, \fB\-\-erase_log_file\fR\r
-This option will cause deletion of the log file\r
-(if it previously exists). By default, the log file\r
-is accumulative.\r
-.TP\r
-\fB\-P\fR, \fB\-\-Pconfig\fR <partition config file>\r
-This option defines the optional partition configuration file.\r
-The default name is \fB\%/usr/local/etc/opensm/partitions.conf\fP.\r
-.TP\r
-\fB\-\-prefix_routes_file\fR <file name>\r
-Prefix routes control how the SA responds to path record queries for\r
-off-subnet DGIDs.  By default, the SA fails such queries. The\r
-.B PREFIX ROUTES\r
-section below describes the format of the configuration file.\r
-The default path is \fB\%/usr/local/etc/opensm/prefix\-routes.conf\fP.\r
-.TP\r
-\fB\-Q\fR, \fB\-\-qos\fR\r
-This option enables QoS setup. It is disabled by default.\r
-.TP\r
-\fB\-Y\fR, \fB\-\-qos_policy_file\fR <file name>\r
-This option defines the optional QoS policy file. The default\r
-name is \fB\%/usr/local/etc/opensm/qos-policy.conf\fP. See\r
-QoS_management_in_OpenSM.txt in opensm doc for more information on\r
-configuring QoS policy via this file.\r
-.TP\r
-\fB\-N\fR, \fB\-\-no_part_enforce\fR\r
-This option disables partition enforcement on switch external ports.\r
-.TP\r
-\fB\-y\fR, \fB\-\-stay_on_fatal\fR\r
-This option will cause SM not to exit on fatal initialization\r
-issues: if SM discovers duplicated guids or a 12x link with\r
-lane reversal badly configured.\r
-By default, the SM will exit on these errors.\r
-.TP\r
-\fB\-B\fR, \fB\-\-daemon\fR\r
-Run in daemon mode - OpenSM will run in the background.\r
-.TP\r
-\fB\-I\fR, \fB\-\-inactive\fR\r
-Start SM in inactive rather than init SM state.  This\r
-option can be used in conjunction with the perfmgr so as to\r
-run a standalone performance manager without SM/SA.  However,\r
-this is NOT currently implemented in the performance manager.\r
-.TP\r
-\fB\-perfmgr\fR\r
-Enable the perfmgr.  Only takes effect if --enable-perfmgr was specified at\r
-configure time.  See performance-manager-HOWTO.txt in opensm doc for\r
-more information on running perfmgr.\r
-.TP\r
-\fB\-perfmgr_sweep_time_s\fR <seconds>\r
-Specify the sweep time for the performance manager in seconds\r
-(default is 180 seconds).  Only takes\r
-effect if --enable-perfmgr was specified at configure time.\r
-.TP\r
-.BI --consolidate_ipv6_snm_req\r
-Use shared MLID for IPv6 Solicited Node Multicast groups per MGID scope\r
-and P_Key.\r
-.TP\r
-\fB\-v\fR, \fB\-\-verbose\fR\r
-This option increases the log verbosity level.\r
-The -v option may be specified multiple times\r
-to further increase the verbosity level.\r
-See the -D option for more information about\r
-log verbosity.\r
-.TP\r
-\fB\-V\fR\r
-This option sets the maximum verbosity level and\r
-forces log flushing.\r
-The -V option is equivalent to \'-D 0xFF -d 2\'.\r
-See the -D option for more information about\r
-log verbosity.\r
-.TP\r
-\fB\-D\fR <value>\r
-This option sets the log verbosity level.\r
-A flags field must follow the -D option.\r
-A bit set/clear in the flags enables/disables a\r
-specific log level as follows:\r
-\r
- BIT    LOG LEVEL ENABLED\r
- ----   -----------------\r
- 0x01 - ERROR (error messages)\r
- 0x02 - INFO (basic messages, low volume)\r
- 0x04 - VERBOSE (interesting stuff, moderate volume)\r
- 0x08 - DEBUG (diagnostic, high volume)\r
- 0x10 - FUNCS (function entry/exit, very high volume)\r
- 0x20 - FRAMES (dumps all SMP and GMP frames)\r
- 0x40 - ROUTING (dump FDB routing information)\r
- 0x80 - currently unused.\r
-\r
-Without -D, OpenSM defaults to ERROR + INFO (0x3).\r
-Specifying -D 0 disables all messages.\r
-Specifying -D 0xFF enables all messages (see -V).\r
-High verbosity levels may require increasing\r
-the transaction timeout with the -t option.\r
-.TP\r
-\fB\-d\fR, \fB\-\-debug\fR <value>\r
-This option specifies a debug option.\r
-These options are not normally needed.\r
-The number following -d selects the debug\r
-option to enable as follows:\r
-\r
- OPT   Description\r
- ---    -----------------\r
- -d0  - Ignore other SM nodes\r
- -d1  - Force single threaded dispatching\r
- -d2  - Force log flushing after each log message\r
- -d3  - Disable multicast support\r
-.TP\r
-\fB\-h\fR, \fB\-\-help\fR\r
-Display this usage info then exit.\r
-.TP\r
-\fB\-?\fR\r
-Display this usage info then exit.\r
-\r
-.SH ENVIRONMENT VARIABLES\r
-.PP\r
-The following environment variables control opensm behavior:\r
-\r
-OSM_TMP_DIR - controls the directory in which the temporary files generated by\r
-opensm are created. These files are: opensm-subnet.lst, opensm.fdbs, and\r
-opensm.mcfdbs. By default, this directory is /var/log.\r
-\r
-OSM_CACHE_DIR - opensm stores certain data to the disk such that subsequent\r
-runs are consistent. The default directory used is /var/cache/opensm.\r
-The following file is included in it:\r
-\r
- guid2lid - stores the LID range assigned to each GUID\r
-\r
-.SH NOTES\r
-.PP\r
-When opensm receives a HUP signal, it starts a new heavy sweep as if a trap was received or a topology change was found.\r
-.PP\r
-Also, SIGUSR1 can be used to trigger a reopen of /var/log/opensm.log for\r
-logrotate purposes.\r
-\r
-.SH PARTITION CONFIGURATION\r
-.PP\r
-The default name of OpenSM partitions configuration file is\r
-\fB\%/usr/local/etc/opensm/partitions.conf\fP. The default may be changed\r
-by using the --Pconfig (-P) option with OpenSM.\r
-\r
-The default partition will be created by OpenSM unconditionally even\r
-when partition configuration file does not exist or cannot be accessed.\r
-\r
-The default partition has P_Key value 0x7fff. OpenSM\'s port will always\r
-have full membership in default partition. All other end ports will have\r
-full membership if the partition configuration file is not found or cannot\r
-be accessed, or limited membership if the file exists and can be accessed\r
-but there is no rule for the Default partition.\r
-\r
-Effectively, this amounts to the same as if one of the following rules\r
-below appear in the partition configuration file.\r
-\r
-In the case of no rule for the Default partition:\r
-\r
-Default=0x7fff : ALL=limited, SELF=full ;\r
-\r
-In the case of no partition configuration file or file cannot be accessed:\r
-\r
-Default=0x7fff : ALL=full ;\r
-\r
-\r
-File Format\r
-\r
-Comments:\r
-\r
-Line content followed after \'#\' character is comment and ignored by\r
-parser.\r
-\r
-General file format:\r
-\r
-<Partition Definition>:<PortGUIDs list> ;\r
-\r
-Partition Definition:\r
-\r
-[PartitionName][=PKey][,flag[=value]][,defmember=full|limited]\r
-\r
- PartitionName - string, will be used with logging. When omitted\r
-                 empty string will be used.\r
- PKey          - P_Key value for this partition. Only low 15 bits will\r
-                 be used. When omitted will be autogenerated.\r
- flag          - used to indicate IPoIB capability of this partition.\r
- defmember=full|limited - specifies default membership for port guid\r
-                 list. Default is limited.\r
-\r
-Currently recognized flags are:\r
-\r
- ipoib       - indicates that this partition may be used for IPoIB, as\r
-               result IPoIB capable MC group will be created.\r
- rate=<val>  - specifies rate for this IPoIB MC group\r
-               (default is 3 (10GBps))\r
- mtu=<val>   - specifies MTU for this IPoIB MC group\r
-               (default is 4 (2048))\r
- sl=<val>    - specifies SL for this IPoIB MC group\r
-               (default is 0)\r
- scope=<val> - specifies scope for this IPoIB MC group\r
-               (default is 2 (link local)).  Multiple scope settings\r
-               are permitted for a partition.\r
-\r
-Note that values for rate, mtu, and scope should be specified as\r
-defined in the IBTA specification (for example, mtu=4 for 2048).\r
-\r
-PortGUIDs list:\r
-\r
- PortGUID         - GUID of partition member EndPort. Hexadecimal\r
-                    numbers should start from 0x, decimal numbers\r
-                    are accepted too.\r
- full or limited  - indicates full or limited membership for this\r
-                    port.  When omitted (or unrecognized) limited\r
-                    membership is assumed.\r
-\r
-There are two useful keywords for PortGUID definition:\r
-\r
- - 'ALL' means all end ports in this subnet.\r
- - 'ALL_CAS' means all Channel Adapter end ports in this subnet.\r
- - 'ALL_SWITCHES' means all Switch end ports in this subnet.\r
- - 'ALL_ROUTERS' means all Router end ports in this subnet.\r
- - 'SELF' means subnet manager's port.\r
-\r
-Empty list means no ports in this partition.\r
-\r
-Notes:\r
-\r
-White space is permitted between delimiters ('=', ',',':',';').\r
-\r
-The line can be wrapped after ':' followed after Partition Definition and\r
-between.\r
-\r
-PartitionName does not need to be unique, PKey does need to be unique.\r
-If PKey is repeated then those partition configurations will be merged\r
-and first PartitionName will be used (see also next note).\r
-\r
-It is possible to split partition configuration in more than one\r
-definition, but then PKey should be explicitly specified (otherwise\r
-different PKey values will be generated for those definitions).\r
-\r
-Examples:\r
-\r
- Default=0x7fff : ALL, SELF=full ;\r
- Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ;\r
-\r
- NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;\r
-\r
- YetAnotherOne = 0x300 : SELF=full ;\r
- YetAnotherOne = 0x300 : ALL=limited ;\r
-\r
- ShareIO = 0x80 , defmember=full : 0x123451, 0x123452;\r
- # 0x123453, 0x123454 will be limited\r
- ShareIO = 0x80 : 0x123453, 0x123454, 0x123455=full;\r
- # 0x123456, 0x123457 will be limited\r
- ShareIO = 0x80 : defmember=limited : 0x123456, 0x123457, 0x123458=full;\r
- ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a;\r
- ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d;\r
-\r
-\r
-Note:\r
-\r
-The following rule is equivalent to how OpenSM used to run prior to the\r
-partition manager:\r
-\r
- Default=0x7fff,ipoib:ALL=full;\r
-\r
-.SH QOS CONFIGURATION\r
-.PP\r
-There are a set of QoS related low-level configuration parameters.\r
-All these parameter names are prefixed by "qos_" string. Here is a full\r
-list of these parameters:\r
-\r
- qos_max_vls    - The maximum number of VLs that will be on the subnet\r
- qos_high_limit - The limit of High Priority component of VL\r
-                  Arbitration table (IBA 7.6.9)\r
- qos_vlarb_low  - Low priority VL Arbitration table (IBA 7.6.9)\r
-                  template\r
- qos_vlarb_high - High priority VL Arbitration table (IBA 7.6.9)\r
-                  template\r
-                  Both VL arbitration templates are pairs of\r
-                  VL and weight\r
- qos_sl2vl      - SL2VL Mapping table (IBA 7.6.6) template. It is\r
-                  a list of VLs corresponding to SLs 0-15 (Note\r
-                  that VL15 used here means drop this SL)\r
-\r
-Typical default values (hard-coded in OpenSM initialization) are:\r
-\r
- qos_max_vls 15\r
- qos_high_limit 0\r
- qos_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4\r
- qos_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0\r
- qos_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-\r
-The syntax is compatible with rest of OpenSM configuration options and\r
-values may be stored in OpenSM config file (cached options file).\r
-\r
-In addition to the above, we may define separate QoS configuration\r
-parameters sets for various target types. As targets, we currently support\r
-CAs, routers, switch external ports, and switch's enhanced port 0. The\r
-names of such specialized parameters are prefixed by "qos_<type>_"\r
-string. Here is a full list of the currently supported sets:\r
-\r
- qos_ca_  - QoS configuration parameters set for CAs.\r
- qos_rtr_ - parameters set for routers.\r
- qos_sw0_ - parameters set for switches' port 0.\r
- qos_swe_ - parameters set for switches' external ports.\r
-\r
-Examples:\r
- qos_sw0_max_vls=2\r
- qos_ca_sl2vl=0,1,2,3,5,5,5,12,12,0,\r
- qos_swe_high_limit=0\r
-\r
-.SH PREFIX ROUTES\r
-.PP\r
-Prefix routes control how the SA responds to path record queries for\r
-off-subnet DGIDs.  By default, the SA fails such queries.\r
-Note that IBA does not specify how the SA should obtain off-subnet path\r
-record information.\r
-The prefix routes configuration is meant as a stop-gap until the\r
-specification is completed.\r
-.PP\r
-Each line in the configuration file is a 64-bit prefix followed by a\r
-64-bit GUID, separated by white space.\r
-The GUID specifies the router port on the local subnet that will\r
-handle the prefix.\r
-Blank lines are ignored, as is anything between a \fB#\fP character\r
-and the end of the line.\r
-The prefix and GUID are both in hex, the leading 0x is optional.\r
-Either, or both, can be wild-carded by specifying an\r
-asterisk instead of an explicit prefix or GUID.\r
-.PP\r
-When responding to a path record query for an off-subnet DGID,\r
-opensm searches for the first prefix match in the configuration file.\r
-Therefore, the order of the lines in the configuration file is important:\r
-a wild-carded prefix at the beginning of the configuration file renders\r
-all subsequent lines useless.\r
-If there is no match, then opensm fails the query.\r
-It is legal to repeat prefixes in the configuration file,\r
-opensm will return the path to the first available matching router.\r
-A configuration file with a single line where both prefix and GUID\r
-are wild-carded means that a path record query specifying any\r
-off-subnet DGID should return a path to the first available router.\r
-This configuration yields the same behavior formerly achieved by\r
-compiling opensm with -DROUTER_EXP which has been obsoleted.\r
-\r
-.SH ROUTING\r
-.PP\r
-OpenSM now offers five routing engines:\r
-\r
-1.  Min Hop Algorithm - based on the minimum hops to each node where the\r
-path length is optimized.\r
-\r
-2.  UPDN Unicast routing algorithm - also based on the minimum hops to each\r
-node, but it is constrained to ranking rules. This algorithm should be chosen\r
-if the subnet is not a pure Fat Tree, and deadlock may occur due to a\r
-loop in the subnet.\r
-\r
-3.  Fat Tree Unicast routing algorithm - this algorithm optimizes routing\r
-for congestion-free "shift" communication pattern.\r
-It should be chosen if a subnet is a symmetrical or almost symmetrical\r
-fat-tree of various types, not just K-ary-N-Trees: non-constant K, not\r
-fully staffed, any Constant Bisectional Bandwidth (CBB) ratio.\r
-Similar to UPDN, Fat Tree routing is constrained to ranking rules.\r
-\r
-4. LASH unicast routing algorithm - uses Infiniband virtual layers\r
-(SL) to provide deadlock-free shortest-path routing while also\r
-distributing the paths between layers. LASH is an alternative\r
-deadlock-free topology-agnostic routing algorithm to the non-minimal\r
-UPDN algorithm avoiding the use of a potentially congested root node.\r
-\r
-5. DOR Unicast routing algorithm - based on the Min Hop algorithm, but\r
-avoids port equalization except for redundant links between the same\r
-two switches.  This provides deadlock free routes for hypercubes when\r
-the fabric is cabled as a hypercube and for meshes when cabled as a\r
-mesh (see details below).\r
-\r
-OpenSM also supports a file method which\r
-can load routes from a table. See \'Modular Routing Engine\' for more\r
-information on this.\r
-\r
-The basic routing algorithm is comprised of two stages:\r
-\r
-1. MinHop matrix calculation\r
-   How many hops are required to get from each port to each LID ?\r
-   The algorithm to fill these tables is different if you run standard\r
-(min hop) or Up/Down.\r
-   For standard routing, a "relaxation" algorithm is used to propagate\r
-min hop from every destination LID through neighbor switches\r
-   For Up/Down routing, a BFS from every target is used. The BFS tracks link\r
-direction (up or down) and avoid steps that will perform up after a down\r
-step was used.\r
-\r
-2. Once MinHop matrices exist, each switch is visited and for each target LID a\r
-decision is made as to what port should be used to get to that LID.\r
-   This step is common to standard and Up/Down routing. Each port has a\r
-counter counting the number of target LIDs going through it.\r
-   When there are multiple alternative ports with same MinHop to a LID,\r
-the one with less previously assigned ports is selected.\r
-   If LMC > 0, more checks are added: Within each group of LIDs assigned to\r
-same target port,\r
-   a. use only ports which have same MinHop\r
-   b. first prefer the ones that go to different systemImageGuid (then\r
-the previous LID of the same LMC group)\r
-   c. if none - prefer those which go through another NodeGuid\r
-   d. fall back to the number of paths method (if all go to same node).\r
-\r
-Effect of Topology Changes\r
-\r
-OpenSM will preserve existing routing in any case where there is no change in\r
-the fabric switches unless the -r (--reassign_lids) option is specified.\r
-\r
--r\r
-.br\r
---reassign_lids\r
-          This option causes OpenSM to reassign LIDs to all\r
-          end nodes. Specifying -r on a running subnet\r
-          may disrupt subnet traffic.\r
-          Without -r, OpenSM attempts to preserve existing\r
-          LID assignments resolving multiple use of same LID.\r
-\r
-If a link is added or removed, OpenSM does not recalculate\r
-the routes that do not have to change. A route has to change\r
-if the port is no longer UP or no longer the MinHop. When routing changes\r
-are performed, the same algorithm for balancing the routes is invoked.\r
-\r
-In the case of using the file based routing, any topology changes are\r
-currently ignored The 'file' routing engine just loads the LFTs from the file\r
-specified, with no reaction to real topology. Obviously, this will not be able\r
-to recheck LIDs (by GUID) for disconnected nodes, and LFTs for non-existent\r
-switches will be skipped. Multicast is not affected by 'file' routing engine\r
-(this uses min hop tables).\r
-\r
-\r
-Min Hop Algorithm\r
-\r
-The Min Hop algorithm is invoked by default if no routing algorithm is\r
-specified.  It can also be invoked by specifying '-R minhop'.\r
-\r
-The Min Hop algorithm is divided into two stages: computation of\r
-min-hop tables on every switch and LFT output port assignment. Link\r
-subscription is also equalized with the ability to override based on\r
-port GUID. The latter is supplied by:\r
-\r
--i <equalize-ignore-guids-file>\r
-.br\r
--ignore-guids <equalize-ignore-guids-file>\r
-          This option provides the means to define a set of ports\r
-          (by guid) that will be ignored by the link load\r
-          equalization algorithm. Note that only endports (CA,\r
-          switch port 0, and router ports) and not switch external\r
-          ports are supported.\r
-\r
-LMC awareness routes based on (remote) system or switch basis.\r
-\r
-\r
-Purpose of UPDN Algorithm\r
-\r
-The UPDN algorithm is designed to prevent deadlocks from occurring in loops\r
-of the subnet. A loop-deadlock is a situation in which it is no longer\r
-possible to send data between any two hosts connected through the loop. As\r
-such, the UPDN routing algorithm should be used if the subnet is not a pure\r
-Fat Tree, and one of its loops may experience a deadlock (due, for example,\r
-to high pressure).\r
-\r
-The UPDN algorithm is based on the following main stages:\r
-\r
-1.  Auto-detect root nodes - based on the CA hop length from any switch in\r
-the subnet, a statistical histogram is built for each switch (hop num vs\r
-number of occurrences). If the histogram reflects a specific column (higher\r
-than others) for a certain node, then it is marked as a root node. Since\r
-the algorithm is statistical, it may not find any root nodes. The list of\r
-the root nodes found by this auto-detect stage is used by the ranking\r
-process stage.\r
-\r
-    Note 1: The user can override the node list manually.\r
-    Note 2: If this stage cannot find any root nodes, and the user did\r
-            not specify a guid list file, OpenSM defaults back to the\r
-            Min Hop routing algorithm.\r
-\r
-2.  Ranking process - All root switch nodes (found in stage 1) are assigned\r
-a rank of 0. Using the BFS algorithm, the rest of the switch nodes in the\r
-subnet are ranked incrementally. This ranking aids in the process of enforcing\r
-rules that ensure loop-free paths.\r
-\r
-3.  Min Hop Table setting - after ranking is done, a BFS algorithm is run from\r
-each (CA or switch) node in the subnet. During the BFS process, the FDB table\r
-of each switch node traversed by BFS is updated, in reference to the starting\r
-node, based on the ranking rules and guid values.\r
-\r
-At the end of the process, the updated FDB tables ensure loop-free paths\r
-through the subnet.\r
-\r
-Note: Up/Down routing does not allow LID routing communication between\r
-switches that are located inside spine "switch systems".\r
-The reason is that there is no way to allow a LID route between them\r
-that does not break the Up/Down rule.\r
-One ramification of this is that you cannot run SM on switches other\r
-than the leaf switches of the fabric.\r
-\r
-\r
-UPDN Algorithm Usage\r
-\r
-Activation through OpenSM\r
-\r
-Use '-R updn' option (instead of old '-u') to activate the UPDN algorithm.\r
-Use '-a <root_guid_file>' for adding an UPDN guid file that contains the\r
-root nodes for ranking.\r
-If the `-a' option is not used, OpenSM uses its auto-detect root nodes\r
-algorithm.\r
-\r
-Notes on the guid list file:\r
-\r
-1.   A valid guid file specifies one guid in each line. Lines with an invalid\r
-format will be discarded.\r
-.br\r
-2.   The user should specify the root switch guids. However, it is also\r
-possible to specify CA guids; OpenSM will use the guid of the switch (if\r
-it exists) that connects the CA to the subnet as a root node.\r
-\r
-\r
-Fat-tree Routing Algorithm\r
-\r
-The fat-tree algorithm optimizes routing for "shift" communication pattern.\r
-It should be chosen if a subnet is a symmetrical or almost symmetrical\r
-fat-tree of various types.\r
-It supports not just K-ary-N-Trees, by handling for non-constant K,\r
-cases where not all leafs (CAs) are present, any CBB ratio.\r
-As in UPDN, fat-tree also prevents credit-loop-deadlocks.\r
-\r
-If the root guid file is not provided ('-a' or '--root_guid_file' options),\r
-the topology has to be pure fat-tree that complies with the following rules:\r
-  - Tree rank should be between two and eight (inclusively)\r
-  - Switches of the same rank should have the same number\r
-    of UP-going port groups*, unless they are root switches,\r
-    in which case the shouldn't have UP-going ports at all.\r
-  - Switches of the same rank should have the same number\r
-    of DOWN-going port groups, unless they are leaf switches.\r
-  - Switches of the same rank should have the same number\r
-    of ports in each UP-going port group.\r
-  - Switches of the same rank should have the same number\r
-    of ports in each DOWN-going port group.\r
-  - All the CAs have to be at the same tree level (rank).\r
-\r
-If the root guid file is provided, the topology doesn't have to be pure\r
-fat-tree, and it should only comply with the following rules:\r
-  - Tree rank should be between two and eight (inclusively)\r
-  - All the Compute Nodes** have to be at the same tree level (rank).\r
-    Note that non-compute node CAs are allowed here to be at different\r
-    tree ranks.\r
-\r
-* ports that are connected to the same remote switch are referenced as\r
-\'port group\'.\r
-\r
-** list of compute nodes (CNs) can be specified by \'-u\' or \'--cn_guid_file\'\r
-OpenSM options.\r
-\r
-Topologies that do not comply cause a fallback to min hop routing.\r
-Note that this can also occur on link failures which cause the topology\r
-to no longer be "pure" fat-tree.\r
-\r
-Note that although fat-tree algorithm supports trees with non-integer CBB\r
-ratio, the routing will not be as balanced as in case of integer CBB ratio.\r
-In addition to this, although the algorithm allows leaf switches to have any\r
-number of CAs, the closer the tree is to be fully populated, the more\r
-effective the "shift" communication pattern will be.\r
-In general, even if the root list is provided, the closer the topology to a\r
-pure and symmetrical fat-tree, the more optimal the routing will be.\r
-\r
-The algorithm also dumps compute node ordering file (opensm-ftree-ca-order.dump)\r
-in the same directory where the OpenSM log resides. This ordering file provides\r
-the CN order that may be used to create efficient communication pattern, that\r
-will match the routing tables.\r
-\r
-Routing between non-CN nodes\r
-\r
-The use of the cn_guid_file option allows non-CN nodes to be located on different levels in the fat tree.\r
-In such case, it is not guaranteed that the Fat Tree algorithm will route between two non-CN nodes.\r
-To solve this problem, a list of non-CN nodes can be specified by \'-G\' or \'--io_guid_file\' option.\r
-Theses nodes will be allowed to use switches the wrong way round a specific number of times (specified by \'-H\' or \'--max_reverse_hops\'.\r
-With the proper max_reverse_hops and io_guid_file values, you can ensure full connectivity in the Fat Tree.\r
-\r
-Please note that using max_reverse_hops creates routes that use the switch in a counter-stream way.\r
-This option should never be used to connect nodes with high bandwidth traffic between them ! It should only be used\r
-to allow connectivity for HA purposes or similar.\r
-Also having routes the other way around can in theory cause credit loops.\r
-\r
-Use these options with extreme care !\r
-\r
-Activation through OpenSM\r
-\r
-Use '-R ftree' option to activate the fat-tree algorithm.\r
-Use '-a <root_guid_file>' to provide root nodes for ranking. If the `-a' option\r
-is not used, routing algorithm will detect roots automatically.\r
-Use '-u <root_cn_file>' to provide the list of compute nodes. If the `-u' option\r
-is not used, all the CAs are considered as compute nodes.\r
-\r
-Note: LMC > 0 is not supported by fat-tree routing. If this is\r
-specified, the default routing algorithm is invoked instead.\r
-\r
-\r
-LASH Routing Algorithm\r
-\r
-LASH is an acronym for LAyered SHortest Path Routing. It is a\r
-deterministic shortest path routing algorithm that enables topology\r
-agnostic deadlock-free routing within communication networks.\r
-\r
-When computing the routing function, LASH analyzes the network\r
-topology for the shortest-path routes between all pairs of sources /\r
-destinations and groups these paths into virtual layers in such a way\r
-as to avoid deadlock.\r
-\r
-Note LASH analyzes routes and ensures deadlock freedom between switch\r
-pairs. The link from HCA between and switch does not need virtual\r
-layers as deadlock will not arise between switch and HCA.\r
-\r
-In more detail, the algorithm works as follows:\r
-\r
-1) LASH determines the shortest-path between all pairs of source /\r
-destination switches. Note, LASH ensures the same SL is used for all\r
-SRC/DST - DST/SRC pairs and there is no guarantee that the return\r
-path for a given DST/SRC will be the reverse of the route SRC/DST.\r
-\r
-2) LASH then begins an SL assignment process where a route is assigned\r
-to a layer (SL) if the addition of that route does not cause deadlock\r
-within that layer. This is achieved by maintaining and analysing a\r
-channel dependency graph for each layer. Once the potential addition\r
-of a path could lead to deadlock, LASH opens a new layer and continues\r
-the process.\r
-\r
-3) Once this stage has been completed, it is highly likely that the\r
-first layers processed will contain more paths than the latter ones.\r
-To better balance the use of layers, LASH moves paths from one layer\r
-to another so that the number of paths in each layer averages out.\r
-\r
-Note, the implementation of LASH in opensm attempts to use as few layers\r
-as possible. This number can be less than the number of actual layers\r
-available.\r
-\r
-In general LASH is a very flexible algorithm. It can, for example,\r
-reduce to Dimension Order Routing in certain topologies, it is topology\r
-agnostic and fares well in the face of faults.\r
-\r
-It has been shown that for both regular and irregular topologies, LASH\r
-outperforms Up/Down. The reason for this is that LASH distributes the\r
-traffic more evenly through a network, avoiding the bottleneck issues\r
-related to a root node and always routes shortest-path.\r
-\r
-The algorithm was developed by Simula Research Laboratory.\r
-\r
-\r
-Use '-R lash -Q ' option to activate the LASH algorithm.\r
-\r
-Note: QoS support has to be turned on in order that SL/VL mappings are\r
-used.\r
-\r
-Note: LMC > 0 is not supported by the LASH routing. If this is\r
-specified, the default routing algorithm is invoked instead.\r
-\r
-For open regular cartesian meshes the DOR algorithm is the ideal\r
-routing algorithm. For toroidal meshes on the other hand there\r
-are routing loops that can cause deadlocks. LASH can be used to\r
-route these cases. The performance of LASH can be improved by\r
-preconditioning the mesh in cases where there are multiple links\r
-connecting switches and also in cases where the switches are not\r
-cabled consistently. An option exists for LASH to do this. To\r
-invoke this use '-R lash -Q --do_mesh_analysis'. This will\r
-add an additional phase that analyses the mesh to try to determine\r
-the dimension and size of a mesh. If it determines that the mesh\r
-looks like an open or closed cartesian mesh it reorders the ports\r
-in dimension order before the rest of the LASH algorithm runs.\r
-\r
-DOR Routing Algorithm\r
-\r
-The Dimension Order Routing algorithm is based on the Min Hop\r
-algorithm and so uses shortest paths.  Instead of spreading traffic\r
-out across different paths with the same shortest distance, it chooses\r
-among the available shortest paths based on an ordering of dimensions.\r
-Each port must be consistently cabled to represent a hypercube\r
-dimension or a mesh dimension.  Paths are grown from a destination\r
-back to a source using the lowest dimension (port) of available paths\r
-at each step.  This provides the ordering necessary to avoid deadlock.\r
-When there are multiple links between any two switches, they still\r
-represent only one dimension and traffic is balanced across them\r
-unless port equalization is turned off.  In the case of hypercubes,\r
-the same port must be used throughout the fabric to represent the\r
-hypercube dimension and match on both ends of the cable.  In the case\r
-of meshes, the dimension should consistently use the same pair of\r
-ports, one port on one end of the cable, and the other port on the\r
-other end, continuing along the mesh dimension.\r
-\r
-Use '-R dor' option to activate the DOR algorithm.\r
-\r
-\r
-Routing References\r
-\r
-To learn more about deadlock-free routing, see the article\r
-"Deadlock Free Message Routing in Multiprocessor Interconnection Networks"\r
-by William J Dally and Charles L Seitz (1985).\r
-\r
-To learn more about the up/down algorithm, see the article\r
-"Effective Strategy to Compute Forwarding Tables for InfiniBand Networks"\r
-by Jose Carlos Sancho, Antonio Robles, and Jose Duato at the\r
-Universidad Politecnica de Valencia.\r
-\r
-To learn more about LASH and the flexibility behind it, the requirement\r
-for layers, performance comparisons to other algorithms, see the\r
-following articles:\r
-\r
-"Layered Routing in Irregular Networks", Lysne et al, IEEE\r
-Transactions on Parallel and Distributed Systems, VOL.16, No12,\r
-December 2005.\r
-\r
-"Routing for the ASI Fabric Manager", Solheim et al. IEEE\r
-Communications Magazine, Vol.44, No.7, July 2006.\r
-\r
-"Layered Shortest Path (LASH) Routing in Irregular System Area\r
-Networks", Skeie et al. IEEE Computer Society Communication\r
-Architecture for Clusters 2002.\r
-\r
-\r
-Modular Routine Engine\r
-\r
-Modular routing engine structure allows for the ease of\r
-"plugging" new routing modules.\r
-\r
-Currently, only unicast callbacks are supported. Multicast\r
-can be added later.\r
-\r
-One existing routing module is up-down "updn", which may be\r
-activated with '-R updn' option (instead of old '-u').\r
-\r
-General usage is:\r
-$ opensm -R 'module-name'\r
-\r
-There is also a trivial routing module which is able\r
-to load LFT tables from a file.\r
-\r
-Main features:\r
-\r
- - this will load switch LFTs and/or LID matrices (min hops tables)\r
- - this will load switch LFTs according to the path entries introduced\r
-   in the file\r
- - no additional checks will be performed (such as "is port connected",\r
-   etc.)\r
- - in case when fabric LIDs were changed this will try to reconstruct\r
-   LFTs correctly if endport GUIDs are represented in the file\r
-   (in order to disable this, GUIDs may be removed from the file\r
-    or zeroed)\r
-\r
-The file format is compatible with output of 'ibroute' util and for\r
-whole fabric can be generated with dump_lfts.sh script.\r
-\r
-To activate file based routing module, use:\r
-\r
-  opensm -R file -U /path/to/lfts_file\r
-\r
-If the lfts_file is not found or is in error, the default routing\r
-algorithm is utilized.\r
-\r
-The ability to dump switch lid matrices (aka min hops tables) to file and\r
-later to load these is also supported.\r
-\r
-The usage is similar to unicast forwarding tables loading from a lfts\r
-file (introduced by 'file' routing engine), but new lid matrix file\r
-name should be specified by -M or --lid_matrix_file option. For example:\r
-\r
-  opensm -R file -M ./opensm-lid-matrix.dump\r
-\r
-The dump file is named \'opensm-lid-matrix.dump\' and will be generated\r
-in standard opensm dump directory (/var/log by default) when\r
-OSM_LOG_ROUTING logging flag is set.\r
-\r
-When routing engine 'file' is activated, but the lfts file is not specified\r
-or not cannot be open default lid matrix algorithm will be used.\r
-\r
-There is also a switch forwarding tables dumper which generates\r
-a file compatible with dump_lfts.sh output. This file can be used\r
-as input for forwarding tables loading by 'file' routing engine.\r
-Both or one of options -U and -M can be specified together with \'-R file\'.\r
-\r
-.SH FILES\r
-.TP\r
-.B /usr/local/etc/opensm/opensm.conf\r
-default OpenSM config file.\r
-\r
-.TP\r
-.B /usr/local/etc/opensm/ib-node-name-map\r
-default node name map file.  See ibnetdiscover for more information on format.\r
-\r
-.TP\r
-.B /usr/local/etc/opensm/partitions.conf\r
-default partition config file\r
-\r
-.TP\r
-.B /usr/local/etc/opensm/qos-policy.conf\r
-default QOS policy config file\r
-\r
-.TP\r
-.B /usr/local/etc/opensm/prefix-routes.conf\r
-default prefix routes file.\r
-\r
-.SH AUTHORS\r
-.TP\r
-Hal Rosenstock\r
-.RI < hal.rosenstock@gmail.com >\r
-.TP\r
-Sasha Khapyorsky\r
-.RI < sashak@voltaire.com >\r
-.TP\r
-Eitan Zahavi\r
-.RI < eitan@mellanox.co.il >\r
-.TP\r
-Yevgeny Kliteynik\r
-.RI < kliteyn@mellanox.co.il >\r
-.TP\r
-Thomas Sodring\r
-.RI < tsodring@simula.no >\r
-.TP\r
-Ira Weiny\r
-.RI < weiny2@llnl.gov >\r
diff --git a/branches/opensm_3/user/man/osmtest.8 b/branches/opensm_3/user/man/osmtest.8
deleted file mode 100644 (file)
index a9d29eb..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-.TH OSMTEST 8 "August 31, 2009" "OpenIB" "OpenIB Management"\r
-\r
-.SH NAME\r
-osmtest \- InfiniBand subnet manager and administration (SM/SA) test program\r
-\r
-.SH SYNOPSIS\r
-.B osmtest\r
-[\-f(low) <c|a|v|s|e|f|m|q|t>] [\-w(ait) <trap_wait_time>] [\-d(ebug) <number>]\r
-[\-m(ax_lid) <LID in hex>] [\-g(uid)[=]<GUID in hex>] [-p(ort)]\r
-[\-i(nventory) <filename>] [\-s(tress)] [\-M(ulticast_Mode)]\r
-[\-t(imeout) <milliseconds>] [\-l | \-\-log_file] [\-v] [\-vf <flags>]\r
-[\-h(elp)]\r
-\r
-.SH DESCRIPTION\r
-.PP\r
-osmtest is a test program to validate InfiniBand subnet manager and\r
-administration (SM/SA).\r
-\r
-Default is to run all flows with the exception of the QoS flow.\r
-\r
-osmtest provides a test suite for opensm.\r
-\r
-osmtest has the following capabilities and testing flows:\r
-\r
-It creates an inventory file of all available Nodes, Ports, and PathRecords,\r
-including all their fields.\r
-It verifies the existing inventory, with all the object fields, and matches it\r
-to a pre-saved one.\r
-A Multicast Compliancy test.\r
-An Event Forwarding test.\r
-A Service Record registration test.\r
-An RMPP stress test.\r
-A Small SA Queries stress test.\r
-\r
-It is recommended that after installing opensm, the user should run\r
-"osmtest -f c" to generate the inventory file, and\r
-immediately afterwards run "osmtest -f a" to test OpenSM.\r
-\r
-Another recommendation for osmtest usage is to create the inventory when the\r
-IB fabric is stable, and occasionally\r
-run "osmtest -v" to verify that nothing has changed.\r
-\r
-.SH OPTIONS\r
-\r
-.PP\r
-.TP\r
-\fB\-f\fR, \fB\-\-flow\fR\r
-This option directs osmtest to run a specific flow:\r
- FLOW  DESCRIPTION\r
- c = create an inventory file with all nodes, ports and paths\r
- a = run all validation tests (expecting an input inventory)\r
- v = only validate the given inventory file\r
- s = run service registration, deregistration, and lease test\r
- e = run event forwarding test\r
- f = flood the SA with queries according to the stress mode\r
- m = multicast flow\r
- q = QoS info: dump VLArb and SLtoVL tables\r
- t = run trap 64/65 flow (this flow requires running of external tool)\r
- (default is all flows except QoS)\r
-.TP\r
-\fB\-w\fR, \fB\-\-wait\fR\r
-This option specifies the wait time for trap 64/65 in seconds\r
-It is used only when running -f t - the trap 64/65 flow\r
-(default to 10 sec)\r
-.TP\r
-\fB\-d\fR, \fB\-\-debug\fR\r
-This option specifies a debug option.\r
-These options are not normally needed.\r
-The number following -d selects the debug\r
-option to enable as follows:\r
-\r
- OPT   Description\r
- ---    -----------------\r
- -d0  - Ignore other SM nodes\r
- -d1  - Force single threaded dispatching\r
- -d2  - Force log flushing after each log message\r
- -d3  - Disable multicast support\r
-.TP\r
-\fB\-m\fR, \fB\-\-max_lid\fR\r
-This option specifies the maximal LID number to be searched\r
-for during inventory file build (default to 100)\r
-.TP\r
-\fB\-g\fR, \fB\-\-guid\fR\r
-This option specifies the local port GUID value\r
-with which OpenSM should bind.  OpenSM may be\r
-bound to 1 port at a time.\r
-If GUID given is 0, OpenSM displays a list\r
-of possible port GUIDs and waits for user input.\r
-Without -g, OpenSM trys to use the default port.\r
-.TP\r
-\fB\-p\fR, \fB\-\-port\fR\r
-This option displays a menu of possible local port GUID values\r
-with which osmtest could bind\r
-.TP\r
-\fB\-i\fR, \fB\-\-inventory\fR\r
-This option specifies the name of the inventory file\r
-Normally, osmtest expects to find an inventory file,\r
-which osmtest uses to validate real-time information\r
-received from the SA during testing\r
-If -i is not specified, osmtest defaults to the file\r
-\'osmtest.dat\'\r
-See -c option for related information\r
-.TP\r
-\fB\-s\fR, \fB\-\-stress\fR\r
-This option runs the specified stress test instead\r
-of the normal test suite\r
-Stress test options are as follows:\r
-\r
- OPT    Description\r
- ---    -----------------\r
- -s1  - Single-MAD (RMPP) response SA queries\r
- -s2  - Multi-MAD (RMPP) response SA queries\r
- -s3  - Multi-MAD (RMPP) Path Record SA queries\r
- -s4  - Single-MAD (non RMPP) get Path Record SA queries\r
-\r
-Without -s, stress testing is not performed\r
-.TP\r
-\fB\-M\fR, \fB\-\-Multicast_Mode\fR\r
-This option specify length of Multicast test:\r
-\r
- OPT    Description\r
- ---    -----------------\r
- -M1  - Short Multicast Flow (default) - single mode\r
- -M2  - Short Multicast Flow - multiple mode\r
- -M3  - Long Multicast Flow - single mode\r
- -M4  - Long Multicast Flow - multiple mode\r
-\r
-Single mode - Osmtest is tested alone, with no other\r
-apps that interact with OpenSM MC\r
-\r
-Multiple mode - Could be run with other apps using MC with\r
-OpenSM. Without -M, default flow testing is performed\r
-.TP\r
-\fB\-t\fR, \fB\-\-timeout\fR\r
-This option specifies the time in milliseconds\r
-used for transaction timeouts.\r
-Specifying -t 0 disables timeouts.\r
-Without -t, OpenSM defaults to a timeout value of\r
-200 milliseconds.\r
-.TP\r
-\fB\-l\fR, \fB\-\-log_file\fR\r
-This option defines the log to be the given file.\r
-By default the log goes to stdout.\r
-.TP\r
-\fB\-v\fR, \fB\-\-verbose\fR\r
-This option increases the log verbosity level.\r
-The -v option may be specified multiple times\r
-to further increase the verbosity level.\r
-See the -vf option for more information about.\r
-log verbosity.\r
-.TP\r
-\fB\-V\fR\r
-This option sets the maximum verbosity level and\r
-forces log flushing.\r
-The -V is equivalent to '-vf 0xFF -d 2'.\r
-See the -vf option for more information about.\r
-log verbosity.\r
-.TP\r
-\fB\-vf\fR\r
-This option sets the log verbosity level.\r
-A flags field must follow the -D option.\r
-A bit set/clear in the flags enables/disables a\r
-specific log level as follows:\r
-\r
- BIT    LOG LEVEL ENABLED\r
- ----   -----------------\r
- 0x01 - ERROR (error messages)\r
- 0x02 - INFO (basic messages, low volume)\r
- 0x04 - VERBOSE (interesting stuff, moderate volume)\r
- 0x08 - DEBUG (diagnostic, high volume)\r
- 0x10 - FUNCS (function entry/exit, very high volume)\r
- 0x20 - FRAMES (dumps all SMP and GMP frames)\r
- 0x40 - ROUTING (dump FDB routing information)\r
- 0x80 - currently unused.\r
-\r
-Without -vf, osmtest defaults to ERROR + INFO (0x3)\r
-Specifying -vf 0 disables all messages\r
-Specifying -vf 0xFF enables all messages (see -V)\r
-High verbosity levels may require increasing\r
-the transaction timeout with the -t option\r
-.TP\r
-\fB\-h\fR, \fB\-\-help\fR\r
-Display this usage info then exit.\r
-\r
-.SH AUTHORS\r
-.TP\r
-Hal Rosenstock\r
-.RI < hal.rosenstock@gmail.com >\r
-.TP\r
-Eitan Zahavi\r
-.RI < eitan@mellanox.co.il >\r
diff --git a/branches/opensm_3/user/opensm/Makefile b/branches/opensm_3/user/opensm/Makefile
deleted file mode 100644 (file)
index a0c0627..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#\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 OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\..\inc\openib.def\r
diff --git a/branches/opensm_3/user/opensm/SOURCES b/branches/opensm_3/user/opensm/SOURCES
deleted file mode 100644 (file)
index 1f0ad94..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-\r
-TARGETNAME=opensm\r
-\r
-!if !defined(WINIBHOME)\r
-WINIBHOME=..\..\..\..\r
-!endif\r
-\r
-LIBPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-\r
-!if defined(OSM_TARGET)\r
-TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)\r
-!else\r
-TARGETPATH=$(LIBPATH)\r
-!endif\r
-\r
-!include ..\mad-vendor.inc\r
-\r
-TARGETTYPE=PROGRAM\r
-UMTYPE=console\r
-UMENTRY=main\r
-USE_MSVCRT=1\r
-\r
-SOURCES=\\r
-       osm.mc \\r
-       opensm.rc \\r
-       osm_qos_parser_y.c \\r
-       osm_qos_parser_l.c \\r
-       osm_sa_mcmember_record.c \\r
-       osm_sa_path_record.c \\r
-       osm_files.c\r
-\r
-OSM_HOME=..\r
-\r
-TARGETLIBS= \\r
-       $(SDK_LIB_PATH)\kernel32.lib \\r
-       $(SDK_LIB_PATH)\ws2_32.lib \\r
-!if $(FREEBUILD)\r
-       $(VENDOR_LIBS) \\r
-       $(LIBPATH)\*\complib.lib \\r
-       $(LIBPATH)\*\ibal.lib\r
-!else\r
-       $(VENDOR_LIBSD) \\r
-       $(LIBPATH)\*\complibd.lib \\r
-       $(LIBPATH)\*\ibald.lib\r
-!endif\r
-\r
-INCLUDES= \\r
-       $(WINIBHOME)\inc; \\r
-       $(WINIBHOME)\inc\user; \\r
-       $(WINIBHOME)\inc\user\linux; \\r
-       $(VENDOR_INC) \\r
-       $(OSM_HOME); \\r
-       $(OSM_HOME)\include;\r
-\r
-# Could be any special flag needed for this project \r
-#USER_C_FLAGS=$(USER_C_FLAGS) /MD\r
-\r
-#Add preproccessor definitions\r
-C_DEFINES=$(C_DEFINES) -D__WIN__ -DHAVE_CONFIG_H -D$(VENDOR_IF)\r
-\r
-C_DEFINES=$(C_DEFINES) -DWINVER=$(_NT_TARGET_VERSION) \r
-\r
-!if !$(FREEBUILD)\r
-C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG\r
-!endif\r
-\r
-LINKER_FLAGS= $(LINKER_FLAGS)\r
-\r
-MSC_WARNING_LEVEL= /W2 /wd4090 /wd4242 /wd4334 /wd4007\r
-\r
-#MSC_OPTIMIZATION= /O0\r
-\r
diff --git a/branches/opensm_3/user/opensm/dlfcn.h b/branches/opensm_3/user/opensm/dlfcn.h
deleted file mode 100644 (file)
index 025b10f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-\r
-\r
-#define RTLD_LAZY 1\r
\r
-void *dlopen(char *lib, int flags) { return (void*)0; }\r
-\r
-void *dlsym(void *hdl, char *sym)\r
-{\r
-       return (void*)0; // always fail.\r
-}\r
-\r
-char * dlerror(void) { return NULL; }\r
-\r
-void dlclose(void *hdl) { }\r
diff --git a/branches/opensm_3/user/opensm/libopensm.map b/branches/opensm_3/user/opensm/libopensm.map
deleted file mode 100644 (file)
index 0099255..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-OPENSM_1.5 {\r
-       global:\r
-               osm_log;\r
-               osm_log_msg_box;\r
-               osm_is_debug;\r
-               osm_log_init;\r
-               osm_log_init_v2;\r
-               osm_log_reopen_file;\r
-               osm_mad_pool_construct;\r
-               osm_mad_pool_destroy;\r
-               osm_mad_pool_init;\r
-               osm_mad_pool_get;\r
-               osm_mad_pool_put;\r
-               osm_mad_pool_get_wrapper;\r
-               osm_mad_pool_get_wrapper_raw;\r
-               ib_get_sa_method_str;\r
-               ib_get_sm_method_str;\r
-               ib_get_sm_attr_str;\r
-               ib_get_sa_attr_str;\r
-               ib_get_trap_str;\r
-               ib_zero_gid;\r
-               osm_dump_port_info;\r
-               osm_dump_portinfo_record;\r
-               osm_dump_guidinfo_record;\r
-               osm_dump_node_info;\r
-               osm_dump_node_record;\r
-               osm_dump_path_record;\r
-               osm_dump_multipath_record;\r
-               osm_dump_mc_record;\r
-               osm_dump_service_record;\r
-               osm_dump_inform_info;\r
-               osm_dump_inform_info_record;\r
-               osm_dump_link_record;\r
-               osm_dump_switch_info;\r
-               osm_dump_switch_info_record;\r
-               osm_dump_pkey_table;\r
-               osm_dump_slvl_map_table;\r
-               osm_dump_vl_arb_table;\r
-               osm_dump_sm_info;\r
-               osm_dump_sm_info_record;\r
-               osm_dump_notice;\r
-               osm_dump_dr_smp;\r
-               osm_dump_sa_mad;\r
-               osm_dump_dr_path;\r
-               osm_dump_smp_dr_path;\r
-               osm_dump_pkey_block;\r
-               osm_log_raw;\r
-               osm_get_sm_state_str;\r
-               osm_get_sm_signal_str;\r
-               osm_get_disp_msg_str;\r
-               osm_get_port_state_str_fixed_width;\r
-               osm_get_node_type_str_fixed_width;\r
-               osm_get_manufacturer_str;\r
-               osm_get_mtu_str;\r
-               osm_get_lwa_str;\r
-               osm_get_lsa_str;\r
-               osm_get_sm_mgr_signal_str;\r
-               osm_get_sm_mgr_state_str;\r
-       local: *;\r
-};\r
diff --git a/branches/opensm_3/user/opensm/libopensm.ver b/branches/opensm_3/user/opensm/libopensm.ver
deleted file mode 100644 (file)
index a04beb5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# In this file we track the current API version\r
-# of the opensm common interface (and libraries)\r
-# The version is built of the following\r
-# tree numbers:\r
-# API_REV:RUNNING_REV:AGE\r
-# API_REV - advance on any added API\r
-# RUNNING_REV - advance any change to the vendor files\r
-# AGE - number of backward versions the API still supports\r
-LIBVERSION=4:0:0\r
diff --git a/branches/opensm_3/user/opensm/main.c b/branches/opensm_3/user/opensm/main.c
deleted file mode 100644 (file)
index b377dd0..0000000
+++ /dev/null
@@ -1,1532 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Command line interface for opensm.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <getopt.h>\r
-#include <unistd.h>\r
-#include <signal.h>\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <fcntl.h>\r
-#include <complib/cl_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_version.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_console.h>\r
-#include <opensm/osm_console_io.h>\r
-#include <opensm/osm_perfmgr.h>\r
-\r
-volatile unsigned int osm_exit_flag = 0;\r
-\r
-static volatile unsigned int osm_hup_flag = 0;\r
-static volatile unsigned int osm_usr1_flag = 0;\r
-\r
-#define MAX_LOCAL_IBPORTS 64\r
-#define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)\r
-\r
-#ifndef __WIN__\r
-\r
-static void mark_exit_flag(int signum)\r
-{\r
-       if (!osm_exit_flag)\r
-               printf("OpenSM: Got signal %d - exiting...\n", signum);\r
-       osm_exit_flag = 1;\r
-}\r
-\r
-static void mark_hup_flag(int signum)\r
-{\r
-       osm_hup_flag = 1;\r
-}\r
-\r
-static void mark_usr1_flag(int signum)\r
-{\r
-       osm_usr1_flag = 1;\r
-}\r
-\r
-static sigset_t saved_sigset;\r
-\r
-static void block_signals()\r
-{\r
-       sigset_t set;\r
-\r
-       sigemptyset(&set);\r
-       sigaddset(&set, SIGINT);\r
-       sigaddset(&set, SIGTERM);\r
-       sigaddset(&set, SIGHUP);\r
-#ifndef HAVE_OLD_LINUX_THREADS\r
-       sigaddset(&set, SIGUSR1);\r
-#endif\r
-       pthread_sigmask(SIG_SETMASK, &set, &saved_sigset);\r
-}\r
-\r
-static void setup_signals()\r
-{\r
-       struct sigaction act;\r
-\r
-       sigemptyset(&act.sa_mask);\r
-       act.sa_handler = mark_exit_flag;\r
-       act.sa_flags = 0;\r
-       sigaction(SIGINT, &act, NULL);\r
-       sigaction(SIGTERM, &act, NULL);\r
-       act.sa_handler = mark_hup_flag;\r
-       sigaction(SIGHUP, &act, NULL);\r
-       sigaction(SIGCONT, &act, NULL);\r
-#ifndef HAVE_OLD_LINUX_THREADS\r
-       act.sa_handler = mark_usr1_flag;\r
-       sigaction(SIGUSR1, &act, NULL);\r
-#endif\r
-       pthread_sigmask(SIG_SETMASK, &saved_sigset, NULL);\r
-}\r
-\r
-#else /* __WIN__ */\r
-\r
-#ifdef complib_exit\r
-#undef complib_exit\r
-#endif\r
-#define complib_exit() g_service_state = SERVICE_STATE_START_FAILED \r
-\r
-#define block_signals()\r
-#define        setup_signals()\r
-#define cl_is_debug osm_is_debug\r
-\r
-HANDLE osm_exit_event = NULL;\r
-\r
-typedef struct _osm_main_args_t\r
-{\r
-  int                   argc;\r
-  char**                argv;\r
-  boolean_t             is_service;\r
-} osm_main_args_t;\r
-\r
-static osm_main_args_t osm_main_args;\r
-\r
-enum service_state {\r
-  SERVICE_STATE_STARTING,\r
-  SERVICE_STATE_STARTED_OK,\r
-  SERVICE_STATE_START_FAILED\r
-};\r
-\r
-enum service_state g_service_state = SERVICE_STATE_STARTING;\r
-\r
-SERVICE_STATUS          OsmServiceStatus; \r
-SERVICE_STATUS_HANDLE   OsmServiceStatusHandle; \r
-\r
-void SvcDebugOut(LPSTR String, ... );\r
-static char *WinErrorStr(DWORD err);\r
-void WINAPI OsmServiceCtrlHandler (DWORD opcode); \r
-\r
-BOOL WINAPI OsmServiceStart (DWORD argc, LPTSTR *argv);\r
-\r
-DWORD OsmServiceInitialization (DWORD argc, LPTSTR *argv, DWORD *specificError); \r
-#endif /* __WIN__ */\r
-\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
-static void show_usage(void)\r
-{\r
-       printf("\n------- OpenSM - Usage and options ----------------------\n");\r
-       printf("Usage:   opensm [options]\n");\r
-       printf("Options:\n");\r
-       printf("--version\n          Prints OpenSM version and exits.\n\n");\r
-       printf("--config, -F <file-name>\n"\r
-              "          The name of the OpenSM config file. When not specified\n"\r
-              "          " OSM_DEFAULT_CONFIG_FILE\r
-              " will be used (if exists).\n\n");\r
-       printf("--create-config, -c <file-name>\n"\r
-              "          OpenSM will dump its configuration to the specified file and exit.\n"\r
-              "          This is a way to generate OpenSM configuration file template.\n\n");\r
-       printf("--guid, -g <GUID in hex>\n"\r
-              "          This option specifies the local port GUID value\n"\r
-              "          with which OpenSM should bind.  OpenSM may be\n"\r
-              "          bound to 1 port at a time.\n"\r
-              "          If GUID given is 0, OpenSM displays a list\n"\r
-              "          of possible port GUIDs and waits for user input.\n"\r
-              "          Without -g, OpenSM tries to use the default port.\n\n");\r
-       printf("--lmc, -l <LMC>\n"\r
-              "          This option specifies the subnet's LMC value.\n"\r
-              "          The number of LIDs assigned to each port is 2^LMC.\n"\r
-              "          The LMC value must be in the range 0-7.\n"\r
-              "          LMC values > 0 allow multiple paths between ports.\n"\r
-              "          LMC values > 0 should only be used if the subnet\n"\r
-              "          topology actually provides multiple paths between\n"\r
-              "          ports, i.e. multiple interconnects between switches.\n"\r
-              "          Without -l, OpenSM defaults to LMC = 0, which allows\n"\r
-              "          one path between any two ports.\n\n");\r
-       printf("--priority, -p <PRIORITY>\n"\r
-              "          This option specifies the SM's PRIORITY.\n"\r
-              "          This will effect the handover cases, where master\n"\r
-              "          is chosen by priority and GUID.  Range goes\n"\r
-              "          from 0 (lowest priority) to 15 (highest).\n\n");\r
-       printf("--smkey, -k <SM_Key>\n"\r
-              "          This option specifies the SM's SM_Key (64 bits).\n"\r
-              "          This will effect SM authentication.\n"\r
-              "          Note that OpenSM version 3.2.1 and below used the\n"\r
-              "          default value '1' in a host byte order, it is fixed\n"\r
-              "          now but you may need this option to interoperate\n"\r
-              "          with old OpenSM running on a little endian machine.\n\n");\r
-       printf("--reassign_lids, -r\n"\r
-              "          This option causes OpenSM to reassign LIDs to all\n"\r
-              "          end nodes. Specifying -r on a running subnet\n"\r
-              "          may disrupt subnet traffic.\n"\r
-              "          Without -r, OpenSM attempts to preserve existing\n"\r
-              "          LID assignments resolving multiple use of same LID.\n\n");\r
-       printf("--routing_engine, -R <engine name>\n"\r
-              "          This option chooses routing engine(s) to use instead of default\n"\r
-              "          Min Hop algorithm.  Multiple routing engines can be specified\n"\r
-              "          separated by commas so that specific ordering of routing\n"\r
-              "          algorithms will be tried if earlier routing engines fail.\n"\r
-              "          Supported engines: updn, file, ftree, lash, dor\n\n");\r
-       printf("--do_mesh_analysis\n"\r
-              "          This option enables additional analysis for the lash\n"\r
-              "          routing engine to precondition switch port assignments\n"\r
-              "          in regular cartesian meshes which may reduce the number\n"\r
-              "          of SLs required to give a deadlock free routing\n\n");\r
-       printf("--lash_start_vl <vl number>\n"\r
-              "          Sets the starting VL to use for the lash routing algorithm.\n"\r
-              "          Defaults to 0.\n");\r
-       printf("--sm_sl <sl number>\n"\r
-              "          Sets the SL to use to communicate with the SM/SA. Defaults to 0.\n\n");\r
-       printf("--connect_roots, -z\n"\r
-              "          This option enforces routing engines (up/down and \n"\r
-              "          fat-tree) to make connectivity between root switches\n"\r
-              "          and in this way be IBA compliant. In many cases,\n"\r
-              "          this can violate \"pure\" deadlock free algorithm, so\n"\r
-              "          use it carefully.\n\n");\r
-       printf("--ucast_cache, -A\n"\r
-              "          This option enables unicast routing cache to prevent\n"\r
-              "          routing recalculation (which is a heavy task in a\n"\r
-              "          large cluster) when there was no topology change\n"\r
-              "          detected during the heavy sweep, or when the topology\n"\r
-              "          change does not require new routing calculation,\n"\r
-              "          e.g. in case of host reboot.\n"\r
-              "          This option becomes very handy when the cluster size\n"\r
-              "          is thousands of nodes.\n\n");\r
-       printf("--lid_matrix_file, -M <file name>\n"\r
-              "          This option specifies the name of the lid matrix dump file\n"\r
-              "          from where switch lid matrices (min hops tables will be\n"\r
-              "          loaded.\n\n");\r
-       printf("--lfts_file, -U <file name>\n"\r
-              "          This option specifies the name of the LFTs file\n"\r
-              "          from where switch forwarding tables will be loaded.\n\n");\r
-       printf("--sadb_file, -S <file name>\n"\r
-              "          This option specifies the name of the SA DB dump file\n"\r
-              "          from where SA database will be loaded.\n\n");\r
-       printf("--root_guid_file, -a <path to file>\n"\r
-              "          Set the root nodes for the Up/Down or Fat-Tree routing\n"\r
-              "          algorithm to the guids provided in the given file (one\n"\r
-              "          to a line)\n" "\n");\r
-       printf("--cn_guid_file, -u <path to file>\n"\r
-              "          Set the compute nodes for the Fat-Tree routing algorithm\n"\r
-              "          to the guids provided in the given file (one to a line)\n\n");\r
-       printf("--io_guid_file, -G <path to file>\n"\r
-              "          Set the I/O nodes for the Fat-Tree routing algorithm\n"\r
-              "          to the guids provided in the given file (one to a line)\n\n");\r
-       printf("--max_reverse_hops, -H <hop_count>\n"\r
-              "          Set the max number of hops the wrong way around\n"\r
-              "          an I/O node is allowed to do (connectivity for I/O nodes on top swithces)\n\n");\r
-       printf("--ids_guid_file, -m <path to file>\n"\r
-              "          Name of the map file with set of the IDs which will be used\n"\r
-              "          by Up/Down routing algorithm instead of node GUIDs\n"\r
-              "          (format: <guid> <id> per line)\n\n");\r
-       printf("--guid_routing_order_file, -X <path to file>\n"\r
-              "          Set the order port guids will be routed for the MinHop\n"\r
-              "          and Up/Down routing algorithms to the guids provided in the\n"\r
-              "          given file (one to a line)\n\n");\r
-       printf("--once, -o\n"\r
-              "          This option causes OpenSM to configure the subnet\n"\r
-              "          once, then exit.  Ports remain in the ACTIVE state.\n\n");\r
-       printf("--sweep, -s <interval>\n"\r
-              "          This option specifies the number of seconds between\n"\r
-              "          subnet sweeps.  Specifying -s 0 disables sweeping.\n"\r
-              "          Without -s, OpenSM defaults to a sweep interval of\n"\r
-              "          10 seconds.\n\n");\r
-       printf("--timeout, -t <milliseconds>\n"\r
-              "          This option specifies the time in milliseconds\n"\r
-              "          used for transaction timeouts.\n"\r
-              "          Specifying -t 0 disables timeouts.\n"\r
-              "          Without -t, OpenSM defaults to a timeout value of\n"\r
-              "          200 milliseconds.\n\n");\r
-       printf("--retries <number>\n"\r
-              "          This option specifies the number of retries used\n"\r
-              "          for transactions.\n"\r
-              "          Without --retries, OpenSM defaults to %u retries\n"\r
-              "          for transactions.\n\n", OSM_DEFAULT_RETRY_COUNT);\r
-       printf("--maxsmps, -n <number>\n"\r
-              "          This option specifies the number of VL15 SMP MADs\n"\r
-              "          allowed on the wire at any one time.\n"\r
-              "          Specifying --maxsmps 0 allows unlimited outstanding\n"\r
-              "          SMPs.\n"\r
-              "          Without --maxsmps, OpenSM defaults to a maximum of\n"\r
-              "          4 outstanding SMPs.\n\n");\r
-       printf("--console, -q [off|local"\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-              "|socket|loopback"\r
-#endif\r
-              "]\n          This option activates the OpenSM console (default off).\n\n");\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-       printf("--console-port, -C <port>\n"\r
-              "          Specify an alternate telnet port for the console (default %d).\n\n",\r
-              OSM_DEFAULT_CONSOLE_PORT);\r
-#endif\r
-       printf("--ignore-guids, -i <equalize-ignore-guids-file>\n"\r
-              "          This option provides the means to define a set of ports\n"\r
-              "          (by guid) that will be ignored by the link load\n"\r
-              "          equalization algorithm.\n\n");\r
-       printf("--hop_weights_file, -w <path to file>\n"\r
-              "          This option provides the means to define a weighting\n"\r
-              "          factor per port for customizing the least weight\n"\r
-              "          hops for the routing.\n\n");\r
-       printf("--dimn_ports_file, -O <path to file>\n"\r
-              "          This option provides the means to define a mapping\n"\r
-              "          between ports and dimension (Order) for controlling\n"\r
-              "          Dimension Order Routing (DOR).\n\n");\r
-       printf("--honor_guid2lid, -x\n"\r
-              "          This option forces OpenSM to honor the guid2lid file,\n"\r
-              "          when it comes out of Standby state, if such file exists\n"\r
-              "          under OSM_CACHE_DIR, and is valid. By default, this is FALSE.\n\n");\r
-       printf("--log_file, -f <log-file-name>\n"\r
-              "          This option defines the log to be the given file.\n"\r
-              "          By default, the log goes to /var/log/opensm.log.\n"\r
-              "          For the log to go to standard output use -f stdout.\n\n");\r
-       printf("--log_limit, -L <size in MB>\n"\r
-              "          This option defines maximal log file size in MB. When\n"\r
-              "          specified the log file will be truncated upon reaching\n"\r
-              "          this limit.\n\n");\r
-       printf("--erase_log_file, -e\n"\r
-              "          This option will cause deletion of the log file\n"\r
-              "          (if it previously exists). By default, the log file\n"\r
-              "          is accumulative.\n\n");\r
-       printf("--Pconfig, -P <partition-config-file>\n"\r
-              "          This option defines the optional partition configuration file.\n"\r
-              "          The default name is \'"\r
-              OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.\n\n");\r
-       printf("--no_part_enforce, -N\n"\r
-              "          This option disables partition enforcement on switch external ports.\n\n");\r
-       printf("--qos, -Q\n" "          This option enables QoS setup.\n\n");\r
-       printf("--qos_policy_file, -Y <QoS-policy-file>\n"\r
-              "          This option defines the optional QoS policy file.\n"\r
-              "          The default name is \'" OSM_DEFAULT_QOS_POLICY_FILE\r
-              "\'.\n\n");\r
-       printf("--stay_on_fatal, -y\n"\r
-              "          This option will cause SM not to exit on fatal initialization\n"\r
-              "          issues: if SM discovers duplicated guids or 12x link with\n"\r
-              "          lane reversal badly configured.\n"\r
-              "          By default, the SM will exit on these errors.\n\n");\r
-       printf("--daemon, -B\n"\r
-              "          Run in daemon mode - OpenSM will run in the background.\n\n");\r
-       printf("--inactive, -I\n"\r
-              "           Start SM in inactive rather than normal init SM state.\n\n");\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       printf("--perfmgr\n" "           Start with PerfMgr enabled.\n\n");\r
-       printf("--perfmgr_sweep_time_s <sec.>\n"\r
-              "           PerfMgr sweep interval in seconds.\n\n");\r
-#endif\r
-       printf("--prefix_routes_file <path to file>\n"\r
-              "          This option specifies the prefix routes file.\n"\r
-              "          Prefix routes control how the SA responds to path record\n"\r
-              "          queries for off-subnet DGIDs.  Default file is:\n"\r
-              "              " OSM_DEFAULT_PREFIX_ROUTES_FILE "\n\n");\r
-       printf("--consolidate_ipv6_snm_req\n"\r
-              "          Use shared MLID for IPv6 Solicited Node Multicast groups\n"\r
-              "          per MGID scope and P_Key.\n\n");\r
-       printf("--log_prefix <prefix text>\n"\r
-              "          Prefix to syslog messages from OpenSM.\n\n");\r
-       printf("--verbose, -v\n"\r
-              "          This option increases the log verbosity level.\n"\r
-              "          The -v option may be specified multiple times\n"\r
-              "          to further increase the verbosity level.\n"\r
-              "          See the -D option for more information about\n"\r
-              "          log verbosity.\n\n");\r
-       printf("--V, -V\n"\r
-              "          This option sets the maximum verbosity level and\n"\r
-              "          forces log flushing.\n"\r
-              "          The -V is equivalent to '-D 0xFF -d 2'.\n"\r
-              "          See the -D option for more information about\n"\r
-              "          log verbosity.\n\n");\r
-       printf("--D, -D <flags>\n"\r
-              "          This option sets the log verbosity level.\n"\r
-              "          A flags field must follow the -D option.\n"\r
-              "          A bit set/clear in the flags enables/disables a\n"\r
-              "          specific log level as follows:\n"\r
-              "          BIT    LOG LEVEL ENABLED\n"\r
-              "          ----   -----------------\n"\r
-              "          0x01 - ERROR (error messages)\n"\r
-              "          0x02 - INFO (basic messages, low volume)\n"\r
-              "          0x04 - VERBOSE (interesting stuff, moderate volume)\n"\r
-              "          0x08 - DEBUG (diagnostic, high volume)\n"\r
-              "          0x10 - FUNCS (function entry/exit, very high volume)\n"\r
-              "          0x20 - FRAMES (dumps all SMP and GMP frames)\n"\r
-              "          0x40 - ROUTING (dump FDB routing information)\n"\r
-              "          0x80 - currently unused.\n"\r
-              "          Without -D, OpenSM defaults to ERROR + INFO (0x3).\n"\r
-              "          Specifying -D 0 disables all messages.\n"\r
-              "          Specifying -D 0xFF enables all messages (see -V).\n"\r
-              "          High verbosity levels may require increasing\n"\r
-              "          the transaction timeout with the -t option.\n\n");\r
-       printf("--debug, -d <number>\n"\r
-              "          This option specifies a debug option.\n"\r
-              "          These options are not normally needed.\n"\r
-              "          The number following -d selects the debug\n"\r
-              "          option to enable as follows:\n"\r
-              "          OPT   Description\n"\r
-              "          ---    -----------------\n"\r
-              "          -d0  - Ignore other SM nodes\n"\r
-              "          -d1  - Force single threaded dispatching\n"\r
-              "          -d2  - Force log flushing after each log message\n"\r
-              "          -d3  - Disable multicast support\n"\r
-              "          -d10 - Put OpenSM in testability mode\n"\r
-              "          Without -d, no debug options are enabled\n\n");\r
-       printf("--help, -h, -?\n"\r
-              "          Display this usage info then exit.\n\n");\r
-#ifdef __WIN__\r
-       printf("\nExtended OpenSM Service Control:\n");\r
-       printf("  'sc control OpenSM 128'  Clear OSM Log file.\n");\r
-       printf("  'sc control OpenSM 129'  Start a Heavy Sweep.\n");\r
-#endif\r
-       fflush(stdout);\r
-       exit(2);\r
-}\r
-\r
-static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)\r
-{\r
-       ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];\r
-       uint32_t num_ports = MAX_LOCAL_IBPORTS;\r
-       uint32_t i, choice = 0;\r
-       ib_api_status_t status;\r
-\r
-       for (i = 0; i < num_ports; i++) {\r
-               attr_array[i].num_pkeys = 0;\r
-               attr_array[i].p_pkey_table = NULL;\r
-       }\r
-\r
-       /* Call the transport layer for a list of local port GUID values */\r
-       status = osm_vendor_get_all_port_attr(p_osm->p_vendor, attr_array,\r
-                                             &num_ports);\r
-       if (status != IB_SUCCESS) {\r
-               printf("\nError from osm_vendor_get_all_port_attr (%x)\n",\r
-                      status);\r
-               return 0;\r
-       }\r
-\r
-       /* if num_ports is 0 - return 0 */\r
-       if (num_ports == 0) {\r
-               printf("\nNo local ports detected!\n");\r
-               return 0;\r
-       }\r
-       /* If num_ports is 1, then there is only one possible port to use.\r
-        * Use it. */\r
-       if (num_ports == 1) {\r
-               printf("Using default GUID 0x%" PRIx64 "\n",\r
-                      cl_hton64(attr_array[0].port_guid));\r
-               return attr_array[0].port_guid;\r
-       }\r
-       /* If port_guid is 0 - use the first connected port */\r
-       if (port_guid == 0) {\r
-               for (i = 0; i < num_ports; i++)\r
-                       if (attr_array[i].link_state > IB_LINK_DOWN)\r
-                               break;\r
-               if (i == num_ports)\r
-                       i = 0;\r
-               printf("Using default GUID 0x%" PRIx64 "\n",\r
-                      cl_hton64(attr_array[i].port_guid));\r
-               return attr_array[i].port_guid;\r
-       }\r
-\r
-       if (p_osm->subn.opt.daemon)\r
-               return 0;\r
-\r
-       /* More than one possible port - list all ports and let the user\r
-        * to choose. */\r
-       while (1) {\r
-               printf("\nChoose a local port number with which to bind:\n\n");\r
-               for (i = 0; i < num_ports; i++)\r
-                       /* Print the index + 1 since by convention, port\r
-                        * numbers start with 1 on host channel adapters. */\r
-                       printf("\t%u: GUID 0x%" PRIx64 ", lid %u, state %s\n",\r
-                              i + 1, cl_ntoh64(attr_array[i].port_guid),\r
-                              attr_array[i].lid,\r
-                              ib_get_port_state_str(attr_array[i].link_state));\r
-               printf("\n\t0: Exit\n");\r
-               printf("\nEnter choice (0-%u): ", i);\r
-               fflush(stdout);\r
-               if (scanf("%u", &choice) <= 0) {\r
-                       char junk[128];\r
-                       if (scanf("%s", junk) <= 0)\r
-                               printf("\nError: Cannot scan!\n");\r
-               } else if (choice == 0)\r
-                       return 0;\r
-               else if (choice <= num_ports)\r
-                       break;\r
-               printf("\nError: Lame choice! Please try again.\n");\r
-       }\r
-       choice--;\r
-       printf("Choice guid=0x%" PRIx64 "\n",\r
-              cl_ntoh64(attr_array[choice].port_guid));\r
-       return attr_array[choice].port_guid;\r
-}\r
-\r
-#ifndef __WIN__\r
-\r
-static int daemonize(osm_opensm_t * osm)\r
-{\r
-       pid_t pid;\r
-       int fd;\r
-\r
-       fd = open("/dev/null", O_WRONLY);\r
-       if (fd < 0) {\r
-               perror("open");\r
-               return -1;\r
-       }\r
-\r
-       if ((pid = fork()) < 0) {\r
-               perror("fork");\r
-               exit(-1);\r
-       } else if (pid > 0)\r
-               exit(0);\r
-\r
-       setsid();\r
-\r
-       if ((pid = fork()) < 0) {\r
-               perror("fork");\r
-               exit(-1);\r
-       } else if (pid > 0)\r
-               exit(0);\r
-\r
-       close(0);\r
-       close(1);\r
-       close(2);\r
-\r
-       dup2(fd, 0);\r
-       dup2(fd, 1);\r
-       dup2(fd, 2);\r
-\r
-       return 0;\r
-}\r
-\r
-#else /* __WIN__ */\r
-\r
-static int daemonize(osm_opensm_t * osm)\r
-{\r
-       return 0;\r
-}\r
-\r
-#endif /* ndef __WIN__ */\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
-int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)\r
-{\r
-       int console_init_flag = 0;\r
-\r
-       if (is_console_enabled(p_opt)) {\r
-               if (!osm_console_init(p_opt, &p_osm->console, &p_osm->log))\r
-                       console_init_flag = 1;\r
-       }\r
-\r
-       /*\r
-          Sit here forever - dwell or do console i/o & cmds\r
-        */\r
-       while (!osm_exit_flag) {\r
-               if (console_init_flag) {\r
-                       if (osm_console(p_osm))\r
-                               console_init_flag = 0;\r
-               } else\r
-                       cl_thread_suspend(10000);\r
-\r
-               if (osm_usr1_flag) {\r
-                       osm_usr1_flag = 0;\r
-                       osm_log_reopen_file(&(p_osm->log));\r
-               }\r
-               if (osm_hup_flag) {\r
-                       osm_hup_flag = 0;\r
-                       /* a HUP signal should only start a new heavy sweep */\r
-                       p_osm->subn.force_heavy_sweep = TRUE;\r
-                       osm_opensm_sweep(p_osm);\r
-               }\r
-       }\r
-       if (is_console_enabled(p_opt))\r
-               osm_console_exit(&p_osm->console, &p_osm->log);\r
-       return 0;\r
-}\r
-\r
-#define SET_STR_OPT(opt, val) do { \\r
-       opt = val ? strdup(val) : NULL ; \\r
-} while (0)\r
-\r
-\r
-int\r
-opensm_main(void *OsmMainArgs)\r
-{\r
-       int argc = ((osm_main_args_t*)OsmMainArgs)->argc;\r
-       char** argv = ((osm_main_args_t*)OsmMainArgs)->argv;\r
-       osm_opensm_t osm = {0};\r
-       osm_subn_opt_t opt;\r
-       ib_net64_t sm_key = 0;\r
-       ib_api_status_t status;\r
-       int32_t temp;\r
-       uint32_t dbg_lvl;\r
-       boolean_t run_once_flag = FALSE;\r
-       int32_t vendor_debug = 0;\r
-       int next_option;\r
-       char *conf_template = NULL, *config_file = NULL;\r
-       uint32_t val;\r
-       const char *const short_option =\r
-#ifdef __WIN__\r
-          "?"\r
-#endif\r
-           "F:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANBIQvVhoryxp:n:q:k:C:G:H:";\r
-\r
-       /*\r
-          In the array below, the 2nd parameter specifies the number\r
-          of arguments as follows:\r
-          0: no arguments\r
-          1: argument\r
-          2: optional\r
-        */\r
-       const struct option long_option[] = {\r
-               {"version", 0, NULL, 12},\r
-               {"config", 1, NULL, 'F'},\r
-               {"create-config", 1, NULL, 'c'},\r
-               {"debug", 1, NULL, 'd'},\r
-               {"guid", 1, NULL, 'g'},\r
-               {"ignore_guids", 1, NULL, 'i'},\r
-               {"hop_weights_file", 1, NULL, 'w'},\r
-               {"dimn_ports_file", 1, NULL, 'O'},\r
-               {"lmc", 1, NULL, 'l'},\r
-               {"sweep", 1, NULL, 's'},\r
-               {"timeout", 1, NULL, 't'},\r
-               {"verbose", 0, NULL, 'v'},\r
-               {"D", 1, NULL, 'D'},\r
-               {"log_file", 1, NULL, 'f'},\r
-               {"log_limit", 1, NULL, 'L'},\r
-               {"erase_log_file", 0, NULL, 'e'},\r
-               {"Pconfig", 1, NULL, 'P'},\r
-               {"no_part_enforce", 0, NULL, 'N'},\r
-               {"qos", 0, NULL, 'Q'},\r
-               {"qos_policy_file", 1, NULL, 'Y'},\r
-               {"maxsmps", 1, NULL, 'n'},\r
-               {"console", 1, NULL, 'q'},\r
-               {"V", 0, NULL, 'V'},\r
-               {"help", 0, NULL, 'h'},\r
-               {"once", 0, NULL, 'o'},\r
-               {"reassign_lids", 0, NULL, 'r'},\r
-               {"priority", 1, NULL, 'p'},\r
-               {"smkey", 1, NULL, 'k'},\r
-               {"routing_engine", 1, NULL, 'R'},\r
-               {"ucast_cache", 0, NULL, 'A'},\r
-               {"connect_roots", 0, NULL, 'z'},\r
-               {"lid_matrix_file", 1, NULL, 'M'},\r
-               {"lfts_file", 1, NULL, 'U'},\r
-               {"sadb_file", 1, NULL, 'S'},\r
-               {"root_guid_file", 1, NULL, 'a'},\r
-               {"cn_guid_file", 1, NULL, 'u'},\r
-               {"io_guid_file", 1, NULL, 'G'},\r
-               {"max_reverse_hops", 1, NULL, 'H'},\r
-               {"ids_guid_file", 1, NULL, 'm'},\r
-               {"guid_routing_order_file", 1, NULL, 'X'},\r
-               {"stay_on_fatal", 0, NULL, 'y'},\r
-               {"honor_guid2lid", 0, NULL, 'x'},\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-               {"console-port", 1, NULL, 'C'},\r
-#endif\r
-               {"service", 0, NULL, 'B'},\r
-               {"daemon", 0, NULL, 'B'},\r
-               {"inactive", 0, NULL, 'I'},\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-               {"perfmgr", 0, NULL, 1},\r
-               {"perfmgr_sweep_time_s", 1, NULL, 2},\r
-#endif\r
-               {"prefix_routes_file", 1, NULL, 3},\r
-               {"consolidate_ipv6_snm_req", 0, NULL, 4},\r
-               {"do_mesh_analysis", 0, NULL, 5},\r
-               {"lash_start_vl", 1, NULL, 6},\r
-               {"sm_sl", 1, NULL, 7},\r
-               {"retries", 1, NULL, 8},\r
-               {"log_prefix", 1, NULL, 9},\r
-               {NULL, 0, NULL, 0}      /* Required at the end of the array */\r
-       };\r
-\r
-       /* Make sure that the opensm and complib were compiled using\r
-          same modes (debug/free) */\r
-       if (osm_is_debug() != cl_is_debug()) {\r
-               fprintf(stderr,\r
-                       "ERROR: OpenSM and Complib were compiled using different modes\n");\r
-               fprintf(stderr, "ERROR: OpenSM debug:%d Complib debug:%d \n",\r
-                       osm_is_debug(), cl_is_debug());\r
-               exit(1);\r
-       }\r
-\r
-#ifdef __WIN__\r
-       if (osm_main_args.is_service) {\r
-               // incorporate Windows system event log write()\r
-               // printf("%s\n", OSM_VERSION);\r
-       }\r
-       else {\r
-               printf("-------------------------------------------------\n");\r
-               printf("%s\n", OSM_VERSION);\r
-       }\r
-#else\r
-               printf("-------------------------------------------------\n");\r
-               printf("%s\n", OSM_VERSION);\r
-#endif\r
-\r
-       osm_subn_set_default_opt(&opt);\r
-\r
-       if (osm_subn_parse_conf_file(OSM_DEFAULT_CONFIG_FILE, &opt) < 0)\r
-               printf("\nFail to parse config file \'%s\'\n",\r
-                      OSM_DEFAULT_CONFIG_FILE);\r
-\r
-       do {\r
-               next_option = getopt_long_only(argc, argv, short_option,\r
-                                              long_option, NULL);\r
-               switch (next_option) {\r
-               case 'F':\r
-                       config_file = optarg;\r
-                       printf("Config file is `%s`:\n", config_file);\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-       } while (next_option != -1);\r
-\r
-       optind = 0;             /* reset command line */\r
-\r
-       if (config_file && osm_subn_parse_conf_file(config_file, &opt) < 0)\r
-               printf("\nFail to parse config file \'%s\'\n", config_file);\r
-\r
-       printf("Command Line Arguments:\n");\r
-       do {\r
-               next_option = getopt_long_only(argc, argv, short_option,\r
-                                              long_option, NULL);\r
-               switch (next_option) {\r
-               case 12:        /* --version - already printed above */\r
-                       exit(0);\r
-                       break;\r
-               case 'F':\r
-                       break;\r
-               case 'c':\r
-                       conf_template = optarg;\r
-                       printf(" Creating config file template \'%s\'.\n",\r
-                              conf_template);\r
-                       break;\r
-               case 'o':\r
-                       /*\r
-                          Run once option.\r
-                        */\r
-                       run_once_flag = TRUE;\r
-                       printf(" Run Once\n");\r
-                       break;\r
-\r
-               case 'r':\r
-                       /*\r
-                          Reassign LIDs subnet option.\r
-                        */\r
-                       opt.reassign_lids = TRUE;\r
-                       printf(" Reassign LIDs\n");\r
-                       break;\r
-\r
-               case 'i':\r
-                       /*\r
-                          Specifies ignore guids file.\r
-                        */\r
-                       SET_STR_OPT(opt.port_prof_ignore_file, optarg);\r
-                       printf(" Ignore Guids File = %s\n",\r
-                              opt.port_prof_ignore_file);\r
-                       break;\r
-\r
-               case 'w':\r
-                       opt.hop_weights_file = optarg;\r
-                       printf(" Hop Weights File = %s\n",\r
-                              opt.hop_weights_file);\r
-                       break;\r
-\r
-               case 'O':\r
-                       opt.dimn_ports_file = optarg;\r
-                       printf(" Dimension Ports File = %s\n",\r
-                              opt.dimn_ports_file);\r
-                       break;\r
-\r
-               case 'g':\r
-                       /*\r
-                          Specifies port guid with which to bind.\r
-                        */\r
-                       opt.guid = cl_hton64(strtoull(optarg, NULL, 16));\r
-                       if (!opt.guid)\r
-                               /* If guid is 0 - need to display the\r
-                                * guid list */\r
-                               opt.guid = INVALID_GUID;\r
-                       else\r
-                               printf(" Guid <0x%" PRIx64 ">\n",\r
-                                      cl_hton64(opt.guid));\r
-                       break;\r
-\r
-               case 's':\r
-                       val = strtol(optarg, NULL, 0);\r
-                       /* Check that the number is not too large */\r
-                       if (((uint32_t) (val * 1000000)) / 1000000 != val)\r
-                               fprintf(stderr,\r
-                                       "ERROR: sweep interval given is too large. Ignoring it.\n");\r
-                       else {\r
-                               opt.sweep_interval = val;\r
-                               printf(" sweep interval = %d\n",\r
-                                      opt.sweep_interval);\r
-                       }\r
-                       break;\r
-\r
-               case 't':\r
-                       opt.transaction_timeout = strtoul(optarg, NULL, 0);\r
-                       printf(" Transaction timeout = %u\n",\r
-                              opt.transaction_timeout);\r
-                       break;\r
-\r
-               case 'n':\r
-                       opt.max_wire_smps = strtoul(optarg, NULL, 0);\r
-                       if (opt.max_wire_smps == 0 ||\r
-                           opt.max_wire_smps > 0x7FFFFFFF)\r
-                               opt.max_wire_smps = 0x7FFFFFFF;\r
-                       printf(" Max wire smp's = %d\n", opt.max_wire_smps);\r
-                       break;\r
-\r
-               case 'q':\r
-                       /*\r
-                        * OpenSM interactive console\r
-                        */\r
-                       if (strcmp(optarg, OSM_DISABLE_CONSOLE) == 0\r
-                           || strcmp(optarg, OSM_LOCAL_CONSOLE) == 0\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-                           || strcmp(optarg, OSM_REMOTE_CONSOLE) == 0\r
-                           || strcmp(optarg, OSM_LOOPBACK_CONSOLE) == 0\r
-#endif\r
-                           )\r
-                               SET_STR_OPT(opt.console, optarg);\r
-                       else\r
-                               printf("-console %s option not understood\n",\r
-                                      optarg);\r
-                       break;\r
-\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-               case 'C':\r
-                       opt.console_port = strtol(optarg, NULL, 0);\r
-                       break;\r
-#endif\r
-\r
-               case 'd':\r
-                       dbg_lvl = strtol(optarg, NULL, 0);\r
-                       printf(" d level = 0x%x\n", dbg_lvl);\r
-                       if (dbg_lvl == 0) {\r
-                               printf(" Debug mode: Ignore Other SMs\n");\r
-                               opt.ignore_other_sm = TRUE;\r
-                       } else if (dbg_lvl == 1) {\r
-                               printf(" Debug mode: Forcing Single Thread\n");\r
-                               opt.single_thread = TRUE;\r
-                       } else if (dbg_lvl == 2) {\r
-                               printf(" Debug mode: Force Log Flush\n");\r
-                               opt.force_log_flush = TRUE;\r
-                       } else if (dbg_lvl == 3) {\r
-                               printf\r
-                                   (" Debug mode: Disable multicast support\n");\r
-                               opt.disable_multicast = TRUE;\r
-                       }\r
-                       /*\r
-                        * NOTE: Debug level 4 used to be used for memory\r
-                        * tracking but this is now deprecated\r
-                        */\r
-                       else if (dbg_lvl == 5)\r
-                               vendor_debug++;\r
-                       else\r
-                               printf(" OpenSM: Unknown debug option %d"\r
-                                      " ignored\n", dbg_lvl);\r
-                       break;\r
-\r
-               case 'l':\r
-                       temp = strtol(optarg, NULL, 0);\r
-                       if (temp > 7) {\r
-                               fprintf(stderr,\r
-                                       "ERROR: LMC must be 7 or less.\n");\r
-                               return -1;\r
-                       }\r
-                       opt.lmc = (uint8_t) temp;\r
-                       printf(" LMC = %d\n", temp);\r
-                       break;\r
-\r
-               case 'D':\r
-                       opt.log_flags = strtol(optarg, NULL, 0);\r
-                       printf(" verbose option -D = 0x%x\n", opt.log_flags);\r
-                       break;\r
-\r
-               case 'f':\r
-                       SET_STR_OPT(opt.log_file, optarg);\r
-                       break;\r
-\r
-               case 'L':\r
-                       opt.log_max_size = strtoul(optarg, NULL, 0);\r
-                       printf(" Log file max size is %lu MBytes\n",\r
-                              opt.log_max_size);\r
-                       break;\r
-\r
-               case 'e':\r
-                       opt.accum_log_file = FALSE;\r
-                       printf(" Creating new log file\n");\r
-                       break;\r
-\r
-               case 'P':\r
-                       SET_STR_OPT(opt.partition_config_file, optarg);\r
-                       break;\r
-\r
-               case 'N':\r
-                       opt.no_partition_enforcement = TRUE;\r
-                       break;\r
-\r
-               case 'Q':\r
-                       opt.qos = TRUE;\r
-                       break;\r
-\r
-               case 'Y':\r
-                       SET_STR_OPT(opt.qos_policy_file, optarg);\r
-                       printf(" QoS policy file \'%s\'\n", optarg);\r
-                       break;\r
-\r
-               case 'y':\r
-                       opt.exit_on_fatal = FALSE;\r
-                       printf(" Staying on fatal initialization errors\n");\r
-                       break;\r
-\r
-               case 'v':\r
-                       opt.log_flags = (opt.log_flags << 1) | 1;\r
-                       printf(" Verbose option -v (log flags = 0x%X)\n",\r
-                              opt.log_flags);\r
-                       break;\r
-\r
-               case 'V':\r
-                       opt.log_flags = 0xFF;\r
-                       opt.force_log_flush = TRUE;\r
-                       printf(" Big V selected\n");\r
-                       break;\r
-\r
-               case 'p':\r
-                       temp = strtol(optarg, NULL, 0);\r
-                       if (0 > temp || 15 < temp) {\r
-                               fprintf(stderr,\r
-                                       "ERROR: priority must be between 0 and 15\n");\r
-                               return -1;\r
-                       }\r
-                       opt.sm_priority = (uint8_t) temp;\r
-                       printf(" Priority = %d\n", temp);\r
-                       break;\r
-\r
-               case 'k':\r
-                       sm_key = cl_hton64(strtoull(optarg, NULL, 16));\r
-                       printf(" SM Key <0x%" PRIx64 ">\n", cl_hton64(sm_key));\r
-                       opt.sm_key = sm_key;\r
-                       break;\r
-\r
-               case 'R':\r
-                       SET_STR_OPT(opt.routing_engine_names, optarg);\r
-                       printf(" Activate \'%s\' routing engine(s)\n", optarg);\r
-                       break;\r
-\r
-               case 'z':\r
-                       opt.connect_roots = TRUE;\r
-                       printf(" Connect roots option is on\n");\r
-                       break;\r
-\r
-               case 'A':\r
-                       opt.use_ucast_cache = TRUE;\r
-                       printf(" Unicast routing cache option is on\n");\r
-                       break;\r
-\r
-               case 'M':\r
-                       SET_STR_OPT(opt.lid_matrix_dump_file, optarg);\r
-                       printf(" Lid matrix dump file is \'%s\'\n", optarg);\r
-                       break;\r
-\r
-               case 'U':\r
-                       SET_STR_OPT(opt.lfts_file, optarg);\r
-                       printf(" LFTs file is \'%s\'\n", optarg);\r
-                       break;\r
-\r
-               case 'S':\r
-                       SET_STR_OPT(opt.sa_db_file, optarg);\r
-                       printf(" SA DB file is \'%s\'\n", optarg);\r
-                       break;\r
-\r
-               case 'a':\r
-                       SET_STR_OPT(opt.root_guid_file, optarg);\r
-                       printf(" Root Guid File: %s\n", opt.root_guid_file);\r
-                       break;\r
-\r
-               case 'u':\r
-                       SET_STR_OPT(opt.cn_guid_file, optarg);\r
-                       printf(" Compute Node Guid File: %s\n",\r
-                              opt.cn_guid_file);\r
-                       break;\r
-\r
-               case 'G':\r
-                       opt.io_guid_file = optarg;\r
-                       printf(" I/O Node Guid File: %s\n", opt.io_guid_file);\r
-                       break;\r
-               case 'H':\r
-                       opt.max_reverse_hops = atoi(optarg);\r
-                       printf(" Max Reverse Hops: %d\n", opt.max_reverse_hops);\r
-                       break;\r
-               case 'm':\r
-                       SET_STR_OPT(opt.ids_guid_file, optarg);\r
-                       printf(" IDs Guid File: %s\n", opt.ids_guid_file);\r
-                       break;\r
-\r
-               case 'X':\r
-                       SET_STR_OPT(opt.guid_routing_order_file, optarg);\r
-                       printf(" GUID Routing Order File: %s\n",\r
-                              opt.guid_routing_order_file);\r
-                       break;\r
-\r
-               case 'x':\r
-                       opt.honor_guid2lid_file = TRUE;\r
-                       printf(" Honor guid2lid file, if possible\n");\r
-                       break;\r
-\r
-               case 'B':\r
-                       opt.daemon = TRUE;\r
-                       printf(" Daemon mode\n");\r
-                       break;\r
-\r
-               case 'I':\r
-                       opt.sm_inactive = TRUE;\r
-                       printf(" SM started in inactive state\n");\r
-                       break;\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-               case 1:\r
-                       opt.perfmgr = TRUE;\r
-                       break;\r
-               case 2:\r
-                       opt.perfmgr_sweep_time_s = atoi(optarg);\r
-                       break;\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-               case 3:\r
-                       SET_STR_OPT(opt.prefix_routes_file, optarg);\r
-                       break;\r
-               case 4:\r
-                       opt.consolidate_ipv6_snm_req = TRUE;\r
-                       break;\r
-               case 5:\r
-                       opt.do_mesh_analysis = TRUE;\r
-                       break;\r
-               case 6:\r
-                       temp = strtol(optarg, NULL, 0);\r
-                       if (temp < 0 || temp >= IB_MAX_NUM_VLS) {\r
-                               fprintf(stderr,\r
-                                       "ERROR: starting lash vl must be between 0 and 15\n");\r
-                               return -1;\r
-                       }\r
-                       opt.lash_start_vl = (uint8_t) temp;\r
-                       printf(" LASH starting VL = %d\n", opt.lash_start_vl);\r
-                       break;\r
-               case 7:\r
-                       temp = strtol(optarg, NULL, 0);\r
-                       if (temp < 0 || temp > 15) {\r
-                               fprintf(stderr,\r
-                                       "ERROR: SM's SL must be between 0 and 15\n");\r
-                               return -1;\r
-                       }\r
-                       opt.sm_sl = (uint8_t) temp;\r
-                       printf(" SMSL = %d\n", opt.sm_sl);\r
-                       break;\r
-               case 8:\r
-                       opt.transaction_retries = strtoul(optarg, NULL, 0);\r
-                       printf(" Transaction retries = %u\n",\r
-                              opt.transaction_retries);\r
-                       break;\r
-               case 9:\r
-                       SET_STR_OPT(opt.log_prefix, optarg);\r
-                       printf("Log prefix = %s\n", opt.log_prefix);\r
-                       break;\r
-               case 'h':\r
-               case '?':\r
-               case ':':\r
-                       show_usage();\r
-                       break;\r
-\r
-               case -1:\r
-                       break;  /* done with option */\r
-               default:        /* something wrong */\r
-                       abort();\r
-               }\r
-       } while (next_option != -1);\r
-\r
-#ifdef __WIN__\r
-       if (osm_main_args.is_service) {\r
-               if (is_console_enabled(&opt)) {\r
-                       free(opt.console);\r
-                       opt.console = strdup(OSM_DISABLE_CONSOLE);\r
-               }\r
-       }\r
-#endif\r
-       if (opt.log_file != NULL)\r
-               printf(" Log File: %s\n", opt.log_file);\r
-       /* Done with options description */\r
-       printf("-------------------------------------------------\n");\r
-\r
-       if (conf_template) {\r
-               status = osm_subn_write_conf_file(conf_template, &opt);\r
-               if (status)\r
-                       printf("\nosm_subn_write_conf_file failed!\n");\r
-               exit(status);\r
-       }\r
-\r
-       osm_subn_verify_config(&opt);\r
-\r
-       if (vendor_debug)\r
-               osm_vendor_set_debug(osm.p_vendor, vendor_debug);\r
-\r
-       block_signals();\r
-\r
-       if (opt.daemon)\r
-               daemonize(&osm);\r
-\r
-       complib_init();\r
-\r
-       status = osm_opensm_init(&osm, &opt);\r
-       if (status != IB_SUCCESS) {\r
-               const char *err_str = ib_get_err_str(status);\r
-               if (err_str == NULL)\r
-                       err_str = "Unknown Error Type";\r
-               printf("\nError from osm_opensm_init: %s.\n", err_str);\r
-               /* We will just exit, and not go to Exit, since we don't\r
-                  want the destroy to be called. */\r
-               complib_exit();\r
-               return status;\r
-       }\r
-\r
-       /*\r
-          If the user didn't specify a GUID on the command line,\r
-          then get a port GUID value with which to bind.\r
-        */\r
-       if (opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))\r
-               opt.guid = get_port_guid(&osm, opt.guid);\r
-\r
-       if (opt.guid == 0)\r
-               goto Exit;\r
-\r
-       status = osm_opensm_bind(&osm, opt.guid);\r
-       if (status != IB_SUCCESS) {\r
-               printf("\nError from osm_opensm_bind (0x%X)\n", status);\r
-               printf\r
-                   ("Perhaps another instance of OpenSM is already running\n");\r
-               goto Exit;\r
-       }\r
-\r
-       setup_signals();\r
-\r
-       osm_opensm_sweep(&osm);\r
-\r
-       if (run_once_flag == TRUE) {\r
-               while (!osm_exit_flag) {\r
-                       status =\r
-                           osm_opensm_wait_for_subnet_up(&osm,\r
-                                                         osm.subn.opt.\r
-                                                         sweep_interval *\r
-                                                         1000000, TRUE);\r
-                       if (!status)\r
-                               osm_exit_flag = 1;\r
-               }\r
-       } else {\r
-               /*\r
-                *         Sit here until signaled to exit\r
-                */\r
-               osm_manager_loop(&opt, &osm);\r
-       }\r
-\r
-       if (osm.mad_pool.mads_out) {\r
-               fprintf(stdout,\r
-                       "There are still %u MADs out. Forcing the exit of the OpenSM application...\n",\r
-                       osm.mad_pool.mads_out);\r
-#ifdef HAVE_LIBPTHREAD\r
-               pthread_cond_signal(&osm.stats.cond);\r
-#else\r
-               cl_event_signal(&osm.stats.event);\r
-#endif\r
-       }\r
-\r
-Exit:\r
-       osm_opensm_destroy(&osm);\r
-       complib_exit();\r
-\r
-       return 0;\r
-}\r
-\r
-#ifdef __WIN__\r
-\r
-int\r
-main(int argc, char **argv)\r
-{\r
-    int i;\r
-    boolean_t run_as_service = FALSE;\r
-    SERVICE_TABLE_ENTRY   DispatchTable[] =\r
-    {\r
-       { "OpenSM", (LPSERVICE_MAIN_FUNCTION) OsmServiceStart }, \r
-       { NULL, NULL } \r
-    }; \r
-\r
-    osm_main_args.argc = argc;\r
-    osm_main_args.argv = argv;\r
-\r
-    /* Is OpenSM being run as a Windows service or from a cmd line?  */\r
-    for (i = 0 ; i< argc ; i++) {\r
-       if (!strcmp(argv[i], "--service")) {\r
-               run_as_service = TRUE;\r
-               osm_main_args.is_service = TRUE;\r
-               break;\r
-        }\r
-        if (!strcmp(argv[i], "/?"))\r
-               show_usage();\r
-    }\r
-\r
-    osm_exit_event = CreateEvent(NULL, FALSE, FALSE, NULL);\r
-    if(osm_exit_event == NULL) {\r
-       printf( "\nCreateEvent failed err %d\n", GetLastError());\r
-       return( 1 );      \r
-    }\r
-  \r
-    if (!run_as_service) {\r
-       /* Running as console executable */\r
-       osm_main_args.is_service = FALSE;\r
-       return opensm_main( (void*)&osm_main_args );\r
-    }\r
-\r
-    /* Running as a Windows service */\r
-   \r
-    i = 0;\r
-    if (!StartServiceCtrlDispatcher( DispatchTable )) { \r
-       i = GetLastError();\r
-       SvcDebugOut(" [OSM_SERVICE] StartServiceCtrlDispatcher (%s)\n", \r
-                       WinErrorStr(i)); \r
-    }\r
-    return i;\r
-}\r
-\r
-/*\r
- * Carried over from previous 3.0.0 openSM port.\r
- * Problem is that Windows service startup needs feedback as to whether openSM\r
- * actually started up successfully or not. Windows service manager calls the\r
- * OsmServiceStart routine which spawns a thread to run opensm. The OpenSM\r
- * thread communicates with the OsmServiceStart thread via g_service_state.\r
- * Once the OpenSM thread resets g_service_state from SERVICE_STATE_STARTING,\r
- * the OsmServiceStart() will return to the Windows service manager. \r
- * The coding problem is how to catch 'all' Error & Success startup conditions\r
- * and reset g_service_state without hacking the entire body of OFED OpenSM\r
- * code (Linux folks are touchy about Windows code in shared code).\r
- * Somebody once decided that scanning osm_log (aka syslog()) message strings\r
- * seemed was the way to solve this this problem.\r
- * For each call to osm_log() with verbosity OSM_LOG_SYS (aka syslog() called)\r
- * OsmReportState() is called; [see osm_log.c].\r
- */\r
-\r
-void OsmReportState(IN const char *p_str)\r
-{\r
-    if ( !strcmp(p_str, "SUBNET UP\n")\r
-       || !strcmp(p_str, "SM port is down\n")\r
-       || !strcmp(p_str, "Errors during initialization\n")\r
-       || !strcmp(p_str, "Entering STANDBY state\n") )\r
-    {\r
-       /* change Service startup state to OK */\r
-        InterlockedCompareExchange( (LONG *)&g_service_state ,\r
-                                   SERVICE_STATE_STARTED_OK,\r
-                                   SERVICE_STATE_STARTING );\r
-       if (osm_main_args.is_service)\r
-               SvcDebugOut(" [OSM_SERVICE] %s", p_str);\r
-\r
-       // consider Windows system event log write()\r
-        return;\r
-    }\r
-\r
-    /* Check opt.exit_on_fatal messages */\r
-    if ( !strcmp(p_str, "Found remote SM with non-matching sm_key. Exiting\n")\r
-       || !strncmp(p_str, "Errors on subnet. Duplicate GUID found ",39)\r
-       || !strcmp(p_str, "Found remote SM with non-matching sm_key. Exiting\n")\r
-       || !strcmp(p_str, "FATAL: duplicated guids or 12x lane reversal\n") )\r
-    {\r
-       /* change Service startup state to Failed */\r
-        InterlockedCompareExchange( (LONG *)&g_service_state,\r
-                                   SERVICE_STATE_START_FAILED,\r
-                                   SERVICE_STATE_STARTING );\r
-       if (osm_main_args.is_service)\r
-               SvcDebugOut(" [OSM_SERVICE] %s", p_str);\r
-\r
-       // consider Windows system event log write() here.\r
-        return;\r
-    }\r
-\r
-    if ( !strcmp(p_str, OSM_VERSION"\n") ||\r
-        !strcmp(p_str, "Entering MASTER state\n") ||\r
-        !strcmp(p_str, "Entering DISCOVERING state\n") )\r
-    {\r
-       // consider Windows system event log write() here.\r
-       if (osm_main_args.is_service)\r
-               SvcDebugOut(" [OSM_SERVICE] %s", p_str);\r
-    }\r
-}\r
-\r
-\r
-static char *WinErrorStr(DWORD err)\r
-{\r
-       char *s;\r
-\r
-       if (err == NO_ERROR)\r
-               return "Success";\r
-\r
-       if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |\r
-                        FORMAT_MESSAGE_FROM_SYSTEM,\r
-                        NULL,\r
-                        err,\r
-                        0,\r
-                        (LPTSTR)&s,\r
-                        0,\r
-                        NULL) == 0)\r
-       { /* failed */\r
-               // Unknown error code %08x (%d)\r
-               s = "WinErrorStr: FormatMessage() error?";\r
-       }\r
-       else\r
-       {       /* success */\r
-               char * p = strchr(s, '\r');\r
-               if(p != NULL) /* lose CRLF */\r
-                       *p = '\0';\r
-       }\r
-       return s;\r
-}\r
-\r
-\r
-void SvcDebugOut(LPSTR fmt, ... ) \r
-{ \r
-       CHAR Buffer[1024];\r
-       va_list args;\r
-\r
-       va_start(args,fmt);\r
-       _vsnprintf(Buffer, 1024, fmt, args); \r
-       va_end(args);\r
-       OutputDebugStringA(Buffer); \r
-}\r
-\r
-/* Local OpenSM service control codes: 128 - 255.\r
- *\r
- * invoke with 'sc control OpenSM local-control-code'\r
- * 'sc control OpenSM 128' clear & reopen %windir%\temp\osm.log\r
- */\r
-#define SERVICE_CONTROL_OSM_REOPEN_LOG_FILE    128\r
-#define SERVICE_CONTROL_OSM_START_HEAVY_SWEEP  129\r
-\r
-void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode ) \r
-{ \r
-   DWORD status=0; \r
-   char *ctl;\r
\r
-   switch(Opcode) \r
-   { \r
-      case SERVICE_CONTROL_SHUTDOWN: \r
-      case SERVICE_CONTROL_STOP: \r
-         if (Opcode == SERVICE_CONTROL_STOP)\r
-             ctl = "STOP";\r
-         else\r
-             ctl = "SHUTDOWN";\r
-         syslog(LOG_INFO,"[OSM_SERVICE] SERVICE_CONTROL_%s\n",ctl); \r
-\r
-         // Do whatever it takes to stop here. \r
-         osm_exit_flag = TRUE;\r
-         SetEvent(osm_exit_event);\r
-\r
-         OsmServiceStatus.dwWin32ExitCode = 0; \r
-         OsmServiceStatus.dwCurrentState  = SERVICE_STOPPED; \r
-         OsmServiceStatus.dwCheckPoint    = 0; \r
-         OsmServiceStatus.dwWaitHint      = 0; \r
-\r
-         if (!SetServiceStatus (OsmServiceStatusHandle, &OsmServiceStatus))\r
-         { \r
-            status = GetLastError(); \r
-         } \r
-         SvcDebugOut(" [OSM_SERVICE] Exit SERVICE_CONTROL_%s (%ld) '%s'\n",\r
-               ctl, status, WinErrorStr(status)); \r
-         return; \r
\r
-      case SERVICE_CONTROL_INTERROGATE: \r
-         SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_INTERROGATE\n"); \r
-         break; // bail out to send current status. \r
\r
-      case SERVICE_CONTROL_PAUSE: \r
-         SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_PAUSE\n"); \r
-         break;\r
-\r
-      case SERVICE_CONTROL_CONTINUE: \r
-         SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_CONTINUE\n"); \r
-         break;\r
-\r
-      case SERVICE_CONTROL_OSM_REOPEN_LOG_FILE:\r
-         osm_usr1_flag = 1;\r
-         SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_OSM_REOPEN_LOG_FILE\n"); \r
-         syslog(LOG_INFO,"[SERVICE_CONTROL] REOPEN_LOG_FILE\n"); \r
-         break;\r
-\r
-      case SERVICE_CONTROL_OSM_START_HEAVY_SWEEP:\r
-         osm_hup_flag = 1;\r
-         SvcDebugOut("[OSM_SERVICE] SERVICE_CONTROL_OSM_START_HEAVY_SWEEP\n"); \r
-         syslog(LOG_INFO,"[SERVICE_CONTROL] START_HEAVY_SWEEP\n"); \r
-         break;\r
-\r
-      default: \r
-         SvcDebugOut(" [OSM_SERVICE] Unrecognized opcode %ld\n", Opcode); \r
-   } \r
\r
-   // Send current status. \r
-   if (!SetServiceStatus (OsmServiceStatusHandle,  &OsmServiceStatus)) \r
-   { \r
-       status = GetLastError(); \r
-       SvcDebugOut(" [OSM_SERVICE] SetServiceStatus error(%ld) %s\n",\r
-                       status,WinErrorStr(status)); \r
-   } \r
-   else\r
-      SvcDebugOut("   [OSM_SERVICE] %s() Exit status %ld\n",__func__, status); \r
-}\r
-\r
-\r
-BOOL WINAPI  OsmServiceStart (DWORD argc, LPTSTR *argv) \r
-{\r
-    DWORD status; \r
-    DWORD specificError; \r
\r
-    OsmServiceStatus.dwServiceType        = SERVICE_WIN32; \r
-    OsmServiceStatus.dwCurrentState       = SERVICE_START_PENDING; \r
-    OsmServiceStatus.dwControlsAccepted   = SERVICE_ACCEPT_STOP |\r
-                                               SERVICE_ACCEPT_SHUTDOWN; \r
-    /* Add when Pause/Standby supported SERVICE_ACCEPT_PAUSE_CONTINUE */\r
-    OsmServiceStatus.dwWin32ExitCode      = 0; \r
-    OsmServiceStatus.dwServiceSpecificExitCode = 0; \r
-    OsmServiceStatus.dwCheckPoint         = 0; \r
-    OsmServiceStatus.dwWaitHint           = 2000; \r
-\r
-    OsmServiceStatusHandle = RegisterServiceCtrlHandler( "OpenSM", \r
-                                                        OsmServiceCtrlHandler);\r
\r
-    if (OsmServiceStatusHandle == (SERVICE_STATUS_HANDLE)0) \r
-    { \r
-       status = GetLastError(); \r
-        SvcDebugOut(" [OSM_SERVICE] RegisterServiceCtrlHandler failed(%d) %s\n",\r
-                       status,WinErrorStr(status)); \r
-        return 0; \r
-    } \r
-\r
-    // Initialization code goes here. \r
-    status = OsmServiceInitialization(argc, argv, &specificError); \r
-\r
-    while (status == NO_ERROR && g_service_state == SERVICE_STATE_STARTING)\r
-    {\r
-        Sleep(1000);\r
-        OsmServiceStatus.dwCheckPoint++;\r
-        if (!SetServiceStatus (OsmServiceStatusHandle, &OsmServiceStatus)) \r
-        { \r
-          status = GetLastError(); \r
-          SvcDebugOut(" [OSM_SERVICE] SetServiceStatus error(%ld) %s\n",\r
-                       status,WinErrorStr(status)); \r
-        } \r
-\r
-    }\r
-    CL_ASSERT(g_service_state == SERVICE_STATE_STARTED_OK ||\r
-              g_service_state == SERVICE_STATE_START_FAILED ||\r
-              status != NO_ERROR);\r
-\r
-    // Handle error condition \r
-    if (status != NO_ERROR || g_service_state == SERVICE_STATE_START_FAILED) \r
-    { \r
-        OsmServiceStatus.dwCurrentState       = SERVICE_STOPPED; \r
-        OsmServiceStatus.dwCheckPoint         = 0; \r
-        OsmServiceStatus.dwWaitHint           = 0; \r
-        OsmServiceStatus.dwWin32ExitCode      = status; \r
-        OsmServiceStatus.dwServiceSpecificExitCode = specificError; \r
\r
-        SetServiceStatus (OsmServiceStatusHandle, &OsmServiceStatus); \r
-        SvcDebugOut(" [OSM_SERVICE] Service Startup error reported; exit\n");\r
-        return 0; \r
-    } \r
\r
-    // Initialization complete - report running status. \r
-    OsmServiceStatus.dwCurrentState       = SERVICE_RUNNING; \r
-    OsmServiceStatus.dwCheckPoint         = 0; \r
-    OsmServiceStatus.dwWaitHint           = 0; \r
\r
-    if (!SetServiceStatus (OsmServiceStatusHandle, &OsmServiceStatus)) \r
-    { \r
-        status = GetLastError(); \r
-        SvcDebugOut(" [OSM_SERVICE] SetServiceStatus error %ld\n",status); \r
-    } \r
\r
-    SvcDebugOut(" [OSM_SERVICE] StartUP SUCCESS\n"); \r
\r
-    return 1; // SUCCESS\r
-}\r
-\r
\r
-// Stub initialization function. \r
-DWORD OsmServiceInitialization( DWORD  argc,\r
-                               LPTSTR  *argv, \r
-                               DWORD   *specificError ) \r
-{ \r
-       DWORD rc = 0;\r
-\r
-       if (CreateThread(NULL, 0, opensm_main, &osm_main_args, 0, NULL) == NULL)\r
-       {\r
-               SvcDebugOut(" [OSM_SERVICE] failed to create thread (%d)\n",\r
-               GetLastError());\r
-               rc = 1;\r
-       }\r
-       return rc;\r
-}\r
-\r
-#endif /* __WIN__ */\r
-\r
diff --git a/branches/opensm_3/user/opensm/opensm.rc b/branches/opensm_3/user/opensm/opensm.rc
deleted file mode 100644 (file)
index 1a088a5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*\r
- * Copyright (c) 2005 Mellanox Technologies.  All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE                   VFT_APP\r
-#define VER_FILESUBTYPE                        VFT2_UNKNOWN\r
-#ifdef _DEBUG_\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Subnet Manager 3.3.6 (Debug)"\r
-#define VER_INTERNALNAME_STR        "opensm.exe"\r
-#define VER_ORIGINALFILENAME_STR    "opensm.exe"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Subnet Manager 3.3.6"\r
-#define VER_INTERNALNAME_STR        "opensm.exe"\r
-#define VER_ORIGINALFILENAME_STR    "opensm.exe"\r
-#endif\r
-#include <common.ver>\r
diff --git a/branches/opensm_3/user/opensm/osm.mc b/branches/opensm_3/user/opensm/osm.mc
deleted file mode 100644 (file)
index 3030f71..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-;/*++
-;=============================================================================
-;Copyright (c) 2005 Mellanox Technologies
-;
-;Module Name:
-;
-;    osm.mc
-;
-;Abstract:
-;
-;    OpenSM event log messages
-;
-;Authors:
-;
-;    Leonid Keller
-;
-;Environment:
-;
-;   Kernel Mode .
-;
-;=============================================================================
-;--*/
-;
-
-MessageId=0x0000 SymbolicName=EVENT_OSM_ANY_INFO
-Language=English
-%1
-.
-
diff --git a/branches/opensm_3/user/opensm/osm_console.c b/branches/opensm_3/user/opensm/osm_console.c
deleted file mode 100644 (file)
index 1df8927..0000000
+++ /dev/null
@@ -1,1574 +0,0 @@
-/*\r
- * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#define _GNU_SOURCE            /* for getline */\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#ifndef __WIN__\r
-#include <sys/poll.h>\r
-#include <sys/types.h>\r
-#include <sys/socket.h>\r
-#include <netdb.h>\r
-#include <regex.h>\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-#include <arpa/inet.h>\r
-#endif\r
-#endif /* ndef __WIN__ */\r
-#include <unistd.h>\r
-#include <errno.h>\r
-#include <ctype.h>\r
-#include <sys/time.h>\r
-#include <opensm/osm_console.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_subnet.h>\r
-\r
-extern void osm_update_node_desc(IN osm_opensm_t *osm);\r
-\r
-struct command {\r
-       char *name;\r
-       void (*help_function) (FILE * out, int detail);\r
-       void (*parse_function) (char **p_last, osm_opensm_t * p_osm,\r
-                               FILE * out);\r
-};\r
-\r
-static struct {\r
-       int on;\r
-       int delay_s;\r
-       time_t previous;\r
-       void (*loop_function) (osm_opensm_t * p_osm, FILE * out);\r
-} loop_command = {\r
-#ifdef __WIN__\r
-       0,2,0,NULL\r
-#else\r
-on: 0, delay_s: 2, loop_function:NULL\r
-#endif\r
-};\r
-\r
-#ifdef __WIN__\r
-extern const struct command console_cmds[];\r
-#else\r
-static const struct command console_cmds[];\r
-#endif\r
-\r
-static char *next_token(char **p_last)\r
-{\r
-       return strtok_r(NULL, " \t\n\r", p_last);\r
-}\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-static char *name_token(char **p_last)\r
-{\r
-       return strtok_r(NULL, "\t\n\r", p_last);\r
-}\r
-#endif\r
-\r
-static void help_command(FILE * out, int detail)\r
-{\r
-       int i;\r
-\r
-       fprintf(out, "Supported commands and syntax:\n");\r
-       fprintf(out, "help [<command>]\n");\r
-       /* skip help command */\r
-       for (i = 1; console_cmds[i].name; i++)\r
-               console_cmds[i].help_function(out, 0);\r
-}\r
-\r
-#ifndef __WIN__\r
-static void help_quit(FILE * out, int detail)\r
-{\r
-       fprintf(out, "quit (not valid in local mode; use ctl-c)\n");\r
-}\r
-#endif\r
-\r
-static void help_loglevel(FILE * out, int detail)\r
-{\r
-       fprintf(out, "loglevel [<log-level>]\n");\r
-       if (detail) {\r
-               fprintf(out, "   log-level is OR'ed from the following\n");\r
-               fprintf(out, "   OSM_LOG_NONE             0x%02X\n",\r
-                       OSM_LOG_NONE);\r
-               fprintf(out, "   OSM_LOG_ERROR            0x%02X\n",\r
-                       OSM_LOG_ERROR);\r
-               fprintf(out, "   OSM_LOG_INFO             0x%02X\n",\r
-                       OSM_LOG_INFO);\r
-               fprintf(out, "   OSM_LOG_VERBOSE          0x%02X\n",\r
-                       OSM_LOG_VERBOSE);\r
-               fprintf(out, "   OSM_LOG_DEBUG            0x%02X\n",\r
-                       OSM_LOG_DEBUG);\r
-               fprintf(out, "   OSM_LOG_FUNCS            0x%02X\n",\r
-                       OSM_LOG_FUNCS);\r
-               fprintf(out, "   OSM_LOG_FRAMES           0x%02X\n",\r
-                       OSM_LOG_FRAMES);\r
-               fprintf(out, "   OSM_LOG_ROUTING          0x%02X\n",\r
-                       OSM_LOG_ROUTING);\r
-               fprintf(out, "   OSM_LOG_SYS              0x%02X\n",\r
-                       OSM_LOG_SYS);\r
-               fprintf(out, "\n");\r
-               fprintf(out, "   OSM_LOG_DEFAULT_LEVEL    0x%02X\n",\r
-                       OSM_LOG_DEFAULT_LEVEL);\r
-       }\r
-}\r
-\r
-static void help_priority(FILE * out, int detail)\r
-{\r
-       fprintf(out, "priority [<sm-priority>]\n");\r
-}\r
-\r
-static void help_resweep(FILE * out, int detail)\r
-{\r
-       fprintf(out, "resweep [heavy|light]\n");\r
-}\r
-\r
-static void help_reroute(FILE * out, int detail)\r
-{\r
-       fprintf(out, "reroute\n");\r
-       if (detail) {\r
-               fprintf(out, "reroute the fabric\n");\r
-       }\r
-}\r
-\r
-static void help_status(FILE * out, int detail)\r
-{\r
-       fprintf(out, "status [loop]\n");\r
-       if (detail) {\r
-               fprintf(out, "   loop -- type \"q<ret>\" to quit\n");\r
-       }\r
-}\r
-\r
-static void help_logflush(FILE * out, int detail)\r
-{\r
-       fprintf(out, "logflush -- flush the opensm.log file\n");\r
-}\r
-\r
-static void help_querylid(FILE * out, int detail)\r
-{\r
-       fprintf(out,\r
-               "querylid lid -- print internal information about the lid specified\n");\r
-}\r
-\r
-static void help_portstatus(FILE * out, int detail)\r
-{\r
-       fprintf(out, "portstatus [ca|switch|router]\n");\r
-       if (detail) {\r
-               fprintf(out, "summarize port status\n");\r
-               fprintf(out,\r
-                       "   [ca|switch|router] -- limit the results to the node type specified\n");\r
-       }\r
-\r
-}\r
-\r
-static void help_switchbalance(FILE * out, int detail)\r
-{\r
-       fprintf(out, "switchbalance [verbose] [guid]\n");\r
-       if (detail) {\r
-               fprintf(out, "output switch balancing information\n");\r
-               fprintf(out,\r
-                       "  [verbose] -- verbose output\n"\r
-                       "  [guid] -- limit results to specified guid\n");\r
-       }\r
-}\r
-\r
-static void help_lidbalance(FILE * out, int detail)\r
-{\r
-       fprintf(out, "lidbalance [switchguid]\n");\r
-       if (detail) {\r
-               fprintf(out, "output lid balanced forwarding information\n");\r
-               fprintf(out,\r
-                       "  [switchguid] -- limit results to specified switch guid\n");\r
-       }\r
-}\r
-\r
-static void help_dump_conf(FILE *out, int detail)\r
-{\r
-       fprintf(out, "dump_conf\n");\r
-       if (detail) {\r
-               fprintf(out, "dump current opensm configuration\n");\r
-       }\r
-}\r
-\r
-static void help_update_desc(FILE *out, int detail)\r
-{\r
-       fprintf(out, "update_desc\n");\r
-       if (detail) {\r
-               fprintf(out, "update node description for all nodes\n");\r
-       }\r
-}\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-static void help_perfmgr(FILE * out, int detail)\r
-{\r
-       fprintf(out,\r
-               "perfmgr [enable|disable|clear_counters|dump_counters|print_counters|sweep_time[seconds]]\n");\r
-       if (detail) {\r
-               fprintf(out,\r
-                       "perfmgr -- print the performance manager state\n");\r
-               fprintf(out,\r
-                       "   [enable|disable] -- change the perfmgr state\n");\r
-               fprintf(out,\r
-                       "   [sweep_time] -- change the perfmgr sweep time (requires [seconds] option)\n");\r
-               fprintf(out,\r
-                       "   [clear_counters] -- clear the counters stored\n");\r
-               fprintf(out,\r
-                       "   [dump_counters [mach]] -- dump the counters (optionally in [mach]ine readable format)\n");\r
-               fprintf(out,\r
-                       "   [print_counters <nodename|nodeguid>] -- print the counters for the specified node\n");\r
-       }\r
-}\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-/* more help routines go here */\r
-\r
-static void help_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-       int i, found = 0;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (!p_cmd)\r
-               help_command(out, 0);\r
-       else {\r
-               for (i = 1; console_cmds[i].name; i++) {\r
-                       if (!strcmp(p_cmd, console_cmds[i].name)) {\r
-                               found = 1;\r
-                               console_cmds[i].help_function(out, 1);\r
-                               break;\r
-                       }\r
-               }\r
-               if (!found) {\r
-                       fprintf(out, "%s : Command not found\n\n", p_cmd);\r
-                       help_command(out, 0);\r
-               }\r
-       }\r
-}\r
-\r
-static void loglevel_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-       int level;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (!p_cmd)\r
-               fprintf(out, "Current log level is 0x%x\n",\r
-                       osm_log_get_level(&p_osm->log));\r
-       else {\r
-               /* Handle x, 0x, and decimal specification of log level */\r
-               if (!strncmp(p_cmd, "x", 1)) {\r
-                       p_cmd++;\r
-                       level = strtoul(p_cmd, NULL, 16);\r
-               } else {\r
-                       if (!strncmp(p_cmd, "0x", 2)) {\r
-                               p_cmd += 2;\r
-                               level = strtoul(p_cmd, NULL, 16);\r
-                       } else\r
-                               level = strtol(p_cmd, NULL, 10);\r
-               }\r
-               if ((level >= 0) && (level < 256)) {\r
-                       fprintf(out, "Setting log level to 0x%x\n", level);\r
-                       osm_log_set_level(&p_osm->log, level);\r
-               } else\r
-                       fprintf(out, "Invalid log level 0x%x\n", level);\r
-       }\r
-}\r
-\r
-static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-       int priority;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (!p_cmd)\r
-               fprintf(out, "Current sm-priority is %d\n",\r
-                       p_osm->subn.opt.sm_priority);\r
-       else {\r
-               priority = strtol(p_cmd, NULL, 0);\r
-               if (0 > priority || 15 < priority)\r
-                       fprintf(out,\r
-                               "Invalid sm-priority %d; must be between 0 and 15\n",\r
-                               priority);\r
-               else {\r
-                       fprintf(out, "Setting sm-priority to %d\n", priority);\r
-                       osm_set_sm_priority(&p_osm->sm, (uint8_t)priority);\r
-               }\r
-       }\r
-}\r
-\r
-static const char *sm_state_str(int state)\r
-{\r
-       switch (state) {\r
-       case IB_SMINFO_STATE_DISCOVERING:\r
-               return "Discovering";\r
-       case IB_SMINFO_STATE_STANDBY:\r
-               return "Standby    ";\r
-       case IB_SMINFO_STATE_NOTACTIVE:\r
-               return "Not Active ";\r
-       case IB_SMINFO_STATE_MASTER:\r
-               return "Master     ";\r
-       }\r
-       return "UNKNOWN    ";\r
-}\r
-\r
-static const char *sa_state_str(osm_sa_state_t state)\r
-{\r
-       switch (state) {\r
-       case OSM_SA_STATE_INIT:\r
-               return "Init";\r
-       case OSM_SA_STATE_READY:\r
-               return "Ready";\r
-       }\r
-       return "UNKNOWN";\r
-}\r
-\r
-static void dump_sms(osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       osm_subn_t *p_subn = &p_osm->subn;\r
-       osm_remote_sm_t *p_rsm;\r
-\r
-       fprintf(out, "\n   Known SMs\n"\r
-                    "   ---------\n");\r
-       fprintf(out, "   Port GUID       SM State    Priority\n");\r
-       fprintf(out, "   ---------       --------    --------\n");\r
-       fprintf(out, "   0x%" PRIx64 " %s %d        SELF\n",\r
-               cl_ntoh64(p_subn->sm_port_guid),\r
-               sm_state_str(p_subn->sm_state),\r
-               p_subn->opt.sm_priority);\r
-\r
-       CL_PLOCK_ACQUIRE(p_osm->sm.p_lock);\r
-       p_rsm = (osm_remote_sm_t *) cl_qmap_head(&p_subn->sm_guid_tbl);\r
-       while (p_rsm != (osm_remote_sm_t *) cl_qmap_end(&p_subn->sm_guid_tbl)) {\r
-               fprintf(out, "   0x%" PRIx64 " %s %d\n",\r
-                       cl_ntoh64(p_rsm->smi.guid),\r
-                       sm_state_str(ib_sminfo_get_state(&p_rsm->smi)),\r
-                       ib_sminfo_get_priority(&p_rsm->smi));\r
-               p_rsm = (osm_remote_sm_t *) cl_qmap_next(&p_rsm->map_item);\r
-       }\r
-       CL_PLOCK_RELEASE(p_osm->sm.p_lock);\r
-}\r
-\r
-static void print_status(osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       cl_list_item_t *item;\r
-\r
-       if (out) {\r
-               cl_plock_acquire(&p_osm->lock);\r
-               fprintf(out, "   OpenSM Version       : %s\n", p_osm->osm_version);\r
-               fprintf(out, "   SM State             : %s\n",\r
-                       sm_state_str(p_osm->subn.sm_state));\r
-               fprintf(out, "   SM Priority          : %d\n",\r
-                       p_osm->subn.opt.sm_priority);\r
-               fprintf(out, "   SA State             : %s\n",\r
-                       sa_state_str(p_osm->sa.state));\r
-               fprintf(out, "   Routing Engine       : %s\n",\r
-                       osm_routing_engine_type_str(p_osm->\r
-                                                   routing_engine_used));\r
-\r
-               fprintf(out, "   Loaded event plugins :");\r
-               if (cl_qlist_head(&p_osm->plugin_list) ==\r
-                       cl_qlist_end(&p_osm->plugin_list)) {\r
-                       fprintf(out, " <none>");\r
-               }\r
-               for (item = cl_qlist_head(&p_osm->plugin_list);\r
-                    item != cl_qlist_end(&p_osm->plugin_list);\r
-                    item = cl_qlist_next(item))\r
-                       fprintf(out, " %s",\r
-                               ((osm_epi_plugin_t *)item)->plugin_name);\r
-               fprintf(out, "\n");\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-               fprintf(out, "\n   PerfMgr state/sweep state : %s/%s\n",\r
-                       osm_perfmgr_get_state_str(&p_osm->perfmgr),\r
-                       osm_perfmgr_get_sweep_state_str(&p_osm->perfmgr));\r
-#endif\r
-               fprintf(out, "\n   MAD stats\n"\r
-                       "   ---------\n"\r
-                       "   QP0 MADs outstanding           : %d\n"\r
-                       "   QP0 MADs outstanding (on wire) : %d\n"\r
-                       "   QP0 MADs rcvd                  : %d\n"\r
-                       "   QP0 MADs sent                  : %d\n"\r
-                       "   QP0 unicasts sent              : %d\n"\r
-                       "   QP0 unknown MADs rcvd          : %d\n"\r
-                       "   SA MADs outstanding            : %d\n"\r
-                       "   SA MADs rcvd                   : %d\n"\r
-                       "   SA MADs sent                   : %d\n"\r
-                       "   SA unknown MADs rcvd           : %d\n"\r
-                       "   SA MADs ignored                : %d\n",\r
-                       p_osm->stats.qp0_mads_outstanding,\r
-                       p_osm->stats.qp0_mads_outstanding_on_wire,\r
-                       p_osm->stats.qp0_mads_rcvd,\r
-                       p_osm->stats.qp0_mads_sent,\r
-                       p_osm->stats.qp0_unicasts_sent,\r
-                       p_osm->stats.qp0_mads_rcvd_unknown,\r
-                       p_osm->stats.sa_mads_outstanding,\r
-                       p_osm->stats.sa_mads_rcvd,\r
-                       p_osm->stats.sa_mads_sent,\r
-                       p_osm->stats.sa_mads_rcvd_unknown,\r
-                       p_osm->stats.sa_mads_ignored);\r
-               fprintf(out, "\n   Subnet flags\n"\r
-                       "   ------------\n"\r
-                       "   Ignore existing lfts           : %d\n"\r
-                       "   Subnet Init errors             : %d\n"\r
-                       "   In sweep hop 0                 : %d\n"\r
-                       "   First time master sweep        : %d\n"\r
-                       "   Coming out of standby          : %d\n",\r
-                       p_osm->subn.ignore_existing_lfts,\r
-                       p_osm->subn.subnet_initialization_error,\r
-                       p_osm->subn.in_sweep_hop_0,\r
-                       p_osm->subn.first_time_master_sweep,\r
-                       p_osm->subn.coming_out_of_standby);\r
-               dump_sms(p_osm, out);\r
-               fprintf(out, "\n");\r
-               cl_plock_release(&p_osm->lock);\r
-       }\r
-}\r
-\r
-static int loop_command_check_time(void)\r
-{\r
-       time_t cur = time(NULL);\r
-       if ((loop_command.previous + loop_command.delay_s) < cur) {\r
-               loop_command.previous = cur;\r
-               return 1;\r
-       }\r
-       return 0;\r
-}\r
-\r
-static void status_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (p_cmd) {\r
-               if (strcmp(p_cmd, "loop") == 0) {\r
-                       fprintf(out, "Looping on status command...\n");\r
-                       fflush(out);\r
-                       loop_command.on = 1;\r
-                       loop_command.previous = time(NULL);\r
-                       loop_command.loop_function = print_status;\r
-               } else {\r
-                       help_status(out, 1);\r
-                       return;\r
-               }\r
-       }\r
-       print_status(p_osm, out);\r
-}\r
-\r
-static void resweep_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (!p_cmd ||\r
-           (strcmp(p_cmd, "heavy") != 0 && strcmp(p_cmd, "light") != 0)) {\r
-               fprintf(out, "Invalid resweep command\n");\r
-               help_resweep(out, 1);\r
-       } else {\r
-               if (strcmp(p_cmd, "heavy") == 0)\r
-                       p_osm->subn.force_heavy_sweep = TRUE;\r
-               osm_opensm_sweep(p_osm);\r
-       }\r
-}\r
-\r
-static void reroute_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       p_osm->subn.force_reroute = TRUE;\r
-       osm_opensm_sweep(p_osm);\r
-}\r
-\r
-static void logflush_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       fflush(p_osm->log.out_port);\r
-}\r
-\r
-static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       unsigned int p = 0;\r
-       uint16_t lid = 0;\r
-       osm_port_t *p_port = NULL;\r
-       char *p_cmd = next_token(p_last);\r
-\r
-       if (!p_cmd) {\r
-               fprintf(out, "no LID specified\n");\r
-               help_querylid(out, 1);\r
-               return;\r
-       }\r
-\r
-       lid = (uint16_t) strtoul(p_cmd, NULL, 0);\r
-       cl_plock_acquire(&p_osm->lock);\r
-       p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);\r
-       if (!p_port)\r
-               goto invalid_lid;\r
-\r
-       fprintf(out, "Query results for LID %u\n", lid);\r
-       fprintf(out,\r
-               "   GUID                : 0x%016" PRIx64 "\n"\r
-               "   Node Desc           : %s\n"\r
-               "   Node Type           : %s\n"\r
-               "   Num Ports           : %d\n",\r
-               cl_ntoh64(p_port->guid),\r
-               p_port->p_node->print_desc,\r
-               ib_get_node_type_str(osm_node_get_type(p_port->p_node)),\r
-               p_port->p_node->node_info.num_ports);\r
-\r
-       if (p_port->p_node->sw)\r
-               p = 0;\r
-       else\r
-               p = 1;\r
-       for ( /* see above */ ; p < p_port->p_node->physp_tbl_size; p++) {\r
-               fprintf(out,\r
-                       "   Port %u health       : %s\n",\r
-                       p,\r
-                       p_port->p_node->physp_table[p].\r
-                       healthy ? "OK" : "ERROR");\r
-       }\r
-\r
-       cl_plock_release(&p_osm->lock);\r
-       return;\r
-\r
-invalid_lid:\r
-       cl_plock_release(&p_osm->lock);\r
-       fprintf(out, "Invalid lid %d\n", lid);\r
-       return;\r
-}\r
-\r
-/**\r
- * Data structures for the portstatus command\r
- */\r
-typedef struct _port_report {\r
-       struct _port_report *next;\r
-       uint64_t node_guid;\r
-       uint8_t port_num;\r
-       char print_desc[IB_NODE_DESCRIPTION_SIZE + 1];\r
-} port_report_t;\r
-\r
-static void\r
-__tag_port_report(port_report_t ** head, uint64_t node_guid,\r
-                 uint8_t port_num, char *print_desc)\r
-{\r
-       port_report_t *rep = malloc(sizeof(*rep));\r
-       if (!rep)\r
-               return;\r
-\r
-       rep->node_guid = node_guid;\r
-       rep->port_num = port_num;\r
-       memcpy(rep->print_desc, print_desc, IB_NODE_DESCRIPTION_SIZE + 1);\r
-       rep->next = NULL;\r
-       if (*head) {\r
-               rep->next = *head;\r
-               *head = rep;\r
-       } else\r
-               *head = rep;\r
-}\r
-\r
-static void __print_port_report(FILE * out, port_report_t * head)\r
-{\r
-       port_report_t *item = head;\r
-       port_report_t *next;\r
-\r
-       while (item != NULL) {\r
-               fprintf(out, "      0x%016" PRIx64 " %d (%s)\n",\r
-                       item->node_guid, item->port_num, item->print_desc);\r
-               next = item->next;\r
-               free(item);\r
-               item = next;\r
-       }\r
-}\r
-\r
-typedef struct {\r
-       uint8_t node_type_lim;  /* limit the results; 0 == ALL */\r
-       uint64_t total_nodes;\r
-       uint64_t total_ports;\r
-       uint64_t ports_down;\r
-       uint64_t ports_active;\r
-       uint64_t ports_disabled;\r
-       port_report_t *disabled_ports;\r
-       uint64_t ports_1X;\r
-       uint64_t ports_4X;\r
-       uint64_t ports_8X;\r
-       uint64_t ports_12X;\r
-       uint64_t ports_unknown_width;\r
-       uint64_t ports_reduced_width;\r
-       port_report_t *reduced_width_ports;\r
-       uint64_t ports_sdr;\r
-       uint64_t ports_ddr;\r
-       uint64_t ports_qdr;\r
-       uint64_t ports_unknown_speed;\r
-       uint64_t ports_reduced_speed;\r
-       port_report_t *reduced_speed_ports;\r
-} fabric_stats_t;\r
-\r
-/**\r
- * iterator function to get portstatus on each node\r
- */\r
-static void __get_stats(cl_map_item_t * const p_map_item, void *context)\r
-{\r
-       fabric_stats_t *fs = (fabric_stats_t *) context;\r
-       osm_node_t *node = (osm_node_t *) p_map_item;\r
-       uint8_t num_ports = osm_node_get_num_physp(node);\r
-       uint8_t port = 0;\r
-\r
-       /* Skip nodes we are not interested in */\r
-       if (fs->node_type_lim != 0\r
-           && fs->node_type_lim != node->node_info.node_type)\r
-               return;\r
-\r
-       fs->total_nodes++;\r
-\r
-       for (port = 1; port < num_ports; port++) {\r
-               osm_physp_t *phys = osm_node_get_physp_ptr(node, port);\r
-               ib_port_info_t *pi = NULL;\r
-               uint8_t active_speed = 0;\r
-               uint8_t enabled_speed = 0;\r
-               uint8_t active_width = 0;\r
-               uint8_t enabled_width = 0;\r
-               uint8_t port_state = 0;\r
-               uint8_t port_phys_state = 0;\r
-\r
-               if (!phys)\r
-                       continue;\r
-\r
-               pi = &(phys->port_info);\r
-               active_speed = ib_port_info_get_link_speed_active(pi);\r
-               enabled_speed = ib_port_info_get_link_speed_enabled(pi);\r
-               active_width = pi->link_width_active;\r
-               enabled_width = pi->link_width_enabled;\r
-               port_state = ib_port_info_get_port_state(pi);\r
-               port_phys_state = ib_port_info_get_port_phys_state(pi);\r
-\r
-               if ((enabled_width ^ active_width) > active_width) {\r
-                       __tag_port_report(&(fs->reduced_width_ports),\r
-                                         cl_ntoh64(node->node_info.node_guid),\r
-                                         port, node->print_desc);\r
-                       fs->ports_reduced_width++;\r
-               }\r
-\r
-               if ((enabled_speed ^ active_speed) > active_speed) {\r
-                       __tag_port_report(&(fs->reduced_speed_ports),\r
-                                         cl_ntoh64(node->node_info.node_guid),\r
-                                         port, node->print_desc);\r
-                       fs->ports_reduced_speed++;\r
-               }\r
-\r
-               switch (active_speed) {\r
-               case IB_LINK_SPEED_ACTIVE_2_5:\r
-                       fs->ports_sdr++;\r
-                       break;\r
-               case IB_LINK_SPEED_ACTIVE_5:\r
-                       fs->ports_ddr++;\r
-                       break;\r
-               case IB_LINK_SPEED_ACTIVE_10:\r
-                       fs->ports_qdr++;\r
-                       break;\r
-               default:\r
-                       fs->ports_unknown_speed++;\r
-                       break;\r
-               }\r
-               switch (active_width) {\r
-               case IB_LINK_WIDTH_ACTIVE_1X:\r
-                       fs->ports_1X++;\r
-                       break;\r
-               case IB_LINK_WIDTH_ACTIVE_4X:\r
-                       fs->ports_4X++;\r
-                       break;\r
-               case IB_LINK_WIDTH_ACTIVE_8X:\r
-                       fs->ports_8X++;\r
-                       break;\r
-               case IB_LINK_WIDTH_ACTIVE_12X:\r
-                       fs->ports_12X++;\r
-                       break;\r
-               default:\r
-                       fs->ports_unknown_width++;\r
-                       break;\r
-               }\r
-               if (port_state == IB_LINK_DOWN)\r
-                       fs->ports_down++;\r
-               else if (port_state == IB_LINK_ACTIVE)\r
-                       fs->ports_active++;\r
-               if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {\r
-                       __tag_port_report(&(fs->disabled_ports),\r
-                                         cl_ntoh64(node->node_info.node_guid),\r
-                                         port, node->print_desc);\r
-                       fs->ports_disabled++;\r
-               }\r
-\r
-               fs->total_ports++;\r
-       }\r
-}\r
-\r
-static void portstatus_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       fabric_stats_t fs;\r
-       struct timeval before, after;\r
-       char *p_cmd;\r
-\r
-       memset(&fs, 0, sizeof(fs));\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (p_cmd) {\r
-               if (strcmp(p_cmd, "ca") == 0) {\r
-                       fs.node_type_lim = IB_NODE_TYPE_CA;\r
-               } else if (strcmp(p_cmd, "switch") == 0) {\r
-                       fs.node_type_lim = IB_NODE_TYPE_SWITCH;\r
-               } else if (strcmp(p_cmd, "router") == 0) {\r
-                       fs.node_type_lim = IB_NODE_TYPE_ROUTER;\r
-               } else {\r
-                       fprintf(out, "Node type not understood\n");\r
-                       help_portstatus(out, 1);\r
-                       return;\r
-               }\r
-       }\r
-\r
-       gettimeofday(&before, NULL);\r
-\r
-       /* for each node in the system gather the stats */\r
-       cl_plock_acquire(&p_osm->lock);\r
-       cl_qmap_apply_func(&(p_osm->subn.node_guid_tbl), __get_stats,\r
-                          (void *)&fs);\r
-       cl_plock_release(&p_osm->lock);\r
-\r
-       gettimeofday(&after, NULL);\r
-\r
-       /* report the stats */\r
-       fprintf(out, "\"%s\" port status:\n",\r
-               fs.node_type_lim ? ib_get_node_type_str(fs.\r
-                                                       node_type_lim) : "ALL");\r
-       fprintf(out,\r
-               "   %" PRIu64 " port(s) scanned on %" PRIu64\r
-               " nodes in %lu us\n", fs.total_ports, fs.total_nodes,\r
-               after.tv_usec - before.tv_usec);\r
-\r
-       if (fs.ports_down)\r
-               fprintf(out, "   %" PRIu64 " down\n", fs.ports_down);\r
-       if (fs.ports_active)\r
-               fprintf(out, "   %" PRIu64 " active\n", fs.ports_active);\r
-       if (fs.ports_1X)\r
-               fprintf(out, "   %" PRIu64 " at 1X\n", fs.ports_1X);\r
-       if (fs.ports_4X)\r
-               fprintf(out, "   %" PRIu64 " at 4X\n", fs.ports_4X);\r
-       if (fs.ports_8X)\r
-               fprintf(out, "   %" PRIu64 " at 8X\n", fs.ports_8X);\r
-       if (fs.ports_12X)\r
-               fprintf(out, "   %" PRIu64 " at 12X\n", fs.ports_12X);\r
-\r
-       if (fs.ports_sdr)\r
-               fprintf(out, "   %" PRIu64 " at 2.5 Gbps\n", fs.ports_sdr);\r
-       if (fs.ports_ddr)\r
-               fprintf(out, "   %" PRIu64 " at 5.0 Gbps\n", fs.ports_ddr);\r
-       if (fs.ports_qdr)\r
-               fprintf(out, "   %" PRIu64 " at 10.0 Gbps\n", fs.ports_qdr);\r
-\r
-       if (fs.ports_disabled + fs.ports_reduced_speed + fs.ports_reduced_width\r
-           > 0) {\r
-               fprintf(out, "\nPossible issues:\n");\r
-       }\r
-       if (fs.ports_disabled) {\r
-               fprintf(out, "   %" PRIu64 " disabled\n", fs.ports_disabled);\r
-               __print_port_report(out, fs.disabled_ports);\r
-       }\r
-       if (fs.ports_reduced_speed) {\r
-               fprintf(out, "   %" PRIu64 " with reduced speed\n",\r
-                       fs.ports_reduced_speed);\r
-               __print_port_report(out, fs.reduced_speed_ports);\r
-       }\r
-       if (fs.ports_reduced_width) {\r
-               fprintf(out, "   %" PRIu64 " with reduced width\n",\r
-                       fs.ports_reduced_width);\r
-               __print_port_report(out, fs.reduced_width_ports);\r
-       }\r
-       fprintf(out, "\n");\r
-}\r
-\r
-static void switchbalance_check(osm_opensm_t * p_osm,\r
-                               osm_switch_t * p_sw, FILE * out, int verbose)\r
-{\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       const cl_qmap_t *p_port_tbl;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_rem_physp;\r
-       osm_node_t *p_rem_node;\r
-       uint32_t count[255];    /* max ports is a uint8_t */\r
-       uint8_t output_ports[255];\r
-       uint8_t output_ports_count = 0;\r
-       uint32_t min_count = 0xFFFFFFFF;\r
-       uint32_t max_count = 0;\r
-       unsigned int i;\r
-\r
-       memset(count, '\0', sizeof(uint32_t) * 255);\r
-\r
-       /* Count port usage */\r
-       p_port_tbl = &p_osm->subn.port_guid_tbl;\r
-       for (p_port = (osm_port_t *) cl_qmap_head(p_port_tbl);\r
-            p_port != (osm_port_t *) cl_qmap_end(p_port_tbl);\r
-            p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {\r
-               uint16_t min_lid_ho;\r
-               uint16_t max_lid_ho;\r
-               uint16_t lid_ho;\r
-\r
-               /* Don't count switches in port usage */\r
-               if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH)\r
-                       continue;\r
-\r
-               osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-               if (min_lid_ho == 0 || max_lid_ho == 0)\r
-                       continue;\r
-\r
-               for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++) {\r
-                       port_num = osm_switch_get_port_by_lid(p_sw, lid_ho);\r
-                       if (port_num == OSM_NO_PATH)\r
-                               continue;\r
-\r
-                       count[port_num]++;\r
-               }\r
-       }\r
-\r
-       num_ports = p_sw->num_ports;\r
-       for (port_num = 1; port_num < num_ports; port_num++) {\r
-               p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-\r
-               /* if port is down/unhealthy, don't consider it in\r
-                * min/max calculations\r
-                */\r
-               if (!p_physp || !osm_physp_is_healthy(p_physp)\r
-                   || !osm_physp_get_remote(p_physp))\r
-                       continue;\r
-\r
-               p_rem_physp = osm_physp_get_remote(p_physp);\r
-               p_rem_node = osm_physp_get_node_ptr(p_rem_physp);\r
-\r
-               /* If we are directly connected to a CA/router, its not really\r
-                * up for balancing consideration.\r
-                */\r
-               if (osm_node_get_type(p_rem_node) != IB_NODE_TYPE_SWITCH)\r
-                       continue;\r
-\r
-               output_ports[output_ports_count] = port_num;\r
-               output_ports_count++;\r
-\r
-               if (count[port_num] < min_count)\r
-                       min_count = count[port_num];\r
-               if (count[port_num] > max_count)\r
-                       max_count = count[port_num];\r
-       }\r
-\r
-       if (verbose || ((max_count - min_count) > 1)) {\r
-               if ((max_count - min_count) > 1)\r
-                       fprintf(out,\r
-                               "Unbalanced Switch: 0x%016" PRIx64 " (%s)\n",\r
-                               cl_ntoh64(p_sw->p_node->node_info.node_guid),\r
-                               p_sw->p_node->print_desc);\r
-               else\r
-                       fprintf(out,\r
-                               "Switch: 0x%016" PRIx64 " (%s)\n",\r
-                               cl_ntoh64(p_sw->p_node->node_info.node_guid),\r
-                               p_sw->p_node->print_desc);\r
-\r
-               for (i = 0; i < output_ports_count; i++) {\r
-                       fprintf(out,\r
-                               "Port %d: %d\n",\r
-                               output_ports[i], count[output_ports[i]]);\r
-               }\r
-       }\r
-}\r
-\r
-static void switchbalance_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-       uint64_t guid = 0;\r
-       osm_switch_t *p_sw;\r
-       int verbose = 0;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (p_cmd) {\r
-               char *p_end;\r
-\r
-               if (strcmp(p_cmd, "verbose") == 0) {\r
-                       verbose++;\r
-                       p_cmd = next_token(p_last);\r
-               }\r
-\r
-               if (p_cmd) {\r
-                       guid = strtoull(p_cmd, &p_end, 0);\r
-                       if (!guid || *p_end != '\0') {\r
-                               fprintf(out, "Invalid guid specified\n");\r
-                               help_switchbalance(out, 1);\r
-                               return;\r
-                       }\r
-               }\r
-       }\r
-\r
-       cl_plock_acquire(&p_osm->lock);\r
-       if (guid) {\r
-               p_sw = osm_get_switch_by_guid(&p_osm->subn, cl_hton64(guid));\r
-               if (!p_sw) {\r
-                       fprintf(out, "guid not found\n");\r
-                       goto lock_exit;\r
-               }\r
-\r
-               switchbalance_check(p_osm, p_sw, out, verbose);\r
-       } else {\r
-               cl_qmap_t *p_sw_guid_tbl = &p_osm->subn.sw_guid_tbl;\r
-               for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_guid_tbl);\r
-                    p_sw != (osm_switch_t *) cl_qmap_end(p_sw_guid_tbl);\r
-                    p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item))\r
-                       switchbalance_check(p_osm, p_sw, out, verbose);\r
-       }\r
-lock_exit:\r
-       cl_plock_release(&p_osm->lock);\r
-       return;\r
-}\r
-\r
-static void lidbalance_check(osm_opensm_t * p_osm,\r
-                            osm_switch_t * p_sw, FILE * out)\r
-{\r
-       uint8_t port_num;\r
-       const cl_qmap_t *p_port_tbl;\r
-       osm_port_t *p_port;\r
-\r
-       p_port_tbl = &p_osm->subn.port_guid_tbl;\r
-       for (p_port = (osm_port_t *) cl_qmap_head(p_port_tbl);\r
-            p_port != (osm_port_t *) cl_qmap_end(p_port_tbl);\r
-            p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {\r
-               uint32_t port_count[255];       /* max ports is a uint8_t */\r
-               osm_node_t *rem_node[255];\r
-               uint32_t rem_node_count;\r
-               uint32_t rem_count[255];\r
-               osm_physp_t *p_physp;\r
-               osm_physp_t *p_rem_physp;\r
-               osm_node_t *p_rem_node;\r
-               uint32_t port_min_count = 0xFFFFFFFF;\r
-               uint32_t port_max_count = 0;\r
-               uint32_t rem_min_count = 0xFFFFFFFF;\r
-               uint32_t rem_max_count = 0;\r
-               uint16_t min_lid_ho;\r
-               uint16_t max_lid_ho;\r
-               uint16_t lid_ho;\r
-               uint8_t num_ports;\r
-               unsigned int i;\r
-\r
-               /* we only care about non-switches */\r
-               if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH)\r
-                       continue;\r
-\r
-               osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-               if (min_lid_ho == 0 || max_lid_ho == 0)\r
-                       continue;\r
-\r
-               memset(port_count, '\0', sizeof(uint32_t) * 255);\r
-               memset(rem_node, '\0', sizeof(osm_node_t *) * 255);\r
-               rem_node_count = 0;\r
-               memset(rem_count, '\0', sizeof(uint32_t) * 255);\r
-\r
-               for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++) {\r
-                       boolean_t rem_node_found = FALSE;\r
-                       unsigned int indx = 0;\r
-\r
-                       port_num = osm_switch_get_port_by_lid(p_sw, lid_ho);\r
-                       if (port_num == OSM_NO_PATH)\r
-                               continue;\r
-\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-\r
-                       /* if port is down/unhealthy, can't calculate */\r
-                       if (!p_physp || !osm_physp_is_healthy(p_physp)\r
-                           || !osm_physp_get_remote(p_physp))\r
-                               continue;\r
-\r
-                       p_rem_physp = osm_physp_get_remote(p_physp);\r
-                       p_rem_node = osm_physp_get_node_ptr(p_rem_physp);\r
-\r
-                       /* determine if we've seen this remote node before.\r
-                        * If not, store it.  If yes, update the counter\r
-                        */\r
-                       for (i = 0; i < rem_node_count; i++) {\r
-                               if (rem_node[i] == p_rem_node) {\r
-                                       rem_node_found = TRUE;\r
-                                       indx = i;\r
-                                       break;\r
-                               }\r
-                       }\r
-\r
-                       if (!rem_node_found) {\r
-                               rem_node[rem_node_count] = p_rem_node;\r
-                               rem_count[rem_node_count]++;\r
-                               indx = rem_node_count;\r
-                               rem_node_count++;\r
-                       } else\r
-                               rem_count[indx]++;\r
-\r
-                       port_count[port_num]++;\r
-               }\r
-\r
-               if (!rem_node_count)\r
-                       continue;\r
-\r
-               for (i = 0; i < rem_node_count; i++) {\r
-                       if (rem_count[i] < rem_min_count)\r
-                               rem_min_count = rem_count[i];\r
-                       if (rem_count[i] > rem_max_count)\r
-                               rem_max_count = rem_count[i];\r
-               }\r
-\r
-               num_ports = p_sw->num_ports;\r
-               for (i = 0; i < num_ports; i++) {\r
-                       if (!port_count[i])\r
-                               continue;\r
-                       if (port_count[i] < port_min_count)\r
-                               port_min_count = port_count[i];\r
-                       if (port_count[i] > port_max_count)\r
-                               port_max_count = port_count[i];\r
-               }\r
-\r
-               /* Output if this CA/router is being forwarded an unbalanced number of\r
-                * times to a destination.\r
-                */\r
-               if ((rem_max_count - rem_min_count) > 1) {\r
-                       fprintf(out,\r
-                               "Unbalanced Remote Forwarding: Switch 0x%016"\r
-                               PRIx64 " (%s): ",\r
-                               cl_ntoh64(p_sw->p_node->node_info.node_guid),\r
-                               p_sw->p_node->print_desc);\r
-                       if (osm_node_get_type(p_port->p_node) ==\r
-                           IB_NODE_TYPE_CA)\r
-                               fprintf(out, "CA");\r
-                       else if (osm_node_get_type(p_port->p_node) ==\r
-                                IB_NODE_TYPE_ROUTER)\r
-                               fprintf(out, "Router");\r
-                       fprintf(out, " 0x%016" PRIx64 " (%s): ",\r
-                               cl_ntoh64(p_port->p_node->node_info.node_guid),\r
-                               p_port->p_node->print_desc);\r
-                       for (i = 0; i < rem_node_count; i++) {\r
-                               fprintf(out,\r
-                                       "Dest 0x%016" PRIx64 "(%s) - %u ",\r
-                                       cl_ntoh64(rem_node[i]->node_info.\r
-                                                 node_guid),\r
-                                       rem_node[i]->print_desc, rem_count[i]);\r
-                       }\r
-                       fprintf(out, "\n");\r
-               }\r
-\r
-               /* Output if this CA/router is being forwarded through a port\r
-                * an unbalanced number of times.\r
-                */\r
-               if ((port_max_count - port_min_count) > 1) {\r
-                       fprintf(out,\r
-                               "Unbalanced Port Forwarding: Switch 0x%016"\r
-                               PRIx64 " (%s): ",\r
-                               cl_ntoh64(p_sw->p_node->node_info.node_guid),\r
-                               p_sw->p_node->print_desc);\r
-                       if (osm_node_get_type(p_port->p_node) ==\r
-                           IB_NODE_TYPE_CA)\r
-                               fprintf(out, "CA");\r
-                       else if (osm_node_get_type(p_port->p_node) ==\r
-                                IB_NODE_TYPE_ROUTER)\r
-                               fprintf(out, "Router");\r
-                       fprintf(out, " 0x%016" PRIx64 " (%s): ",\r
-                               cl_ntoh64(p_port->p_node->node_info.node_guid),\r
-                               p_port->p_node->print_desc);\r
-                       for (i = 0; i < num_ports; i++) {\r
-                               if (!port_count[i])\r
-                                       continue;\r
-                               fprintf(out, "Port %u - %u: ", i,\r
-                                       port_count[i]);\r
-                       }\r
-                       fprintf(out, "\n");\r
-               }\r
-       }\r
-}\r
-\r
-static void lidbalance_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-       uint64_t guid = 0;\r
-       osm_switch_t *p_sw;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (p_cmd) {\r
-               char *p_end;\r
-\r
-               guid = strtoull(p_cmd, &p_end, 0);\r
-               if (!guid || *p_end != '\0') {\r
-                       fprintf(out, "Invalid switchguid specified\n");\r
-                       help_lidbalance(out, 1);\r
-                       return;\r
-               }\r
-       }\r
-\r
-       cl_plock_acquire(&p_osm->lock);\r
-       if (guid) {\r
-               p_sw = osm_get_switch_by_guid(&p_osm->subn, cl_hton64(guid));\r
-               if (!p_sw) {\r
-                       fprintf(out, "switchguid not found\n");\r
-                       goto lock_exit;\r
-               }\r
-               lidbalance_check(p_osm, p_sw, out);\r
-       } else {\r
-               cl_qmap_t *p_sw_guid_tbl = &p_osm->subn.sw_guid_tbl;\r
-               for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_guid_tbl);\r
-                    p_sw != (osm_switch_t *) cl_qmap_end(p_sw_guid_tbl);\r
-                    p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item))\r
-                       lidbalance_check(p_osm, p_sw, out);\r
-       }\r
-\r
-lock_exit:\r
-       cl_plock_release(&p_osm->lock);\r
-       return;\r
-}\r
-\r
-static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       osm_subn_output_conf(out, &p_osm->subn.opt);\r
-}\r
-\r
-static void update_desc_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       osm_update_node_desc(p_osm);\r
-}\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       char *p_cmd;\r
-\r
-       p_cmd = next_token(p_last);\r
-       if (p_cmd) {\r
-               if (strcmp(p_cmd, "enable") == 0) {\r
-                       osm_perfmgr_set_state(&p_osm->perfmgr,\r
-                                             PERFMGR_STATE_ENABLED);\r
-               } else if (strcmp(p_cmd, "disable") == 0) {\r
-                       osm_perfmgr_set_state(&p_osm->perfmgr,\r
-                                             PERFMGR_STATE_DISABLE);\r
-               } else if (strcmp(p_cmd, "clear_counters") == 0) {\r
-                       osm_perfmgr_clear_counters(&p_osm->perfmgr);\r
-               } else if (strcmp(p_cmd, "dump_counters") == 0) {\r
-                       p_cmd = next_token(p_last);\r
-                       if (p_cmd && (strcmp(p_cmd, "mach") == 0)) {\r
-                               osm_perfmgr_dump_counters(&p_osm->perfmgr,\r
-                                                         PERFMGR_EVENT_DB_DUMP_MR);\r
-                       } else {\r
-                               osm_perfmgr_dump_counters(&p_osm->perfmgr,\r
-                                                         PERFMGR_EVENT_DB_DUMP_HR);\r
-                       }\r
-               } else if (strcmp(p_cmd, "print_counters") == 0) {\r
-                       p_cmd = name_token(p_last);\r
-                       if (p_cmd) {\r
-                               osm_perfmgr_print_counters(&p_osm->perfmgr,\r
-                                                          p_cmd, out);\r
-                       } else {\r
-                               fprintf(out,\r
-                                       "print_counters requires a node name or node GUID to be specified\n");\r
-                       }\r
-               } else if (strcmp(p_cmd, "sweep_time") == 0) {\r
-                       p_cmd = next_token(p_last);\r
-                       if (p_cmd) {\r
-                               uint16_t time_s = atoi(p_cmd);\r
-                               osm_perfmgr_set_sweep_time_s(&p_osm->perfmgr,\r
-                                                            time_s);\r
-                       } else {\r
-                               fprintf(out,\r
-                                       "sweep_time requires a time period (in seconds) to be specified\n");\r
-                       }\r
-               } else {\r
-                       fprintf(out, "\"%s\" option not found\n", p_cmd);\r
-               }\r
-       } else {\r
-               fprintf(out, "Performance Manager status:\n"\r
-                       "state                   : %s\n"\r
-                       "sweep state             : %s\n"\r
-                       "sweep time              : %us\n"\r
-                       "outstanding queries/max : %d/%u\n",\r
-                       osm_perfmgr_get_state_str(&p_osm->perfmgr),\r
-                       osm_perfmgr_get_sweep_state_str(&p_osm->perfmgr),\r
-                       osm_perfmgr_get_sweep_time_s(&p_osm->perfmgr),\r
-                       p_osm->perfmgr.outstanding_queries,\r
-                       p_osm->perfmgr.max_outstanding_queries);\r
-       }\r
-}\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-#ifndef __WIN__\r
-static void quit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       cio_close(&p_osm->console, &p_osm->log);\r
-}\r
-#endif\r
-\r
-static void help_version(FILE * out, int detail)\r
-{\r
-       fprintf(out, "version -- print the OSM version\n");\r
-}\r
-\r
-static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       fprintf(out, "%s build %s %s\n", p_osm->osm_version, __DATE__, __TIME__);\r
-}\r
-\r
-/* more parse routines go here */\r
-#ifdef __WIN__\r
-\r
-static void exit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       syslog(LOG_INFO, "graceful OpenSM shutdown.\n");\r
-       osm_exit_flag = 1;\r
-}\r
-\r
-static void help_exit(FILE * out, int detail)\r
-{\r
-       fprintf(out, "exit - graceful OpenSM shutdown.\n");\r
-}\r
-\r
-#else  /* def __WIN__ */\r
-\r
-typedef struct _regexp_list {\r
-       regex_t exp;\r
-       struct _regexp_list *next;\r
-} regexp_list_t;\r
-\r
-static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
-{\r
-       cl_qmap_t *p_port_guid_tbl;\r
-       osm_port_t *p_port, *p_next_port;\r
-       regexp_list_t *p_regexp, *p_head_regexp = NULL;\r
-       FILE *output = out;\r
-\r
-       while (1) {\r
-               char *p_cmd = next_token(p_last);\r
-               if (!p_cmd)\r
-                       break;\r
-\r
-               if (strcmp(p_cmd, "file") == 0) {\r
-                       p_cmd = next_token(p_last);\r
-                       if (p_cmd) {\r
-                               output = fopen(p_cmd, "w+");\r
-                               if (output == NULL) {\r
-                                       fprintf(out,\r
-                                               "Could not open file %s: %s\n",\r
-                                               p_cmd, strerror(errno));\r
-                                       output = out;\r
-                               }\r
-                       } else\r
-                               fprintf(out, "No file name passed\n");\r
-               } else if (!(p_regexp = malloc(sizeof(*p_regexp)))) {\r
-                       fprintf(out, "No memory\n");\r
-                       break;\r
-               } else if (regcomp(&p_regexp->exp, p_cmd,\r
-                                  REG_NOSUB | REG_EXTENDED) != 0) {\r
-                       fprintf(out, "Cannot parse regular expression \'%s\'."\r
-                               " Skipping\n", p_cmd);\r
-                       free(p_regexp);\r
-                       continue;\r
-               } else {\r
-                       p_regexp->next = p_head_regexp;\r
-                       p_head_regexp = p_regexp;\r
-               }\r
-       }\r
-\r
-       /* Check we have at least one expression to match */\r
-       if (p_head_regexp == NULL) {\r
-               fprintf(out, "No valid expression provided. Aborting\n");\r
-               return;\r
-       }\r
-\r
-       if (p_osm->sm.p_subn->need_update != 0) {\r
-               fprintf(out, "Subnet is not ready yet. Try again later\n");\r
-               return;\r
-       }\r
-\r
-       /* Subnet doesn't need to be updated so we can carry on */\r
-\r
-       CL_PLOCK_ACQUIRE(p_osm->sm.p_lock);\r
-       p_port_guid_tbl = &(p_osm->sm.p_subn->port_guid_tbl);\r
-\r
-       p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);\r
-       while (p_next_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl)) {\r
-\r
-               p_port = p_next_port;\r
-               p_next_port =\r
-                   (osm_port_t *) cl_qmap_next(&p_next_port->map_item);\r
-\r
-               for (p_regexp = p_head_regexp; p_regexp != NULL;\r
-                    p_regexp = p_regexp->next)\r
-                       if (regexec(&p_regexp->exp, p_port->p_node->print_desc,\r
-                                   0, NULL, 0) == 0) {\r
-                               fprintf(output, "0x%" PRIxLEAST64 "\n",\r
-                                       cl_ntoh64(p_port->p_physp->port_guid));\r
-                               break;\r
-                       }\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(p_osm->sm.p_lock);\r
-       if (output != out)\r
-               fclose(output);\r
-\r
-       for (; p_head_regexp; p_head_regexp = p_regexp) {\r
-               p_regexp = p_head_regexp->next;\r
-               regfree(&p_head_regexp->exp);\r
-               free(p_head_regexp);\r
-       }\r
-}\r
-\r
-static void help_dump_portguid(FILE * out, int detail)\r
-{\r
-       fprintf(out,\r
-               "dump_portguid [file filename] regexp1 [regexp2 [regexp3 ...]] -- Dump port GUID matching a regexp \n");\r
-       if (detail) {\r
-               fprintf(out,\r
-                       "getguidgetguid  -- Dump all the port GUID whom node_desc matches one of the provided regexp\n");\r
-               fprintf(out,\r
-                       "   [file filename] -- Send the port GUID list to the specified file instead of regular output\n");\r
-       }\r
-\r
-}\r
-#endif /* def __WIN__ */\r
-\r
-#ifndef __WIN__\r
-static\r
-#endif\r
-const struct command console_cmds[] = {\r
-       {"help", &help_command, &help_parse},\r
-#ifdef __WIN__\r
-       {"exit", &help_exit, &exit_parse},\r
-#else\r
-       {"quit", &help_quit, &quit_parse},\r
-#endif\r
-       {"loglevel", &help_loglevel, &loglevel_parse},\r
-       {"priority", &help_priority, &priority_parse},\r
-       {"resweep", &help_resweep, &resweep_parse},\r
-       {"reroute", &help_reroute, &reroute_parse},\r
-       {"status", &help_status, &status_parse},\r
-       {"logflush", &help_logflush, &logflush_parse},\r
-       {"querylid", &help_querylid, &querylid_parse},\r
-       {"portstatus", &help_portstatus, &portstatus_parse},\r
-       {"switchbalance", &help_switchbalance, &switchbalance_parse},\r
-       {"lidbalance", &help_lidbalance, &lidbalance_parse},\r
-       {"dump_conf", &help_dump_conf, &dump_conf_parse},\r
-       {"update_desc", &help_update_desc, &update_desc_parse},\r
-       {"version", &help_version, &version_parse},\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       {"perfmgr", &help_perfmgr, &perfmgr_parse},\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-#ifndef __WIN__\r
-       {"dump_portguid", &help_dump_portguid, &dump_portguid_parse},\r
-#endif\r
-       {NULL, NULL, NULL}      /* end of array */\r
-};\r
-\r
-static void parse_cmd_line(char *line, osm_opensm_t * p_osm)\r
-{\r
-       char *p_cmd, *p_last;\r
-       int i, found = 0;\r
-       FILE *out = p_osm->console.out;\r
-\r
-       while (isspace(*line))\r
-               line++;\r
-       if (!*line)\r
-               return;\r
-\r
-       /* find first token which is the command */\r
-       p_cmd = strtok_r(line, " \t\n\r", &p_last);\r
-       if (p_cmd) {\r
-               for (i = 0; console_cmds[i].name; i++) {\r
-                       if (loop_command.on) {\r
-                               if (!strcmp(p_cmd, "q")) {\r
-                                       loop_command.on = 0;\r
-                               }\r
-                               found = 1;\r
-                               break;\r
-                       }\r
-                       if (!strcmp(p_cmd, console_cmds[i].name)) {\r
-                               found = 1;\r
-                               console_cmds[i].parse_function(&p_last, p_osm,\r
-                                                              out);\r
-                               break;\r
-                       }\r
-               }\r
-               if (!found) {\r
-                       fprintf(out, "%s : Command not found\n\n", p_cmd);\r
-                       help_command(out, 0);\r
-               }\r
-       } else {\r
-               fprintf(out, "Error parsing command line: `%s'\n", line);\r
-       }\r
-       if (loop_command.on) {\r
-               fprintf(out, "use \"q<ret>\" to quit loop\n");\r
-               fflush(out);\r
-       }\r
-}\r
-\r
-#ifdef __WIN__\r
-\r
-int osm_console(osm_opensm_t * p_osm)\r
-{\r
-       osm_console_t *p_oct = &p_osm->console;\r
-       char p_line[120];\r
-       char *n;\r
-\r
-       if (loop_command.on && loop_command_check_time() &&\r
-           loop_command.loop_function) {\r
-               if (p_oct->out) {\r
-                       loop_command.loop_function(p_osm, p_oct->out);\r
-                       fflush(p_oct->out);\r
-               } else {\r
-                       loop_command.on = 0;\r
-               }\r
-       }\r
-\r
-       /* Get input line */\r
-       n = fgets(p_line, 120, p_oct->in);\r
-       if (n != NULL) {\r
-               /* Parse and act on input */\r
-               parse_cmd_line(p_line, p_osm);\r
-               if (!loop_command.on) {\r
-                       osm_console_prompt(p_oct->out);\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-#else /* !__WIN__ */\r
-\r
-int osm_console(osm_opensm_t * p_osm)\r
-{\r
-       struct pollfd pollfd[2];\r
-       char *p_line;\r
-       size_t len;\r
-       ssize_t n;\r
-       struct pollfd *fds;\r
-       nfds_t nfds;\r
-       osm_console_t *p_oct = &p_osm->console;\r
-\r
-       pollfd[0].fd = p_oct->socket;\r
-       pollfd[0].events = POLLIN;\r
-       pollfd[0].revents = 0;\r
-\r
-       pollfd[1].fd = p_oct->in_fd;\r
-       pollfd[1].events = POLLIN;\r
-       pollfd[1].revents = 0;\r
-\r
-       fds = p_oct->socket < 0 ? &pollfd[1] : pollfd;\r
-       nfds = p_oct->socket < 0 || pollfd[1].fd < 0 ? 1 : 2;\r
-\r
-       if (loop_command.on && loop_command_check_time() &&\r
-           loop_command.loop_function) {\r
-               if (p_oct->out) {\r
-                       loop_command.loop_function(p_osm, p_oct->out);\r
-                       fflush(p_oct->out);\r
-               } else {\r
-                       loop_command.on = 0;\r
-               }\r
-       }\r
-\r
-       if (poll(fds, nfds, 1000) <= 0)\r
-               return 0;\r
-\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-       if (pollfd[0].revents & POLLIN) {\r
-               int new_fd = 0;\r
-               struct sockaddr_in sin;\r
-               socklen_t len = sizeof(sin);\r
-               struct hostent *hent;\r
-               if ((new_fd = accept(p_oct->socket, &sin, &len)) < 0) {\r
-                       OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR 4B04: Failed to accept console socket: %s\n",\r
-                               strerror(errno));\r
-                       p_oct->in_fd = -1;\r
-                       return 0;\r
-               }\r
-               if (inet_ntop\r
-                   (AF_INET, &sin.sin_addr, p_oct->client_ip,\r
-                    sizeof(p_oct->client_ip)) == NULL) {\r
-                       snprintf(p_oct->client_ip, sizeof(p_oct->client_ip),\r
-                                "STRING_UNKNOWN");\r
-               }\r
-               if ((hent = gethostbyaddr((const char *)&sin.sin_addr,\r
-                                         sizeof(struct in_addr),\r
-                                         AF_INET)) == NULL) {\r
-                       snprintf(p_oct->client_hn, sizeof(p_oct->client_hn),\r
-                                "STRING_UNKNOWN");\r
-               } else {\r
-                       snprintf(p_oct->client_hn, sizeof(p_oct->client_hn),\r
-                                "%s", hent->h_name);\r
-               }\r
-               if (is_authorized(p_oct)) {\r
-                       cio_open(p_oct, new_fd, &p_osm->log);\r
-               } else {\r
-                       OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR 4B05: Console connection denied: %s (%s)\n",\r
-                               p_oct->client_hn, p_oct->client_ip);\r
-                       close(new_fd);\r
-               }\r
-               return 0;\r
-       }\r
-#endif\r
-\r
-       if (pollfd[1].revents & POLLIN) {\r
-               p_line = NULL;\r
-               /* Get input line */\r
-               n = getline(&p_line, &len, p_oct->in);\r
-               if (n > 0) {\r
-                       /* Parse and act on input */\r
-                       parse_cmd_line(p_line, p_osm);\r
-                       if (!loop_command.on) {\r
-                               osm_console_prompt(p_oct->out);\r
-                       }\r
-               } else\r
-                       cio_close(p_oct, &p_osm->log);\r
-               if (p_line)\r
-                       free(p_line);\r
-               return 0;\r
-       }\r
-       /* input fd is closed (hanged up) */\r
-       if (pollfd[1].revents & POLLHUP) {\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-               /* If we are using a socket, we close the current connection */\r
-               if (p_oct->socket >= 0) {\r
-                       cio_close(p_oct, &p_osm->log);\r
-                       return 0;\r
-               }\r
-#endif\r
-               /* If we use a local console, stdin is closed (most probable is pipe ended)\r
-                * so we close the local console */\r
-               return -1;\r
-       }\r
-\r
-       return 0;\r
-}\r
-#endif /* __WIN__ */\r
diff --git a/branches/opensm_3/user/opensm/osm_console_io.c b/branches/opensm_3/user/opensm/osm_console_io.c
deleted file mode 100644 (file)
index afb2636..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*\r
- * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Provide a framework for the Console which decouples the connection\r
- *    or I/O from the functionality, or commands.\r
- *\r
- *    Extensible - allows a variety of connection methods independent of\r
- *    the console commands.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#define _GNU_SOURCE            /* for getline */\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-#include <tcpd.h>\r
-#include <arpa/inet.h>\r
-#include <netinet/in.h>\r
-#include <sys/socket.h>\r
-#endif\r
-#include <unistd.h>\r
-#include <errno.h>\r
-#include <signal.h>\r
-#include <opensm/osm_console_io.h>\r
-\r
-static int is_local(char *str)\r
-{\r
-       /* convenience - checks if just stdin/stdout */\r
-       if (str)\r
-               return (strcmp(str, OSM_LOCAL_CONSOLE) == 0);\r
-       return 0;\r
-}\r
-\r
-static int is_loopback(char *str)\r
-{\r
-       /* convenience - checks if socket based connection */\r
-       if (str)\r
-               return (strcmp(str, OSM_LOOPBACK_CONSOLE) == 0);\r
-       return 0;\r
-}\r
-\r
-static int is_remote(char *str)\r
-{\r
-       /* convenience - checks if socket based connection */\r
-       if (str)\r
-               return strcmp(str, OSM_REMOTE_CONSOLE) == 0 || is_loopback(str);\r
-       return 0;\r
-}\r
-\r
-int is_console_enabled(osm_subn_opt_t * p_opt)\r
-{\r
-       /* checks for a variety of types of consoles - default is off or 0 */\r
-       if (p_opt)\r
-               return is_local(p_opt->console) || is_loopback(p_opt->console)\r
-                       || is_remote(p_opt->console);\r
-       return 0;\r
-}\r
-\r
-\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-int cio_close(osm_console_t * p_oct, osm_log_t * p_log)\r
-{\r
-       int rtnval = -1;\r
-       if (p_oct && p_oct->in_fd > 0) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "Console connection closed: %s (%s)\n",\r
-                       p_oct->client_hn, p_oct->client_ip);\r
-               rtnval = close(p_oct->in_fd);\r
-               p_oct->in_fd = -1;\r
-               p_oct->out_fd = -1;\r
-               p_oct->in = NULL;\r
-               p_oct->out = NULL;\r
-       }\r
-       return rtnval;\r
-}\r
-\r
-int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log)\r
-{\r
-       /* returns zero if opened fine, -1 otherwise */\r
-       char *p_line;\r
-       size_t len;\r
-       ssize_t n;\r
-\r
-       if (p_oct->in_fd >= 0) {\r
-               FILE *file = fdopen(new_fd, "w+");\r
-\r
-               fprintf(file, "OpenSM Console connection already in use\n"\r
-                       "   kill other session (y/n)? ");\r
-               fflush(file);\r
-               p_line = NULL;\r
-               n = getline(&p_line, &len, file);\r
-               if (n > 0 && (p_line[0] == 'y' || p_line[0] == 'Y'))\r
-                       cio_close(p_oct, p_log);\r
-               else {\r
-                       OSM_LOG(p_log, OSM_LOG_INFO,\r
-                               "Console connection aborted: %s (%s)\n",\r
-                               p_oct->client_hn, p_oct->client_ip);\r
-                       close(new_fd);\r
-                       return -1;\r
-               }\r
-       }\r
-       p_oct->in_fd = new_fd;\r
-       p_oct->out_fd = p_oct->in_fd;\r
-       p_oct->in = fdopen(p_oct->in_fd, "w+");\r
-       p_oct->out = p_oct->in;\r
-       osm_console_prompt(p_oct->out);\r
-       OSM_LOG(p_log, OSM_LOG_INFO, "Console connection accepted: %s (%s)\n",\r
-               p_oct->client_hn, p_oct->client_ip);\r
-\r
-       return (p_oct->in == NULL) ? -1 : 0;\r
-}\r
-\r
-/**********************************************************************\r
- * Do authentication & authorization check\r
- **********************************************************************/\r
-int is_authorized(osm_console_t * p_oct)\r
-{\r
-       /* allowed to use the console? */\r
-       p_oct->authorized = !is_remote(p_oct->client_type) ||\r
-           hosts_ctl(OSM_DAEMON_NAME, p_oct->client_hn, p_oct->client_ip,\r
-                     "STRING_UNKNOWN");\r
-       return p_oct->authorized;\r
-}\r
-#endif\r
-\r
-void osm_console_prompt(FILE * out)\r
-{\r
-       if (out) {\r
-               fprintf(out, "OpenSM %s", OSM_COMMAND_PROMPT);\r
-               fflush(out);\r
-       }\r
-}\r
-\r
-int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_log)\r
-{\r
-       p_oct->socket = -1;\r
-       strncpy(p_oct->client_type, opt->console, sizeof(p_oct->client_type));\r
-\r
-       /* set up the file descriptors for the console */\r
-       if (strcmp(opt->console, OSM_LOCAL_CONSOLE) == 0) {\r
-               p_oct->in = stdin;\r
-               p_oct->out = stdout;\r
-               p_oct->in_fd = fileno(stdin);\r
-               p_oct->out_fd = fileno(stdout);\r
-\r
-               osm_console_prompt(p_oct->out);\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-       } else if (strcmp(opt->console, OSM_REMOTE_CONSOLE) == 0\r
-                  || strcmp(opt->console, OSM_LOOPBACK_CONSOLE) == 0) {\r
-               struct sockaddr_in sin;\r
-               int optval = 1;\r
-\r
-               if ((p_oct->socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                               "ERR 4B01: Failed to open console socket: %s\n",\r
-                               strerror(errno));\r
-                       return -1;\r
-               }\r
-               setsockopt(p_oct->socket, SOL_SOCKET, SO_REUSEADDR,\r
-                          &optval, sizeof(optval));\r
-               sin.sin_family = AF_INET;\r
-               sin.sin_port = htons(opt->console_port);\r
-               if (strcmp(opt->console, OSM_REMOTE_CONSOLE) == 0)\r
-                       sin.sin_addr.s_addr = htonl(INADDR_ANY);\r
-               else\r
-                       sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\r
-               if (bind(p_oct->socket, &sin, sizeof(sin)) < 0) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                               "ERR 4B02: Failed to bind console socket: %s\n",\r
-                               strerror(errno));\r
-                       return -1;\r
-               }\r
-               if (listen(p_oct->socket, 1) < 0) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                               "ERR 4B03: Failed to listen on socket: %s\n",\r
-                               strerror(errno));\r
-                       return -1;\r
-               }\r
-\r
-               signal(SIGPIPE, SIG_IGN);       /* protect ourselves from closed pipes */\r
-               p_oct->in = NULL;\r
-               p_oct->out = NULL;\r
-               p_oct->in_fd = -1;\r
-               p_oct->out_fd = -1;\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "Console listening on port %d\n", opt->console_port);\r
-#endif\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/* clean up and release resources */\r
-void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log)\r
-{\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-       cio_close(p_oct, p_log);\r
-       if (p_oct->socket > 0) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO, "Closing console socket\n");\r
-               close(p_oct->socket);\r
-               p_oct->socket = -1;\r
-       }\r
-#endif\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_db_files.c b/branches/opensm_3/user/opensm/osm_db_files.c
deleted file mode 100644 (file)
index 5b4dedd..0000000
+++ /dev/null
@@ -1,691 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- * Implementation of the osm_db interface using simple text files\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <sys/stat.h>\r
-#include <sys/types.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <opensm/st.h>\r
-#include <opensm/osm_db.h>\r
-\r
-/****d* Database/OSM_DB_MAX_LINE_LEN\r
- * NAME\r
- * OSM_DB_MAX_LINE_LEN\r
- *\r
- * DESCRIPTION\r
- * The Maximal line length allowed for the file\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DB_MAX_LINE_LEN 1024\r
-/**********/\r
-\r
-/****d* Database/OSM_DB_MAX_GUID_LEN\r
- * NAME\r
- * OSM_DB_MAX_GUID_LEN\r
- *\r
- * DESCRIPTION\r
- * The Maximal word length allowed for the file (guid or lid)\r
- *\r
- * SYNOPSIS\r
- */\r
-#define OSM_DB_MAX_GUID_LEN 32\r
-/**********/\r
-\r
-/****s* OpenSM: Database/osm_db_domain_imp\r
- * NAME\r
- * osm_db_domain_imp\r
- *\r
- * DESCRIPTION\r
- * An implementation for domain of the database based on text files and\r
- *  hash tables.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct osm_db_domain_imp {\r
-       char *file_name;\r
-       st_table *p_hash;\r
-       cl_spinlock_t lock;\r
-} osm_db_domain_imp_t;\r
-/*\r
- * FIELDS\r
- *\r
- * SEE ALSO\r
- * osm_db_domain_t\r
- *********/\r
-\r
-/****s* OpenSM: Database/osm_db_imp_t\r
- * NAME\r
- * osm_db_imp_t\r
- *\r
- * DESCRIPTION\r
- * An implementation for file based database\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct osm_db_imp {\r
-       char *db_dir_name;\r
-} osm_db_imp_t;\r
-/*\r
- * FIELDS\r
- *\r
- * db_dir_name\r
- *   The directory holding the database\r
- *\r
- * SEE ALSO\r
- * osm_db_t\r
- *********/\r
-\r
-void osm_db_construct(IN osm_db_t * p_db)\r
-{\r
-       memset(p_db, 0, sizeof(osm_db_t));\r
-       cl_list_construct(&p_db->domains);\r
-}\r
-\r
-void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain)\r
-{\r
-       osm_db_domain_imp_t *p_domain_imp;\r
-       p_domain_imp = (osm_db_domain_imp_t *) p_db_domain->p_domain_imp;\r
-\r
-       osm_db_clear(p_db_domain);\r
-\r
-       cl_spinlock_destroy(&p_domain_imp->lock);\r
-\r
-       st_free_table(p_domain_imp->p_hash);\r
-       free(p_domain_imp->file_name);\r
-       free(p_domain_imp);\r
-}\r
-\r
-void osm_db_destroy(IN osm_db_t * p_db)\r
-{\r
-       osm_db_domain_t *p_domain;\r
-\r
-       while ((p_domain = cl_list_remove_head(&p_db->domains)) != NULL) {\r
-               osm_db_domain_destroy(p_domain);\r
-               free(p_domain);\r
-       }\r
-       cl_list_destroy(&p_db->domains);\r
-       free(p_db->p_db_imp);\r
-}\r
-\r
-int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)\r
-{\r
-       osm_db_imp_t *p_db_imp;\r
-       struct stat dstat;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_db_imp = (osm_db_imp_t *) malloc(sizeof(osm_db_imp_t));\r
-       CL_ASSERT(p_db_imp != NULL);\r
-\r
-       p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");\r
-       if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name))\r
-               p_db_imp->db_dir_name = strdup_expand(OSM_DEFAULT_CACHE_DIR);\r
-\r
-       /* Create the directory if it doesn't exist */\r
-       /* There is a difference in creating directory between windows and linux */\r
-#ifdef __WIN__\r
-       /* Check if the directory exists. If not - create it. */\r
-       CreateDirectory(p_db_imp->db_dir_name, NULL);\r
-#else                          /* __WIN__ */\r
-       /* make sure the directory exists */\r
-       if (lstat(p_db_imp->db_dir_name, &dstat)) {\r
-               if (mkdir(p_db_imp->db_dir_name, 0755)) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6101: "\r
-                               "Failed to create the db directory:%s\n",\r
-                               p_db_imp->db_dir_name);\r
-                       OSM_LOG_EXIT(p_log);\r
-                       return 1;\r
-               }\r
-       }\r
-#endif\r
-\r
-       p_db->p_log = p_log;\r
-       p_db->p_db_imp = (void *)p_db_imp;\r
-\r
-       cl_list_init(&p_db->domains, 5);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-\r
-       return 0;\r
-}\r
-\r
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name)\r
-{\r
-       osm_db_domain_t *p_domain;\r
-       osm_db_domain_imp_t *p_domain_imp;\r
-       size_t path_len;\r
-       osm_log_t *p_log = p_db->p_log;\r
-       FILE *p_file;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* allocate a new domain object */\r
-       p_domain = malloc(sizeof(osm_db_domain_t));\r
-       CL_ASSERT(p_domain != NULL);\r
-\r
-       p_domain_imp = malloc(sizeof(osm_db_domain_imp_t));\r
-       CL_ASSERT(p_domain_imp != NULL);\r
-\r
-       path_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name)\r
-           + strlen(domain_name) + 2;\r
-\r
-       /* set the domain file name */\r
-       p_domain_imp->file_name = malloc(path_len);\r
-       CL_ASSERT(p_domain_imp->file_name != NULL);\r
-       snprintf(p_domain_imp->file_name, path_len,\r
-#ifdef __WIN__\r
-               "%s\\%s",\r
-#else\r
-               "%s/%s",\r
-#endif\r
-                ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name, domain_name);\r
-\r
-       /* make sure the file exists - or exit if not writable */\r
-       p_file = fopen(p_domain_imp->file_name, "a+");\r
-       if (!p_file) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6102: "\r
-                       "Failed to open the db file:%s\n",\r
-                       p_domain_imp->file_name);\r
-               free(p_domain_imp);\r
-               free(p_domain);\r
-               p_domain = NULL;\r
-               goto Exit;\r
-       }\r
-       fclose(p_file);\r
-\r
-       /* initialize the hash table object */\r
-       p_domain_imp->p_hash = st_init_strtable();\r
-       CL_ASSERT(p_domain_imp->p_hash != NULL);\r
-\r
-       p_domain->p_db = p_db;\r
-       cl_list_insert_tail(&p_db->domains, p_domain);\r
-       p_domain->p_domain_imp = p_domain_imp;\r
-       cl_spinlock_construct(&p_domain_imp->lock);\r
-       cl_spinlock_init(&p_domain_imp->lock);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return p_domain;\r
-}\r
-\r
-int osm_db_restore(IN osm_db_domain_t * p_domain)\r
-{\r
-\r
-       osm_log_t *p_log = p_domain->p_db->p_log;\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-       FILE *p_file;\r
-       int status;\r
-       char sLine[OSM_DB_MAX_LINE_LEN];\r
-       boolean_t before_key;\r
-       char *p_first_word, *p_rest_of_line, *p_last;\r
-       char *p_key = NULL;\r
-       char *p_prev_val, *p_accum_val = NULL;\r
-       char *endptr = NULL;\r
-       unsigned int line_num;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* take the lock on the domain */\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-\r
-       /* open the file - read mode */\r
-       p_file = fopen(p_domain_imp->file_name, "r");\r
-\r
-       if (!p_file) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6103: "\r
-                       "Failed to open the db file:%s\n",\r
-                       p_domain_imp->file_name);\r
-               status = 1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* parse the file allocating new hash tables as required */\r
-       /*\r
-          states:\r
-          before_key (0) -> in_key (1)\r
-\r
-          before_key: if a word on the first byte - it is the key. state=in_key\r
-          the rest of the line is start of the value.\r
-          in_key: unless the line is empty - add it (with newlines) to the value.\r
-          if empty: state=before_key\r
-        */\r
-       status = 0;\r
-       before_key = TRUE;\r
-       line_num = 0;\r
-       /* if we got to EOF in the middle of a key we add a last newline */\r
-       while ((fgets(sLine, OSM_DB_MAX_LINE_LEN, p_file) != NULL) ||\r
-              ((before_key == FALSE) && strcpy(sLine, "\n"))\r
-           ) {\r
-               line_num++;\r
-               if (before_key) {\r
-                       if ((sLine[0] != ' ') && (sLine[0] != '\t')\r
-                           && (sLine[0] != '\n')) {\r
-                               /* we got a new key */\r
-                               before_key = FALSE;\r
-\r
-                               /* handle the key */\r
-                               p_first_word =\r
-                                   strtok_r(sLine, " \t\n", &p_last);\r
-                               if (!p_first_word) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                               "ERR 6104: "\r
-                                               "Failed to get key from line:%u : %s (file:%s)\n",\r
-                                               line_num, sLine,\r
-                                               p_domain_imp->file_name);\r
-                                       status = 1;\r
-                                       goto EndParsing;\r
-                               }\r
-                               if (strlen(p_first_word) > OSM_DB_MAX_GUID_LEN) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                               "ERR 610A: "\r
-                                               "Illegal key from line:%u : %s (file:%s)\n",\r
-                                               line_num, sLine,\r
-                                               p_domain_imp->file_name);\r
-                                       status = 1;\r
-                                       goto EndParsing;\r
-                               }\r
-\r
-                               p_key = malloc(sizeof(char) *\r
-                                              (strlen(p_first_word) + 1));\r
-                               strcpy(p_key, p_first_word);\r
-\r
-                               p_rest_of_line = strtok_r(NULL, "\n", &p_last);\r
-                               if (p_rest_of_line != NULL) {\r
-                                       p_accum_val = malloc(sizeof(char) *\r
-                                           (strlen(p_rest_of_line) + 1));\r
-                                       strcpy(p_accum_val, p_rest_of_line);\r
-                               } else {\r
-                                       p_accum_val = malloc(2);\r
-                                       strcpy(p_accum_val, "\0");\r
-                               }\r
-                       } else if (sLine[0] != '\n') {\r
-                               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6105: "\r
-                                       "How did we get here? line:%u : %s (file:%s)\n",\r
-                                       line_num, sLine,\r
-                                       p_domain_imp->file_name);\r
-                               status = 1;\r
-                               goto EndParsing;\r
-                       }\r
-               } /* before key */\r
-               else {\r
-                       /* we already have a key */\r
-\r
-                       if (sLine[0] == '\n') {\r
-                               /* got an end of key */\r
-                               before_key = TRUE;\r
-\r
-                               /* make sure the key was not previously used */\r
-                               if (st_lookup(p_domain_imp->p_hash,\r
-                                             (st_data_t) p_key,\r
-                                             (void *)&p_prev_val)) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                               "ERR 6106: "\r
-                                               "Key:%s already exists in:%s with value:%s."\r
-                                               " Removing it\n", p_key,\r
-                                               p_domain_imp->file_name,\r
-                                               p_prev_val);\r
-                               } else {\r
-                                       p_prev_val = NULL;\r
-                               }\r
-\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                       "Got key:%s value:%s\n", p_key,\r
-                                       p_accum_val);\r
-\r
-                               /* check that the key is a number */\r
-                               if (!strtouq(p_key, &endptr, 0)\r
-                                   && *endptr != '\0') {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                               "ERR 610B: "\r
-                                               "Key:%s is invalid\n", p_key);\r
-                               } else {\r
-                                       /* store our key and value */\r
-                                       st_insert(p_domain_imp->p_hash,\r
-                                                 (st_data_t) p_key,\r
-                                                 (st_data_t) p_accum_val);\r
-                               }\r
-                       } else {\r
-                               /* accumulate into the value */\r
-                               p_prev_val = p_accum_val;\r
-                               p_accum_val = malloc(strlen(p_prev_val) +\r
-                                                    strlen(sLine) + 1);\r
-                               strcpy(p_accum_val, p_prev_val);\r
-                               free(p_prev_val);\r
-                               strcat(p_accum_val, sLine);\r
-                       }\r
-               }               /* in key */\r
-       }                       /* while lines or last line */\r
-\r
-EndParsing:\r
-       fclose(p_file);\r
-\r
-Exit:\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-static int dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)\r
-{\r
-       FILE *p_file = (FILE *) arg;\r
-       char *p_key = (char *)key;\r
-       char *p_val = (char *)val;\r
-\r
-       fprintf(p_file, "%s %s\n\n", p_key, p_val);\r
-       return ST_CONTINUE;\r
-}\r
-\r
-int osm_db_store(IN osm_db_domain_t * p_domain)\r
-{\r
-       osm_log_t *p_log = p_domain->p_db->p_log;\r
-       osm_db_domain_imp_t *p_domain_imp;\r
-       FILE *p_file;\r
-       int status = 0;\r
-       char *p_tmp_file_name;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_domain_imp = (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-       p_tmp_file_name = malloc(sizeof(char) *\r
-                                (strlen(p_domain_imp->file_name) + 8));\r
-       strcpy(p_tmp_file_name, p_domain_imp->file_name);\r
-       strcat(p_tmp_file_name, ".tmp");\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-\r
-       /* open up the output file */\r
-       p_file = fopen(p_tmp_file_name, "w");\r
-       if (!p_file) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6107: "\r
-                       "Failed to open the db file:%s for writing\n",\r
-                       p_domain_imp->file_name);\r
-               status = 1;\r
-               goto Exit;\r
-       }\r
-\r
-       st_foreach(p_domain_imp->p_hash, dump_tbl_entry, (st_data_t) p_file);\r
-       fclose(p_file);\r
-\r
-       /* move the domain file */\r
-       status = remove(p_domain_imp->file_name);\r
-       if (status) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6109: "\r
-                       "Failed to remove file:%s (err:%u)\n",\r
-                       p_domain_imp->file_name, status);\r
-       }\r
-\r
-       status = rename(p_tmp_file_name, p_domain_imp->file_name);\r
-       if (status) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6108: "\r
-                       "Failed to rename the db file to:%s (err:%u)\n",\r
-                       p_domain_imp->file_name, status);\r
-       }\r
-Exit:\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-       free(p_tmp_file_name);\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/* simply de-allocate the key and the value and return the code\r
-   that makes the st_foreach delete the entry */\r
-static int clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)\r
-{\r
-       free((char *)key);\r
-       free((char *)val);\r
-       return ST_DELETE;\r
-}\r
-\r
-int osm_db_clear(IN osm_db_domain_t * p_domain)\r
-{\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-       st_foreach(p_domain_imp->p_hash, clear_tbl_entry, (st_data_t) NULL);\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-\r
-       return 0;\r
-}\r
-\r
-static int get_key_of_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)\r
-{\r
-       cl_list_t *p_list = (cl_list_t *) arg;\r
-       cl_list_insert_tail(p_list, (void *)key);\r
-       return ST_CONTINUE;\r
-}\r
-\r
-int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list)\r
-{\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-\r
-       st_foreach(p_domain_imp->p_hash, get_key_of_tbl_entry,\r
-                  (st_data_t) p_key_list);\r
-\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-\r
-       return 0;\r
-}\r
-\r
-char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key)\r
-{\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-       char *p_val = NULL;\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-\r
-       if (!st_lookup(p_domain_imp->p_hash, (st_data_t) p_key, (void *)&p_val))\r
-               p_val = NULL;\r
-\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-\r
-       return p_val;\r
-}\r
-\r
-int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val)\r
-{\r
-       osm_log_t *p_log = p_domain->p_db->p_log;\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-       char *p_prev_val = NULL;\r
-       char *p_new_key;\r
-       char *p_new_val;\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-\r
-       if (st_lookup(p_domain_imp->p_hash,\r
-                     (st_data_t) p_key, (void *)&p_prev_val)) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Key:%s previously exists in:%s with value:%s\n",\r
-                       p_key, p_domain_imp->file_name, p_prev_val);\r
-               p_new_key = p_key;\r
-       } else {\r
-               /* need to allocate the key */\r
-               p_new_key = malloc(sizeof(char) * (strlen(p_key) + 1));\r
-               strcpy(p_new_key, p_key);\r
-       }\r
-\r
-       /* need to arange a new copy of the  value */\r
-       p_new_val = malloc(sizeof(char) * (strlen(p_val) + 1));\r
-       strcpy(p_new_val, p_val);\r
-\r
-       st_insert(p_domain_imp->p_hash, (st_data_t) p_new_key,\r
-                 (st_data_t) p_new_val);\r
-\r
-       if (p_prev_val)\r
-               free(p_prev_val);\r
-\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key)\r
-{\r
-       osm_log_t *p_log = p_domain->p_db->p_log;\r
-       osm_db_domain_imp_t *p_domain_imp =\r
-           (osm_db_domain_imp_t *) p_domain->p_domain_imp;\r
-       char *p_prev_val = NULL;\r
-       int res;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       cl_spinlock_acquire(&p_domain_imp->lock);\r
-       if (st_delete(p_domain_imp->p_hash,\r
-                     (void *)&p_key, (void *)&p_prev_val)) {\r
-               if (st_lookup(p_domain_imp->p_hash,\r
-                             (st_data_t) p_key, (void *)&p_prev_val)) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                               "key:%s still exists in:%s with value:%s\n",\r
-                               p_key, p_domain_imp->file_name, p_prev_val);\r
-                       res = 1;\r
-               } else {\r
-                       free(p_key);\r
-                       free(p_prev_val);\r
-                       res = 0;\r
-               }\r
-       } else {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "fail to find key:%s. delete failed\n", p_key);\r
-               res = 1;\r
-       }\r
-       cl_spinlock_release(&p_domain_imp->lock);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}\r
-\r
-#ifdef TEST_OSMDB\r
-#include <stdlib.h>\r
-#include <math.h>\r
-\r
-int main(int argc, char **argv)\r
-{\r
-       osm_db_t db;\r
-       osm_log_t log;\r
-       osm_db_domain_t *p_dbd;\r
-       cl_list_t keys;\r
-       cl_list_iterator_t kI;\r
-       char *p_key;\r
-       char *p_val;\r
-       int i;\r
-\r
-       cl_list_construct(&keys);\r
-       cl_list_init(&keys, 10);\r
-\r
-       osm_log_init_v2(&log, TRUE, 0xff, "/var/log/osm_db_test.log", 0, FALSE);\r
-\r
-       osm_db_construct(&db);\r
-       if (osm_db_init(&db, &log)) {\r
-               printf("db init failed\n");\r
-               exit(1);\r
-       }\r
-\r
-       p_dbd = osm_db_domain_init(&db, "lid_by_guid");\r
-\r
-       if (osm_db_restore(p_dbd)) {\r
-               printf("failed to restore\n");\r
-       }\r
-\r
-       if (osm_db_keys(p_dbd, &keys)) {\r
-               printf("failed to get keys\n");\r
-       } else {\r
-               kI = cl_list_head(&keys);\r
-               while (kI != cl_list_end(&keys)) {\r
-                       p_key = cl_list_obj(kI);\r
-                       kI = cl_list_next(kI);\r
-\r
-                       p_val = osm_db_lookup(p_dbd, p_key);\r
-                       printf("key = %s val = %s\n", p_key, p_val);\r
-               }\r
-       }\r
-\r
-       cl_list_remove_all(&keys);\r
-\r
-       /* randomly add and remove numbers */\r
-       for (i = 0; i < 10; i++) {\r
-               int k;\r
-               float v;\r
-               int is_add;\r
-               char val_buf[16];\r
-               char key_buf[16];\r
-\r
-               k = floor(1.0 * rand() / RAND_MAX * 100);\r
-               v = rand();\r
-               sprintf(key_buf, "%u", k);\r
-               sprintf(val_buf, "%u", v);\r
-\r
-               is_add = (rand() < RAND_MAX / 2);\r
-\r
-               if (is_add) {\r
-                       osm_db_update(p_dbd, key_buf, val_buf);\r
-               } else {\r
-                       osm_db_delete(p_dbd, key_buf);\r
-               }\r
-       }\r
-       if (osm_db_keys(p_dbd, &keys)) {\r
-               printf("failed to get keys\n");\r
-       } else {\r
-               kI = cl_list_head(&keys);\r
-               while (kI != cl_list_end(&keys)) {\r
-                       p_key = cl_list_obj(kI);\r
-                       kI = cl_list_next(kI);\r
-\r
-                       p_val = osm_db_lookup(p_dbd, p_key);\r
-                       printf("key = %s val = %s\n", p_key, p_val);\r
-               }\r
-       }\r
-       if (osm_db_store(p_dbd))\r
-               printf("failed to store\n");\r
-\r
-       osm_db_destroy(&db);\r
-       cl_list_destroy(&keys);\r
-}\r
-#endif\r
diff --git a/branches/opensm_3/user/opensm/osm_db_pack.c b/branches/opensm_3/user/opensm/osm_db_pack.c
deleted file mode 100644 (file)
index a1b61a7..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_db_pack.h>\r
-\r
-static inline void pack_guid(uint64_t guid, char *p_guid_str)\r
-{\r
-       sprintf(p_guid_str, "0x%016" PRIx64, guid);\r
-}\r
-\r
-static inline uint64_t unpack_guid(char *p_guid_str)\r
-{\r
-       return strtoull(p_guid_str, NULL, 0);\r
-}\r
-\r
-static inline void pack_lids(uint16_t min_lid, uint16_t max_lid, char *lid_str)\r
-{\r
-       sprintf(lid_str, "0x%04x 0x%04x", min_lid, max_lid);\r
-}\r
-\r
-static inline int unpack_lids(IN char *p_lid_str, OUT uint16_t * p_min_lid,\r
-                             OUT uint16_t * p_max_lid)\r
-{\r
-       unsigned long tmp;\r
-       char *p_next;\r
-       char *p_num;\r
-       char lids_str[24];\r
-\r
-       strncpy(lids_str, p_lid_str, 23);\r
-       lids_str[23] = '\0';\r
-       p_num = strtok_r(lids_str, " \t", &p_next);\r
-       if (!p_num)\r
-               return 1;\r
-       tmp = strtoul(p_num, NULL, 0);\r
-       CL_ASSERT(tmp < 0x10000);\r
-       *p_min_lid = (uint16_t) tmp;\r
-\r
-       p_num = strtok_r(NULL, " \t", &p_next);\r
-       if (!p_num)\r
-               return 1;\r
-       tmp = strtoul(p_num, NULL, 0);\r
-       CL_ASSERT(tmp < 0x10000);\r
-       *p_max_lid = (uint16_t) tmp;\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l,\r
-                         OUT cl_qlist_t * p_guid_list)\r
-{\r
-       char *p_key;\r
-       cl_list_t keys;\r
-       osm_db_guid_elem_t *p_guid_elem;\r
-\r
-       cl_list_construct(&keys);\r
-       cl_list_init(&keys, 10);\r
-\r
-       if (osm_db_keys(p_g2l, &keys))\r
-               return 1;\r
-\r
-       while ((p_key = cl_list_remove_head(&keys)) != NULL) {\r
-               p_guid_elem =\r
-                   (osm_db_guid_elem_t *) malloc(sizeof(osm_db_guid_elem_t));\r
-               CL_ASSERT(p_guid_elem != NULL);\r
-\r
-               p_guid_elem->guid = unpack_guid(p_key);\r
-               cl_qlist_insert_head(p_guid_list, &p_guid_elem->item);\r
-       }\r
-\r
-       cl_list_destroy(&keys);\r
-       return 0;\r
-}\r
-\r
-int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid,\r
-                       OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid)\r
-{\r
-       char guid_str[20];\r
-       char *p_lid_str;\r
-       uint16_t min_lid, max_lid;\r
-\r
-       pack_guid(guid, guid_str);\r
-       p_lid_str = osm_db_lookup(p_g2l, guid_str);\r
-       if (!p_lid_str)\r
-               return 1;\r
-       if (unpack_lids(p_lid_str, &min_lid, &max_lid))\r
-               return 1;\r
-\r
-       if (p_min_lid)\r
-               *p_min_lid = min_lid;\r
-       if (p_max_lid)\r
-               *p_max_lid = max_lid;\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid,\r
-                       IN uint16_t min_lid, IN uint16_t max_lid)\r
-{\r
-       char guid_str[20];\r
-       char lid_str[16];\r
-\r
-       pack_guid(guid, guid_str);\r
-       pack_lids(min_lid, max_lid, lid_str);\r
-\r
-       return osm_db_update(p_g2l, guid_str, lid_str);\r
-}\r
-\r
-int osm_db_guid2lid_delete(IN osm_db_domain_t * p_g2l, IN uint64_t guid)\r
-{\r
-       char guid_str[20];\r
-       pack_guid(guid, guid_str);\r
-       return osm_db_delete(p_g2l, guid_str);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_drop_mgr.c b/branches/opensm_3/user/opensm/osm_drop_mgr.c
deleted file mode 100644 (file)
index d8d3e56..0000000
+++ /dev/null
@@ -1,491 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_drop_mgr_t.\r
- * This object represents the Drop Manager object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_ptr_vector.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_router.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_remote_sm.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-\r
-static void drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid)\r
-{\r
-       osm_router_t *p_rtr;\r
-       cl_qmap_t *p_rtr_guid_tbl;\r
-\r
-       p_rtr_guid_tbl = &sm->p_subn->rtr_guid_tbl;\r
-       p_rtr = (osm_router_t *) cl_qmap_remove(p_rtr_guid_tbl, portguid);\r
-       if (p_rtr != (osm_router_t *) cl_qmap_end(p_rtr_guid_tbl)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Cleaned router for port guid 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(portguid));\r
-               osm_router_delete(&p_rtr);\r
-       }\r
-}\r
-\r
-static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)\r
-{\r
-       osm_physp_t *p_remote_physp;\r
-       osm_port_t *p_remote_port;\r
-\r
-       p_remote_physp = osm_physp_get_remote(p_physp);\r
-       if (p_remote_physp) {\r
-               p_remote_port = osm_get_port_by_guid(sm->p_subn,\r
-                                                    p_remote_physp->port_guid);\r
-\r
-               if (p_remote_port) {\r
-                       /* Let's check if this is a case of link that is lost\r
-                          (both ports weren't recognized), or a "hiccup" in the\r
-                          subnet - in which case the remote port was\r
-                          recognized, and its state is ACTIVE.\r
-                          If this is just a "hiccup" - force a heavy sweep in\r
-                          the next sweep. We don't want to lose that part of\r
-                          the subnet. */\r
-                       if (p_remote_port->discovery_count &&\r
-                           osm_physp_get_port_state(p_remote_physp) ==\r
-                           IB_LINK_ACTIVE) {\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Forcing new heavy sweep. Remote "\r
-                                       "port 0x%016" PRIx64 " port num: %u "\r
-                                       "was recognized in ACTIVE state\n",\r
-                                       cl_ntoh64(p_remote_physp->port_guid),\r
-                                       p_remote_physp->port_num);\r
-                               sm->p_subn->force_heavy_sweep = TRUE;\r
-                       }\r
-\r
-                       /* If the remote node is ca or router - need to remove\r
-                          the remote port, since it is no longer reachable.\r
-                          This can be done if we reset the discovery count\r
-                          of the remote port. */\r
-                       if (!p_remote_physp->p_node->sw) {\r
-                               p_remote_port->discovery_count = 0;\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Resetting discovery count of node: "\r
-                                       "0x%016" PRIx64 " port num:%u\n",\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_remote_physp->p_node)),\r
-                                       p_remote_physp->port_num);\r
-                       }\r
-               }\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Unlinking local node 0x%016" PRIx64 ", port %u"\r
-                       "\n\t\t\t\tand remote node 0x%016" PRIx64\r
-                       ", port %u\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_physp->p_node)),\r
-                       p_physp->port_num,\r
-                       cl_ntoh64(osm_node_get_node_guid\r
-                                 (p_remote_physp->p_node)),\r
-                       p_remote_physp->port_num);\r
-\r
-               if (sm->ucast_mgr.cache_valid)\r
-                       osm_ucast_cache_add_link(&sm->ucast_mgr, p_physp,\r
-                                                p_remote_physp);\r
-\r
-               osm_physp_unlink(p_physp, p_remote_physp);\r
-\r
-       }\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Clearing node 0x%016" PRIx64 " physical port number %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_physp->p_node)),\r
-               p_physp->port_num);\r
-\r
-       osm_physp_destroy(p_physp);\r
-}\r
-\r
-static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)\r
-{\r
-       ib_net64_t port_guid;\r
-       osm_port_t *p_port_check;\r
-       cl_qmap_t *p_sm_guid_tbl;\r
-       osm_mcm_port_t *mcm_port=NULL;\r
-       cl_ptr_vector_t *p_port_lid_tbl;\r
-       uint16_t min_lid_ho;\r
-       uint16_t max_lid_ho;\r
-       uint16_t lid_ho;\r
-       osm_node_t *p_node;\r
-       osm_remote_sm_t *p_sm;\r
-       ib_gid_t port_gid;\r
-       ib_mad_notice_attr_t notice;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       port_guid = osm_port_get_guid(p_port);\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Unreachable port 0x%016" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       p_port_check =\r
-           (osm_port_t *) cl_qmap_remove(&sm->p_subn->port_guid_tbl,\r
-                                         port_guid);\r
-       if (p_port_check != p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0101: "\r
-                       "Port 0x%016" PRIx64 " not in guid table\n",\r
-                       cl_ntoh64(port_guid));\r
-               goto Exit;\r
-       }\r
-\r
-       /* issue a notice - trap 65 */\r
-       /* details of the notice */\r
-       notice.generic_type = 0x83;     /* is generic subn mgt type */\r
-       ib_notice_set_prod_type_ho(&notice, 4); /* A class manager generator */\r
-       /* endport ceases to be reachable */\r
-       notice.g_or_v.generic.trap_num = CL_HTON16(65);\r
-       /* The sm_base_lid is saved in network order already. */\r
-       notice.issuer_lid = sm->p_subn->sm_base_lid;\r
-       /* following C14-72.1.2 and table 119 p725 */\r
-       /* we need to provide the GID */\r
-       port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;\r
-       port_gid.unicast.interface_id = port_guid;\r
-       memcpy(&(notice.data_details.ntc_64_67.gid),\r
-              &(port_gid), sizeof(ib_gid_t));\r
-\r
-       /* According to page 653 - the issuer gid in this case of trap\r
-          is the SM gid, since the SM is the initiator of this trap. */\r
-       notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;\r
-       notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;\r
-\r
-       status = osm_report_notice(sm->p_log, sm->p_subn, &notice);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: "\r
-                       "Error sending trap reports (%s)\n",\r
-                       ib_get_err_str(status));\r
-       }\r
-\r
-       p_sm_guid_tbl = &sm->p_subn->sm_guid_tbl;\r
-       p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_guid_tbl, port_guid);\r
-       if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl)) {\r
-               /* need to remove this item */\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Cleaned SM for port guid 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(port_guid));\r
-\r
-               free(p_sm);\r
-       }\r
-\r
-       drop_mgr_remove_router(sm, port_guid);\r
-\r
-       osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Clearing abandoned LID range [%u,%u]\n",\r
-               min_lid_ho, max_lid_ho);\r
-\r
-       p_port_lid_tbl = &sm->p_subn->port_lid_tbl;\r
-       for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++)\r
-               cl_ptr_vector_set(p_port_lid_tbl, lid_ho, NULL);\r
-\r
-       drop_mgr_clean_physp(sm, p_port->p_physp);\r
-\r
-       while (!cl_is_qlist_empty(&p_port->mcm_list)) {\r
-               mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),\r
-                                      mcm_port, list_item);\r
-               osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,\r
-                                    p_port->guid);\r
-       }\r
-\r
-       /* initialize the p_node - may need to get node_desc later */\r
-       p_node = p_port->p_node;\r
-\r
-       osm_port_delete(&p_port);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_INFO,\r
-               "Removed port with GUID:0x%016" PRIx64\r
-               " LID range [%u, %u] of node:%s\n",\r
-               cl_ntoh64(port_gid.unicast.interface_id),\r
-               min_lid_ho, max_lid_ho,\r
-               p_node ? p_node->print_desc : "UNKNOWN");\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node)\r
-{\r
-       osm_switch_t *p_sw;\r
-       cl_qmap_t *p_sw_guid_tbl;\r
-       ib_net64_t node_guid;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       node_guid = osm_node_get_node_guid(p_node);\r
-       p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;\r
-\r
-       p_sw = (osm_switch_t *) cl_qmap_remove(p_sw_guid_tbl, node_guid);\r
-       if (p_sw == (osm_switch_t *) cl_qmap_end(p_sw_guid_tbl)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0102: "\r
-                       "Node 0x%016" PRIx64 " not in switch table\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-       } else {\r
-               p_node->sw = NULL;\r
-               osm_switch_delete(&p_sw);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_port_t *p_port;\r
-       osm_node_t *p_node_check;\r
-       uint32_t port_num;\r
-       uint32_t max_ports;\r
-       ib_net64_t port_guid;\r
-       boolean_t return_val = FALSE;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Unreachable node 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       if (sm->ucast_mgr.cache_valid)\r
-               osm_ucast_cache_add_node(&sm->ucast_mgr, p_node);\r
-\r
-       /*\r
-          Delete all the logical and physical port objects\r
-          associated with this node.\r
-        */\r
-       max_ports = osm_node_get_num_physp(p_node);\r
-       for (port_num = 0; port_num < max_ports; port_num++) {\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               if (p_physp) {\r
-                       port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-                       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-\r
-                       if (p_port)\r
-                               drop_mgr_remove_port(sm, p_port);\r
-                       else\r
-                               drop_mgr_clean_physp(sm, p_physp);\r
-               }\r
-       }\r
-\r
-       return_val = TRUE;\r
-\r
-       if (p_node->sw)\r
-               drop_mgr_remove_switch(sm, p_node);\r
-\r
-       p_node_check =\r
-           (osm_node_t *) cl_qmap_remove(&sm->p_subn->node_guid_tbl,\r
-                                         osm_node_get_node_guid(p_node));\r
-       if (p_node_check != p_node) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0105: "\r
-                       "Node 0x%016" PRIx64 " not in guid table\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-       }\r
-\r
-       /* free memory allocated to node */\r
-       osm_node_delete(&p_node);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return return_val;\r
-}\r
-\r
-static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)\r
-{\r
-       ib_net64_t node_guid;\r
-       osm_physp_t *p_physp;\r
-       osm_port_t *p_port;\r
-       ib_net64_t port_guid;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       node_guid = osm_node_get_node_guid(p_node);\r
-\r
-       if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0107: "\r
-                       "Node 0x%016" PRIx64 " is not a switch node\n",\r
-                       cl_ntoh64(node_guid));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure we have a switch object for this node */\r
-       if (!p_node->sw) {\r
-               /* We do not have switch info for this node */\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Node 0x%016" PRIx64 " no switch in table\n",\r
-                       cl_ntoh64(node_guid));\r
-\r
-               drop_mgr_process_node(sm, p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure we have a port object for port zero */\r
-       p_physp = osm_node_get_physp_ptr(p_node, 0);\r
-       if (!p_physp) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Node 0x%016" PRIx64 " no valid physical port 0\n",\r
-                       cl_ntoh64(node_guid));\r
-\r
-               drop_mgr_process_node(sm, p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Node 0x%016" PRIx64 " has no port object\n",\r
-                       cl_ntoh64(node_guid));\r
-\r
-               drop_mgr_process_node(sm, p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_port->discovery_count == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Node 0x%016" PRIx64 " port has discovery count zero\n",\r
-                       cl_ntoh64(node_guid));\r
-\r
-               drop_mgr_process_node(sm, p_node);\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return;\r
-}\r
-\r
-void osm_drop_mgr_process(osm_sm_t * sm)\r
-{\r
-       cl_qmap_t *p_node_guid_tbl, *p_port_guid_tbl;\r
-       osm_port_t *p_port, *p_next_port;\r
-       osm_node_t *p_node, *p_next_node;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_node_guid_tbl = &sm->p_subn->node_guid_tbl;\r
-       p_port_guid_tbl = &sm->p_subn->port_guid_tbl;\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       p_next_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);\r
-       while (p_next_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl)) {\r
-               p_node = p_next_node;\r
-               p_next_node =\r
-                   (osm_node_t *) cl_qmap_next(&p_next_node->map_item);\r
-\r
-               CL_ASSERT(cl_qmap_key(&p_node->map_item) ==\r
-                         osm_node_get_node_guid(p_node));\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Checking node 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-               /*\r
-                  Check if this node was discovered during the last sweep.\r
-                  If not, it is unreachable in the current subnet, and\r
-                  should therefore be removed from the subnet object.\r
-                */\r
-               if (p_node->discovery_count == 0)\r
-                       drop_mgr_process_node(sm, p_node);\r
-       }\r
-\r
-       /*\r
-          Go over all the nodes. If the node is a switch - make sure\r
-          there is also a switch record for it, and a portInfo record for\r
-          port zero of of the node.\r
-          If not - this means that there was some error in getting the data\r
-          of this node. Drop the node.\r
-        */\r
-       p_next_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);\r
-       while (p_next_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl)) {\r
-               p_node = p_next_node;\r
-               p_next_node =\r
-                   (osm_node_t *) cl_qmap_next(&p_next_node->map_item);\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Checking full discovery of node 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-               if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH)\r
-                       continue;\r
-\r
-               /* We are handling a switch node */\r
-               drop_mgr_check_node(sm, p_node);\r
-       }\r
-\r
-       p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);\r
-       while (p_next_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl)) {\r
-               p_port = p_next_port;\r
-               p_next_port =\r
-                   (osm_port_t *) cl_qmap_next(&p_next_port->map_item);\r
-\r
-               CL_ASSERT(cl_qmap_key(&p_port->map_item) ==\r
-                         osm_port_get_guid(p_port));\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Checking port 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(osm_port_get_guid(p_port)));\r
-\r
-               /*\r
-                  If the port is unreachable, remove it from the guid table.\r
-                */\r
-               if (p_port->discovery_count == 0)\r
-                       drop_mgr_remove_port(sm, p_port);\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_dump.c b/branches/opensm_3/user/opensm/osm_dump.c
deleted file mode 100644 (file)
index a5c7127..0000000
+++ /dev/null
@@ -1,639 +0,0 @@
-/*\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Various OpenSM dumpers\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <errno.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-static void dump_ucast_path_distribution(cl_map_item_t * item, FILE * file,\r
-                                        void *cxt)\r
-{\r
-       osm_node_t *p_node;\r
-       osm_node_t *p_remote_node;\r
-       uint8_t i;\r
-       uint8_t num_ports;\r
-       uint32_t num_paths;\r
-       ib_net64_t remote_guid_ho;\r
-       osm_switch_t *p_sw = (osm_switch_t *) item;\r
-\r
-       p_node = p_sw->p_node;\r
-       num_ports = p_sw->num_ports;\r
-\r
-       fprintf(file, "dump_ucast_path_distribution: Switch 0x%" PRIx64 "\n"\r
-               "Port : Path Count Through Port",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       for (i = 0; i < num_ports; i++) {\r
-               num_paths = osm_switch_path_count_get(p_sw, i);\r
-               fprintf(file, "\n %03u : %u", i, num_paths);\r
-               if (i == 0) {\r
-                       fprintf(file, " (switch management port)");\r
-                       continue;\r
-               }\r
-\r
-               p_remote_node = osm_node_get_remote_node(p_node, i, NULL);\r
-               if (p_remote_node == NULL)\r
-                       continue;\r
-\r
-               remote_guid_ho =\r
-                   cl_ntoh64(osm_node_get_node_guid(p_remote_node));\r
-\r
-               switch (osm_node_get_type(p_remote_node)) {\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       fprintf(file, " (link to switch");\r
-                       break;\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       fprintf(file, " (link to router");\r
-                       break;\r
-               case IB_NODE_TYPE_CA:\r
-                       fprintf(file, " (link to CA");\r
-                       break;\r
-               default:\r
-                       fprintf(file, " (link to unknown node type");\r
-                       break;\r
-               }\r
-\r
-               fprintf(file, " 0x%" PRIx64 ")", remote_guid_ho);\r
-       }\r
-\r
-       fprintf(file, "\n");\r
-}\r
-\r
-static void dump_ucast_routes(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       const osm_node_t *p_node;\r
-       osm_port_t *p_port;\r
-       uint8_t port_num;\r
-       uint8_t num_hops;\r
-       uint8_t best_hops;\r
-       uint8_t best_port;\r
-       uint16_t max_lid_ho;\r
-       uint16_t lid_ho, base_lid;\r
-       boolean_t direct_route_exists = FALSE;\r
-       boolean_t dor;\r
-       osm_switch_t *p_sw = (osm_switch_t *) item;\r
-       osm_opensm_t *p_osm = cxt;\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       max_lid_ho = p_sw->max_lid_ho;\r
-\r
-       fprintf(file, "dump_ucast_routes: "\r
-               "Switch 0x%016" PRIx64 "\nLID    : Port : Hops : Optimal\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       dor = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_DOR);\r
-\r
-       for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++) {\r
-               fprintf(file, "0x%04X : ", lid_ho);\r
-\r
-               p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid_ho);\r
-               if (!p_port) {\r
-                       fprintf(file, "UNREACHABLE\n");\r
-                       continue;\r
-               }\r
-\r
-               port_num = osm_switch_get_port_by_lid(p_sw, lid_ho);\r
-               if (port_num == OSM_NO_PATH) {\r
-                       /*\r
-                          This may occur if there are 'holes' in the existing\r
-                          LID assignments.  Running SM with --reassign_lids\r
-                          will reassign and compress the LID range.  The\r
-                          subnet should work fine either way.\r
-                        */\r
-                       fprintf(file, "UNREACHABLE\n");\r
-                       continue;\r
-               }\r
-               /*\r
-                  Switches can lie about which port routes a given\r
-                  lid due to a recent reconfiguration of the subnet.\r
-                  Therefore, ensure that the hop count is better than\r
-                  OSM_NO_PATH.\r
-                */\r
-               if (p_port->p_node->sw) {\r
-                       /* Target LID is switch.\r
-                          Get its base lid and check hop count for this base LID only. */\r
-                       base_lid = osm_node_get_base_lid(p_port->p_node, 0);\r
-                       base_lid = cl_ntoh16(base_lid);\r
-                       num_hops =\r
-                           osm_switch_get_hop_count(p_sw, base_lid, port_num);\r
-               } else {\r
-                       /* Target LID is not switch (CA or router).\r
-                          Check if we have route to this target from current switch. */\r
-                       num_hops =\r
-                           osm_switch_get_hop_count(p_sw, lid_ho, port_num);\r
-                       if (num_hops != OSM_NO_PATH) {\r
-                               direct_route_exists = TRUE;\r
-                               base_lid = lid_ho;\r
-                       } else {\r
-                               osm_physp_t *p_physp = p_port->p_physp;\r
-\r
-                               if (!p_physp || !p_physp->p_remote_physp ||\r
-                                   !p_physp->p_remote_physp->p_node->sw)\r
-                                       num_hops = OSM_NO_PATH;\r
-                               else {\r
-                                       base_lid =\r
-                                           osm_node_get_base_lid(p_physp->\r
-                                                                 p_remote_physp->\r
-                                                                 p_node, 0);\r
-                                       base_lid = cl_ntoh16(base_lid);\r
-                                       num_hops =\r
-                                           p_physp->p_remote_physp->p_node->\r
-                                           sw ==\r
-                                           p_sw ? 0 :\r
-                                           osm_switch_get_hop_count(p_sw,\r
-                                                                    base_lid,\r
-                                                                    port_num);\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if (num_hops == OSM_NO_PATH) {\r
-                       fprintf(file, "%03u  : HOPS UNKNOWN\n", port_num);\r
-                       continue;\r
-               }\r
-\r
-               best_hops = osm_switch_get_least_hops(p_sw, base_lid);\r
-               if (!p_port->p_node->sw && !direct_route_exists) {\r
-                       best_hops++;\r
-                       num_hops++;\r
-               }\r
-\r
-               fprintf(file, "%03u  : %02u   : ", port_num, num_hops);\r
-\r
-               if (best_hops == num_hops)\r
-                       fprintf(file, "yes");\r
-               else {\r
-                       /* No LMC Optimization */\r
-                       best_port = osm_switch_recommend_path(p_sw, p_port,\r
-                                                             lid_ho, 1, TRUE,\r
-                                                             dor);\r
-                       fprintf(file, "No %u hop path possible via port %u!",\r
-                               best_hops, best_port);\r
-               }\r
-\r
-               fprintf(file, "\n");\r
-       }\r
-}\r
-\r
-static void dump_mcast_routes(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       osm_switch_t *p_sw = (osm_switch_t *) item;\r
-       osm_mcast_tbl_t *p_tbl;\r
-       int16_t mlid_ho = 0;\r
-       int16_t mlid_start_ho;\r
-       uint8_t position = 0;\r
-       int16_t block_num = 0;\r
-       boolean_t first_mlid;\r
-       boolean_t first_port;\r
-       const osm_node_t *p_node;\r
-       uint16_t i, j;\r
-       uint16_t mask_entry;\r
-       char sw_hdr[256];\r
-       char mlid_hdr[32];\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-\r
-       sprintf(sw_hdr, "\nSwitch 0x%016" PRIx64 "\nLID    : Out Port(s)\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-       first_mlid = TRUE;\r
-       while (block_num <= p_tbl->max_block_in_use) {\r
-               mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);\r
-               for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++) {\r
-                       mlid_ho = mlid_start_ho + i;\r
-                       position = 0;\r
-                       first_port = TRUE;\r
-                       sprintf(mlid_hdr, "0x%04X :",\r
-                               mlid_ho + IB_LID_MCAST_START_HO);\r
-                       while (position <= p_tbl->max_position) {\r
-                               mask_entry =\r
-                                   cl_ntoh16((*p_tbl->\r
-                                              p_mask_tbl)[mlid_ho][position]);\r
-                               if (mask_entry == 0) {\r
-                                       position++;\r
-                                       continue;\r
-                               }\r
-                               for (j = 0; j < 16; j++) {\r
-                                       if ((1 << j) & mask_entry) {\r
-                                               if (first_mlid) {\r
-                                                       fprintf(file, "%s",\r
-                                                               sw_hdr);\r
-                                                       first_mlid = FALSE;\r
-                                               }\r
-                                               if (first_port) {\r
-                                                       fprintf(file, "%s",\r
-                                                               mlid_hdr);\r
-                                                       first_port = FALSE;\r
-                                               }\r
-                                               fprintf(file, " 0x%03X ",\r
-                                                       j + (position * 16));\r
-                                       }\r
-                               }\r
-                               position++;\r
-                       }\r
-                       if (first_port == FALSE)\r
-                               fprintf(file, "\n");\r
-               }\r
-               block_num++;\r
-       }\r
-}\r
-\r
-static void dump_lid_matrix(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       osm_switch_t *p_sw = (osm_switch_t *) item;\r
-       osm_opensm_t *p_osm = cxt;\r
-       osm_node_t *p_node = p_sw->p_node;\r
-       unsigned max_lid = p_sw->max_lid_ho;\r
-       unsigned max_port = p_sw->num_ports;\r
-       uint16_t lid;\r
-       uint8_t port;\r
-\r
-       fprintf(file, "Switch: guid 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-       for (lid = 1; lid <= max_lid; lid++) {\r
-               osm_port_t *p_port;\r
-               if (osm_switch_get_least_hops(p_sw, lid) == OSM_NO_PATH)\r
-                       continue;\r
-               fprintf(file, "0x%04x:", lid);\r
-               for (port = 0; port < max_port; port++)\r
-                       fprintf(file, " %02x",\r
-                               osm_switch_get_hop_count(p_sw, lid, port));\r
-               p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);\r
-               if (p_port)\r
-                       fprintf(file, " # portguid 0x016%" PRIx64,\r
-                               cl_ntoh64(osm_port_get_guid(p_port)));\r
-               fprintf(file, "\n");\r
-       }\r
-}\r
-\r
-static void dump_ucast_lfts(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       osm_switch_t *p_sw = (osm_switch_t *) item;\r
-       osm_opensm_t *p_osm = cxt;\r
-       osm_node_t *p_node = p_sw->p_node;\r
-       unsigned max_lid = p_sw->max_lid_ho;\r
-       unsigned max_port = p_sw->num_ports;\r
-       uint16_t lid;\r
-       uint8_t port;\r
-\r
-       fprintf(file, "Unicast lids [0-%u] of switch Lid %u guid 0x%016"\r
-               PRIx64 " (\'%s\'):\n",\r
-               max_lid, cl_ntoh16(osm_node_get_base_lid(p_node, 0)),\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)), p_node->print_desc);\r
-       for (lid = 0; lid <= max_lid; lid++) {\r
-               osm_port_t *p_port;\r
-               port = osm_switch_get_port_by_lid(p_sw, lid);\r
-\r
-               if (port >= max_port)\r
-                       continue;\r
-\r
-               fprintf(file, "0x%04x %03u # ", lid, port);\r
-\r
-               p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);\r
-               if (p_port) {\r
-                       p_node = p_port->p_node;\r
-                       fprintf(file, "%s portguid 0x%016" PRIx64 ": \'%s\'",\r
-                               ib_get_node_type_str(osm_node_get_type(p_node)),\r
-                               cl_ntoh64(osm_port_get_guid(p_port)),\r
-                               p_node->print_desc);\r
-               } else\r
-                       fprintf(file, "unknown node and type");\r
-               fprintf(file, "\n");\r
-       }\r
-       fprintf(file, "%u lids dumped\n", max_lid);\r
-}\r
-\r
-static void dump_topology_node(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) item;\r
-       uint32_t cPort;\r
-       osm_node_t *p_nbnode;\r
-       osm_physp_t *p_physp, *p_default_physp, *p_rphysp;\r
-       uint8_t link_speed_act;\r
-\r
-       if (!p_node->node_info.num_ports)\r
-               return;\r
-\r
-       for (cPort = 1; cPort < osm_node_get_num_physp(p_node); cPort++) {\r
-               uint8_t port_state;\r
-\r
-               p_physp = osm_node_get_physp_ptr(p_node, cPort);\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               p_rphysp = p_physp->p_remote_physp;\r
-               if (!p_rphysp)\r
-                       continue;\r
-\r
-               CL_ASSERT(cPort == p_physp->port_num);\r
-\r
-               if (p_node->node_info.node_type == IB_NODE_TYPE_SWITCH)\r
-                       p_default_physp = osm_node_get_physp_ptr(p_node, 0);\r
-               else\r
-                       p_default_physp = p_physp;\r
-\r
-               fprintf(file, "{ %s%s Ports:%02X SystemGUID:%016" PRIx64\r
-                       " NodeGUID:%016" PRIx64 " PortGUID:%016" PRIx64\r
-                       " VenID:%06X DevID:%04X Rev:%08X {%s} LID:%04X PN:%02X } ",\r
-                       p_node->node_info.node_type == IB_NODE_TYPE_SWITCH ?\r
-                       "SW" : p_node->node_info.node_type ==\r
-                       IB_NODE_TYPE_CA ? "CA" : p_node->node_info.node_type ==\r
-                       IB_NODE_TYPE_ROUTER ? "Rt" : "**",\r
-                       p_default_physp->port_info.base_lid ==\r
-                       p_default_physp->port_info.\r
-                       master_sm_base_lid ? "-SM" : "",\r
-                       p_node->node_info.num_ports,\r
-                       cl_ntoh64(p_node->node_info.sys_guid),\r
-                       cl_ntoh64(p_node->node_info.node_guid),\r
-                       cl_ntoh64(p_physp->port_guid),\r
-                       cl_ntoh32(ib_node_info_get_vendor_id\r
-                                 (&p_node->node_info)),\r
-                       cl_ntoh16(p_node->node_info.device_id),\r
-                       cl_ntoh32(p_node->node_info.revision),\r
-                       p_node->print_desc,\r
-                       cl_ntoh16(p_default_physp->port_info.base_lid), cPort);\r
-\r
-               p_nbnode = p_rphysp->p_node;\r
-\r
-               if (p_nbnode->node_info.node_type == IB_NODE_TYPE_SWITCH)\r
-                       p_default_physp = osm_node_get_physp_ptr(p_nbnode, 0);\r
-               else\r
-                       p_default_physp = p_rphysp;\r
-\r
-               fprintf(file, "{ %s%s Ports:%02X SystemGUID:%016" PRIx64\r
-                       " NodeGUID:%016" PRIx64 " PortGUID:%016" PRIx64\r
-                       " VenID:%08X DevID:%04X Rev:%08X {%s} LID:%04X PN:%02X } ",\r
-                       p_nbnode->node_info.node_type == IB_NODE_TYPE_SWITCH ?\r
-                       "SW" : p_nbnode->node_info.node_type ==\r
-                       IB_NODE_TYPE_CA ? "CA" :\r
-                       p_nbnode->node_info.node_type == IB_NODE_TYPE_ROUTER ?\r
-                       "Rt" : "**",\r
-                       p_default_physp->port_info.base_lid ==\r
-                       p_default_physp->port_info.\r
-                       master_sm_base_lid ? "-SM" : "",\r
-                       p_nbnode->node_info.num_ports,\r
-                       cl_ntoh64(p_nbnode->node_info.sys_guid),\r
-                       cl_ntoh64(p_nbnode->node_info.node_guid),\r
-                       cl_ntoh64(p_rphysp->port_guid),\r
-                       cl_ntoh32(ib_node_info_get_vendor_id\r
-                                 (&p_nbnode->node_info)),\r
-                       cl_ntoh32(p_nbnode->node_info.device_id),\r
-                       cl_ntoh32(p_nbnode->node_info.revision),\r
-                       p_nbnode->print_desc,\r
-                       cl_ntoh16(p_default_physp->port_info.base_lid),\r
-                       p_rphysp->port_num);\r
-\r
-               port_state = ib_port_info_get_port_state(&p_physp->port_info);\r
-               link_speed_act =\r
-                   ib_port_info_get_link_speed_active(&p_physp->port_info);\r
-\r
-               fprintf(file, "PHY=%s LOG=%s SPD=%s\n",\r
-                       p_physp->port_info.link_width_active == 1 ? "1x" :\r
-                       p_physp->port_info.link_width_active == 2 ? "4x" :\r
-                       p_physp->port_info.link_width_active == 8 ? "12x" :\r
-                       "??",\r
-                       port_state == IB_LINK_ACTIVE ? "ACT" :\r
-                       port_state == IB_LINK_ARMED ? "ARM" :\r
-                       port_state == IB_LINK_INIT ? "INI" : "DWN",\r
-                       link_speed_act == 1 ? "2.5" :\r
-                       link_speed_act == 2 ? "5" :\r
-                       link_speed_act == 4 ? "10" : "??");\r
-       }\r
-}\r
-\r
-static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) item;\r
-       osm_opensm_t *osm = cxt;\r
-       const osm_physp_t *p_physp, *p_remote_physp;\r
-       const ib_port_info_t *p_pi;\r
-       uint8_t port_num;\r
-       uint32_t num_ports;\r
-       uint8_t node_type;\r
-\r
-       node_type = osm_node_get_type(p_node);\r
-\r
-       num_ports = osm_node_get_num_physp(p_node);\r
-       port_num = node_type == IB_NODE_TYPE_SWITCH ? 0 : 1;\r
-       for (; port_num < num_ports; port_num++) {\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               fprintf(file, "%-11s : %s : %02X :",\r
-                       osm_get_manufacturer_str(cl_ntoh64\r
-                                                (osm_node_get_node_guid\r
-                                                 (p_node))),\r
-                       osm_get_node_type_str_fixed_width(node_type), port_num);\r
-\r
-               p_pi = &p_physp->port_info;\r
-\r
-               /*\r
-                * Port state is not defined for switch port 0\r
-                */\r
-               if (port_num == 0)\r
-                       fprintf(file, "     :");\r
-               else\r
-                       fprintf(file, " %s :",\r
-                               osm_get_port_state_str_fixed_width\r
-                               (ib_port_info_get_port_state(p_pi)));\r
-\r
-               /*\r
-                * LID values are only meaningful in select cases.\r
-                */\r
-               if (ib_port_info_get_port_state(p_pi) != IB_LINK_DOWN\r
-                   && ((node_type == IB_NODE_TYPE_SWITCH && port_num == 0)\r
-                       || node_type != IB_NODE_TYPE_SWITCH))\r
-                       fprintf(file, " %04X :  %01X  :",\r
-                               cl_ntoh16(p_pi->base_lid),\r
-                               ib_port_info_get_lmc(p_pi));\r
-               else\r
-                       fprintf(file, "      :     :");\r
-\r
-               if (port_num != 0)\r
-                       fprintf(file, " %s : %s : %s ",\r
-                               osm_get_mtu_str\r
-                               (ib_port_info_get_neighbor_mtu(p_pi)),\r
-                               osm_get_lwa_str(p_pi->link_width_active),\r
-                               osm_get_lsa_str\r
-                               (ib_port_info_get_link_speed_active(p_pi)));\r
-               else\r
-                       fprintf(file, "      :     :     ");\r
-\r
-               if (osm_physp_get_port_guid(p_physp) == osm->subn.sm_port_guid)\r
-                       fprintf(file, "* %016" PRIx64 " *",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)));\r
-               else\r
-                       fprintf(file, ": %016" PRIx64 " :",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)));\r
-\r
-               if (port_num\r
-                   && (ib_port_info_get_port_state(p_pi) != IB_LINK_DOWN)) {\r
-                       p_remote_physp = osm_physp_get_remote(p_physp);\r
-                       if (p_remote_physp)\r
-                               fprintf(file, " %016" PRIx64 " (%02X)",\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_remote_physp)),\r
-                                       osm_physp_get_port_num(p_remote_physp));\r
-                       else\r
-                               fprintf(file, " UNKNOWN");\r
-               }\r
-\r
-               fprintf(file, "\n");\r
-       }\r
-\r
-       fprintf(file, "------------------------------------------------------"\r
-               "------------------------------------------------\n");\r
-}\r
-\r
-struct dump_context {\r
-       osm_opensm_t *p_osm;\r
-       FILE *file;\r
-       void (*func) (cl_map_item_t *, FILE *, void *);\r
-       void *cxt;\r
-};\r
-\r
-static void dump_item(cl_map_item_t * item, void *cxt)\r
-{\r
-       ((struct dump_context *)cxt)->func(item,\r
-                                          ((struct dump_context *)cxt)->file,\r
-                                          ((struct dump_context *)cxt)->cxt);\r
-}\r
-\r
-static void dump_qmap(FILE * file, cl_qmap_t * map,\r
-                     void (*func) (cl_map_item_t *, FILE *, void *), void *cxt)\r
-{\r
-       struct dump_context dump_context;\r
-\r
-       dump_context.file = file;\r
-       dump_context.func = func;\r
-       dump_context.cxt = cxt;\r
-\r
-       cl_qmap_apply_func(map, dump_item, &dump_context);\r
-}\r
-\r
-void osm_dump_qmap_to_file(osm_opensm_t * p_osm, const char *file_name,\r
-                          cl_qmap_t * map,\r
-                          void (*func) (cl_map_item_t *, FILE *, void *),\r
-                          void *cxt)\r
-{\r
-       char path[1024];\r
-       FILE *file;\r
-\r
-       snprintf(path, sizeof(path), "%s/%s",\r
-                p_osm->subn.opt.dump_files_dir, file_name);\r
-\r
-       file = fopen(path, "w");\r
-       if (!file) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                       "cannot create file \'%s\': %s\n",\r
-                       path, strerror(errno));\r
-               return;\r
-       }\r
-\r
-       dump_qmap(file, map, func, cxt);\r
-\r
-       fclose(file);\r
-}\r
-\r
-\r
-static void print_report(osm_opensm_t * osm, FILE * file)\r
-{\r
-       fprintf(file, "\n==================================================="\r
-               "====================================================\n"\r
-               "Vendor      : Ty : #  : Sta : LID  : LMC : MTU  : LWA :"\r
-               " LSA : Port GUID        : Neighbor Port (Port #)\n");\r
-       dump_qmap(stdout, &osm->subn.node_guid_tbl, print_node_report, osm);\r
-}\r
-\r
-void osm_dump_mcast_routes(osm_opensm_t * osm)\r
-{\r
-       if (osm_log_is_active(&osm->log, OSM_LOG_ROUTING))\r
-               /* multicast routes */\r
-               osm_dump_qmap_to_file(osm, "opensm.mcfdbs",\r
-                                     &osm->subn.sw_guid_tbl,\r
-                                     dump_mcast_routes, osm);\r
-}\r
-\r
-void osm_dump_all(osm_opensm_t * osm)\r
-{\r
-       if (osm_log_is_active(&osm->log, OSM_LOG_ROUTING)) {\r
-               /* unicast routes */\r
-               osm_dump_qmap_to_file(osm, "opensm-lid-matrix.dump",\r
-                                     &osm->subn.sw_guid_tbl, dump_lid_matrix,\r
-                                     osm);\r
-               osm_dump_qmap_to_file(osm, "opensm-lfts.dump",\r
-                                     &osm->subn.sw_guid_tbl, dump_ucast_lfts,\r
-                                     osm);\r
-               if (osm_log_is_active(&osm->log, OSM_LOG_DEBUG))\r
-                       dump_qmap(stdout, &osm->subn.sw_guid_tbl,\r
-                                 dump_ucast_path_distribution, osm);\r
-               osm_dump_qmap_to_file(osm, "opensm.fdbs",\r
-                                     &osm->subn.sw_guid_tbl,\r
-                                     dump_ucast_routes, osm);\r
-               /* multicast routes */\r
-               osm_dump_qmap_to_file(osm, "opensm.mcfdbs",\r
-                                     &osm->subn.sw_guid_tbl,\r
-                                     dump_mcast_routes, osm);\r
-       }\r
-       osm_dump_qmap_to_file(osm, "opensm-subnet.lst",\r
-                             &osm->subn.node_guid_tbl, dump_topology_node,\r
-                             osm);\r
-       if (osm_log_is_active(&osm->log, OSM_LOG_VERBOSE))\r
-               print_report(osm, stdout);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_event_plugin.c b/branches/opensm_3/user/opensm/osm_event_plugin.c
deleted file mode 100644 (file)
index dbf5a64..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*\r
- * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/****h* OpenSM Event plugin interface\r
-* DESCRIPTION\r
-*       Database interface to record subnet events\r
-*\r
-*       Implementations of this object _MUST_ be thread safe.\r
-*\r
-* AUTHOR\r
-*      Ira Weiny, LLNL\r
-*\r
-*********/\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <dlfcn.h>\r
-#include <opensm/osm_event_plugin.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-#if defined(PATH_MAX)\r
-#define OSM_PATH_MAX   (PATH_MAX + 1)\r
-#elif defined (_POSIX_PATH_MAX)\r
-#define OSM_PATH_MAX   (_POSIX_PATH_MAX + 1)\r
-#else\r
-#define OSM_PATH_MAX   256\r
-#endif\r
-\r
-/**\r
- * functions\r
- */\r
-osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name)\r
-{\r
-       char lib_name[OSM_PATH_MAX];\r
-       struct old_if { unsigned ver; } *old_impl;\r
-       osm_epi_plugin_t *rc = NULL;\r
-\r
-       if (!plugin_name || !*plugin_name)\r
-               return NULL;\r
-\r
-       /* find the plugin */\r
-       snprintf(lib_name, sizeof(lib_name), "lib%s.so", plugin_name);\r
-\r
-       rc = malloc(sizeof(*rc));\r
-       if (!rc)\r
-               return NULL;\r
-\r
-       rc->handle = dlopen(lib_name, RTLD_LAZY);\r
-       if (!rc->handle) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "Failed to open event plugin \"%s\" : \"%s\"\n",\r
-                       lib_name, dlerror());\r
-               goto DLOPENFAIL;\r
-       }\r
-\r
-       rc->impl =\r
-           (osm_event_plugin_t *) dlsym(rc->handle,\r
-                                        OSM_EVENT_PLUGIN_IMPL_NAME);\r
-       if (!rc->impl) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "Failed to find \"%s\" symbol in \"%s\" : \"%s\"\n",\r
-                       OSM_EVENT_PLUGIN_IMPL_NAME, lib_name, dlerror());\r
-               goto Exit;\r
-       }\r
-\r
-       /* check for old interface */\r
-       old_impl = (struct old_if *) rc->impl;\r
-       if (old_impl->ver == OSM_ORIG_EVENT_PLUGIN_INTERFACE_VER) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR, "Error loading plugin: "\r
-                       "\'%s\' contains a depricated interface version %d\n"\r
-                       "   Please recompile with the new interface.\n",\r
-                       plugin_name, old_impl->ver);\r
-               goto Exit;\r
-       }\r
-\r
-       /* Check the version to make sure this module will work with us */\r
-       if (strcmp(rc->impl->osm_version, osm->osm_version)) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR, "Error loading plugin"\r
-                       " \'%s\': OpenSM version mismatch - plugin was built"\r
-                       " against %s version of OpenSM. Skip loading.\n",\r
-                       plugin_name, rc->impl->osm_version);\r
-               goto Exit;\r
-       }\r
-\r
-       if (!rc->impl->create) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "Error loading plugin \'%s\': no create() method.\n",\r
-                       plugin_name);\r
-               goto Exit;\r
-       }\r
-\r
-       rc->plugin_data = rc->impl->create(osm);\r
-\r
-       if (!rc->plugin_data)\r
-               goto Exit;\r
-\r
-       rc->plugin_name = strdup(plugin_name);\r
-       return rc;\r
-\r
-Exit:\r
-       dlclose(rc->handle);\r
-DLOPENFAIL:\r
-       free(rc);\r
-       return NULL;\r
-}\r
-\r
-void osm_epi_destroy(osm_epi_plugin_t * plugin)\r
-{\r
-       if (plugin) {\r
-               if (plugin->impl->delete)\r
-                       plugin->impl->delete(plugin->plugin_data);\r
-               dlclose(plugin->handle);\r
-               free(plugin->plugin_name);\r
-               free(plugin);\r
-       }\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_files.c b/branches/opensm_3/user/opensm/osm_files.c
deleted file mode 100644 (file)
index 0540861..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*\r
- * [4-15-2010]\r
- *\r
- * files moved from SOURCES to here to decrease opensm.exe build time.\r
- * Reduced OpenSM.exe build time by 29 seconds.\r
- */\r
-\r
-#include <main.c>\r
-#include <osm_console.c>\r
-#include <osm_console_io.c>\r
-#include <osm_db_files.c>\r
-#include <osm_helper.c>\r
-#include <osm_db_pack.c>\r
-#include <osm_drop_mgr.c>\r
-#include <osm_dump.c>\r
-#include <osm_event_plugin.c>\r
-#include <osm_inform.c>\r
-#include <osm_lid_mgr.c>\r
-#include <osm_link_mgr.c>\r
-#include <osm_lin_fwd_rcv.c>\r
-#include <osm_log.c>\r
-#include <osm_mad_pool.c>\r
-#include <osm_mcast_fwd_rcv.c>\r
-#include <osm_mcast_mgr.c>\r
-#include <osm_mcast_tbl.c>\r
-#include <osm_mcm_port.c>\r
-#include <osm_mesh.c>\r
-#include <osm_mtree.c>\r
-#include <osm_multicast.c>\r
-#include <osm_node.c>\r
-#include <osm_node_desc_rcv.c>\r
-#include <osm_node_info_rcv.c>\r
-#include <osm_opensm.c>\r
-#include <osm_perfmgr.c>\r
-#include <osm_perfmgr_db.c>\r
-#include <osm_pkey.c>\r
-#include <osm_pkey_mgr.c>\r
-#include <osm_pkey_rcv.c>\r
-#include <osm_port.c>\r
-#include <osm_port_info_rcv.c>\r
-#include <osm_prtn.c>\r
-#include <osm_prtn_config.c>\r
-#include <osm_qos.c>\r
-#include <osm_qos_policy.c>\r
-#include <osm_remote_sm.c>\r
-#include <osm_req.c>\r
-#include <osm_resp.c>\r
-#include <osm_router.c>\r
-#include <osm_sa.c>\r
-#include <osm_sa_class_port_info.c>\r
-#include <osm_sa_guidinfo_record.c>\r
-#include <osm_sa_informinfo.c>\r
-#include <osm_sa_lft_record.c>\r
-#include <osm_sa_link_record.c>\r
-#include <osm_sa_mad_ctrl.c>\r
-#include <osm_sa_mft_record.c>\r
-#include <osm_sa_multipath_record.c>\r
-#include <osm_sa_node_record.c>\r
-#include <osm_sa_pkey_record.c>\r
-#include <osm_sa_portinfo_record.c>\r
-#include <osm_sa_service_record.c>\r
-#include <osm_sa_slvl_record.c>\r
-#include <osm_sa_sminfo_record.c>\r
-#include <osm_sa_sw_info_record.c>\r
-#include <osm_sa_vlarb_record.c>\r
-#include <osm_service.c>\r
-#include <osm_slvl_map_rcv.c>\r
-#include <osm_sm.c>\r
-#include <osm_sminfo_rcv.c>\r
-#include <osm_sm_mad_ctrl.c>\r
-#include <osm_sm_state_mgr.c>\r
-#include <osm_state_mgr.c>\r
-#include <osm_subnet.c>\r
-#include <osm_switch.c>\r
-#include <osm_sw_info_rcv.c>\r
-#include <osm_trap_rcv.c>\r
-#include <osm_ucast_cache.c>\r
-#include <osm_ucast_file.c>\r
-#include <osm_ucast_ftree.c>\r
-#include <osm_ucast_lash.c>\r
-#include <osm_ucast_mgr.c>\r
-#include <osm_ucast_updn.c>\r
-#include <osm_vl15intf.c>\r
-#include <osm_vl_arb_rcv.c>\r
-#include <st.c>\r
-\r
diff --git a/branches/opensm_3/user/opensm/osm_helper.c b/branches/opensm_3/user/opensm/osm_helper.c
deleted file mode 100644 (file)
index 15b6a2a..0000000
+++ /dev/null
@@ -1,2254 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of opensm helper functions.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_log.h>\r
-\r
-#define LINE_LENGTH 256\r
-\r
-#define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))\r
-\r
-/* we use two tables - one for queries and one for responses */\r
-static const char *ib_sa_method_str[] = {\r
-       "RESERVED",             /* 0 */\r
-       "SubnAdmGet",           /* 1 */\r
-       "SubnAdmSet",           /* 2 */\r
-       "RESERVED",             /* 3 */\r
-       "RESERVED",             /* 4 */\r
-       "RESERVED",             /* 5 */\r
-       "SubnAdmReport",        /* 6 */\r
-       "RESERVED",             /* 7 */\r
-       "RESERVED",             /* 8 */\r
-       "RESERVED",             /* 9 */\r
-       "RESERVED",             /* A */\r
-       "RESERVED",             /* B */\r
-       "RESERVED",             /* C */\r
-       "RESERVED",             /* D */\r
-       "RESERVED",             /* E */\r
-       "RESERVED",             /* F */\r
-       "RESERVED",             /* 10 */\r
-       "RESERVED",             /* 11 */\r
-       "SubnAdmGetTable",      /* 12 */\r
-       "SubnAdmGetTraceTable", /* 13 */\r
-       "SubnAdmGetMulti",      /* 14 */\r
-       "SubnAdmDelete",        /* 15 */\r
-       "UNKNOWN"               /* 16 */\r
-};\r
-\r
-static const char *ib_sa_resp_method_str[] = {\r
-       "RESERVED",             /* 80 */\r
-       "SubnAdmGetResp",       /* 81 */\r
-       "RESERVED (SetResp?)",  /* 82 */\r
-       "RESERVED",             /* 83 */\r
-       "RESERVED",             /* 84 */\r
-       "RESERVED",             /* 85 */\r
-       "SubnAdmReportResp",    /* 86 */\r
-       "RESERVED",             /* 87 */\r
-       "RESERVED",             /* 88 */\r
-       "RESERVED",             /* 89 */\r
-       "RESERVED",             /* 8A */\r
-       "RESERVED",             /* 8B */\r
-       "RESERVED",             /* 8C */\r
-       "RESERVED",             /* 8D */\r
-       "RESERVED",             /* 8E */\r
-       "RESERVED",             /* 8F */\r
-       "RESERVED",             /* 90 */\r
-       "RESERVED",             /* 91 */\r
-       "SubnAdmGetTableResp",  /* 92 */\r
-       "RESERVED",             /* 93 */\r
-       "SubnAdmGetMultiResp",  /* 94 */\r
-       "SubnAdmDeleteResp",    /* 95 */\r
-       "UNKNOWN"\r
-};\r
-\r
-#define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16\r
-\r
-static const char *ib_sm_method_str[] = {\r
-       "RESERVED0",            /* 0 */\r
-       "SubnGet",              /* 1 */\r
-       "SubnSet",              /* 2 */\r
-       "RESERVED3",            /* 3 */\r
-       "RESERVED4",            /* 4 */\r
-       "SubnTrap",             /* 5 */\r
-       "RESERVED6",            /* 6 */\r
-       "SubnTrapRepress",      /* 7 */\r
-       "RESERVED8",            /* 8 */\r
-       "RESERVED9",            /* 9 */\r
-       "RESERVEDA",            /* A */\r
-       "RESERVEDB",            /* B */\r
-       "RESERVEDC",            /* C */\r
-       "RESERVEDD",            /* D */\r
-       "RESERVEDE",            /* E */\r
-       "RESERVEDF",            /* F */\r
-       "RESERVED10",           /* 10 */\r
-       "SubnGetResp",          /* 11 */\r
-       "RESERVED12",           /* 12 */\r
-       "RESERVED13",           /* 13 */\r
-       "RESERVED14",           /* 14 */\r
-       "RESERVED15",           /* 15 */\r
-       "RESERVED16",           /* 16 */\r
-       "RESERVED17",           /* 17 */\r
-       "RESERVED18",           /* 18 */\r
-       "RESERVED19",           /* 19 */\r
-       "RESERVED1A",           /* 1A */\r
-       "RESERVED1B",           /* 1B */\r
-       "RESERVED1C",           /* 1C */\r
-       "RESERVED1D",           /* 1D */\r
-       "RESERVED1E",           /* 1E */\r
-       "RESERVED1F",           /* 1F */\r
-       "UNKNOWN"               /* 20 */\r
-};\r
-\r
-#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21\r
-\r
-static const char *ib_sm_attr_str[] = {\r
-       "RESERVED",             /* 0 */\r
-       "ClassPortInfo",        /* 1 */\r
-       "Notice",               /* 2 */\r
-       "InformInfo",           /* 3 */\r
-       "RESERVED",             /* 4 */\r
-       "RESERVED",             /* 5 */\r
-       "RESERVED",             /* 6 */\r
-       "RESERVED",             /* 7 */\r
-       "RESERVED",             /* 8 */\r
-       "RESERVED",             /* 9 */\r
-       "RESERVED",             /* A */\r
-       "RESERVED",             /* B */\r
-       "RESERVED",             /* C */\r
-       "RESERVED",             /* D */\r
-       "RESERVED",             /* E */\r
-       "RESERVED",             /* F */\r
-       "NodeDescription",      /* 10 */\r
-       "NodeInfo",             /* 11 */\r
-       "SwitchInfo",           /* 12 */\r
-       "UNKNOWN",              /* 13 */\r
-       "GUIDInfo",             /* 14 */\r
-       "PortInfo",             /* 15 */\r
-       "P_KeyTable",           /* 16 */\r
-       "SLtoVLMappingTable",   /* 17 */\r
-       "VLArbitrationTable",   /* 18 */\r
-       "LinearForwardingTable",        /* 19 */\r
-       "RandomForwardingTable",        /* 1A */\r
-       "MulticastForwardingTable",     /* 1B */\r
-       "UNKNOWN",              /* 1C */\r
-       "UNKNOWN",              /* 1D */\r
-       "UNKNOWN",              /* 1E */\r
-       "UNKNOWN",              /* 1F */\r
-       "SMInfo",               /* 20 */\r
-       "UNKNOWN"               /* 21 - always highest value */\r
-};\r
-\r
-#define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21\r
-\r
-static const char *ib_sa_attr_str[] = {\r
-       "RESERVED",             /* 0 */\r
-       "ClassPortInfo",        /* 1 */\r
-       "Notice",               /* 2 */\r
-       "InformInfo",           /* 3 */\r
-       "RESERVED",             /* 4 */\r
-       "RESERVED",             /* 5 */\r
-       "RESERVED",             /* 6 */\r
-       "RESERVED",             /* 7 */\r
-       "RESERVED",             /* 8 */\r
-       "RESERVED",             /* 9 */\r
-       "RESERVED",             /* A */\r
-       "RESERVED",             /* B */\r
-       "RESERVED",             /* C */\r
-       "RESERVED",             /* D */\r
-       "RESERVED",             /* E */\r
-       "RESERVED",             /* F */\r
-       "RESERVED",             /* 10 */\r
-       "NodeRecord",           /* 11 */\r
-       "PortInfoRecord",       /* 12 */\r
-       "SLtoVLMappingTableRecord",     /* 13 */\r
-       "SwitchInfoRecord",     /* 14 */\r
-       "LinearForwardingTableRecord",  /* 15 */\r
-       "RandomForwardingTableRecord",  /* 16 */\r
-       "MulticastForwardingTableRecord",       /* 17 */\r
-       "SMInfoRecord",         /* 18 */\r
-       "RESERVED",             /* 19 */\r
-       "RandomForwardingTable",        /* 1A */\r
-       "MulticastForwardingTable",     /* 1B */\r
-       "UNKNOWN",              /* 1C */\r
-       "UNKNOWN",              /* 1D */\r
-       "UNKNOWN",              /* 1E */\r
-       "UNKNOWN",              /* 1F */\r
-       "LinkRecord",           /* 20 */\r
-       "UNKNOWN",              /* 21 */\r
-       "UNKNOWN",              /* 22 */\r
-       "UNKNOWN",              /* 23 */\r
-       "UNKNOWN",              /* 24 */\r
-       "UNKNOWN",              /* 25 */\r
-       "UNKNOWN",              /* 26 */\r
-       "UNKNOWN",              /* 27 */\r
-       "UNKNOWN",              /* 28 */\r
-       "UNKNOWN",              /* 29 */\r
-       "UNKNOWN",              /* 2A */\r
-       "UNKNOWN",              /* 2B */\r
-       "UNKNOWN",              /* 2C */\r
-       "UNKNOWN",              /* 2D */\r
-       "UNKNOWN",              /* 2E */\r
-       "UNKNOWN",              /* 2F */\r
-       "GuidInfoRecord",       /* 30 */\r
-       "ServiceRecord",        /* 31 */\r
-       "UNKNOWN",              /* 32 */\r
-       "P_KeyTableRecord",     /* 33 */\r
-       "UNKNOWN",              /* 34 */\r
-       "PathRecord",           /* 35 */\r
-       "VLArbitrationTableRecord",     /* 36 */\r
-       "UNKNOWN",              /* 37 */\r
-       "MCMemberRecord",       /* 38 */\r
-       "TraceRecord",          /* 39 */\r
-       "MultiPathRecord",      /* 3A */\r
-       "ServiceAssociationRecord",     /* 3B */\r
-       "UNKNOWN",              /* 3C */\r
-       "UNKNOWN",              /* 3D */\r
-       "UNKNOWN",              /* 3E */\r
-       "UNKNOWN",              /* 3F */\r
-       "UNKNOWN",              /* 40 */\r
-       "UNKNOWN",              /* 41 */\r
-       "UNKNOWN",              /* 42 */\r
-       "UNKNOWN",              /* 43 */\r
-       "UNKNOWN",              /* 44 */\r
-       "UNKNOWN",              /* 45 */\r
-       "UNKNOWN",              /* 46 */\r
-       "UNKNOWN",              /* 47 */\r
-       "UNKNOWN",              /* 48 */\r
-       "UNKNOWN",              /* 49 */\r
-       "UNKNOWN",              /* 4A */\r
-       "UNKNOWN",              /* 4B */\r
-       "UNKNOWN",              /* 4C */\r
-       "UNKNOWN",              /* 4D */\r
-       "UNKNOWN",              /* 4E */\r
-       "UNKNOWN",              /* 4F */\r
-       "UNKNOWN",              /* 50 */\r
-       "UNKNOWN",              /* 51 */\r
-       "UNKNOWN",              /* 52 */\r
-       "UNKNOWN",              /* 53 */\r
-       "UNKNOWN",              /* 54 */\r
-       "UNKNOWN",              /* 55 */\r
-       "UNKNOWN",              /* 56 */\r
-       "UNKNOWN",              /* 57 */\r
-       "UNKNOWN",              /* 58 */\r
-       "UNKNOWN",              /* 59 */\r
-       "UNKNOWN",              /* 5A */\r
-       "UNKNOWN",              /* 5B */\r
-       "UNKNOWN",              /* 5C */\r
-       "UNKNOWN",              /* 5D */\r
-       "UNKNOWN",              /* 5E */\r
-       "UNKNOWN",              /* 5F */\r
-       "UNKNOWN",              /* 60 */\r
-       "UNKNOWN",              /* 61 */\r
-       "UNKNOWN",              /* 62 */\r
-       "UNKNOWN",              /* 63 */\r
-       "UNKNOWN",              /* 64 */\r
-       "UNKNOWN",              /* 65 */\r
-       "UNKNOWN",              /* 66 */\r
-       "UNKNOWN",              /* 67 */\r
-       "UNKNOWN",              /* 68 */\r
-       "UNKNOWN",              /* 69 */\r
-       "UNKNOWN",              /* 6A */\r
-       "UNKNOWN",              /* 6B */\r
-       "UNKNOWN",              /* 6C */\r
-       "UNKNOWN",              /* 6D */\r
-       "UNKNOWN",              /* 6E */\r
-       "UNKNOWN",              /* 6F */\r
-       "UNKNOWN",              /* 70 */\r
-       "UNKNOWN",              /* 71 */\r
-       "UNKNOWN",              /* 72 */\r
-       "UNKNOWN",              /* 73 */\r
-       "UNKNOWN",              /* 74 */\r
-       "UNKNOWN",              /* 75 */\r
-       "UNKNOWN",              /* 76 */\r
-       "UNKNOWN",              /* 77 */\r
-       "UNKNOWN",              /* 78 */\r
-       "UNKNOWN",              /* 79 */\r
-       "UNKNOWN",              /* 7A */\r
-       "UNKNOWN",              /* 7B */\r
-       "UNKNOWN",              /* 7C */\r
-       "UNKNOWN",              /* 7D */\r
-       "UNKNOWN",              /* 7E */\r
-       "UNKNOWN",              /* 7F */\r
-       "UNKNOWN",              /* 80 */\r
-       "UNKNOWN",              /* 81 */\r
-       "UNKNOWN",              /* 82 */\r
-       "UNKNOWN",              /* 83 */\r
-       "UNKNOWN",              /* 84 */\r
-       "UNKNOWN",              /* 85 */\r
-       "UNKNOWN",              /* 86 */\r
-       "UNKNOWN",              /* 87 */\r
-       "UNKNOWN",              /* 88 */\r
-       "UNKNOWN",              /* 89 */\r
-       "UNKNOWN",              /* 8A */\r
-       "UNKNOWN",              /* 8B */\r
-       "UNKNOWN",              /* 8C */\r
-       "UNKNOWN",              /* 8D */\r
-       "UNKNOWN",              /* 8E */\r
-       "UNKNOWN",              /* 8F */\r
-       "UNKNOWN",              /* 90 */\r
-       "UNKNOWN",              /* 91 */\r
-       "UNKNOWN",              /* 92 */\r
-       "UNKNOWN",              /* 93 */\r
-       "UNKNOWN",              /* 94 */\r
-       "UNKNOWN",              /* 95 */\r
-       "UNKNOWN",              /* 96 */\r
-       "UNKNOWN",              /* 97 */\r
-       "UNKNOWN",              /* 98 */\r
-       "UNKNOWN",              /* 99 */\r
-       "UNKNOWN",              /* 9A */\r
-       "UNKNOWN",              /* 9B */\r
-       "UNKNOWN",              /* 9C */\r
-       "UNKNOWN",              /* 9D */\r
-       "UNKNOWN",              /* 9E */\r
-       "UNKNOWN",              /* 9F */\r
-       "UNKNOWN",              /* A0 */\r
-       "UNKNOWN",              /* A1 */\r
-       "UNKNOWN",              /* A2 */\r
-       "UNKNOWN",              /* A3 */\r
-       "UNKNOWN",              /* A4 */\r
-       "UNKNOWN",              /* A5 */\r
-       "UNKNOWN",              /* A6 */\r
-       "UNKNOWN",              /* A7 */\r
-       "UNKNOWN",              /* A8 */\r
-       "UNKNOWN",              /* A9 */\r
-       "UNKNOWN",              /* AA */\r
-       "UNKNOWN",              /* AB */\r
-       "UNKNOWN",              /* AC */\r
-       "UNKNOWN",              /* AD */\r
-       "UNKNOWN",              /* AE */\r
-       "UNKNOWN",              /* AF */\r
-       "UNKNOWN",              /* B0 */\r
-       "UNKNOWN",              /* B1 */\r
-       "UNKNOWN",              /* B2 */\r
-       "UNKNOWN",              /* B3 */\r
-       "UNKNOWN",              /* B4 */\r
-       "UNKNOWN",              /* B5 */\r
-       "UNKNOWN",              /* B6 */\r
-       "UNKNOWN",              /* B7 */\r
-       "UNKNOWN",              /* B8 */\r
-       "UNKNOWN",              /* B9 */\r
-       "UNKNOWN",              /* BA */\r
-       "UNKNOWN",              /* BB */\r
-       "UNKNOWN",              /* BC */\r
-       "UNKNOWN",              /* BD */\r
-       "UNKNOWN",              /* BE */\r
-       "UNKNOWN",              /* BF */\r
-       "UNKNOWN",              /* C0 */\r
-       "UNKNOWN",              /* C1 */\r
-       "UNKNOWN",              /* C2 */\r
-       "UNKNOWN",              /* C3 */\r
-       "UNKNOWN",              /* C4 */\r
-       "UNKNOWN",              /* C5 */\r
-       "UNKNOWN",              /* C6 */\r
-       "UNKNOWN",              /* C7 */\r
-       "UNKNOWN",              /* C8 */\r
-       "UNKNOWN",              /* C9 */\r
-       "UNKNOWN",              /* CA */\r
-       "UNKNOWN",              /* CB */\r
-       "UNKNOWN",              /* CC */\r
-       "UNKNOWN",              /* CD */\r
-       "UNKNOWN",              /* CE */\r
-       "UNKNOWN",              /* CF */\r
-       "UNKNOWN",              /* D0 */\r
-       "UNKNOWN",              /* D1 */\r
-       "UNKNOWN",              /* D2 */\r
-       "UNKNOWN",              /* D3 */\r
-       "UNKNOWN",              /* D4 */\r
-       "UNKNOWN",              /* D5 */\r
-       "UNKNOWN",              /* D6 */\r
-       "UNKNOWN",              /* D7 */\r
-       "UNKNOWN",              /* D8 */\r
-       "UNKNOWN",              /* D9 */\r
-       "UNKNOWN",              /* DA */\r
-       "UNKNOWN",              /* DB */\r
-       "UNKNOWN",              /* DC */\r
-       "UNKNOWN",              /* DD */\r
-       "UNKNOWN",              /* DE */\r
-       "UNKNOWN",              /* DF */\r
-       "UNKNOWN",              /* E0 */\r
-       "UNKNOWN",              /* E1 */\r
-       "UNKNOWN",              /* E2 */\r
-       "UNKNOWN",              /* E3 */\r
-       "UNKNOWN",              /* E4 */\r
-       "UNKNOWN",              /* E5 */\r
-       "UNKNOWN",              /* E6 */\r
-       "UNKNOWN",              /* E7 */\r
-       "UNKNOWN",              /* E8 */\r
-       "UNKNOWN",              /* E9 */\r
-       "UNKNOWN",              /* EA */\r
-       "UNKNOWN",              /* EB */\r
-       "UNKNOWN",              /* EC */\r
-       "UNKNOWN",              /* ED */\r
-       "UNKNOWN",              /* EE */\r
-       "UNKNOWN",              /* EF */\r
-       "UNKNOWN",              /* F0 */\r
-       "UNKNOWN",              /* F1 */\r
-       "UNKNOWN",              /* F2 */\r
-       "InformInfoRecord",     /* F3 */\r
-       "UNKNOWN"               /* F4 - always highest value */\r
-};\r
-\r
-#define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4\r
-\r
-static int sprint_uint8_arr(char *buf, size_t size,\r
-                           const uint8_t * arr, size_t len)\r
-{\r
-       unsigned int n, i;\r
-       for (i = 0, n = 0; i < len; i++) {\r
-               n += snprintf(buf + n, size - n, "%s%u", i == 0 ? "" : ",",\r
-                             arr[i]);\r
-               if (n >= size)\r
-                       break;\r
-       }\r
-       return n;\r
-}\r
-\r
-const char *ib_get_sa_method_str(IN uint8_t method)\r
-{\r
-       if (method & 0x80) {\r
-               method = method & 0x7f;\r
-               if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)\r
-                       method = OSM_SA_METHOD_STR_UNKNOWN_VAL;\r
-               /* it is a response - use the response table */\r
-               return ib_sa_resp_method_str[method];\r
-       } else {\r
-               if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)\r
-                       method = OSM_SA_METHOD_STR_UNKNOWN_VAL;\r
-               return ib_sa_method_str[method];\r
-       }\r
-}\r
-\r
-const char *ib_get_sm_method_str(IN uint8_t method)\r
-{\r
-       if (method & 0x80)\r
-               method = (method & 0x0F) | 0x10;\r
-       if (method > OSM_SM_METHOD_STR_UNKNOWN_VAL)\r
-               method = OSM_SM_METHOD_STR_UNKNOWN_VAL;\r
-       return ib_sm_method_str[method];\r
-}\r
-\r
-const char *ib_get_sm_attr_str(IN ib_net16_t attr)\r
-{\r
-       uint16_t host_attr = cl_ntoh16(attr);\r
-\r
-       if (host_attr > OSM_SM_ATTR_STR_UNKNOWN_VAL)\r
-               host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;\r
-\r
-       return ib_sm_attr_str[host_attr];\r
-}\r
-\r
-const char *ib_get_sa_attr_str(IN ib_net16_t attr)\r
-{\r
-       uint16_t host_attr = cl_ntoh16(attr);\r
-\r
-       if (host_attr > OSM_SA_ATTR_STR_UNKNOWN_VAL)\r
-               host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL;\r
-\r
-       return ib_sa_attr_str[host_attr];\r
-}\r
-\r
-const char *ib_get_trap_str(ib_net16_t trap_num)\r
-{\r
-       switch (cl_ntoh16(trap_num)) {\r
-       case 64:\r
-               return "GID in service";\r
-       case 65:\r
-               return "GID out of service";\r
-       case 66:\r
-               return "New mcast group created";\r
-       case 67:\r
-               return "Mcast group deleted";\r
-       case 68:\r
-               return "UnPath, Path no longer valid";\r
-       case 69:\r
-               return "RePath, Path recomputed";\r
-       case 128:\r
-               return "Link state change";\r
-       case 129:\r
-               return "Local Link integrity threshold reached";\r
-       case 130:\r
-               return "Excessive Buffer Overrun Threshold reached";\r
-       case 131:\r
-               return "Flow Control Update watchdog timer expired";\r
-       case 144:\r
-               return\r
-                   "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled, SM priority changed";\r
-       case 145:\r
-               return "System Image GUID changed";\r
-       case 256:\r
-               return "Bad M_Key";\r
-       case 257:\r
-               return "Bad P_Key";\r
-       case 258:\r
-               return "Bad Q_Key";\r
-       case 259:\r
-               return "Bad P_Key (switch external port)";\r
-       default:\r
-               break;\r
-       }\r
-       return "Unknown";\r
-}\r
-\r
-const ib_gid_t ib_zero_gid = { {0} };\r
-\r
-static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size,\r
-                                  IN const char *p_prefix_str,\r
-                                  IN const char *p_new_str,\r
-                                  IN uint32_t * p_total_len)\r
-{\r
-       char line[LINE_LENGTH];\r
-       uint32_t len;\r
-\r
-       sprintf(line, "%s%s", p_prefix_str, p_new_str);\r
-       len = (uint32_t) strlen(line);\r
-       *p_total_len += len;\r
-       if (*p_total_len + sizeof('\0') > buf_size)\r
-               return IB_INSUFFICIENT_MEMORY;\r
-\r
-       strcpy(*pp_local, line);\r
-       *pp_local += len;\r
-       return IB_SUCCESS;\r
-}\r
-\r
-static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size,\r
-                                    IN const char *p_prefix_str,\r
-                                    IN const ib_port_info_t * p_pi)\r
-{\r
-       uint32_t total_len = 0;\r
-       char *p_local = p_buf;\r
-\r
-       strcpy(p_local, "Capability Mask:\n");\r
-       p_local += strlen(p_local);\r
-\r
-       if (p_pi->capability_mask & IB_PORT_CAP_RESV0) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_RESV0\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_IS_SM\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_NOTICE\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_TRAP\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_IPD) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_IPD\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_AUTO_MIG\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_SL_MAP\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_NV_MKEY\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_NV_PKEY\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_LED_INFO\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_SM_DISAB) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_SM_DISAB\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_SYS_IMG_GUID\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_RESV13) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_RESV13\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_RESV14\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_RESV15) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_RESV15\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_COM_MGT\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_SNMP\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_REINIT) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_REINIT\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_DEV_MGT\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_VEND_CLS\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_DR_NTC\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_CAP_NTC\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_BM) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_BM\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_LINK_RT_LATENCY\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_CLIENT_REREG\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_MADS) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_VEND_MADS\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_FDB_TOP) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_MCAST_FDB_TOP\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-       if (p_pi->capability_mask & IB_PORT_CAP_HAS_HIER_INFO) {\r
-               if (dbg_do_line(&p_local, buf_size, p_prefix_str,\r
-                               "IB_PORT_CAP_HAS_HIER_INFO\n",\r
-                               &total_len) != IB_SUCCESS)\r
-                       return;\r
-       }\r
-}\r
-\r
-void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,\r
-                       IN ib_net64_t port_guid, IN uint8_t port_num,\r
-                       IN const ib_port_info_t * p_pi,\r
-                       IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-\r
-               osm_log(p_log, log_level,\r
-                       "PortInfo dump:\n"\r
-                       "\t\t\t\tport number.............%u\n"\r
-                       "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tm_key...................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tbase_lid................%u\n"\r
-                       "\t\t\t\tmaster_sm_base_lid......%u\n"\r
-                       "\t\t\t\tcapability_mask.........0x%X\n"\r
-                       "\t\t\t\tdiag_code...............0x%X\n"\r
-                       "\t\t\t\tm_key_lease_period......0x%X\n"\r
-                       "\t\t\t\tlocal_port_num..........%u\n"\r
-                       "\t\t\t\tlink_width_enabled......0x%X\n"\r
-                       "\t\t\t\tlink_width_supported....0x%X\n"\r
-                       "\t\t\t\tlink_width_active.......0x%X\n"\r
-                       "\t\t\t\tlink_speed_supported....0x%X\n"\r
-                       "\t\t\t\tport_state..............%s\n"\r
-                       "\t\t\t\tstate_info2.............0x%X\n"\r
-                       "\t\t\t\tm_key_protect_bits......0x%X\n"\r
-                       "\t\t\t\tlmc.....................0x%X\n"\r
-                       "\t\t\t\tlink_speed..............0x%X\n"\r
-                       "\t\t\t\tmtu_smsl................0x%X\n"\r
-                       "\t\t\t\tvl_cap_init_type........0x%X\n"\r
-                       "\t\t\t\tvl_high_limit...........0x%X\n"\r
-                       "\t\t\t\tvl_arb_high_cap.........0x%X\n"\r
-                       "\t\t\t\tvl_arb_low_cap..........0x%X\n"\r
-                       "\t\t\t\tinit_rep_mtu_cap........0x%X\n"\r
-                       "\t\t\t\tvl_stall_life...........0x%X\n"\r
-                       "\t\t\t\tvl_enforce..............0x%X\n"\r
-                       "\t\t\t\tm_key_violations........0x%X\n"\r
-                       "\t\t\t\tp_key_violations........0x%X\n"\r
-                       "\t\t\t\tq_key_violations........0x%X\n"\r
-                       "\t\t\t\tguid_cap................0x%X\n"\r
-                       "\t\t\t\tclient_reregister.......0x%X\n"\r
-                       "\t\t\t\tmcast_pkey_trap_suppr...0x%X\n"\r
-                       "\t\t\t\tsubnet_timeout..........0x%X\n"\r
-                       "\t\t\t\tresp_time_value.........0x%X\n"\r
-                       "\t\t\t\terror_threshold.........0x%X\n"\r
-                       "\t\t\t\tmax_credit_hint.........0x%X\n"\r
-                       "\t\t\t\tlink_round_trip_latency.0x%X\n",\r
-                       port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),\r
-                       cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),\r
-                       cl_ntoh16(p_pi->base_lid),\r
-                       cl_ntoh16(p_pi->master_sm_base_lid),\r
-                       cl_ntoh32(p_pi->capability_mask),\r
-                       cl_ntoh16(p_pi->diag_code),\r
-                       cl_ntoh16(p_pi->m_key_lease_period),\r
-                       p_pi->local_port_num, p_pi->link_width_enabled,\r
-                       p_pi->link_width_supported, p_pi->link_width_active,\r
-                       ib_port_info_get_link_speed_sup(p_pi),\r
-                       ib_get_port_state_str(ib_port_info_get_port_state\r
-                                             (p_pi)), p_pi->state_info2,\r
-                       ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),\r
-                       p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,\r
-                       p_pi->vl_high_limit, p_pi->vl_arb_high_cap,\r
-                       p_pi->vl_arb_low_cap, p_pi->mtu_cap,\r
-                       p_pi->vl_stall_life, p_pi->vl_enforce,\r
-                       cl_ntoh16(p_pi->m_key_violations),\r
-                       cl_ntoh16(p_pi->p_key_violations),\r
-                       cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,\r
-                       ib_port_info_get_client_rereg(p_pi),\r
-                       ib_port_info_get_mcast_pkey_trap_suppress(p_pi),\r
-                       ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,\r
-                       p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),\r
-                       cl_ntoh32(p_pi->link_rt_latency));\r
-\r
-               /*  show the capabilities mask */\r
-               if (p_pi->capability_mask) {\r
-                       dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",\r
-                                                p_pi);\r
-                       osm_log(p_log, log_level, "%s", buf);\r
-               }\r
-       }\r
-}\r
-\r
-void osm_dump_portinfo_record(IN osm_log_t * p_log,\r
-                             IN const ib_portinfo_record_t * p_pir,\r
-                             IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-               const ib_port_info_t *p_pi = &p_pir->port_info;\r
-\r
-               osm_log(p_log, log_level,\r
-                       "PortInfo Record dump:\n"\r
-                       "\t\t\t\tRID\n"\r
-                       "\t\t\t\tEndPortLid..............%u\n"\r
-                       "\t\t\t\tPortNum.................%u\n"\r
-                       "\t\t\t\tReserved................0x%X\n"\r
-                       "\t\t\t\tPortInfo dump:\n"\r
-                       "\t\t\t\tm_key...................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tbase_lid................%u\n"\r
-                       "\t\t\t\tmaster_sm_base_lid......%u\n"\r
-                       "\t\t\t\tcapability_mask.........0x%X\n"\r
-                       "\t\t\t\tdiag_code...............0x%X\n"\r
-                       "\t\t\t\tm_key_lease_period......0x%X\n"\r
-                       "\t\t\t\tlocal_port_num..........%u\n"\r
-                       "\t\t\t\tlink_width_enabled......0x%X\n"\r
-                       "\t\t\t\tlink_width_supported....0x%X\n"\r
-                       "\t\t\t\tlink_width_active.......0x%X\n"\r
-                       "\t\t\t\tlink_speed_supported....0x%X\n"\r
-                       "\t\t\t\tport_state..............%s\n"\r
-                       "\t\t\t\tstate_info2.............0x%X\n"\r
-                       "\t\t\t\tm_key_protect_bits......0x%X\n"\r
-                       "\t\t\t\tlmc.....................0x%X\n"\r
-                       "\t\t\t\tlink_speed..............0x%X\n"\r
-                       "\t\t\t\tmtu_smsl................0x%X\n"\r
-                       "\t\t\t\tvl_cap_init_type........0x%X\n"\r
-                       "\t\t\t\tvl_high_limit...........0x%X\n"\r
-                       "\t\t\t\tvl_arb_high_cap.........0x%X\n"\r
-                       "\t\t\t\tvl_arb_low_cap..........0x%X\n"\r
-                       "\t\t\t\tinit_rep_mtu_cap........0x%X\n"\r
-                       "\t\t\t\tvl_stall_life...........0x%X\n"\r
-                       "\t\t\t\tvl_enforce..............0x%X\n"\r
-                       "\t\t\t\tm_key_violations........0x%X\n"\r
-                       "\t\t\t\tp_key_violations........0x%X\n"\r
-                       "\t\t\t\tq_key_violations........0x%X\n"\r
-                       "\t\t\t\tguid_cap................0x%X\n"\r
-                       "\t\t\t\tsubnet_timeout..........0x%X\n"\r
-                       "\t\t\t\tresp_time_value.........0x%X\n"\r
-                       "\t\t\t\terror_threshold.........0x%X\n",\r
-                       cl_ntoh16(p_pir->lid), p_pir->port_num, p_pir->resv,\r
-                       cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),\r
-                       cl_ntoh16(p_pi->base_lid),\r
-                       cl_ntoh16(p_pi->master_sm_base_lid),\r
-                       cl_ntoh32(p_pi->capability_mask),\r
-                       cl_ntoh16(p_pi->diag_code),\r
-                       cl_ntoh16(p_pi->m_key_lease_period),\r
-                       p_pi->local_port_num, p_pi->link_width_enabled,\r
-                       p_pi->link_width_supported, p_pi->link_width_active,\r
-                       ib_port_info_get_link_speed_sup(p_pi),\r
-                       ib_get_port_state_str(ib_port_info_get_port_state\r
-                                             (p_pi)), p_pi->state_info2,\r
-                       ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),\r
-                       p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,\r
-                       p_pi->vl_high_limit, p_pi->vl_arb_high_cap,\r
-                       p_pi->vl_arb_low_cap, p_pi->mtu_cap,\r
-                       p_pi->vl_stall_life, p_pi->vl_enforce,\r
-                       cl_ntoh16(p_pi->m_key_violations),\r
-                       cl_ntoh16(p_pi->p_key_violations),\r
-                       cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,\r
-                       ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,\r
-                       p_pi->error_threshold);\r
-\r
-               /*  show the capabilities mask */\r
-               if (p_pi->capability_mask) {\r
-                       dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",\r
-                                                p_pi);\r
-                       osm_log(p_log, log_level, "%s", buf);\r
-               }\r
-       }\r
-}\r
-\r
-void osm_dump_guidinfo_record(IN osm_log_t * p_log,\r
-                             IN const ib_guidinfo_record_t * p_gir,\r
-                             IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               const ib_guid_info_t *p_gi = &p_gir->guid_info;\r
-\r
-               osm_log(p_log, log_level,\r
-                       "GUIDInfo Record dump:\n"\r
-                       "\t\t\t\tRID\n"\r
-                       "\t\t\t\tLid.....................%u\n"\r
-                       "\t\t\t\tBlockNum................0x%X\n"\r
-                       "\t\t\t\tReserved................0x%X\n"\r
-                       "\t\t\t\tGUIDInfo dump:\n"\r
-                       "\t\t\t\tReserved................0x%X\n"\r
-                       "\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",\r
-                       cl_ntoh16(p_gir->lid), p_gir->block_num, p_gir->resv,\r
-                       cl_ntoh32(p_gir->reserved),\r
-                       cl_ntoh64(p_gi->guid[0]), cl_ntoh64(p_gi->guid[1]),\r
-                       cl_ntoh64(p_gi->guid[2]), cl_ntoh64(p_gi->guid[3]),\r
-                       cl_ntoh64(p_gi->guid[4]), cl_ntoh64(p_gi->guid[5]),\r
-                       cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));\r
-       }\r
-}\r
-\r
-void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,\r
-                       IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, log_level,\r
-                       "NodeInfo dump:\n"\r
-                       "\t\t\t\tbase_version............0x%X\n"\r
-                       "\t\t\t\tclass_version...........0x%X\n"\r
-                       "\t\t\t\tnode_type...............%s\n"\r
-                       "\t\t\t\tnum_ports...............%u\n"\r
-                       "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tpartition_cap...........0x%X\n"\r
-                       "\t\t\t\tdevice_id...............0x%X\n"\r
-                       "\t\t\t\trevision................0x%X\n"\r
-                       "\t\t\t\tport_num................%u\n"\r
-                       "\t\t\t\tvendor_id...............0x%X\n",\r
-                       p_ni->base_version, p_ni->class_version,\r
-                       ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,\r
-                       cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),\r
-                       cl_ntoh64(p_ni->port_guid),\r
-                       cl_ntoh16(p_ni->partition_cap),\r
-                       cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),\r
-                       ib_node_info_get_local_port_num(p_ni),\r
-                       cl_ntoh32(ib_node_info_get_vendor_id(p_ni)));\r
-       }\r
-}\r
-\r
-void osm_dump_node_record(IN osm_log_t * p_log,\r
-                         IN const ib_node_record_t * p_nr,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char desc[sizeof(p_nr->node_desc.description) + 1];\r
-               const ib_node_info_t *p_ni = &p_nr->node_info;\r
-\r
-               memcpy(desc, p_nr->node_desc.description,\r
-                      sizeof(p_nr->node_desc.description));\r
-               desc[sizeof(desc) - 1] = '\0';\r
-               osm_log(p_log, log_level,\r
-                       "Node Record dump:\n"\r
-                       "\t\t\t\tRID\n"\r
-                       "\t\t\t\tLid.....................%u\n"\r
-                       "\t\t\t\tReserved................0x%X\n"\r
-                       "\t\t\t\tNodeInfo dump:\n"\r
-                       "\t\t\t\tbase_version............0x%X\n"\r
-                       "\t\t\t\tclass_version...........0x%X\n"\r
-                       "\t\t\t\tnode_type...............%s\n"\r
-                       "\t\t\t\tnum_ports...............%u\n"\r
-                       "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tpartition_cap...........0x%X\n"\r
-                       "\t\t\t\tdevice_id...............0x%X\n"\r
-                       "\t\t\t\trevision................0x%X\n"\r
-                       "\t\t\t\tport_num................%u\n"\r
-                       "\t\t\t\tvendor_id...............0x%X\n"\r
-                       "\t\t\t\tNodeDescription\n"\r
-                       "\t\t\t\t%s\n",\r
-                       cl_ntoh16(p_nr->lid), cl_ntoh16(p_nr->resv),\r
-                       p_ni->base_version, p_ni->class_version,\r
-                       ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,\r
-                       cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),\r
-                       cl_ntoh64(p_ni->port_guid),\r
-                       cl_ntoh16(p_ni->partition_cap),\r
-                       cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),\r
-                       ib_node_info_get_local_port_num(p_ni),\r
-                       cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), desc);\r
-       }\r
-}\r
-\r
-void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char gid_str2[INET6_ADDRSTRLEN];\r
-#ifdef __WIN__\r
-               uint8_t *p_resv = (uint8_t*) &p_pr->resv1;\r
-#endif\r
-               osm_log(p_log, log_level,\r
-                       "PathRecord dump:\n"\r
-                       "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tdgid....................%s\n"\r
-                       "\t\t\t\tsgid....................%s\n"\r
-                       "\t\t\t\tdlid....................%u\n"\r
-                       "\t\t\t\tslid....................%u\n"\r
-                       "\t\t\t\thop_flow_raw............0x%X\n"\r
-                       "\t\t\t\ttclass..................0x%X\n"\r
-                       "\t\t\t\tnum_path_revers.........0x%X\n"\r
-                       "\t\t\t\tpkey....................0x%X\n"\r
-                       "\t\t\t\tqos_class...............0x%X\n"\r
-                       "\t\t\t\tsl......................0x%X\n"\r
-                       "\t\t\t\tmtu.....................0x%X\n"\r
-                       "\t\t\t\trate....................0x%X\n"\r
-                       "\t\t\t\tpkt_life................0x%X\n"\r
-                       "\t\t\t\tpreference..............0x%X\n"\r
-                       "\t\t\t\tresv2...................0x%02X%02X%02X%02X%02X%02X\n",\r
-                       cl_ntoh64(p_pr->service_id),\r
-                       inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str,\r
-                                 sizeof gid_str),\r
-                       inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2,\r
-                                 sizeof gid_str2),\r
-                       cl_ntoh16(p_pr->dlid), cl_ntoh16(p_pr->slid),\r
-                       cl_ntoh32(p_pr->hop_flow_raw), p_pr->tclass,\r
-                       p_pr->num_path, cl_ntoh16(p_pr->pkey),\r
-                       ib_path_rec_qos_class(p_pr), ib_path_rec_sl(p_pr),\r
-                       p_pr->mtu, p_pr->rate, p_pr->pkt_life, p_pr->preference,\r
-#ifdef __WIN__\r
-                       p_resv[0], p_resv[1], p_resv[2],\r
-                       p_resv[3], p_resv[4], p_resv[5]);\r
-#else\r
-                       p_pr->resv2[0], p_pr->resv2[1], p_pr->resv2[2],\r
-                       p_pr->resv2[3], p_pr->resv2[4], p_pr->resv2[5]);\r
-#endif\r
-       }\r
-}\r
-\r
-void osm_dump_multipath_record(IN osm_log_t * p_log,\r
-                              IN const ib_multipath_rec_t * p_mpr,\r
-                              IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char buf_line[1024];\r
-               ib_gid_t const *p_gid = p_mpr->gids;\r
-               int i, n = 0;\r
-\r
-               if (p_mpr->sgid_count) {\r
-                       for (i = 0; i < p_mpr->sgid_count; i++) {\r
-                               n += sprintf(buf_line + n,\r
-                                            "\t\t\t\tsgid%02d.................."\r
-                                            "%s\n", i + 1,\r
-                                            inet_ntop(AF_INET6, p_gid->raw,\r
-                                                      gid_str,\r
-                                                      sizeof gid_str));\r
-                               p_gid++;\r
-                       }\r
-               }\r
-               if (p_mpr->dgid_count) {\r
-                       for (i = 0; i < p_mpr->dgid_count; i++) {\r
-                               n += sprintf(buf_line + n,\r
-                                            "\t\t\t\tdgid%02d.................."\r
-                                            "%s\n", i + 1,\r
-                                            inet_ntop(AF_INET6, p_gid->raw,\r
-                                                      gid_str,\r
-                                                      sizeof gid_str));\r
-                               p_gid++;\r
-                       }\r
-               }\r
-               osm_log(p_log, log_level,\r
-                       "MultiPath Record dump:\n"\r
-                       "\t\t\t\thop_flow_raw............0x%X\n"\r
-                       "\t\t\t\ttclass..................0x%X\n"\r
-                       "\t\t\t\tnum_path_revers.........0x%X\n"\r
-                       "\t\t\t\tpkey....................0x%X\n"\r
-                       "\t\t\t\tqos_class...............0x%X\n"\r
-                       "\t\t\t\tsl......................0x%X\n"\r
-                       "\t\t\t\tmtu.....................0x%X\n"\r
-                       "\t\t\t\trate....................0x%X\n"\r
-                       "\t\t\t\tpkt_life................0x%X\n"\r
-                       "\t\t\t\tindependence............0x%X\n"\r
-                       "\t\t\t\tsgid_count..............0x%X\n"\r
-                       "\t\t\t\tdgid_count..............0x%X\n"\r
-                       "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"\r
-                       "%s\n",\r
-                       cl_ntoh32(p_mpr->hop_flow_raw), p_mpr->tclass,\r
-                       p_mpr->num_path, cl_ntoh16(p_mpr->pkey),\r
-                       ib_multipath_rec_qos_class(p_mpr),\r
-                       ib_multipath_rec_sl(p_mpr), p_mpr->mtu, p_mpr->rate,\r
-                       p_mpr->pkt_life, p_mpr->independence,\r
-                       p_mpr->sgid_count, p_mpr->dgid_count,\r
-                       cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),\r
-                       buf_line);\r
-       }\r
-}\r
-\r
-void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,\r
-                       IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char gid_str2[INET6_ADDRSTRLEN];\r
-               osm_log(p_log, log_level,\r
-                       "MCMember Record dump:\n"\r
-                       "\t\t\t\tMGID....................%s\n"\r
-                       "\t\t\t\tPortGid.................%s\n"\r
-                       "\t\t\t\tqkey....................0x%X\n"\r
-                       "\t\t\t\tmlid....................0x%X\n"\r
-                       "\t\t\t\tmtu.....................0x%X\n"\r
-                       "\t\t\t\tTClass..................0x%X\n"\r
-                       "\t\t\t\tpkey....................0x%X\n"\r
-                       "\t\t\t\trate....................0x%X\n"\r
-                       "\t\t\t\tpkt_life................0x%X\n"\r
-                       "\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"\r
-                       "\t\t\t\tScopeState..............0x%X\n"\r
-                       "\t\t\t\tProxyJoin...............0x%X\n",\r
-                       inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str,\r
-                                 sizeof gid_str),\r
-                       inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2,\r
-                                 sizeof gid_str2),\r
-                       cl_ntoh32(p_mcmr->qkey), cl_ntoh16(p_mcmr->mlid),\r
-                       p_mcmr->mtu, p_mcmr->tclass, cl_ntoh16(p_mcmr->pkey),\r
-                       p_mcmr->rate, p_mcmr->pkt_life,\r
-                       cl_ntoh32(p_mcmr->sl_flow_hop),\r
-                       p_mcmr->scope_state, p_mcmr->proxy_join);\r
-       }\r
-}\r
-\r
-void osm_dump_service_record(IN osm_log_t * p_log,\r
-                            IN const ib_service_record_t * p_sr,\r
-                            IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char buf_service_key[35];\r
-               char buf_service_name[65];\r
-\r
-               sprintf(buf_service_key,\r
-                       "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",\r
-                       p_sr->service_key[0], p_sr->service_key[1],\r
-                       p_sr->service_key[2], p_sr->service_key[3],\r
-                       p_sr->service_key[4], p_sr->service_key[5],\r
-                       p_sr->service_key[6], p_sr->service_key[7],\r
-                       p_sr->service_key[8], p_sr->service_key[9],\r
-                       p_sr->service_key[10], p_sr->service_key[11],\r
-                       p_sr->service_key[12], p_sr->service_key[13],\r
-                       p_sr->service_key[14], p_sr->service_key[15]);\r
-               strncpy(buf_service_name, (char *)p_sr->service_name, 64);\r
-               buf_service_name[64] = '\0';\r
-\r
-               osm_log(p_log, log_level,\r
-                       "Service Record dump:\n"\r
-                       "\t\t\t\tServiceID...............0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tServiceGID..............%s\n"\r
-                       "\t\t\t\tServiceP_Key............0x%X\n"\r
-                       "\t\t\t\tServiceLease............0x%X\n"\r
-                       "\t\t\t\tServiceKey..............%s\n"\r
-                       "\t\t\t\tServiceName.............%s\n"\r
-                       "\t\t\t\tServiceData8.1..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.2..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.3..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.4..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.5..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.6..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.7..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.8..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.9..........0x%X\n"\r
-                       "\t\t\t\tServiceData8.10.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.11.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.12.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.13.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.14.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.15.........0x%X\n"\r
-                       "\t\t\t\tServiceData8.16.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.1.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.2.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.3.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.4.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.5.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.6.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.7.........0x%X\n"\r
-                       "\t\t\t\tServiceData16.8.........0x%X\n"\r
-                       "\t\t\t\tServiceData32.1.........0x%X\n"\r
-                       "\t\t\t\tServiceData32.2.........0x%X\n"\r
-                       "\t\t\t\tServiceData32.3.........0x%X\n"\r
-                       "\t\t\t\tServiceData32.4.........0x%X\n"\r
-                       "\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_sr->service_id),\r
-                       inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str,\r
-                                 sizeof gid_str),\r
-                       cl_ntoh16(p_sr->service_pkey),\r
-                       cl_ntoh32(p_sr->service_lease),\r
-                       buf_service_key, buf_service_name,\r
-                       p_sr->service_data8[0], p_sr->service_data8[1],\r
-                       p_sr->service_data8[2], p_sr->service_data8[3],\r
-                       p_sr->service_data8[4], p_sr->service_data8[5],\r
-                       p_sr->service_data8[6], p_sr->service_data8[7],\r
-                       p_sr->service_data8[8], p_sr->service_data8[9],\r
-                       p_sr->service_data8[10], p_sr->service_data8[11],\r
-                       p_sr->service_data8[12], p_sr->service_data8[13],\r
-                       p_sr->service_data8[14], p_sr->service_data8[15],\r
-                       cl_ntoh16(p_sr->service_data16[0]),\r
-                       cl_ntoh16(p_sr->service_data16[1]),\r
-                       cl_ntoh16(p_sr->service_data16[2]),\r
-                       cl_ntoh16(p_sr->service_data16[3]),\r
-                       cl_ntoh16(p_sr->service_data16[4]),\r
-                       cl_ntoh16(p_sr->service_data16[5]),\r
-                       cl_ntoh16(p_sr->service_data16[6]),\r
-                       cl_ntoh16(p_sr->service_data16[7]),\r
-                       cl_ntoh32(p_sr->service_data32[0]),\r
-                       cl_ntoh32(p_sr->service_data32[1]),\r
-                       cl_ntoh32(p_sr->service_data32[2]),\r
-                       cl_ntoh32(p_sr->service_data32[3]),\r
-                       cl_ntoh64(p_sr->service_data64[0]),\r
-                       cl_ntoh64(p_sr->service_data64[1]));\r
-       }\r
-}\r
-\r
-void osm_dump_inform_info(IN osm_log_t * p_log,\r
-                         IN const ib_inform_info_t * p_ii,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               uint32_t qpn;\r
-               uint8_t resp_time_val;\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.\r
-                                                qpn_resp_time_val, &qpn,\r
-                                                &resp_time_val);\r
-               if (p_ii->is_generic) {\r
-                       osm_log(p_log, log_level,\r
-                               "InformInfo dump:\n"\r
-                               "\t\t\t\tgid.....................%s\n"\r
-                               "\t\t\t\tlid_range_begin.........%u\n"\r
-                               "\t\t\t\tlid_range_end...........%u\n"\r
-                               "\t\t\t\tis_generic..............0x%X\n"\r
-                               "\t\t\t\tsubscribe...............0x%X\n"\r
-                               "\t\t\t\ttrap_type...............0x%X\n"\r
-                               "\t\t\t\ttrap_num................%u\n"\r
-                               "\t\t\t\tqpn.....................0x%06X\n"\r
-                               "\t\t\t\tresp_time_val...........0x%X\n"\r
-                               "\t\t\t\tnode_type...............0x%06X\n" "",\r
-                               inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,\r
-                                         sizeof gid_str),\r
-                               cl_ntoh16(p_ii->lid_range_begin),\r
-                               cl_ntoh16(p_ii->lid_range_end),\r
-                               p_ii->is_generic, p_ii->subscribe,\r
-                               cl_ntoh16(p_ii->trap_type),\r
-                               cl_ntoh16(p_ii->g_or_v.generic.trap_num),\r
-                               cl_ntoh32(qpn), resp_time_val,\r
-                               cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));\r
-               } else {\r
-                       osm_log(p_log, log_level,\r
-                               "InformInfo dump:\n"\r
-                               "\t\t\t\tgid.....................%s\n"\r
-                               "\t\t\t\tlid_range_begin.........%u\n"\r
-                               "\t\t\t\tlid_range_end...........%u\n"\r
-                               "\t\t\t\tis_generic..............0x%X\n"\r
-                               "\t\t\t\tsubscribe...............0x%X\n"\r
-                               "\t\t\t\ttrap_type...............0x%X\n"\r
-                               "\t\t\t\tdev_id..................0x%X\n"\r
-                               "\t\t\t\tqpn.....................0x%06X\n"\r
-                               "\t\t\t\tresp_time_val...........0x%X\n"\r
-                               "\t\t\t\tvendor_id...............0x%06X\n" "",\r
-                               inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,\r
-                                         sizeof gid_str),\r
-                               cl_ntoh16(p_ii->lid_range_begin),\r
-                               cl_ntoh16(p_ii->lid_range_end),\r
-                               p_ii->is_generic, p_ii->subscribe,\r
-                               cl_ntoh16(p_ii->trap_type),\r
-                               cl_ntoh16(p_ii->g_or_v.vend.dev_id),\r
-                               cl_ntoh32(qpn), resp_time_val,\r
-                               cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));\r
-               }\r
-       }\r
-}\r
-\r
-void osm_dump_inform_info_record(IN osm_log_t * p_log,\r
-                                IN const ib_inform_info_record_t * p_iir,\r
-                                IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char gid_str2[INET6_ADDRSTRLEN];\r
-               uint32_t qpn;\r
-               uint8_t resp_time_val;\r
-\r
-               ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.\r
-                                                generic.qpn_resp_time_val,\r
-                                                &qpn, &resp_time_val);\r
-               if (p_iir->inform_info.is_generic) {\r
-                       osm_log(p_log, log_level,\r
-                               "InformInfo Record dump:\n"\r
-                               "\t\t\t\tRID\n"\r
-                               "\t\t\t\tSubscriberGID...........%s\n"\r
-                               "\t\t\t\tSubscriberEnum..........0x%X\n"\r
-                               "\t\t\t\tInformInfo dump:\n"\r
-                               "\t\t\t\tgid.....................%s\n"\r
-                               "\t\t\t\tlid_range_begin.........%u\n"\r
-                               "\t\t\t\tlid_range_end...........%u\n"\r
-                               "\t\t\t\tis_generic..............0x%X\n"\r
-                               "\t\t\t\tsubscribe...............0x%X\n"\r
-                               "\t\t\t\ttrap_type...............0x%X\n"\r
-                               "\t\t\t\ttrap_num................%u\n"\r
-                               "\t\t\t\tqpn.....................0x%06X\n"\r
-                               "\t\t\t\tresp_time_val...........0x%X\n"\r
-                               "\t\t\t\tnode_type...............0x%06X\n" "",\r
-                               inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               cl_ntoh16(p_iir->subscriber_enum),\r
-                               inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,\r
-                                         gid_str2, sizeof gid_str2),\r
-                               cl_ntoh16(p_iir->inform_info.lid_range_begin),\r
-                               cl_ntoh16(p_iir->inform_info.lid_range_end),\r
-                               p_iir->inform_info.is_generic,\r
-                               p_iir->inform_info.subscribe,\r
-                               cl_ntoh16(p_iir->inform_info.trap_type),\r
-                               cl_ntoh16(p_iir->inform_info.g_or_v.generic.\r
-                                         trap_num), cl_ntoh32(qpn),\r
-                               resp_time_val,\r
-                               cl_ntoh32(ib_inform_info_get_prod_type\r
-                                         (&p_iir->inform_info)));\r
-               } else {\r
-                       osm_log(p_log, log_level,\r
-                               "InformInfo Record dump:\n"\r
-                               "\t\t\t\tRID\n"\r
-                               "\t\t\t\tSubscriberGID...........%s\n"\r
-                               "\t\t\t\tSubscriberEnum..........0x%X\n"\r
-                               "\t\t\t\tInformInfo dump:\n"\r
-                               "\t\t\t\tgid.....................%s\n"\r
-                               "\t\t\t\tlid_range_begin.........%u\n"\r
-                               "\t\t\t\tlid_range_end...........%u\n"\r
-                               "\t\t\t\tis_generic..............0x%X\n"\r
-                               "\t\t\t\tsubscribe...............0x%X\n"\r
-                               "\t\t\t\ttrap_type...............0x%X\n"\r
-                               "\t\t\t\tdev_id..................0x%X\n"\r
-                               "\t\t\t\tqpn.....................0x%06X\n"\r
-                               "\t\t\t\tresp_time_val...........0x%X\n"\r
-                               "\t\t\t\tvendor_id...............0x%06X\n" "",\r
-                               inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               cl_ntoh16(p_iir->subscriber_enum),\r
-                               inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,\r
-                                         gid_str2, sizeof gid_str2),\r
-                               cl_ntoh16(p_iir->inform_info.lid_range_begin),\r
-                               cl_ntoh16(p_iir->inform_info.lid_range_end),\r
-                               p_iir->inform_info.is_generic,\r
-                               p_iir->inform_info.subscribe,\r
-                               cl_ntoh16(p_iir->inform_info.trap_type),\r
-                               cl_ntoh16(p_iir->inform_info.g_or_v.vend.\r
-                                         dev_id), cl_ntoh32(qpn),\r
-                               resp_time_val,\r
-                               cl_ntoh32(ib_inform_info_get_prod_type\r
-                                         (&p_iir->inform_info)));\r
-               }\r
-       }\r
-}\r
-\r
-void osm_dump_link_record(IN osm_log_t * p_log,\r
-                         IN const ib_link_record_t * p_lr,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, log_level,\r
-                       "Link Record dump:\n"\r
-                       "\t\t\t\tfrom_lid................%u\n"\r
-                       "\t\t\t\tfrom_port_num...........%u\n"\r
-                       "\t\t\t\tto_port_num.............%u\n"\r
-                       "\t\t\t\tto_lid..................%u\n",\r
-                       cl_ntoh16(p_lr->from_lid),\r
-                       p_lr->from_port_num,\r
-                       p_lr->to_port_num, cl_ntoh16(p_lr->to_lid));\r
-       }\r
-}\r
-\r
-void osm_dump_switch_info(IN osm_log_t * p_log,\r
-                         IN const ib_switch_info_t * p_si,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, OSM_LOG_VERBOSE,\r
-                       "SwitchInfo dump:\n"\r
-                       "\t\t\t\tlin_cap.................0x%X\n"\r
-                       "\t\t\t\trand_cap................0x%X\n"\r
-                       "\t\t\t\tmcast_cap...............0x%X\n"\r
-                       "\t\t\t\tlin_top.................0x%X\n"\r
-                       "\t\t\t\tdef_port................%u\n"\r
-                       "\t\t\t\tdef_mcast_pri_port......%u\n"\r
-                       "\t\t\t\tdef_mcast_not_port......%u\n"\r
-                       "\t\t\t\tlife_state..............0x%X\n"\r
-                       "\t\t\t\tlids_per_port...........%u\n"\r
-                       "\t\t\t\tpartition_enf_cap.......0x%X\n"\r
-                       "\t\t\t\tflags...................0x%X\n"\r
-                       "\t\t\t\tmcast_top...............0x%X\n",\r
-                       cl_ntoh16(p_si->lin_cap), cl_ntoh16(p_si->rand_cap),\r
-                       cl_ntoh16(p_si->mcast_cap), cl_ntoh16(p_si->lin_top),\r
-                       p_si->def_port, p_si->def_mcast_pri_port,\r
-                       p_si->def_mcast_not_port, p_si->life_state,\r
-                       cl_ntoh16(p_si->lids_per_port),\r
-                       cl_ntoh16(p_si->enforce_cap), p_si->flags,\r
-                       cl_ntoh16(p_si->mcast_top));\r
-       }\r
-}\r
-\r
-void osm_dump_switch_info_record(IN osm_log_t * p_log,\r
-                                IN const ib_switch_info_record_t * p_sir,\r
-                                IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, log_level,\r
-                       "SwitchInfo Record dump:\n"\r
-                       "\t\t\t\tRID\n"\r
-                       "\t\t\t\tlid.....................%u\n"\r
-                       "\t\t\t\tSwitchInfo dump:\n"\r
-                       "\t\t\t\tlin_cap.................0x%X\n"\r
-                       "\t\t\t\trand_cap................0x%X\n"\r
-                       "\t\t\t\tmcast_cap...............0x%X\n"\r
-                       "\t\t\t\tlin_top.................0x%X\n"\r
-                       "\t\t\t\tdef_port................%u\n"\r
-                       "\t\t\t\tdef_mcast_pri_port......%u\n"\r
-                       "\t\t\t\tdef_mcast_not_port......%u\n"\r
-                       "\t\t\t\tlife_state..............0x%X\n"\r
-                       "\t\t\t\tlids_per_port...........%u\n"\r
-                       "\t\t\t\tpartition_enf_cap.......0x%X\n"\r
-                       "\t\t\t\tflags...................0x%X\n",\r
-                       cl_ntoh16(p_sir->lid),\r
-                       cl_ntoh16(p_sir->switch_info.lin_cap),\r
-                       cl_ntoh16(p_sir->switch_info.rand_cap),\r
-                       cl_ntoh16(p_sir->switch_info.mcast_cap),\r
-                       cl_ntoh16(p_sir->switch_info.lin_top),\r
-                       p_sir->switch_info.def_port,\r
-                       p_sir->switch_info.def_mcast_pri_port,\r
-                       p_sir->switch_info.def_mcast_not_port,\r
-                       p_sir->switch_info.life_state,\r
-                       cl_ntoh16(p_sir->switch_info.lids_per_port),\r
-                       cl_ntoh16(p_sir->switch_info.enforce_cap),\r
-                       p_sir->switch_info.flags);\r
-       }\r
-}\r
-\r
-void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                        IN uint16_t block_num, IN uint8_t port_num,\r
-                        IN const ib_pkey_table_t * p_pkey_tbl,\r
-                        IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf_line[1024];\r
-               int i, n;\r
-\r
-               for (i = 0, n = 0; i < 32; i++)\r
-                       n += sprintf(buf_line + n, " 0x%04x |",\r
-                                    cl_ntoh16(p_pkey_tbl->pkey_entry[i]));\r
-\r
-               osm_log(p_log, log_level,\r
-                       "P_Key table dump:\n"\r
-                       "\t\t\tport_guid...........0x%016" PRIx64 "\n"\r
-                       "\t\t\tblock_num...........0x%X\n"\r
-                       "\t\t\tport_num............%u\n\tP_Key Table: %s\n",\r
-                       cl_ntoh64(port_guid), block_num, port_num, buf_line);\r
-       }\r
-}\r
-\r
-void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                            IN uint8_t in_port_num, IN uint8_t out_port_num,\r
-                            IN const ib_slvl_table_t * p_slvl_tbl,\r
-                            IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf_line1[1024], buf_line2[1024];\r
-               int n;\r
-               uint8_t i;\r
-\r
-               for (i = 0, n = 0; i < 16; i++)\r
-                       n += sprintf(buf_line1 + n, " %-2u |", i);\r
-               for (i = 0, n = 0; i < 16; i++)\r
-                       n += sprintf(buf_line2 + n, "0x%01X |",\r
-                                    ib_slvl_table_get(p_slvl_tbl, i));\r
-               osm_log(p_log, log_level,\r
-                       "SLtoVL dump:\n"\r
-                       "\t\t\tport_guid............0x%016" PRIx64 "\n"\r
-                       "\t\t\tin_port_num..........%u\n"\r
-                       "\t\t\tout_port_num.........%u\n\tSL: | %s\n\tVL: | %s\n",\r
-                       cl_ntoh64(port_guid), in_port_num, out_port_num,\r
-                       buf_line1, buf_line2);\r
-       }\r
-}\r
-\r
-void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,\r
-                          IN uint8_t block_num, IN uint8_t port_num,\r
-                          IN const ib_vl_arb_table_t * p_vla_tbl,\r
-                          IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf_line1[1024], buf_line2[1024];\r
-               int i, n;\r
-\r
-               for (i = 0, n = 0; i < 32; i++)\r
-                       n += sprintf(buf_line1 + n, " 0x%01X |",\r
-                                    p_vla_tbl->vl_entry[i].vl);\r
-               for (i = 0, n = 0; i < 32; i++)\r
-                       n += sprintf(buf_line2 + n, " 0x%01X |",\r
-                                    p_vla_tbl->vl_entry[i].weight);\r
-               osm_log(p_log, log_level,\r
-                       "VLArb dump:\n" "\t\t\tport_guid...........0x%016"\r
-                       PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"\r
-                       "\t\t\tport_num............%u\n\tVL    : | %s\n\tWEIGHT:| %s\n",\r
-                       cl_ntoh64(port_guid), block_num, port_num, buf_line1,\r
-                       buf_line2);\r
-       }\r
-}\r
-\r
-void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,\r
-                     IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "SMInfo dump:\n"\r
-                       "\t\t\t\tguid....................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tact_count...............%u\n"\r
-                       "\t\t\t\tpriority................%u\n"\r
-                       "\t\t\t\tsm_state................%u\n",\r
-                       cl_ntoh64(p_smi->guid), cl_ntoh64(p_smi->sm_key),\r
-                       cl_ntoh32(p_smi->act_count),\r
-                       ib_sminfo_get_priority(p_smi),\r
-                       ib_sminfo_get_state(p_smi));\r
-       }\r
-}\r
-\r
-void osm_dump_sm_info_record(IN osm_log_t * p_log,\r
-                            IN const ib_sminfo_record_t * p_smir,\r
-                            IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               osm_log(p_log, OSM_LOG_DEBUG,\r
-                       "SMInfo Record dump:\n"\r
-                       "\t\t\t\tRID\n"\r
-                       "\t\t\t\tLid.....................%u\n"\r
-                       "\t\t\t\tReserved................0x%X\n"\r
-                       "\t\t\t\tSMInfo dump:\n"\r
-                       "\t\t\t\tguid....................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tact_count...............%u\n"\r
-                       "\t\t\t\tpriority................%u\n"\r
-                       "\t\t\t\tsm_state................%u\n",\r
-                       cl_ntoh16(p_smir->lid), cl_ntoh16(p_smir->resv0),\r
-                       cl_ntoh64(p_smir->sm_info.guid),\r
-                       cl_ntoh64(p_smir->sm_info.sm_key),\r
-                       cl_ntoh32(p_smir->sm_info.act_count),\r
-                       ib_sminfo_get_priority(&p_smir->sm_info),\r
-                       ib_sminfo_get_state(&p_smir->sm_info));\r
-       }\r
-}\r
-\r
-void osm_dump_notice(IN osm_log_t * p_log,\r
-                    IN const ib_mad_notice_attr_t * p_ntci,\r
-                    IN osm_log_level_t log_level)\r
-{\r
-       if (!osm_log_is_active(p_log, log_level))\r
-               return;\r
-\r
-       if (ib_notice_is_generic(p_ntci)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char gid_str2[INET6_ADDRSTRLEN];\r
-               char buff[1024];\r
-               int n;\r
-               buff[0] = '\0';\r
-\r
-               /* immediate data based on the trap */\r
-               switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {\r
-               case 64:\r
-               case 65:\r
-               case 66:\r
-               case 67:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tsrc_gid..................%s\n",\r
-                               inet_ntop(AF_INET6, p_ntci->data_details.\r
-                                         ntc_64_67.gid.raw, gid_str,\r
-                                         sizeof gid_str));\r
-                       break;\r
-               case 128:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tsw_lid...................%u\n",\r
-                               cl_ntoh16(p_ntci->data_details.ntc_128.sw_lid));\r
-                       break;\r
-               case 129:\r
-               case 130:\r
-               case 131:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tlid......................%u\n"\r
-                               "\t\t\t\tport_num.................%u\n",\r
-                               cl_ntoh16(p_ntci->data_details.\r
-                                         ntc_129_131.lid),\r
-                               p_ntci->data_details.ntc_129_131.port_num);\r
-                       break;\r
-               case 144:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tlid......................%u\n"\r
-                               "\t\t\t\tlocal_changes............%u\n"\r
-                               "\t\t\t\tnew_cap_mask.............0x%08x\n"\r
-                               "\t\t\t\tchange_flags.............0x%x\n",\r
-                               cl_ntoh16(p_ntci->data_details.ntc_144.lid),\r
-                               p_ntci->data_details.ntc_144.local_changes,\r
-                               cl_ntoh32(p_ntci->data_details.ntc_144.\r
-                                         new_cap_mask),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_144.\r
-                                         change_flgs));\r
-                       break;\r
-               case 145:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tlid......................%u\n"\r
-                               "\t\t\t\tnew_sys_guid.............0x%016"\r
-                               PRIx64 "\n",\r
-                               cl_ntoh16(p_ntci->data_details.ntc_145.\r
-                                         lid),\r
-                               cl_ntoh64(p_ntci->data_details.ntc_145.\r
-                                         new_sys_guid));\r
-                       break;\r
-               case 256:\r
-                       n = sprintf(buff,\r
-                                   "\t\t\t\tlid......................%u\n"\r
-                                   "\t\t\t\tdrslid...................%u\n"\r
-                                   "\t\t\t\tmethod...................0x%x\n"\r
-                                   "\t\t\t\tattr_id..................0x%x\n"\r
-                                   "\t\t\t\tattr_mod.................0x%x\n"\r
-                                   "\t\t\t\tm_key....................0x%016"\r
-                                   PRIx64 "\n"\r
-                                   "\t\t\t\tdr_notice................%d\n"\r
-                                   "\t\t\t\tdr_path_truncated........%d\n"\r
-                                   "\t\t\t\tdr_hop_count.............%u\n",\r
-                                   cl_ntoh16(p_ntci->data_details.ntc_256.lid),\r
-                                   cl_ntoh16(p_ntci->data_details.ntc_256.\r
-                                             dr_slid),\r
-                                   p_ntci->data_details.ntc_256.method,\r
-                                   cl_ntoh16(p_ntci->data_details.ntc_256.\r
-                                             attr_id),\r
-                                   cl_ntoh32(p_ntci->data_details.ntc_256.\r
-                                             attr_mod),\r
-                                   cl_ntoh64(p_ntci->data_details.ntc_256.\r
-                                             mkey),\r
-                                   p_ntci->data_details.ntc_256.\r
-                                   dr_trunc_hop >> 7,\r
-                                   p_ntci->data_details.ntc_256.\r
-                                   dr_trunc_hop >> 6,\r
-                                   p_ntci->data_details.ntc_256.\r
-                                   dr_trunc_hop & 0x3f);\r
-                       n += snprintf(buff + n, sizeof(buff) - n,\r
-                                     "Directed Path Dump of %u hop path:"\r
-                                     "\n\t\t\t\tPath = ",\r
-                                     p_ntci->data_details.ntc_256.\r
-                                     dr_trunc_hop & 0x3f);\r
-                       n += sprint_uint8_arr(buff + n, sizeof(buff) - n,\r
-                                             p_ntci->data_details.ntc_256.\r
-                                             dr_rtn_path,\r
-                                             (p_ntci->data_details.ntc_256.\r
-                                              dr_trunc_hop & 0x3f) + 1);\r
-                       if (n >= sizeof(buff)) {\r
-                               n = sizeof(buff) - 2;\r
-                               break;\r
-                       }\r
-                       snprintf(buff + n, sizeof(buff) - n, "\n");\r
-                       break;\r
-               case 257:\r
-               case 258:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tlid1.....................%u\n"\r
-                               "\t\t\t\tlid2.....................%u\n"\r
-                               "\t\t\t\tkey......................0x%x\n"\r
-                               "\t\t\t\tsl.......................%d\n"\r
-                               "\t\t\t\tqp1......................0x%x\n"\r
-                               "\t\t\t\tqp2......................0x%x\n"\r
-                               "\t\t\t\tgid1.....................%s\n"\r
-                               "\t\t\t\tgid2.....................%s\n",\r
-                               cl_ntoh16(p_ntci->data_details.ntc_257_258.\r
-                                         lid1),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_257_258.\r
-                                         lid2),\r
-                               cl_ntoh32(p_ntci->data_details.ntc_257_258.key),\r
-                               cl_ntoh32(p_ntci->data_details.ntc_257_258.\r
-                                         qp1) >> 28,\r
-                               cl_ntoh32(p_ntci->data_details.ntc_257_258.\r
-                                         qp1) & 0xffffff,\r
-                               cl_ntoh32(p_ntci->data_details.ntc_257_258.\r
-                                         qp2) & 0xffffff,\r
-                               inet_ntop(AF_INET6, p_ntci->data_details.\r
-                                         ntc_257_258.gid1.raw, gid_str,\r
-                                         sizeof gid_str),\r
-                               inet_ntop(AF_INET6, p_ntci->data_details.\r
-                                         ntc_257_258.gid2.raw, gid_str2,\r
-                                         sizeof gid_str2));\r
-                       break;\r
-               case 259:\r
-                       sprintf(buff,\r
-                               "\t\t\t\tdata_valid...............0x%x\n"\r
-                               "\t\t\t\tlid1.....................%u\n"\r
-                               "\t\t\t\tlid2.....................%u\n"\r
-                               "\t\t\t\tpkey.....................0x%x\n"\r
-                               "\t\t\t\tsl.......................%d\n"\r
-                               "\t\t\t\tqp1......................0x%x\n"\r
-                               "\t\t\t\tqp2......................0x%x\n"\r
-                               "\t\t\t\tgid1.....................%s\n"\r
-                               "\t\t\t\tgid2.....................%s\n"\r
-                               "\t\t\t\tsw_lid...................%u\n"\r
-                               "\t\t\t\tport_no..................%u\n",\r
-                               cl_ntoh16(p_ntci->data_details.ntc_259.\r
-                                         data_valid),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_259.lid1),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_259.lid2),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_259.pkey),\r
-                               cl_ntoh32(p_ntci->data_details.ntc_259.\r
-                                         sl_qp1) >> 24,\r
-                               cl_ntoh32(p_ntci->data_details.ntc_259.\r
-                                         sl_qp1) & 0xffffff,\r
-                               cl_ntoh32(p_ntci->data_details.ntc_259.qp2),\r
-                               inet_ntop(AF_INET6, p_ntci->data_details.\r
-                                         ntc_259.gid1.raw, gid_str,\r
-                                         sizeof gid_str),\r
-                               inet_ntop(AF_INET6, p_ntci->data_details.\r
-                                         ntc_259.gid2.raw, gid_str2,\r
-                                         sizeof gid_str2),\r
-                               cl_ntoh16(p_ntci->data_details.ntc_259.sw_lid),\r
-                               p_ntci->data_details.ntc_259.port_no);\r
-                       break;\r
-               }\r
-\r
-               osm_log(p_log, log_level,\r
-                       "Generic Notice dump:\n"\r
-                       "\t\t\t\ttype.....................%u\n"\r
-                       "\t\t\t\tprod_type................%u (%s)\n"\r
-                       "\t\t\t\ttrap_num.................%u\n%s",\r
-                       ib_notice_get_type(p_ntci),\r
-                       cl_ntoh32(ib_notice_get_prod_type(p_ntci)),\r
-                       ib_get_producer_type_str(ib_notice_get_prod_type\r
-                                                (p_ntci)),\r
-                       cl_ntoh16(p_ntci->g_or_v.generic.trap_num), buff);\r
-       } else {\r
-               osm_log(p_log, log_level,\r
-                       "Vendor Notice dump:\n"\r
-                       "\t\t\t\ttype.....................%u\n"\r
-                       "\t\t\t\tvendor...................%u\n"\r
-                       "\t\t\t\tdevice_id................%u\n",\r
-                       cl_ntoh16(ib_notice_get_type(p_ntci)),\r
-                       cl_ntoh32(ib_notice_get_vend_id(p_ntci)),\r
-                       cl_ntoh16(p_ntci->g_or_v.vend.dev_id));\r
-       }\r
-}\r
-\r
-void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,\r
-                    IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-               unsigned n;\r
-\r
-               n = sprintf(buf,\r
-                           "SMP dump:\n"\r
-                           "\t\t\t\tbase_ver................0x%X\n"\r
-                           "\t\t\t\tmgmt_class..............0x%X\n"\r
-                           "\t\t\t\tclass_ver...............0x%X\n"\r
-                           "\t\t\t\tmethod..................0x%X (%s)\n",\r
-                           p_smp->base_ver, p_smp->mgmt_class,\r
-                           p_smp->class_ver, p_smp->method,\r
-                           ib_get_sm_method_str(p_smp->method));\r
-\r
-               if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\t\t\t\tD bit...................0x%X\n"\r
-                                     "\t\t\t\tstatus..................0x%X\n",\r
-                                     ib_smp_is_d(p_smp),\r
-                                     cl_ntoh16(ib_smp_get_status(p_smp)));\r
-               } else {\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\t\t\t\tstatus..................0x%X\n",\r
-                                     cl_ntoh16(p_smp->status));\r
-               }\r
-\r
-               n += snprintf(buf + n, sizeof(buf) - n,\r
-                             "\t\t\t\thop_ptr.................0x%X\n"\r
-                             "\t\t\t\thop_count...............0x%X\n"\r
-                             "\t\t\t\ttrans_id................0x%" PRIx64 "\n"\r
-                             "\t\t\t\tattr_id.................0x%X (%s)\n"\r
-                             "\t\t\t\tresv....................0x%X\n"\r
-                             "\t\t\t\tattr_mod................0x%X\n"\r
-                             "\t\t\t\tm_key...................0x%016" PRIx64\r
-                             "\n", p_smp->hop_ptr, p_smp->hop_count,\r
-                             cl_ntoh64(p_smp->trans_id),\r
-                             cl_ntoh16(p_smp->attr_id),\r
-                             ib_get_sm_attr_str(p_smp->attr_id),\r
-                             cl_ntoh16(p_smp->resv),\r
-                             cl_ntoh32(p_smp->attr_mod),\r
-                             cl_ntoh64(p_smp->m_key));\r
-\r
-               if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {\r
-                       uint32_t i;\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\t\t\t\tdr_slid.................%u\n"\r
-                                     "\t\t\t\tdr_dlid.................%u\n",\r
-                                     cl_ntoh16(p_smp->dr_slid),\r
-                                     cl_ntoh16(p_smp->dr_dlid));\r
-\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\n\t\t\t\tInitial path: ");\r
-                       n += sprint_uint8_arr(buf + n, sizeof(buf) - n,\r
-                                             p_smp->initial_path,\r
-                                             p_smp->hop_count + 1);\r
-\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\n\t\t\t\tReturn path:  ");\r
-                       n += sprint_uint8_arr(buf + n, sizeof(buf) - n,\r
-                                             p_smp->return_path,\r
-                                             p_smp->hop_count + 1);\r
-\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\n\t\t\t\tReserved:     ");\r
-                       for (i = 0; i < 7; i++) {\r
-                               n += snprintf(buf + n, sizeof(buf) - n,\r
-                                             "[%0X]", p_smp->resv1[i]);\r
-                       }\r
-                       n += snprintf(buf + n, sizeof(buf) - n, "\n");\r
-\r
-                       for (i = 0; i < 64; i += 16) {\r
-                               n += snprintf(buf + n, sizeof(buf) - n,\r
-                                             "\n\t\t\t\t%02X %02X %02X %02X "\r
-                                             "%02X %02X %02X %02X"\r
-                                             "   %02X %02X %02X %02X %02X %02X %02X %02X\n",\r
-                                             p_smp->data[i],\r
-                                             p_smp->data[i + 1],\r
-                                             p_smp->data[i + 2],\r
-                                             p_smp->data[i + 3],\r
-                                             p_smp->data[i + 4],\r
-                                             p_smp->data[i + 5],\r
-                                             p_smp->data[i + 6],\r
-                                             p_smp->data[i + 7],\r
-                                             p_smp->data[i + 8],\r
-                                             p_smp->data[i + 9],\r
-                                             p_smp->data[i + 10],\r
-                                             p_smp->data[i + 11],\r
-                                             p_smp->data[i + 12],\r
-                                             p_smp->data[i + 13],\r
-                                             p_smp->data[i + 14],\r
-                                             p_smp->data[i + 15]);\r
-                       }\r
-               } else {\r
-                       /* not a Direct Route so provide source and destination lids */\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "\t\t\t\tMAD IS LID ROUTED\n");\r
-               }\r
-\r
-               osm_log(p_log, log_level, "%s\n", buf);\r
-       }\r
-}\r
-\r
-void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,\r
-                    IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-\r
-               /* make sure the mad is valid */\r
-               if (p_mad == NULL) {\r
-                       OSM_LOG(p_log, log_level, "NULL MAD POINTER\n");\r
-                       return;\r
-               }\r
-\r
-               sprintf(buf,\r
-                       "SA MAD dump:\n"\r
-                       "\t\t\t\tbase_ver................0x%X\n"\r
-                       "\t\t\t\tmgmt_class..............0x%X\n"\r
-                       "\t\t\t\tclass_ver...............0x%X\n"\r
-                       "\t\t\t\tmethod..................0x%X (%s)\n"\r
-                       "\t\t\t\tstatus..................0x%X\n"\r
-                       "\t\t\t\tresv....................0x%X\n"\r
-                       "\t\t\t\ttrans_id................0x%" PRIx64 "\n"\r
-                       "\t\t\t\tattr_id.................0x%X (%s)\n"\r
-                       "\t\t\t\tresv1...................0x%X\n"\r
-                       "\t\t\t\tattr_mod................0x%X\n"\r
-                       "\t\t\t\trmpp_version............0x%X\n"\r
-                       "\t\t\t\trmpp_type...............0x%X\n"\r
-                       "\t\t\t\trmpp_flags..............0x%X\n"\r
-                       "\t\t\t\trmpp_status.............0x%X\n"\r
-                       "\t\t\t\tseg_num.................0x%X\n"\r
-                       "\t\t\t\tpayload_len/new_win.....0x%X\n"\r
-                       "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tattr_offset.............0x%X\n"\r
-                       "\t\t\t\tresv2...................0x%X\n"\r
-                       "\t\t\t\tcomp_mask...............0x%016" PRIx64 "\n",\r
-                       p_mad->base_ver, p_mad->mgmt_class, p_mad->class_ver,\r
-                       p_mad->method, ib_get_sa_method_str(p_mad->method),\r
-                       cl_ntoh16(p_mad->status), cl_ntoh16(p_mad->resv),\r
-                       cl_ntoh64(p_mad->trans_id), cl_ntoh16(p_mad->attr_id),\r
-                       ib_get_sa_attr_str(p_mad->attr_id),\r
-                       cl_ntoh16(p_mad->resv1), cl_ntoh32(p_mad->attr_mod),\r
-                       p_mad->rmpp_version, p_mad->rmpp_type,\r
-                       p_mad->rmpp_flags, p_mad->rmpp_status,\r
-                       cl_ntoh32(p_mad->seg_num),\r
-                       cl_ntoh32(p_mad->paylen_newwin),\r
-                       cl_ntoh64(p_mad->sm_key), cl_ntoh16(p_mad->attr_offset),\r
-                       cl_ntoh16(p_mad->resv3), cl_ntoh64(p_mad->comp_mask));\r
-\r
-               strcat(buf, "\n");\r
-\r
-               osm_log(p_log, log_level, "%s\n", buf);\r
-       }\r
-}\r
-\r
-void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,\r
-                     IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-               unsigned n = 0;\r
-\r
-               n = sprintf(buf, "Directed Path Dump of %u hop path: "\r
-                           "Path = ", p_path->hop_count);\r
-\r
-               sprint_uint8_arr(buf + n, sizeof(buf) - n, p_path->path,\r
-                                p_path->hop_count + 1);\r
-               osm_log(p_log, log_level, "%s\n", buf);\r
-       }\r
-}\r
-\r
-void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,\r
-                         IN osm_log_level_t log_level)\r
-{\r
-       if (osm_log_is_active(p_log, log_level)) {\r
-               char buf[BUF_SIZE];\r
-               unsigned n;\r
-\r
-               n = sprintf(buf, "Received SMP on a %u hop path: "\r
-                           "Initial path = ", p_smp->hop_count);\r
-               n += sprint_uint8_arr(buf + n, sizeof(buf) - n,\r
-                                     p_smp->initial_path,\r
-                                     p_smp->hop_count + 1);\r
-\r
-               n += sprintf(buf + n, ", Return path  = ");\r
-               n += sprint_uint8_arr(buf + n, sizeof(buf) - n,\r
-                                     p_smp->return_path, p_smp->hop_count + 1);\r
-\r
-               osm_log(p_log, log_level, "%s\n", buf);\r
-       }\r
-}\r
-\r
-static const char *sm_signal_str[] = {\r
-       "OSM_SIGNAL_NONE",      /* 0 */\r
-       "OSM_SIGNAL_SWEEP",     /* 1 */\r
-       "OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST", /* 2 */\r
-       "OSM_SIGNAL_EXIT_STBY", /* 3 */\r
-       "OSM_SIGNAL_PERFMGR_SWEEP",     /* 4 */\r
-       "UNKNOWN SIGNAL!!"      /* 5 */\r
-};\r
-\r
-const char *osm_get_sm_signal_str(IN osm_signal_t signal)\r
-{\r
-       if (signal > OSM_SIGNAL_MAX)\r
-               signal = OSM_SIGNAL_MAX;\r
-       return sm_signal_str[signal];\r
-}\r
-\r
-static const char *disp_msg_str[] = {\r
-       "OSM_MSG_NONE",\r
-       "OSM_MSG_MAD_NODE_INFO",\r
-       "OSM_MSG_MAD_PORT_INFO",\r
-       "OSM_MSG_MAD_SWITCH_INFO",\r
-       "OSM_MSG_MAD_NODE_DESC",\r
-       "OSM_MSG_MAD_NODE_RECORD",\r
-       "OSM_MSG_MAD_PORTINFO_RECORD",\r
-       "OSM_MSG_MAD_SERVICE_RECORD",\r
-       "OSM_MSG_MAD_PATH_RECORD",\r
-       "OSM_MSG_MAD_MCMEMBER_RECORD",\r
-       "OSM_MSG_MAD_LINK_RECORD",\r
-       "OSM_MSG_MAD_SMINFO_RECORD",\r
-       "OSM_MSG_MAD_CLASS_PORT_INFO",\r
-       "OSM_MSG_MAD_INFORM_INFO",\r
-       "OSM_MSG_MAD_LFT_RECORD",\r
-       "OSM_MSG_MAD_LFT",\r
-       "OSM_MSG_MAD_SM_INFO",\r
-       "OSM_MSG_MAD_NOTICE",\r
-       "OSM_MSG_LIGHT_SWEEP_FAIL",\r
-       "OSM_MSG_MAD_MFT",\r
-       "OSM_MSG_MAD_PKEY_TBL_RECORD",\r
-       "OSM_MSG_MAD_VL_ARB_RECORD",\r
-       "OSM_MSG_MAD_SLVL_TBL_RECORD",\r
-       "OSM_MSG_MAD_PKEY",\r
-       "OSM_MSG_MAD_VL_ARB",\r
-       "OSM_MSG_MAD_SLVL",\r
-       "OSM_MSG_MAD_GUIDINFO_RECORD",\r
-       "OSM_MSG_MAD_INFORM_INFO_RECORD",\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       "OSM_MSG_MAD_MULTIPATH_RECORD",\r
-#endif\r
-       "OSM_MSG_MAD_PORT_COUNTERS",\r
-       "UNKNOWN!!"\r
-};\r
-\r
-const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)\r
-{\r
-       if (msg > OSM_MSG_MAX)\r
-               msg = OSM_MSG_MAX;\r
-       return disp_msg_str[msg];\r
-}\r
-\r
-static const char *port_state_str_fixed_width[] = {\r
-       "NOC",\r
-       "DWN",\r
-       "INI",\r
-       "ARM",\r
-       "ACT",\r
-       "???"\r
-};\r
-\r
-const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state)\r
-{\r
-       if (port_state > IB_LINK_ACTIVE)\r
-               port_state = IB_LINK_ACTIVE + 1;\r
-       return port_state_str_fixed_width[port_state];\r
-}\r
-\r
-static const char *node_type_str_fixed_width[] = {\r
-       "??",\r
-       "CA",\r
-       "SW",\r
-       "RT",\r
-};\r
-\r
-const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type)\r
-{\r
-       if (node_type > IB_NODE_TYPE_ROUTER)\r
-               node_type = 0;\r
-       return node_type_str_fixed_width[node_type];\r
-}\r
-\r
-const char *osm_get_manufacturer_str(IN uint64_t guid_ho)\r
-{\r
-       /* note that the max vendor string length is 11 */\r
-       static const char *intel_str = "Intel";\r
-       static const char *mellanox_str = "Mellanox";\r
-       static const char *redswitch_str = "Redswitch";\r
-       static const char *silverstorm_str = "SilverStorm";\r
-       static const char *topspin_str = "Topspin";\r
-       static const char *fujitsu_str = "Fujitsu";\r
-       static const char *voltaire_str = "Voltaire";\r
-       static const char *yotta_str = "YottaYotta";\r
-       static const char *pathscale_str = "PathScale";\r
-       static const char *ibm_str = "IBM";\r
-       static const char *divergenet_str = "DivergeNet";\r
-       static const char *flextronics_str = "Flextronics";\r
-       static const char *agilent_str = "Agilent";\r
-       static const char *obsidian_str = "Obsidian";\r
-       static const char *baymicro_str = "BayMicro";\r
-       static const char *lsilogic_str = "LSILogic";\r
-       static const char *ddn_str = "DataDirect";\r
-       static const char *panta_str = "Panta";\r
-       static const char *hp_str = "HP";\r
-       static const char *rioworks_str = "Rioworks";\r
-       static const char *sun_str = "Sun";\r
-       static const char *leafntwks_str = "3LeafNtwks";\r
-       static const char *xsigo_str = "Xsigo";\r
-       static const char *dell_str = "Dell";\r
-       static const char *supermicro_str = "SuperMicro";\r
-       static const char *unknown_str = "Unknown";\r
-\r
-       switch ((uint32_t) (guid_ho >> (5 * 8))) {\r
-       case OSM_VENDOR_ID_INTEL:\r
-               return intel_str;\r
-       case OSM_VENDOR_ID_MELLANOX:\r
-               return mellanox_str;\r
-       case OSM_VENDOR_ID_REDSWITCH:\r
-               return redswitch_str;\r
-       case OSM_VENDOR_ID_SILVERSTORM:\r
-               return silverstorm_str;\r
-       case OSM_VENDOR_ID_TOPSPIN:\r
-               return topspin_str;\r
-       case OSM_VENDOR_ID_FUJITSU:\r
-       case OSM_VENDOR_ID_FUJITSU2:\r
-               return fujitsu_str;\r
-       case OSM_VENDOR_ID_VOLTAIRE:\r
-               return voltaire_str;\r
-       case OSM_VENDOR_ID_YOTTAYOTTA:\r
-               return yotta_str;\r
-       case OSM_VENDOR_ID_PATHSCALE:\r
-               return pathscale_str;\r
-       case OSM_VENDOR_ID_IBM:\r
-               return ibm_str;\r
-       case OSM_VENDOR_ID_DIVERGENET:\r
-               return divergenet_str;\r
-       case OSM_VENDOR_ID_FLEXTRONICS:\r
-               return flextronics_str;\r
-       case OSM_VENDOR_ID_AGILENT:\r
-               return agilent_str;\r
-       case OSM_VENDOR_ID_OBSIDIAN:\r
-               return obsidian_str;\r
-       case OSM_VENDOR_ID_BAYMICRO:\r
-               return baymicro_str;\r
-       case OSM_VENDOR_ID_LSILOGIC:\r
-               return lsilogic_str;\r
-       case OSM_VENDOR_ID_DDN:\r
-               return ddn_str;\r
-       case OSM_VENDOR_ID_PANTA:\r
-               return panta_str;\r
-       case OSM_VENDOR_ID_HP:\r
-       case OSM_VENDOR_ID_HP2:\r
-       case OSM_VENDOR_ID_HP3:\r
-       case OSM_VENDOR_ID_HP4:\r
-               return hp_str;\r
-       case OSM_VENDOR_ID_RIOWORKS:\r
-               return rioworks_str;\r
-       case OSM_VENDOR_ID_SUN:\r
-       case OSM_VENDOR_ID_SUN2:\r
-               return sun_str;\r
-       case OSM_VENDOR_ID_3LEAFNTWKS:\r
-               return leafntwks_str;\r
-       case OSM_VENDOR_ID_XSIGO:\r
-               return xsigo_str;\r
-       case OSM_VENDOR_ID_DELL:\r
-               return dell_str;\r
-       case OSM_VENDOR_ID_SUPERMICRO:\r
-               return supermicro_str;\r
-       default:\r
-               return unknown_str;\r
-       }\r
-}\r
-\r
-static const char *mtu_str_fixed_width[] = {\r
-       "??? ",\r
-       "256 ",\r
-       "512 ",\r
-       "1024",\r
-       "2048",\r
-       "4096"\r
-};\r
-\r
-const char *osm_get_mtu_str(IN uint8_t mtu)\r
-{\r
-       if (mtu > IB_MTU_LEN_4096)\r
-               return mtu_str_fixed_width[0];\r
-       else\r
-               return mtu_str_fixed_width[mtu];\r
-}\r
-\r
-static const char *lwa_str_fixed_width[] = {\r
-       "???",\r
-       "1x ",\r
-       "4x ",\r
-       "???",\r
-       "8x ",\r
-       "???",\r
-       "???",\r
-       "???",\r
-       "12x"\r
-};\r
-\r
-const char *osm_get_lwa_str(IN uint8_t lwa)\r
-{\r
-       if (lwa > 8)\r
-               return lwa_str_fixed_width[0];\r
-       else\r
-               return lwa_str_fixed_width[lwa];\r
-}\r
-\r
-static const char *lsa_str_fixed_width[] = {\r
-       "???",\r
-       "2.5",\r
-       "5  ",\r
-       "???",\r
-       "10 "\r
-};\r
-\r
-const char *osm_get_lsa_str(IN uint8_t lsa)\r
-{\r
-       if (lsa > 4)\r
-               return lsa_str_fixed_width[0];\r
-       else\r
-               return lsa_str_fixed_width[lsa];\r
-}\r
-\r
-static const char *sm_mgr_signal_str[] = {\r
-       "OSM_SM_SIGNAL_NONE",   /* 0 */\r
-       "OSM_SM_SIGNAL_DISCOVERY_COMPLETED",    /* 2 */\r
-       "OSM_SM_SIGNAL_POLLING_TIMEOUT",        /* 3 */\r
-       "OSM_SM_SIGNAL_DISCOVER",       /* 4 */\r
-       "OSM_SM_SIGNAL_DISABLE",        /* 5 */\r
-       "OSM_SM_SIGNAL_HANDOVER",       /* 6 */\r
-       "OSM_SM_SIGNAL_HANDOVER_SENT",  /* 7 */\r
-       "OSM_SM_SIGNAL_ACKNOWLEDGE",    /* 8 */\r
-       "OSM_SM_SIGNAL_STANDBY",        /* 9 */\r
-       "OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED",   /* 10 */\r
-       "OSM_SM_SIGNAL_WAIT_FOR_HANDOVER",      /* 11 */\r
-       "UNKNOWN STATE!!"       /* 12 */\r
-};\r
-\r
-const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal)\r
-{\r
-       if (signal > OSM_SM_SIGNAL_MAX)\r
-               signal = OSM_SM_SIGNAL_MAX;\r
-       return sm_mgr_signal_str[signal];\r
-}\r
-\r
-static const char *sm_mgr_state_str[] = {\r
-       "NOTACTIVE",            /* 0 */\r
-       "DISCOVERING",          /* 1 */\r
-       "STANDBY",              /* 2 */\r
-       "MASTER",               /* 3 */\r
-       "UNKNOWN STATE!!"       /* 4 */\r
-};\r
-\r
-const char *osm_get_sm_mgr_state_str(IN uint16_t state)\r
-{\r
-       return state < ARR_SIZE(sm_mgr_state_str) ?\r
-           sm_mgr_state_str[state] :\r
-           sm_mgr_state_str[ARR_SIZE(sm_mgr_state_str) - 1];\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_inform.c b/branches/opensm_3/user/opensm/osm_inform.c
deleted file mode 100644 (file)
index 2cdf456..0000000
+++ /dev/null
@@ -1,617 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of inform record functions.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_inform.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-typedef struct osm_infr_match_ctxt {\r
-       cl_list_t *p_remove_infr_list;\r
-       ib_mad_notice_attr_t *p_ntc;\r
-} osm_infr_match_ctxt_t;\r
-\r
-void osm_infr_delete(IN osm_infr_t * p_infr)\r
-{\r
-       free(p_infr);\r
-}\r
-\r
-osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec)\r
-{\r
-       osm_infr_t *p_infr;\r
-\r
-       CL_ASSERT(p_infr_rec);\r
-\r
-       p_infr = (osm_infr_t *) malloc(sizeof(osm_infr_t));\r
-       if (p_infr)\r
-               memcpy(p_infr, p_infr_rec, sizeof(osm_infr_t));\r
-\r
-       return p_infr;\r
-}\r
-\r
-static void dump_all_informs(IN const osm_subn_t * p_subn, IN osm_log_t * p_log)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-\r
-       if (!osm_log_is_active(p_log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       p_list_item = cl_qlist_head(&p_subn->sa_infr_list);\r
-       while (p_list_item != cl_qlist_end(&p_subn->sa_infr_list)) {\r
-               osm_dump_inform_info(p_log,\r
-                                    &((osm_infr_t *) p_list_item)->\r
-                                    inform_record.inform_info, OSM_LOG_DEBUG);\r
-               p_list_item = cl_qlist_next(p_list_item);\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Match an infr by the InformInfo and Address vector\r
- **********************************************************************/\r
-static cl_status_t match_inf_rec(IN const cl_list_item_t * p_list_item,\r
-                                IN void *context)\r
-{\r
-       osm_infr_t *p_infr_rec = (osm_infr_t *) context;\r
-       osm_infr_t *p_infr = (osm_infr_t *) p_list_item;\r
-       osm_log_t *p_log = p_infr_rec->sa->p_log;\r
-       cl_status_t status = CL_NOT_FOUND;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (memcmp(&p_infr->report_addr, &p_infr_rec->report_addr,\r
-                  sizeof(p_infr_rec->report_addr))) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "Differ by Address\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* if inform_info.gid is not zero, ignore lid range */\r
-       if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {\r
-               if (memcmp(&p_infr->inform_record.inform_info.gid,\r
-                          &p_infr_rec->inform_record.inform_info.gid,\r
-                          sizeof(p_infr->inform_record.inform_info.gid))) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.gid\n");\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               if ((p_infr->inform_record.inform_info.lid_range_begin !=\r
-                    p_infr_rec->inform_record.inform_info.lid_range_begin) ||\r
-                   (p_infr->inform_record.inform_info.lid_range_end !=\r
-                    p_infr_rec->inform_record.inform_info.lid_range_end)) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.LIDRange\n");\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (p_infr->inform_record.inform_info.trap_type !=\r
-           p_infr_rec->inform_record.inform_info.trap_type) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Differ by InformInfo.TrapType\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_infr->inform_record.inform_info.is_generic !=\r
-           p_infr_rec->inform_record.inform_info.is_generic) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Differ by InformInfo.IsGeneric\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_infr->inform_record.inform_info.is_generic) {\r
-               if (p_infr->inform_record.inform_info.g_or_v.generic.trap_num !=\r
-                   p_infr_rec->inform_record.inform_info.g_or_v.generic.\r
-                   trap_num)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Generic.TrapNumber\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.generic.\r
-                        qpn_resp_time_val !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.generic.\r
-                        qpn_resp_time_val)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Generic.QPNRespTimeVal\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.generic.\r
-                        node_type_msb !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.generic.\r
-                        node_type_msb)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Generic.NodeTypeMSB\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.generic.\r
-                        node_type_lsb !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.generic.\r
-                        node_type_lsb)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Generic.NodeTypeLSB\n");\r
-               else\r
-                       status = CL_SUCCESS;\r
-       } else {\r
-               if (p_infr->inform_record.inform_info.g_or_v.vend.dev_id !=\r
-                   p_infr_rec->inform_record.inform_info.g_or_v.vend.dev_id)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Vendor.DeviceID\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.vend.\r
-                        qpn_resp_time_val !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.vend.\r
-                        qpn_resp_time_val)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Vendor.QPNRespTimeVal\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.vend.\r
-                        vendor_id_msb !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.vend.\r
-                        vendor_id_msb)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Vendor.VendorIdMSB\n");\r
-               else if (p_infr->inform_record.inform_info.g_or_v.vend.\r
-                        vendor_id_lsb !=\r
-                        p_infr_rec->inform_record.inform_info.g_or_v.vend.\r
-                        vendor_id_lsb)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Differ by InformInfo.Vendor.VendorIdLSB\n");\r
-               else\r
-                       status = CL_SUCCESS;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,\r
-                               IN osm_log_t * p_log,\r
-                               IN osm_infr_t * p_infr_rec)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       dump_all_informs(p_subn, p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Looking for Inform Record\n");\r
-       osm_dump_inform_info(p_log, &(p_infr_rec->inform_record.inform_info),\r
-                            OSM_LOG_DEBUG);\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "InformInfo list size %d\n",\r
-               cl_qlist_count(&p_subn->sa_infr_list));\r
-\r
-       p_list_item = cl_qlist_find_from_head(&p_subn->sa_infr_list,\r
-                                             match_inf_rec, p_infr_rec);\r
-\r
-       if (p_list_item == cl_qlist_end(&p_subn->sa_infr_list))\r
-               p_list_item = NULL;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return (osm_infr_t *) p_list_item;\r
-}\r
-\r
-void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                          IN osm_infr_t * p_infr)\r
-{\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Inserting new InformInfo Record into Database\n");\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Dump before insertion (size %d)\n",\r
-               cl_qlist_count(&p_subn->sa_infr_list));\r
-       dump_all_informs(p_subn, p_log);\r
-\r
-#if 0\r
-       osm_dump_inform_info(p_log,\r
-                            &(p_infr->inform_record.inform_info),\r
-                            OSM_LOG_DEBUG);\r
-#endif\r
-\r
-       cl_qlist_insert_head(&p_subn->sa_infr_list, &p_infr->list_item);\r
-       p_subn->p_osm->sa.dirty = TRUE;\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Dump after insertion (size %d)\n",\r
-               cl_qlist_count(&p_subn->sa_infr_list));\r
-       dump_all_informs(p_subn, p_log);\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                            IN osm_infr_t * p_infr)\r
-{\r
-       char gid_str[INET6_ADDRSTRLEN];\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Removing InformInfo Subscribing GID:%s"\r
-               " Enum:0x%X from Database\n",\r
-               inet_ntop(AF_INET6, p_infr->inform_record.subscriber_gid.raw,\r
-                         gid_str, sizeof gid_str),\r
-               p_infr->inform_record.subscriber_enum);\r
-\r
-       osm_dump_inform_info(p_log, &(p_infr->inform_record.inform_info),\r
-                            OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_remove_item(&p_subn->sa_infr_list, &p_infr->list_item);\r
-       p_subn->p_osm->sa.dirty = TRUE;\r
-\r
-       osm_infr_delete(p_infr);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Send a report:\r
- * Given a target address to send to and the notice.\r
- * We need to send SubnAdmReport\r
- **********************************************************************/\r
-static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec, /* the informinfo */\r
-                                  IN ib_mad_notice_attr_t * p_ntc      /* notice to send */\r
-    )\r
-{\r
-       osm_madw_t *p_report_madw;\r
-       ib_mad_notice_attr_t *p_report_ntc;\r
-       ib_mad_t *p_mad;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       static atomic32_t trap_fwd_trans_id = 0x02DAB000;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_log_t *p_log = p_infr_rec->sa->p_log;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* HACK: who switches or uses the src and dest GIDs in the grh_info ?? */\r
-\r
-       /* it is better to use LIDs since the GIDs might not be there for SMI traps */\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Forwarding Notice Event from LID:%u"\r
-               " to InformInfo LID:%u TID:0x%X\n",\r
-               cl_ntoh16(p_ntc->issuer_lid),\r
-               cl_ntoh16(p_infr_rec->report_addr.dest_lid), trap_fwd_trans_id);\r
-\r
-       /* get the MAD to send */\r
-       p_report_madw = osm_mad_pool_get(p_infr_rec->sa->p_mad_pool,\r
-                                        p_infr_rec->h_bind, MAD_BLOCK_SIZE,\r
-                                        &(p_infr_rec->report_addr));\r
-\r
-       if (!p_report_madw) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0203"\r
-                       "osm_mad_pool_get failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_report_madw->resp_expected = TRUE;\r
-\r
-       /* advance trap trans id (cant simply ++ on some systems inside ntoh) */\r
-       p_mad = osm_madw_get_mad_ptr(p_report_madw);\r
-       ib_mad_init_new(p_mad, IB_MCLASS_SUBN_ADM, 2, IB_MAD_METHOD_REPORT,\r
-                       cl_hton64((uint64_t) cl_atomic_inc(&trap_fwd_trans_id)),\r
-                       IB_MAD_ATTR_NOTICE, 0);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_report_madw);\r
-\r
-       p_report_ntc = (ib_mad_notice_attr_t *) & (p_sa_mad->data);\r
-\r
-       /* copy the notice */\r
-       *p_report_ntc = *p_ntc;\r
-\r
-       /* The TRUE is for: response is expected */\r
-       osm_sa_send(p_infr_rec->sa, p_report_madw, TRUE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * This routine compares a given Notice and a ListItem of InformInfo type.\r
- * PREREQUISITE:\r
- * The Notice.GID should be pre-filled with the trap generator GID\r
- **********************************************************************/\r
-static void match_notice_to_inf_rec(IN cl_list_item_t * p_list_item,\r
-                                   IN void *context)\r
-{\r
-       osm_infr_match_ctxt_t *p_infr_match = (osm_infr_match_ctxt_t *) context;\r
-       ib_mad_notice_attr_t *p_ntc = p_infr_match->p_ntc;\r
-       cl_list_t *p_infr_to_remove_list = p_infr_match->p_remove_infr_list;\r
-       osm_infr_t *p_infr_rec = (osm_infr_t *) p_list_item;\r
-       ib_inform_info_t *p_ii = &(p_infr_rec->inform_record.inform_info);\r
-       cl_status_t status = CL_NOT_FOUND;\r
-       osm_log_t *p_log = p_infr_rec->sa->p_log;\r
-       osm_subn_t *p_subn = p_infr_rec->sa->p_subn;\r
-       ib_gid_t source_gid;\r
-       osm_port_t *p_src_port;\r
-       osm_port_t *p_dest_port;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* matching rules\r
-        * InformInfo   Notice\r
-        * GID          IssuerGID    if non zero must match the trap\r
-        * LIDRange     IssuerLID    apply only if GID=0\r
-        * IsGeneric    IsGeneric    is compulsory and must match the trap\r
-        * Type         Type         if not 0xFFFF must match\r
-        * TrapNumber   TrapNumber   if not 0xFFFF must match\r
-        * DeviceId     DeviceID     if not 0xFFFF must match\r
-        * QPN dont care\r
-        * ProducerType ProducerType match or 0xFFFFFF // EZ: actually my interpretation\r
-        * VendorID     VendorID     match or 0xFFFFFF\r
-        */\r
-\r
-       /* GID          IssuerGID    if non zero must match the trap  */\r
-       if (p_ii->gid.unicast.prefix != 0\r
-           || p_ii->gid.unicast.interface_id != 0) {\r
-               /* match by GID */\r
-               if (memcmp(&(p_ii->gid), &(p_ntc->issuer_gid),\r
-                          sizeof(ib_gid_t))) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by GID\n");\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               /* LIDRange     IssuerLID    apply only if GID=0 */\r
-               /* If lid_range_begin of the informInfo is 0xFFFF - then it should be ignored. */\r
-               if (p_ii->lid_range_begin != 0xFFFF) {\r
-                       /* a real lid range is given - check it */\r
-                       if ((cl_hton16(p_ii->lid_range_begin) >\r
-                            cl_hton16(p_ntc->issuer_lid))\r
-                           || (cl_hton16(p_ntc->issuer_lid) >\r
-                               cl_hton16(p_ii->lid_range_end))) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                       "Mismatch by LID Range. Needed: %u <= %u <= %u\n",\r
-                                       cl_hton16(p_ii->lid_range_begin),\r
-                                       cl_hton16(p_ntc->issuer_lid),\r
-                                       cl_hton16(p_ii->lid_range_end));\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* IsGeneric    IsGeneric    is compulsory and must match the trap  */\r
-       if ((p_ii->is_generic && !ib_notice_is_generic(p_ntc)) ||\r
-           (!p_ii->is_generic && ib_notice_is_generic(p_ntc))) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Generic/Vendor\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* Type         Type         if not 0xFFFF must match */\r
-       if ((p_ii->trap_type != 0xFFFF) &&\r
-           (cl_ntoh16(p_ii->trap_type) != ib_notice_get_type(p_ntc))) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Type\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* based on generic type */\r
-       if (p_ii->is_generic) {\r
-               /* TrapNumber   TrapNumber   if not 0xFFFF must match */\r
-               if ((p_ii->g_or_v.generic.trap_num != 0xFFFF) &&\r
-                   (p_ii->g_or_v.generic.trap_num !=\r
-                    p_ntc->g_or_v.generic.trap_num)) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Trap Num\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               /* ProducerType ProducerType match or 0xFFFFFF  */\r
-               if ((cl_ntoh32(ib_inform_info_get_prod_type(p_ii)) != 0xFFFFFF)\r
-                   && (ib_inform_info_get_prod_type(p_ii) !=\r
-                       ib_notice_get_prod_type(p_ntc))) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Mismatch by Node Type: II=0x%06X (%s) Trap=0x%06X (%s)\n",\r
-                               cl_ntoh32(ib_inform_info_get_prod_type(p_ii)),\r
-                               ib_get_producer_type_str\r
-                               (ib_inform_info_get_prod_type(p_ii)),\r
-                               cl_ntoh32(ib_notice_get_prod_type(p_ntc)),\r
-                               ib_get_producer_type_str(ib_notice_get_prod_type\r
-                                                        (p_ntc)));\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               /* DeviceId     DeviceID     if not 0xFFFF must match */\r
-               if ((p_ii->g_or_v.vend.dev_id != 0xFFFF) &&\r
-                   (p_ii->g_or_v.vend.dev_id != p_ntc->g_or_v.vend.dev_id)) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Dev Id\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               /* VendorID     VendorID     match or 0xFFFFFF  */\r
-               if ((ib_inform_info_get_vend_id(p_ii) != CL_HTON32(0xFFFFFF)) &&\r
-                   (ib_inform_info_get_vend_id(p_ii) !=\r
-                    ib_notice_get_vend_id(p_ntc))) {\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Mismatch by Vendor ID\n");\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* Check if there is a pkey match. o13-17.1.1 */\r
-       /* Check if the issuer of the trap is the SM. If it is, then the gid\r
-          comparison should be done on the trap source (saved as the gid in the\r
-          data details field).\r
-          If the issuer gid is not the SM - then it is the guid of the trap\r
-          source */\r
-       if ((cl_ntoh64(p_ntc->issuer_gid.unicast.prefix) ==\r
-            p_subn->opt.subnet_prefix)\r
-           && (cl_ntoh64(p_ntc->issuer_gid.unicast.interface_id) ==\r
-               p_subn->sm_port_guid))\r
-               /* The issuer is the SM then this is trap 64-67 - compare the gid\r
-                  with the gid saved on the data details */\r
-               source_gid = p_ntc->data_details.ntc_64_67.gid;\r
-       else\r
-               source_gid = p_ntc->issuer_gid;\r
-\r
-       p_src_port =\r
-           osm_get_port_by_guid(p_subn, source_gid.unicast.interface_id);\r
-       if (!p_src_port) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "Cannot find source port with GUID:0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(source_gid.unicast.interface_id));\r
-               goto Exit;\r
-       }\r
-\r
-       p_dest_port = osm_get_port_by_lid(p_subn,\r
-                                         p_infr_rec->report_addr.dest_lid);\r
-       if (!p_dest_port) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "Cannot find destination port with LID:%u\n",\r
-                       cl_ntoh16(p_infr_rec->report_addr.dest_lid));\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_port_share_pkey(p_log, p_src_port, p_dest_port) == FALSE) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "Mismatch by Pkey\n");\r
-               /* According to o13-17.1.2 - If this informInfo does not have\r
-                  lid_range_begin of 0xFFFF, then this informInfo request\r
-                  should be removed from database */\r
-               if (p_ii->lid_range_begin != 0xFFFF) {\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "Pkey mismatch on lid_range_begin != 0xFFFF. "\r
-                               "Need to remove this informInfo from db\n");\r
-                       /* add the informInfo record to the remove_infr list */\r
-                       cl_list_insert_tail(p_infr_to_remove_list, p_infr_rec);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* send the report to the address provided in the inform record */\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "MATCH! Sending Report...\n");\r
-       send_report(p_infr_rec, p_ntc);\r
-       status = CL_SUCCESS;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Once a Trap was received by osm_trap_rcv, or a Trap sourced by\r
- * the SM was sent (Traps 64-67), this routine is called with a copy of\r
- * the notice data.\r
- * Given a notice attribute - compare and see if it matches the InformInfo\r
- * element and if it does - call the Report(Notice) for the\r
- * target QP registered by the address stored in the InformInfo element\r
- **********************************************************************/\r
-static void log_notice(osm_log_t * log, osm_log_level_t level,\r
-                      ib_mad_notice_attr_t * ntc)\r
-{\r
-       char gid_str[INET6_ADDRSTRLEN];\r
-       ib_gid_t *gid;\r
-\r
-       /* an official Event information log */\r
-       if (ib_notice_is_generic(ntc)) {\r
-               if ((ntc->g_or_v.generic.trap_num == CL_HTON16(64)) ||\r
-                   (ntc->g_or_v.generic.trap_num == CL_HTON16(65)) ||\r
-                   (ntc->g_or_v.generic.trap_num == CL_HTON16(66)) ||\r
-                   (ntc->g_or_v.generic.trap_num == CL_HTON16(67)))\r
-                       gid = &ntc->data_details.ntc_64_67.gid;\r
-               else\r
-                       gid = &ntc->issuer_gid;\r
-               OSM_LOG(log, level,\r
-                       "Reporting Generic Notice type:%u num:%u (%s)"\r
-                       " from LID:%u GID:%s\n",\r
-                       ib_notice_get_type(ntc),\r
-                       cl_ntoh16(ntc->g_or_v.generic.trap_num),\r
-                       ib_get_trap_str(ntc->g_or_v.generic.trap_num),\r
-                       cl_ntoh16(ntc->issuer_lid),\r
-                       inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));\r
-       } else\r
-               OSM_LOG(log, level,\r
-                       "Reporting Vendor Notice type:%u vend:%u dev:%u"\r
-                       " from LID:%u GID:%s\n",\r
-                       ib_notice_get_type(ntc),\r
-                       cl_ntoh32(ib_notice_get_vend_id(ntc)),\r
-                       cl_ntoh16(ntc->g_or_v.vend.dev_id),\r
-                       cl_ntoh16(ntc->issuer_lid),\r
-                       inet_ntop(AF_INET6, ntc->issuer_gid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-}\r
-\r
-ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,\r
-                                 IN ib_mad_notice_attr_t * p_ntc)\r
-{\r
-       osm_infr_match_ctxt_t context;\r
-       cl_list_t infr_to_remove_list;\r
-       osm_infr_t *p_infr_rec;\r
-       osm_infr_t *p_next_infr_rec;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /*\r
-        * we must make sure we are ready for this...\r
-        * note that the trap receivers might be initialized before\r
-        * the osm_infr_init call is performed.\r
-        */\r
-       if (p_subn->sa_infr_list.state != CL_INITIALIZED) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Ignoring Notice Reports since Inform List is not initialized yet!\n");\r
-               return IB_ERROR;\r
-       }\r
-\r
-       if (osm_log_is_active(p_log, OSM_LOG_INFO))\r
-               log_notice(p_log, OSM_LOG_INFO, p_ntc);\r
-\r
-       /* Create a list that will hold all the infr records that should\r
-          be removed due to violation. o13-17.1.2 */\r
-       cl_list_construct(&infr_to_remove_list);\r
-       cl_list_init(&infr_to_remove_list, 5);\r
-       context.p_remove_infr_list = &infr_to_remove_list;\r
-       context.p_ntc = p_ntc;\r
-\r
-       /* go over all inform info available at the subnet */\r
-       /* try match to the given notice and send if match */\r
-       cl_qlist_apply_func(&p_subn->sa_infr_list, match_notice_to_inf_rec,\r
-                           &context);\r
-\r
-       /* If we inserted items into the infr_to_remove_list - we need to\r
-          remove them */\r
-       p_infr_rec = (osm_infr_t *) cl_list_remove_head(&infr_to_remove_list);\r
-       while (p_infr_rec != NULL) {\r
-               p_next_infr_rec =\r
-                   (osm_infr_t *) cl_list_remove_head(&infr_to_remove_list);\r
-               osm_infr_remove_from_db(p_subn, p_log, p_infr_rec);\r
-               p_infr_rec = p_next_infr_rec;\r
-       }\r
-       cl_list_destroy(&infr_to_remove_list);\r
-\r
-       /* report IB traps to plugin */\r
-       osm_opensm_report_event(p_subn->p_osm, OSM_EVENT_ID_TRAP, p_ntc);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-\r
-       return IB_SUCCESS;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_lid_mgr.c b/branches/opensm_3/user/opensm/osm_lid_mgr.c
deleted file mode 100644 (file)
index 5086004..0000000
+++ /dev/null
@@ -1,1206 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_lid_mgr_t.\r
- * This file implements the LID Manager object which is responsible for\r
- * assigning LIDs to all ports on the subnet.\r
- *\r
- * DATA STRUCTURES:\r
- *  p_subn->port_lid_tbl : a vector pointing from lid to its port.\r
- *  osm db guid2lid domain : a hash from guid to lid (min lid).\r
- *  p_subn->port_guid_tbl : a map from guid to discovered port obj.\r
- *\r
- * ALGORITHM:\r
- *\r
- * 0. we define a function to obtain the correct port lid:\r
- *    lid_mgr_get_port_lid( p_mgr, port, &min_lid ):\r
- *    0.1 if the port info lid matches the guid2lid return 0\r
- *    0.2 if the port info has a lid and that range is empty in\r
- *        port_lid_tbl, return 0 and update the port_lid_tbl and\r
- *        guid2lid\r
- *    0.3 else find an empty space in port_lid_tbl, update the\r
- *    port_lid_tbl and guid2lid, return 1 to flag a change required.\r
- *\r
- * 1. During initialization:\r
- *   1.1 initialize the guid2lid database domain.\r
- *   1.2 if reassign_lid is not set:\r
- *   1.2.1 read the persistent data for the domain.\r
- *   1.2.2 validate no duplicate use of lids and lids are 2^(lmc-1)\r
- *\r
- * 2. During SM port lid assignment:\r
- *   2.1 if reassign_lids is set, make it 2^lmc\r
- *   2.2 cleanup all port_lid_tbl and re-fill it according to guid2lid\r
- *   2.3 call lid_mgr_get_port_lid the SM port\r
- *   2.4 set the port info\r
- *\r
- * 3. During all other ports lid assignment:\r
- *   3.1 go through all ports in the subnet\r
- *   3.1.1 call lid_mgr_get_port_min_lid\r
- *   3.1.2 if a change required send the port info\r
- *   3.2 if any change send the signal PENDING...\r
- *\r
- * 4. Store the guid2lid\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_lid_mgr.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_db_pack.h>\r
-\r
-/**********************************************************************\r
-  lid range item of qlist\r
- **********************************************************************/\r
-typedef struct osm_lid_mgr_range {\r
-       cl_list_item_t item;\r
-       uint16_t min_lid;\r
-       uint16_t max_lid;\r
-} osm_lid_mgr_range_t;\r
-\r
-void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       memset(p_mgr, 0, sizeof(*p_mgr));\r
-}\r
-\r
-void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       cl_list_item_t *p_item;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) !=\r
-              cl_qlist_end(&p_mgr->free_ranges))\r
-               free((osm_lid_mgr_range_t *) p_item);\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-/**********************************************************************\r
-Validate the guid to lid data by making sure that under the current\r
-LMC we did not get duplicates. If we do flag them as errors and remove\r
-the entry.\r
-**********************************************************************/\r
-static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       cl_qlist_t guids;\r
-       osm_db_guid_elem_t *p_item;\r
-       uint16_t lid;\r
-       uint16_t min_lid;\r
-       uint16_t max_lid;\r
-       uint16_t lmc_mask;\r
-       boolean_t lids_ok;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);\r
-\r
-       cl_qlist_init(&guids);\r
-\r
-       if (osm_db_guid2lid_guids(p_mgr->p_g2l, &guids)) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0310: "\r
-                       "could not get guid list\n");\r
-               goto Exit;\r
-       }\r
-\r
-       while ((p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids))\r
-              != (osm_db_guid_elem_t *) cl_qlist_end(&guids)) {\r
-               if (osm_db_guid2lid_get(p_mgr->p_g2l, p_item->guid,\r
-                                       &min_lid, &max_lid))\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0311: "\r
-                               "could not get lid for guid:0x%016" PRIx64 "\n",\r
-                               p_item->guid);\r
-               else {\r
-                       lids_ok = TRUE;\r
-\r
-                       if (min_lid > max_lid || min_lid == 0\r
-                           || p_item->guid == 0\r
-                           || max_lid > p_mgr->p_subn->max_ucast_lid_ho) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 0312: "\r
-                                       "Illegal LID range [%u:%u] for "\r
-                                       "guid:0x%016" PRIx64 "\n", min_lid,\r
-                                       max_lid, p_item->guid);\r
-                               lids_ok = FALSE;\r
-                       } else if (min_lid != max_lid\r
-                                  && (min_lid & lmc_mask) != min_lid) {\r
-                               /* check that if the lids define a range that is\r
-                                  valid for the current LMC mask */\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 0313: "\r
-                                       "LID range [%u:%u] for guid:0x%016"\r
-                                       PRIx64\r
-                                       " is not aligned according to mask:0x%04x\n",\r
-                                       min_lid, max_lid, p_item->guid,\r
-                                       lmc_mask);\r
-                               lids_ok = FALSE;\r
-                       } else {\r
-                               /* check if the lids were not previously assigned */\r
-                               for (lid = min_lid; lid <= max_lid; lid++) {\r
-                                       if (p_mgr->used_lids[lid]) {\r
-                                               OSM_LOG(p_mgr->p_log,\r
-                                                       OSM_LOG_ERROR,\r
-                                                       "ERR 0314: "\r
-                                                       "0x%04x for guid:0x%016"\r
-                                                       PRIx64\r
-                                                       " was previously used\n",\r
-                                                       lid, p_item->guid);\r
-                                               lids_ok = FALSE;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       if (lids_ok)\r
-                               /* mark that it was visited */\r
-                               for (lid = min_lid; lid <= max_lid; lid++)\r
-                                       p_mgr->used_lids[lid] = 1;\r
-                       else if (osm_db_guid2lid_delete(p_mgr->p_g2l,\r
-                                                       p_item->guid))\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 0315: failed to delete entry for "\r
-                                       "guid:0x%016" PRIx64 "\n",\r
-                                       p_item->guid);\r
-               }               /* got a lid */\r
-               free(p_item);\r
-       }                       /* all guids */\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       osm_lid_mgr_construct(p_mgr);\r
-\r
-       p_mgr->sm = sm;\r
-       p_mgr->p_log = sm->p_log;\r
-       p_mgr->p_subn = sm->p_subn;\r
-       p_mgr->p_db = sm->p_db;\r
-       p_mgr->p_lock = sm->p_lock;\r
-\r
-       /* we initialize and restore the db domain of guid to lid map */\r
-       p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "guid2lid");\r
-       if (!p_mgr->p_g2l) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0316: "\r
-                       "Error initializing Guid-to-Lid persistent database\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qlist_init(&p_mgr->free_ranges);\r
-\r
-       /* we use the stored guid to lid table if not forced to reassign */\r
-       if (!p_mgr->p_subn->opt.reassign_lids) {\r
-               if (osm_db_restore(p_mgr->p_g2l)) {\r
-#ifndef __WIN__\r
-                       /*\r
-                        * When Windows is BSODing, it might corrupt files that\r
-                        * were previously opened for writing, even if the files\r
-                        * are closed, so we might see corrupted guid2lid file.\r
-                        */\r
-                       if (p_mgr->p_subn->opt.exit_on_fatal) {\r
-                               osm_log(p_mgr->p_log, OSM_LOG_SYS,\r
-                                       "FATAL: Error restoring Guid-to-Lid "\r
-                                       "persistent database\n");\r
-                               status = IB_ERROR;\r
-                               goto Exit;\r
-                       } else\r
-#endif\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 0317: Error restoring Guid-to-Lid "\r
-                                       "persistent database\n");\r
-               }\r
-\r
-               /* we need to make sure we did not get duplicates with\r
-                  current lmc */\r
-               lid_mgr_validate_db(p_mgr);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return status;\r
-}\r
-\r
-static uint16_t trim_lid(IN uint16_t lid)\r
-{\r
-       if (lid > IB_LID_UCAST_END_HO || lid < IB_LID_UCAST_START_HO)\r
-               return 0;\r
-       return lid;\r
-}\r
-\r
-/**********************************************************************\r
- initialize the manager for a new sweep:\r
- scans the known persistent assignment and port_lid_tbl\r
- re-calculate all empty ranges.\r
- cleanup invalid port_lid_tbl entries\r
-**********************************************************************/\r
-static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl;\r
-       uint16_t max_defined_lid, max_persistent_lid, max_discovered_lid;\r
-       uint16_t disc_min_lid, disc_max_lid, db_min_lid, db_max_lid;\r
-       int status = 0;\r
-       cl_list_item_t *p_item;\r
-       boolean_t is_free;\r
-       osm_lid_mgr_range_t *p_range = NULL;\r
-       osm_port_t *p_port;\r
-       cl_qmap_t *p_port_guid_tbl;\r
-       uint8_t lmc_num_lids = (uint8_t) (1 << p_mgr->p_subn->opt.lmc);\r
-       uint16_t lmc_mask, req_lid, num_lids, lid;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);\r
-\r
-       /* if we came out of standby we need to discard any previous guid2lid\r
-          info we might have.\r
-          Do this only if the honor_guid2lid_file option is FALSE. If not, then\r
-          need to honor this file. */\r
-       if (p_mgr->p_subn->coming_out_of_standby == TRUE) {\r
-               osm_db_clear(p_mgr->p_g2l);\r
-               memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));\r
-               if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Ignore guid2lid file when coming out of standby\n");\r
-               else {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Honor current guid2lid file when coming out "\r
-                               "of standby\n");\r
-                       if (osm_db_restore(p_mgr->p_g2l))\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 0306: "\r
-                                       "Error restoring Guid-to-Lid "\r
-                                       "persistent database. Ignoring it\n");\r
-                       lid_mgr_validate_db(p_mgr);\r
-               }\r
-       }\r
-\r
-       /* we need to cleanup the empty ranges list */\r
-       while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) !=\r
-              cl_qlist_end(&p_mgr->free_ranges))\r
-               free((osm_lid_mgr_range_t *) p_item);\r
-\r
-       /* first clean up the port_by_lid_tbl */\r
-       for (lid = 0; lid < cl_ptr_vector_get_size(p_discovered_vec); lid++)\r
-               cl_ptr_vector_set(p_discovered_vec, lid, NULL);\r
-\r
-       /* we if are in the first sweep and in reassign lids mode\r
-          we should ignore all the available info and simply define one\r
-          huge empty range */\r
-       if (p_mgr->p_subn->first_time_master_sweep == TRUE &&\r
-           p_mgr->p_subn->opt.reassign_lids == TRUE) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Skipping all lids as we are reassigning them\n");\r
-               p_range = malloc(sizeof(osm_lid_mgr_range_t));\r
-               if (p_range)\r
-                       p_range->min_lid = 1;\r
-               goto AfterScanningLids;\r
-       }\r
-\r
-       /* go over all discovered ports and mark their entries */\r
-       p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;\r
-\r
-       for (p_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);\r
-            p_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl);\r
-            p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {\r
-               osm_port_get_lid_range_ho(p_port, &disc_min_lid, &disc_max_lid);\r
-               disc_min_lid = trim_lid(disc_min_lid);\r
-               disc_max_lid = trim_lid(disc_max_lid);\r
-               for (lid = disc_min_lid; lid <= disc_max_lid; lid++)\r
-                       cl_ptr_vector_set(p_discovered_vec, lid, p_port);\r
-               /* make sure the guid2lid entry is valid. If not, clean it. */\r
-               if (osm_db_guid2lid_get(p_mgr->p_g2l,\r
-                                       cl_ntoh64(osm_port_get_guid(p_port)),\r
-                                       &db_min_lid, &db_max_lid))\r
-                       continue;\r
-\r
-               if (!p_port->p_node->sw ||\r
-                   osm_switch_sp0_is_lmc_capable(p_port->p_node->sw,\r
-                                                 p_mgr->p_subn))\r
-                       num_lids = lmc_num_lids;\r
-               else\r
-                       num_lids = 1;\r
-\r
-               if (num_lids != 1 &&\r
-                   ((db_min_lid & lmc_mask) != db_min_lid ||\r
-                    db_max_lid - db_min_lid + 1 < num_lids)) {\r
-                       /* Not aligned, or not wide enough, then remove the entry */\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Cleaning persistent entry for guid:"\r
-                               "0x%016" PRIx64 " illegal range:[0x%x:0x%x]\n",\r
-                               cl_ntoh64(osm_port_get_guid(p_port)),\r
-                               db_min_lid, db_max_lid);\r
-                       osm_db_guid2lid_delete(p_mgr->p_g2l,\r
-                                              cl_ntoh64\r
-                                              (osm_port_get_guid(p_port)));\r
-                       for (lid = db_min_lid; lid <= db_max_lid; lid++)\r
-                               p_mgr->used_lids[lid] = 0;\r
-               }\r
-       }\r
-\r
-       /*\r
-          Our task is to find free lid ranges.\r
-          A lid can be used if\r
-          1. a persistent assignment exists\r
-          2. the lid is used by a discovered port that does not have a\r
-          persistent assignment.\r
-\r
-          scan through all lid values of both the persistent table and\r
-          discovered table.\r
-          If the lid has an assigned port in the discovered table:\r
-          * make sure the lid matches the persistent table, or\r
-          * there is no other persistent assignment for that lid.\r
-          * else cleanup the port_by_lid_tbl, mark this as empty range.\r
-          Else if the lid does not have an entry in the persistent table\r
-          mark it as free.\r
-        */\r
-\r
-       /* find the range of lids to scan */\r
-       max_discovered_lid =\r
-           (uint16_t) cl_ptr_vector_get_size(p_discovered_vec);\r
-       max_persistent_lid = sizeof(p_mgr->used_lids) - 1;\r
-\r
-       /* but the vectors have one extra entry for lid=0 */\r
-       if (max_discovered_lid)\r
-               max_discovered_lid--;\r
-\r
-       if (max_persistent_lid > max_discovered_lid)\r
-               max_defined_lid = max_persistent_lid;\r
-       else\r
-               max_defined_lid = max_discovered_lid;\r
-\r
-       for (lid = 1; lid <= max_defined_lid; lid++) {\r
-               is_free = TRUE;\r
-               /* first check to see if the lid is used by a persistent assignment */\r
-               if (lid <= max_persistent_lid && p_mgr->used_lids[lid]) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "0x%04x is not free as its mapped by the "\r
-                               "persistent db\n", lid);\r
-                       is_free = FALSE;\r
-                       /* check this is a discovered port */\r
-               } else if (lid <= max_discovered_lid &&\r
-                          (p_port = cl_ptr_vector_get(p_discovered_vec,\r
-                                                      lid))) {\r
-                       /* we have a port. Now lets see if we can preserve its lid range. */\r
-                       /* For that, we need to make sure:\r
-                          1. The port has a (legal) persistency entry. Then the\r
-                          local lid is free (we will use the persistency value).\r
-                          2. Can the port keep its local assignment?\r
-                          a. Make sure the lid a aligned.\r
-                          b. Make sure all needed lids (for the lmc) are free\r
-                          according to persistency table.\r
-                        */\r
-                       /* qualify the guid of the port is not persistently\r
-                          mapped to another range */\r
-                       if (!osm_db_guid2lid_get(p_mgr->p_g2l,\r
-                                                cl_ntoh64\r
-                                                (osm_port_get_guid(p_port)),\r
-                                                &db_min_lid, &db_max_lid)) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "0x%04x is free as it was "\r
-                                       "discovered but mapped by the "\r
-                                       "persistent db to [0x%04x:0x%04x]\n",\r
-                                       lid, db_min_lid, db_max_lid);\r
-                       } else {\r
-                               /* can the port keep its assignment ? */\r
-                               /* get the lid range of that port, and the\r
-                                  required number of lids we are about to\r
-                                  assign to it */\r
-                               osm_port_get_lid_range_ho(p_port,\r
-                                                         &disc_min_lid,\r
-                                                         &disc_max_lid);\r
-                               if (!p_port->p_node->sw ||\r
-                                   osm_switch_sp0_is_lmc_capable\r
-                                   (p_port->p_node->sw, p_mgr->p_subn)) {\r
-                                       disc_max_lid =\r
-                                           disc_min_lid + lmc_num_lids - 1;\r
-                                       num_lids = lmc_num_lids;\r
-                               } else\r
-                                       num_lids = 1;\r
-\r
-                               /* Make sure the lid is aligned */\r
-                               if (num_lids != 1\r
-                                   && (disc_min_lid & lmc_mask) !=\r
-                                   disc_min_lid) {\r
-                                       /* The lid cannot be used */\r
-                                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                               "0x%04x is free as it was "\r
-                                               "discovered but not aligned\n",\r
-                                               lid);\r
-                               } else {\r
-                                       /* check that all needed lids are not persistently mapped */\r
-                                       is_free = FALSE;\r
-                                       for (req_lid = disc_min_lid + 1;\r
-                                            req_lid <= disc_max_lid;\r
-                                            req_lid++) {\r
-                                               if (req_lid <=\r
-                                                   max_persistent_lid &&\r
-                                                   p_mgr->used_lids[req_lid]) {\r
-                                                       OSM_LOG(p_mgr->p_log,\r
-                                                               OSM_LOG_DEBUG,\r
-                                                               "0x%04x is free as it was discovered "\r
-                                                               "but mapped\n",\r
-                                                               lid);\r
-                                                       is_free = TRUE;\r
-                                                       break;\r
-                                               }\r
-                                       }\r
-\r
-                                       if (is_free == FALSE) {\r
-                                               /* This port will use its local lid, and consume the entire required lid range.\r
-                                                  Thus we can skip that range. */\r
-                                               /* If the disc_max_lid is greater then lid, we can skip right to it,\r
-                                                  since we've done all neccessary checks on the lids in between. */\r
-                                               if (disc_max_lid > lid)\r
-                                                       lid = disc_max_lid;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if (is_free) {\r
-                       if (p_range)\r
-                               p_range->max_lid = lid;\r
-                       else {\r
-                               p_range = malloc(sizeof(osm_lid_mgr_range_t));\r
-                               if (p_range) {\r
-                                       p_range->min_lid = lid;\r
-                                       p_range->max_lid = lid;\r
-                               }\r
-                       }\r
-               /* this lid is used so we need to finalize the previous free range */\r
-               } else if (p_range) {\r
-                       cl_qlist_insert_tail(&p_mgr->free_ranges,\r
-                                            &p_range->item);\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "new free lid range [%u:%u]\n",\r
-                               p_range->min_lid, p_range->max_lid);\r
-                       p_range = NULL;\r
-               }\r
-       }\r
-\r
-AfterScanningLids:\r
-       /* after scanning all known lids we need to extend the last range\r
-          to the max allowed lid */\r
-       if (!p_range) {\r
-               p_range = malloc(sizeof(osm_lid_mgr_range_t));\r
-               /*\r
-                  The p_range can be NULL in one of 2 cases:\r
-                  1. If max_defined_lid == 0. In this case, we want the\r
-                  entire range.\r
-                  2. If all lids discovered in the loop where mapped. In this\r
-                  case, no free range exists and we want to define it after the\r
-                  last mapped lid.\r
-                */\r
-               if (p_range)\r
-                       p_range->min_lid = lid;\r
-       }\r
-       if (p_range) {\r
-               p_range->max_lid = p_mgr->p_subn->max_ucast_lid_ho;\r
-               cl_qlist_insert_tail(&p_mgr->free_ranges, &p_range->item);\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "final free lid range [%u:%u]\n",\r
-                       p_range->min_lid, p_range->max_lid);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- check if the given range of lids is free\r
-**********************************************************************/\r
-static boolean_t lid_mgr_is_range_not_persistent(IN osm_lid_mgr_t * p_mgr,\r
-                                                IN uint16_t lid,\r
-                                                IN uint16_t num_lids)\r
-{\r
-       uint16_t i;\r
-       uint8_t start_lid = (uint8_t) (1 << p_mgr->p_subn->opt.lmc);\r
-\r
-       if (lid < start_lid)\r
-               return FALSE;\r
-\r
-       for (i = lid; i < lid + num_lids; i++)\r
-               if (p_mgr->used_lids[i])\r
-                       return FALSE;\r
-\r
-       return TRUE;\r
-}\r
-\r
-/**********************************************************************\r
-find a free lid range\r
-**********************************************************************/\r
-static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr,\r
-                                       IN uint8_t num_lids,\r
-                                       OUT uint16_t * p_min_lid,\r
-                                       OUT uint16_t * p_max_lid)\r
-{\r
-       uint16_t lid;\r
-       cl_list_item_t *p_item;\r
-       cl_list_item_t *p_next_item;\r
-       osm_lid_mgr_range_t *p_range = NULL;\r
-       uint8_t lmc_num_lids;\r
-       uint16_t lmc_mask;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "LMC = %u, number LIDs = %u\n",\r
-               p_mgr->p_subn->opt.lmc, num_lids);\r
-\r
-       lmc_num_lids = (1 << p_mgr->p_subn->opt.lmc);\r
-       lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);\r
-\r
-       /*\r
-          Search the list of free lid ranges for a range which is big enough\r
-        */\r
-       p_item = cl_qlist_head(&p_mgr->free_ranges);\r
-       while (p_item != cl_qlist_end(&p_mgr->free_ranges)) {\r
-               p_next_item = cl_qlist_next(p_item);\r
-               p_range = (osm_lid_mgr_range_t *) p_item;\r
-\r
-               lid = p_range->min_lid;\r
-\r
-               /* if we require more then one lid we must align to LMC */\r
-               if (num_lids > 1) {\r
-                       if ((lid & lmc_mask) != lid)\r
-                               lid = (lid + lmc_num_lids) & lmc_mask;\r
-               }\r
-\r
-               /* but we can be out of the range */\r
-               if (lid + num_lids - 1 <= p_range->max_lid) {\r
-                       /* ok let us use that range */\r
-                       if (lid + num_lids - 1 == p_range->max_lid) {\r
-                               /* we consumed the entire range */\r
-                               cl_qlist_remove_item(&p_mgr->free_ranges,\r
-                                                    p_item);\r
-                               free(p_item);\r
-                       } else\r
-                               /* only update the available range */\r
-                               p_range->min_lid = lid + num_lids;\r
-\r
-                       *p_min_lid = lid;\r
-                       *p_max_lid = (uint16_t) (lid + num_lids - 1);\r
-                       return;\r
-               }\r
-               p_item = p_next_item;\r
-       }\r
-\r
-       /*\r
-          Couldn't find a free range of lids.\r
-        */\r
-       *p_min_lid = *p_max_lid = 0;\r
-       /* if we run out of lids, give an error and abort! */\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0307: "\r
-               "OPENSM RAN OUT OF LIDS!!!\n");\r
-       CL_ASSERT(0);\r
-}\r
-\r
-static void lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,\r
-                                                     IN osm_port_t * p_port)\r
-{\r
-       cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl;\r
-       uint16_t lid, min_lid, max_lid;\r
-       uint16_t max_tbl_lid =\r
-           (uint16_t) (cl_ptr_vector_get_size(p_discovered_vec));\r
-\r
-       osm_port_get_lid_range_ho(p_port, &min_lid, &max_lid);\r
-       min_lid = trim_lid(min_lid);\r
-       max_lid = trim_lid(max_lid);\r
-       for (lid = min_lid; lid <= max_lid; lid++)\r
-               if (lid < max_tbl_lid &&\r
-                   p_port == cl_ptr_vector_get(p_discovered_vec, lid))\r
-                       cl_ptr_vector_set(p_discovered_vec, lid, NULL);\r
-}\r
-\r
-/**********************************************************************\r
- 0.1 if the port info lid matches the guid2lid return 0\r
- 0.2 if the port info has a lid and that range is empty in\r
-     port_lid_tbl, return 0 and update the port_lid_tbl and\r
-     guid2lid\r
- 0.3 else find an empty space in port_lid_tbl, update the\r
- port_lid_tbl and guid2lid, return 1 to flag a change required.\r
-**********************************************************************/\r
-static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,\r
-                               IN osm_port_t * p_port,\r
-                               OUT uint16_t * p_min_lid,\r
-                               OUT uint16_t * p_max_lid)\r
-{\r
-       uint16_t lid, min_lid, max_lid;\r
-       uint64_t guid;\r
-       uint8_t num_lids = (1 << p_mgr->p_subn->opt.lmc);\r
-       int lid_changed = 0;\r
-       uint16_t lmc_mask;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       /* get the lid from the guid2lid */\r
-       guid = cl_ntoh64(osm_port_get_guid(p_port));\r
-\r
-       /* if the port is a base switch port 0 then we only need one lid */\r
-       if (p_port->p_node->sw &&\r
-           !osm_switch_sp0_is_lmc_capable(p_port->p_node->sw, p_mgr->p_subn))\r
-               num_lids = 1;\r
-\r
-       if (p_mgr->p_subn->first_time_master_sweep == TRUE &&\r
-           p_mgr->p_subn->opt.reassign_lids == TRUE)\r
-               goto AssignLid;\r
-\r
-       lmc_mask = ~(num_lids - 1);\r
-\r
-       /* if the port matches the guid2lid */\r
-       if (!osm_db_guid2lid_get(p_mgr->p_g2l, guid, &min_lid, &max_lid)) {\r
-               *p_min_lid = min_lid;\r
-               *p_max_lid = min_lid + num_lids - 1;\r
-               if (min_lid == cl_ntoh16(osm_port_get_base_lid(p_port)))\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "0x%016" PRIx64\r
-                               " matches its known lid:%u\n", guid, min_lid);\r
-               else {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "0x%016" PRIx64 " with lid:%u "\r
-                               "does not match its known lid:%u\n",\r
-                               guid, cl_ntoh16(osm_port_get_base_lid(p_port)),\r
-                               min_lid);\r
-                       lid_mgr_cleanup_discovered_port_lid_range(p_mgr,\r
-                                                                 p_port);\r
-                       /* we still need to send the setting to the target port */\r
-                       lid_changed = 1;\r
-               }\r
-               goto NewLidSet;\r
-       } else\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "0x%016" PRIx64 " has no persistent lid assigned\n",\r
-                       guid);\r
-\r
-       /* if the port info carries a lid it must be lmc aligned and not mapped\r
-          by the pesistent storage  */\r
-       min_lid = cl_ntoh16(osm_port_get_base_lid(p_port));\r
-\r
-       /* we want to ignore the discovered lid if we are also on first sweep of\r
-          reassign lids flow */\r
-       if (min_lid) {\r
-               /* make sure lid is valid */\r
-               if ((min_lid & lmc_mask) == min_lid) {\r
-                       /* is it free */\r
-                       if (lid_mgr_is_range_not_persistent\r
-                           (p_mgr, min_lid, num_lids)) {\r
-                               *p_min_lid = min_lid;\r
-                               *p_max_lid = min_lid + num_lids - 1;\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "0x%016" PRIx64\r
-                                       " lid range:[%u-%u] is free\n",\r
-                                       guid, *p_min_lid, *p_max_lid);\r
-                               goto NewLidSet;\r
-                       } else\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "0x%016" PRIx64 " existing lid "\r
-                                       "range:[%u:%u] is not free\n",\r
-                                       guid, min_lid, min_lid + num_lids - 1);\r
-               } else\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "0x%016" PRIx64 " existing lid range:"\r
-                               "[%u:%u] is not lmc aligned\n",\r
-                               guid, min_lid, min_lid + num_lids - 1);\r
-       }\r
-\r
-AssignLid:\r
-       /* first cleanup the existing discovered lid range */\r
-       lid_mgr_cleanup_discovered_port_lid_range(p_mgr, p_port);\r
-\r
-       /* find an empty space */\r
-       lid_mgr_find_free_lid_range(p_mgr, num_lids, p_min_lid, p_max_lid);\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "0x%016" PRIx64 " assigned a new lid range:[%u-%u]\n",\r
-               guid, *p_min_lid, *p_max_lid);\r
-       lid_changed = 1;\r
-\r
-NewLidSet:\r
-       /* update the guid2lid db and used_lids */\r
-       osm_db_guid2lid_set(p_mgr->p_g2l, guid, *p_min_lid, *p_max_lid);\r
-       for (lid = *p_min_lid; lid <= *p_max_lid; lid++)\r
-               p_mgr->used_lids[lid] = 1;\r
-\r
-       /* make sure the assigned lids are marked in port_lid_tbl */\r
-       for (lid = *p_min_lid; lid <= *p_max_lid; lid++)\r
-               cl_ptr_vector_set(&p_mgr->p_subn->port_lid_tbl, lid, p_port);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return lid_changed;\r
-}\r
-\r
-/**********************************************************************\r
- Set to INIT the remote port of the given physical port\r
- **********************************************************************/\r
-static void lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * p_mgr,\r
-                                               IN osm_physp_t * p_physp)\r
-{\r
-       osm_physp_t *p_rem_physp = osm_physp_get_remote(p_physp);\r
-\r
-       if (p_rem_physp == NULL)\r
-               return;\r
-\r
-       /* but in some rare cases the remote side might be non responsive */\r
-       ib_port_info_set_port_state(&p_rem_physp->port_info, IB_LINK_INIT);\r
-}\r
-\r
-static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,\r
-                               IN osm_port_t * p_port,\r
-                               IN osm_physp_t * p_physp, IN ib_net16_t lid)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_port_info_t *p_pi = (ib_port_info_t *) payload;\r
-       const ib_port_info_t *p_old_pi;\r
-       osm_madw_context_t context;\r
-       osm_node_t *p_node;\r
-       ib_api_status_t status;\r
-       uint8_t mtu;\r
-       uint8_t op_vls;\r
-       uint8_t port_num;\r
-       boolean_t send_set = FALSE;\r
-       int ret = 0;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       /*\r
-          Don't bother doing anything if this Physical Port is not valid.\r
-          This allows simplified code in the caller.\r
-        */\r
-       if (!p_physp)\r
-               goto Exit;\r
-\r
-       port_num = osm_physp_get_port_num(p_physp);\r
-       p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH && port_num != 0) {\r
-               /*\r
-                  Switch ports that are not numbered 0 should not be set\r
-                  with the following attributes as they are set later\r
-                  (during NO_CHANGE state in link mgr).\r
-                */\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Skipping switch port %u, GUID 0x%016" PRIx64 "\n",\r
-                       port_num, cl_ntoh64(osm_physp_get_port_guid(p_physp)));\r
-               goto Exit;\r
-       }\r
-\r
-       p_old_pi = &p_physp->port_info;\r
-\r
-       /*\r
-          First, copy existing parameters from the PortInfo attribute we\r
-          already have for this node.\r
-\r
-          Second, update with default values that we know must be set for\r
-          every Physical Port and the LID and set the neighbor MTU field\r
-          appropriately.\r
-\r
-          Third, send the SMP to this physical port.\r
-        */\r
-\r
-       memcpy(payload, p_old_pi, sizeof(ib_port_info_t));\r
-       memset(payload + sizeof(ib_port_info_t), 0,\r
-              IB_SMP_DATA_SIZE - sizeof(ib_port_info_t));\r
-\r
-       /*\r
-          Should never write back a value that is bigger then 3 in\r
-          the PortPhysicalState field, so cannot simply copy!\r
-\r
-          Actually we want to write there:\r
-          port physical state - no change\r
-          link down default state = polling\r
-          port state - no change\r
-        */\r
-       p_pi->state_info2 = 0x02;\r
-       ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);\r
-\r
-       if (ib_port_info_get_link_down_def_state(p_pi) !=\r
-           ib_port_info_get_link_down_def_state(p_old_pi))\r
-               send_set = TRUE;\r
-\r
-       /* didn't get PortInfo before */\r
-       if (!ib_port_info_get_port_state(p_old_pi))\r
-               send_set = TRUE;\r
-\r
-       p_pi->m_key = p_mgr->p_subn->opt.m_key;\r
-       if (memcmp(&p_pi->m_key, &p_old_pi->m_key, sizeof(p_pi->m_key)))\r
-               send_set = TRUE;\r
-\r
-       p_pi->subnet_prefix = p_mgr->p_subn->opt.subnet_prefix;\r
-       if (memcmp(&p_pi->subnet_prefix, &p_old_pi->subnet_prefix,\r
-                  sizeof(p_pi->subnet_prefix)))\r
-               send_set = TRUE;\r
-\r
-       p_pi->base_lid = lid;\r
-       if (memcmp(&p_pi->base_lid, &p_old_pi->base_lid,\r
-                  sizeof(p_pi->base_lid)))\r
-               send_set = TRUE;\r
-\r
-       /* we are updating the ports with our local sm_base_lid */\r
-       p_pi->master_sm_base_lid = p_mgr->p_subn->sm_base_lid;\r
-       if (memcmp(&p_pi->master_sm_base_lid, &p_old_pi->master_sm_base_lid,\r
-                  sizeof(p_pi->master_sm_base_lid)))\r
-               send_set = TRUE;\r
-\r
-       p_pi->m_key_lease_period = p_mgr->p_subn->opt.m_key_lease_period;\r
-       if (memcmp(&p_pi->m_key_lease_period, &p_old_pi->m_key_lease_period,\r
-                  sizeof(p_pi->m_key_lease_period)))\r
-               send_set = TRUE;\r
-\r
-       /*\r
-          we want to set the timeout for both the switch port 0\r
-          and the CA ports\r
-        */\r
-       ib_port_info_set_timeout(p_pi, p_mgr->p_subn->opt.subnet_timeout);\r
-       if (ib_port_info_get_timeout(p_pi) !=\r
-           ib_port_info_get_timeout(p_old_pi))\r
-               send_set = TRUE;\r
-\r
-       if (port_num != 0) {\r
-               /*\r
-                  CAs don't have a port 0, and for switch port 0,\r
-                  the state bits are ignored.\r
-                  This is not the switch management port\r
-                */\r
-               p_pi->link_width_enabled = p_old_pi->link_width_supported;\r
-               if (memcmp(&p_pi->link_width_enabled,\r
-                          &p_old_pi->link_width_enabled,\r
-                          sizeof(p_pi->link_width_enabled)))\r
-                       send_set = TRUE;\r
-\r
-               /* M_KeyProtectBits are always zero */\r
-               p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;\r
-               if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,\r
-                          sizeof(p_pi->mkey_lmc)))\r
-                       send_set = TRUE;\r
-\r
-               /* calc new op_vls and mtu */\r
-               op_vls = osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn,\r
-                                                   p_physp);\r
-               mtu = osm_physp_calc_link_mtu(p_mgr->p_log, p_physp);\r
-\r
-               ib_port_info_set_neighbor_mtu(p_pi, mtu);\r
-\r
-               if (ib_port_info_get_neighbor_mtu(p_pi) !=\r
-                   ib_port_info_get_neighbor_mtu(p_old_pi))\r
-                       send_set = TRUE;\r
-\r
-               ib_port_info_set_op_vls(p_pi, op_vls);\r
-               if (ib_port_info_get_op_vls(p_pi) !=\r
-                   ib_port_info_get_op_vls(p_old_pi))\r
-                       send_set = TRUE;\r
-\r
-               /*\r
-                  Several timeout mechanisms:\r
-                */\r
-               ib_port_info_set_phy_and_overrun_err_thd(p_pi,\r
-                                                        p_mgr->p_subn->opt.\r
-                                                        local_phy_errors_threshold,\r
-                                                        p_mgr->p_subn->opt.\r
-                                                        overrun_errors_threshold);\r
-\r
-               if (memcmp(&p_pi->error_threshold, &p_old_pi->error_threshold,\r
-                          sizeof(p_pi->error_threshold)))\r
-                       send_set = TRUE;\r
-\r
-               /*\r
-                  To reset the port state machine we can send\r
-                  PortInfo.State = DOWN. (see: 7.2.7 p171 lines:10-19)\r
-                */\r
-               if (mtu != ib_port_info_get_neighbor_mtu(p_old_pi) ||\r
-                   op_vls != ib_port_info_get_op_vls(p_old_pi)) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Sending Link Down to GUID 0x%016"\r
-                               PRIx64 " port %d due to op_vls or "\r
-                               "mtu change. MTU:%u,%u VL_CAP:%u,%u\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                               port_num, mtu,\r
-                               ib_port_info_get_neighbor_mtu(p_old_pi),\r
-                               op_vls, ib_port_info_get_op_vls(p_old_pi));\r
-\r
-                       /*\r
-                          we need to make sure the internal DB will follow the\r
-                          fact that the remote port is also going through\r
-                          "down" state into "init"...\r
-                        */\r
-                       lid_mgr_set_remote_pi_state_to_init(p_mgr, p_physp);\r
-\r
-                       ib_port_info_set_port_state(p_pi, IB_LINK_DOWN);\r
-                       if (ib_port_info_get_port_state(p_pi) !=\r
-                           ib_port_info_get_port_state(p_old_pi))\r
-                               send_set = TRUE;\r
-               }\r
-       } else {\r
-               /*\r
-                  For Port 0, NeighborMTU is relevant only for Enh. SP0.\r
-                  In this case, we'll set the MTU according to the mtu_cap\r
-                */\r
-               ib_port_info_set_neighbor_mtu(p_pi,\r
-                                             ib_port_info_get_mtu_cap\r
-                                             (p_old_pi));\r
-               if (ib_port_info_get_neighbor_mtu(p_pi) !=\r
-                   ib_port_info_get_neighbor_mtu(p_old_pi))\r
-                       send_set = TRUE;\r
-\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Updating neighbor_mtu on switch GUID 0x%016" PRIx64\r
-                       " port 0 to:%u\n",\r
-                       cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                       ib_port_info_get_neighbor_mtu(p_pi));\r
-\r
-               /* Determine if enhanced switch port 0 and if so set LMC */\r
-               if (osm_switch_sp0_is_lmc_capable(p_node->sw, p_mgr->p_subn)) {\r
-                       /* M_KeyProtectBits are always zero */\r
-                       p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;\r
-                       if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,\r
-                                  sizeof(p_pi->mkey_lmc)))\r
-                               send_set = TRUE;\r
-               }\r
-       }\r
-\r
-       context.pi_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);\r
-       context.pi_context.set_method = TRUE;\r
-       context.pi_context.light_sweep = FALSE;\r
-       context.pi_context.active_transition = FALSE;\r
-\r
-       /*\r
-          We need to set the cli_rereg bit when we are in first_time_master_sweep\r
-          for ports supporting the ClientReregistration Vol1 (v1.2) p811 14.4.11\r
-          Also, if this port was just now discovered, then we should also set\r
-          the cli_rereg bit. We know that the port was just discovered if its\r
-          is_new field is set.\r
-        */\r
-       if ((p_mgr->p_subn->first_time_master_sweep == TRUE || p_port->is_new)\r
-           && !p_mgr->p_subn->opt.no_clients_rereg\r
-           && (p_old_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG)) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Setting client rereg on %s, port %d\n",\r
-                       p_port->p_node->print_desc, p_port->p_physp->port_num);\r
-               ib_port_info_set_client_rereg(p_pi, 1);\r
-               send_set = TRUE;\r
-       } else\r
-               ib_port_info_set_client_rereg(p_pi, 0);\r
-\r
-       /* We need to send the PortInfo Set request with the new sm_lid\r
-          in the following cases:\r
-          1. There is a change in the values (send_set == TRUE)\r
-          2. first_time_master_sweep flag on the subnet is TRUE. This means the\r
-          SM just became master, and it then needs to send a PortInfo Set to\r
-          every port.\r
-        */\r
-       if (p_mgr->p_subn->first_time_master_sweep == TRUE)\r
-               send_set = TRUE;\r
-\r
-       if (!send_set)\r
-               goto Exit;\r
-\r
-       status = osm_req_set(p_mgr->sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                            payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,\r
-                            cl_hton32(osm_physp_get_port_num(p_physp)),\r
-                            CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS)\r
-               ret = -1;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return ret;\r
-}\r
-\r
-/**********************************************************************\r
- Processes our own node\r
- Lock must already be held.\r
-**********************************************************************/\r
-static int lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       osm_port_t *p_port;\r
-       uint16_t min_lid_ho;\r
-       uint16_t max_lid_ho;\r
-       int ret;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       /*\r
-          Acquire our own port object.\r
-        */\r
-       p_port = osm_get_port_by_guid(p_mgr->p_subn,\r
-                                     p_mgr->p_subn->sm_port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0308: "\r
-                       "Can't acquire SM's port object, GUID 0x%016" PRIx64\r
-                       "\n", cl_ntoh64(p_mgr->p_subn->sm_port_guid));\r
-               ret = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Determine the LID this SM will use for its own port.\r
-          Be careful.  With an LMC > 0, the bottom of the LID range becomes\r
-          unusable, since port hardware will mask off least significant bits,\r
-          leaving a LID of 0 (invalid).  Therefore, make sure that we always\r
-          configure the SM with a LID that has non-zero bits, even after\r
-          LMC masking by hardware.\r
-        */\r
-       lid_mgr_get_port_lid(p_mgr, p_port, &min_lid_ho, &max_lid_ho);\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Current base LID is %u\n", min_lid_ho);\r
-       /*\r
-          Update subnet object.\r
-        */\r
-       p_mgr->p_subn->master_sm_base_lid = cl_hton16(min_lid_ho);\r
-       p_mgr->p_subn->sm_base_lid = cl_hton16(min_lid_ho);\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,\r
-               "Assigning SM's port 0x%016" PRIx64\r
-               "\n\t\t\t\tto LID range [%u,%u]\n",\r
-               cl_ntoh64(osm_port_get_guid(p_port)), min_lid_ho, max_lid_ho);\r
-\r
-       /*\r
-          Set the PortInfo the Physical Port associated with this Port.\r
-        */\r
-       ret = lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,\r
-                                  cl_hton16(min_lid_ho));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return ret;\r
-}\r
-\r
-int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       int ret;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       CL_ASSERT(p_mgr->p_subn->sm_port_guid);\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);\r
-\r
-       /* initialize the port_lid_tbl and empty ranges list following the\r
-          persistent db */\r
-       lid_mgr_init_sweep(p_mgr);\r
-\r
-       ret = lid_mgr_process_our_sm_node(p_mgr);\r
-\r
-       CL_PLOCK_RELEASE(p_mgr->p_lock);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return ret;\r
-}\r
-\r
-/**********************************************************************\r
- 1 go through all ports in the subnet.\r
- 1.1 call lid_mgr_get_port_min_lid\r
- 1.2 if a change is required send the port info\r
- 2 if any change send the signal PENDING...\r
-**********************************************************************/\r
-int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)\r
-{\r
-       cl_qmap_t *p_port_guid_tbl;\r
-       osm_port_t *p_port;\r
-       ib_net64_t port_guid;\r
-       int lid_changed, ret = 0;\r
-       uint16_t min_lid_ho, max_lid_ho;\r
-\r
-       CL_ASSERT(p_mgr);\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);\r
-\r
-       CL_ASSERT(p_mgr->p_subn->sm_port_guid);\r
-\r
-       p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;\r
-\r
-       for (p_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);\r
-            p_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl);\r
-            p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {\r
-               port_guid = osm_port_get_guid(p_port);\r
-\r
-               /*\r
-                  Our own port is a special case in that we want to\r
-                  assign a LID to ourselves first, since we have to\r
-                  advertise that LID value to the other ports.\r
-\r
-                  For that reason, our node is treated separately and\r
-                  we will not add it to any of these lists.\r
-                */\r
-               if (port_guid == p_mgr->p_subn->sm_port_guid) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Skipping our own port 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(port_guid));\r
-                       continue;\r
-               }\r
-\r
-               /*\r
-                  get the port lid range - we need to send it on first active\r
-                  sweep or if there was a change (the result of\r
-                  lid_mgr_get_port_lid)\r
-                */\r
-               lid_changed = lid_mgr_get_port_lid(p_mgr, p_port,\r
-                                                  &min_lid_ho, &max_lid_ho);\r
-\r
-               /* we can call the function to update the port info as it known\r
-                  to look for any field change and will only send an updated\r
-                  if required */\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,\r
-                       "Assigned port 0x%016" PRIx64 ", LID [%u,%u]\n",\r
-                       cl_ntoh64(port_guid), min_lid_ho, max_lid_ho);\r
-\r
-               /* the proc returns the fact it sent a set port info */\r
-               if (lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,\r
-                                        cl_hton16(min_lid_ho)))\r
-                       ret = -1;\r
-       }                       /* all ports */\r
-\r
-       /* store the guid to lid table in persistent db */\r
-       osm_db_store(p_mgr->p_g2l);\r
-\r
-       CL_PLOCK_RELEASE(p_mgr->p_lock);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c b/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c
deleted file mode 100644 (file)
index f2567d6..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_lft_rcv_t.\r
- * This object represents the Linear Forwarding Table Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_sm.h>\r
-\r
-void osm_lft_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_smp_t *p_smp;\r
-       uint32_t block_num;\r
-       osm_switch_t *p_sw;\r
-       osm_lft_context_t *p_lft_context;\r
-       uint8_t *p_block;\r
-       ib_net64_t node_guid;\r
-       ib_api_status_t status;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_block = ib_smp_get_payload_ptr(p_smp);\r
-       block_num = cl_ntoh32(p_smp->attr_mod);\r
-\r
-       /*\r
-          Acquire the switch object for this switch.\r
-        */\r
-       p_lft_context = osm_madw_get_lft_context_ptr(p_madw);\r
-       node_guid = p_lft_context->node_guid;\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-       p_sw = osm_get_switch_by_guid(sm->p_subn, node_guid);\r
-\r
-       if (!p_sw) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0401: "\r
-                       "LFT received for nonexistent node "\r
-                       "0x%" PRIx64 "\n", cl_ntoh64(node_guid));\r
-       } else {\r
-               status = osm_switch_set_lft_block(p_sw, p_block, block_num);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: "\r
-                               "Setting forwarding table block failed (%s)"\r
-                               ", Switch 0x%" PRIx64 " %s\n",\r
-                               ib_get_err_str(status), cl_ntoh64(node_guid),\r
-                               p_sw->p_node->print_desc);\r
-               }\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_link_mgr.c b/branches/opensm_3/user/opensm/osm_link_mgr.c
deleted file mode 100644 (file)
index 75b44a3..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_link_mgr_t.\r
- * This file implements the Link Manager object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_ucast_lash.h>\r
-\r
-static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp)\r
-{\r
-       osm_opensm_t *p_osm = sm->p_subn->p_osm;\r
-       const osm_port_t *p_sm_port, *p_src_port;\r
-       ib_net16_t slid;\r
-       uint8_t sl;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       if (p_osm->routing_engine_used != OSM_ROUTING_ENGINE_TYPE_LASH\r
-           || !(slid = osm_physp_get_base_lid(p_physp))) {\r
-               /* Use default SL if lash routing is not used */\r
-               OSM_LOG_EXIT(sm->p_log);\r
-               return sm->p_subn->opt.sm_sl;\r
-       }\r
-\r
-       /* Find osm_port of the SM itself = dest_port */\r
-       p_sm_port = osm_get_port_by_lid(sm->p_subn, sm->p_subn->sm_base_lid);\r
-\r
-       /* Find osm_port of the source = p_physp */\r
-       p_src_port = osm_get_port_by_lid(sm->p_subn, slid);\r
-\r
-       /* Call lash to find proper SL */\r
-       sl = osm_get_lash_sl(p_osm, p_src_port, p_sm_port);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return sl;\r
-}\r
-\r
-static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,\r
-                                IN uint8_t port_state)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_port_info_t *p_pi = (ib_port_info_t *) payload;\r
-       const ib_port_info_t *p_old_pi;\r
-       osm_madw_context_t context;\r
-       osm_node_t *p_node;\r
-       ib_api_status_t status;\r
-       uint8_t port_num, mtu, op_vls, smsl = OSM_DEFAULT_SL;\r
-       boolean_t esp0 = FALSE, send_set = FALSE;\r
-       osm_physp_t *p_remote_physp;\r
-       int ret = 0;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-       p_old_pi = &p_physp->port_info;\r
-\r
-       port_num = osm_physp_get_port_num(p_physp);\r
-\r
-       if (port_num == 0) {\r
-               /*\r
-                  CAs don't have a port 0, and for switch port 0,\r
-                  we need to check if this is enhanced or base port 0.\r
-                  For base port 0 the following parameters are not valid\r
-                  (IBA 1.2.1 p.830 table 146).\r
-                */\r
-               if (!p_node->sw) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4201: "\r
-                               "Cannot find switch by guid: 0x%" PRIx64 "\n",\r
-                               cl_ntoh64(p_node->node_info.node_guid));\r
-                       goto Exit;\r
-               }\r
-\r
-               if (ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info)\r
-                   == FALSE) {\r
-\r
-                       /* Even for base port 0 we might have to set smsl\r
-                          (if we are using lash routing) */\r
-                       smsl = link_mgr_get_smsl(sm, p_physp);\r
-                       if (smsl != ib_port_info_get_master_smsl(p_old_pi)) {\r
-                               send_set = TRUE;\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Setting SMSL to %d on port 0 GUID 0x%016"\r
-                                       PRIx64 "\n", smsl,\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_physp)));\r
-                       } else {\r
-                               /* This means the switch doesn't support\r
-                                  enhanced port 0 and we don't need to\r
-                                  change SMSL. Can skip it. */\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Skipping port 0, GUID 0x%016" PRIx64\r
-                                       "\n",\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_physp)));\r
-                               goto Exit;\r
-                       }\r
-               } else\r
-                       esp0 = TRUE;\r
-       }\r
-\r
-       memcpy(payload, p_old_pi, sizeof(ib_port_info_t));\r
-       memset(payload + sizeof(ib_port_info_t), 0,\r
-              IB_SMP_DATA_SIZE - sizeof(ib_port_info_t));\r
-\r
-       /*\r
-          Should never write back a value that is bigger then 3 in\r
-          the PortPhysicalState field - so can not simply copy!\r
-\r
-          Actually we want to write there:\r
-          port physical state - no change,\r
-          link down default state = polling\r
-          port state - as requested.\r
-        */\r
-       p_pi->state_info2 = 0x02;\r
-       ib_port_info_set_port_state(p_pi, port_state);\r
-\r
-       /* Check whether this is base port0 smsl handling only */\r
-       if (port_num == 0 && esp0 == FALSE) {\r
-               ib_port_info_set_master_smsl(p_pi, smsl);\r
-               goto Send;\r
-       }\r
-\r
-       /*\r
-          PAST THIS POINT WE ARE HANDLING EITHER A NON PORT 0 OR ENHANCED PORT 0\r
-        */\r
-\r
-       if (ib_port_info_get_link_down_def_state(p_pi) !=\r
-           ib_port_info_get_link_down_def_state(p_old_pi))\r
-               send_set = TRUE;\r
-\r
-       /* didn't get PortInfo before */\r
-       if (!ib_port_info_get_port_state(p_old_pi))\r
-               send_set = TRUE;\r
-\r
-       /* we only change port fields if we do not change state */\r
-       if (port_state == IB_LINK_NO_CHANGE) {\r
-               /* The following fields are relevant only for CA port, router, or Enh. SP0 */\r
-               if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH ||\r
-                   port_num == 0) {\r
-                       p_pi->m_key = sm->p_subn->opt.m_key;\r
-                       if (memcmp(&p_pi->m_key, &p_old_pi->m_key,\r
-                                  sizeof(p_pi->m_key)))\r
-                               send_set = TRUE;\r
-\r
-                       p_pi->subnet_prefix = sm->p_subn->opt.subnet_prefix;\r
-                       if (memcmp(&p_pi->subnet_prefix,\r
-                                  &p_old_pi->subnet_prefix,\r
-                                  sizeof(p_pi->subnet_prefix)))\r
-                               send_set = TRUE;\r
-\r
-                       p_pi->base_lid = osm_physp_get_base_lid(p_physp);\r
-                       if (memcmp(&p_pi->base_lid, &p_old_pi->base_lid,\r
-                                  sizeof(p_pi->base_lid)))\r
-                               send_set = TRUE;\r
-\r
-                       /* we are initializing the ports with our local sm_base_lid */\r
-                       p_pi->master_sm_base_lid = sm->p_subn->sm_base_lid;\r
-                       if (memcmp(&p_pi->master_sm_base_lid,\r
-                                  &p_old_pi->master_sm_base_lid,\r
-                                  sizeof(p_pi->master_sm_base_lid)))\r
-                               send_set = TRUE;\r
-\r
-                       smsl = link_mgr_get_smsl(sm, p_physp);\r
-                       if (smsl != ib_port_info_get_master_smsl(p_old_pi)) {\r
-\r
-                               ib_port_info_set_master_smsl(p_pi, smsl);\r
-\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Setting SMSL to %d on GUID 0x%016"\r
-                                       PRIx64 ", port %d\n", smsl,\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_physp)), port_num);\r
-\r
-                               send_set = TRUE;\r
-                       }\r
-\r
-                       p_pi->m_key_lease_period =\r
-                           sm->p_subn->opt.m_key_lease_period;\r
-                       if (memcmp(&p_pi->m_key_lease_period,\r
-                                  &p_old_pi->m_key_lease_period,\r
-                                  sizeof(p_pi->m_key_lease_period)))\r
-                               send_set = TRUE;\r
-\r
-                       if (esp0 == FALSE)\r
-                               p_pi->mkey_lmc = sm->p_subn->opt.lmc;\r
-                       else {\r
-                               if (sm->p_subn->opt.lmc_esp0)\r
-                                       p_pi->mkey_lmc = sm->p_subn->opt.lmc;\r
-                               else\r
-                                       p_pi->mkey_lmc = 0;\r
-                       }\r
-                       if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,\r
-                                  sizeof(p_pi->mkey_lmc)))\r
-                               send_set = TRUE;\r
-\r
-                       ib_port_info_set_timeout(p_pi,\r
-                                                sm->p_subn->opt.\r
-                                                subnet_timeout);\r
-                       if (ib_port_info_get_timeout(p_pi) !=\r
-                           ib_port_info_get_timeout(p_old_pi))\r
-                               send_set = TRUE;\r
-               }\r
-\r
-               /*\r
-                  Several timeout mechanisms:\r
-                */\r
-               p_remote_physp = osm_physp_get_remote(p_physp);\r
-               if (port_num != 0 && p_remote_physp) {\r
-                       if (osm_node_get_type(osm_physp_get_node_ptr(p_physp))\r
-                           == IB_NODE_TYPE_ROUTER) {\r
-                               ib_port_info_set_hoq_lifetime(p_pi,\r
-                                                             sm->p_subn->\r
-                                                             opt.\r
-                                                             leaf_head_of_queue_lifetime);\r
-                       } else\r
-                           if (osm_node_get_type\r
-                               (osm_physp_get_node_ptr(p_physp)) ==\r
-                               IB_NODE_TYPE_SWITCH) {\r
-                               /* Is remote end CA or router (a leaf port) ? */\r
-                               if (osm_node_get_type\r
-                                   (osm_physp_get_node_ptr(p_remote_physp)) !=\r
-                                   IB_NODE_TYPE_SWITCH) {\r
-                                       ib_port_info_set_hoq_lifetime(p_pi,\r
-                                                                     sm->\r
-                                                                     p_subn->\r
-                                                                     opt.\r
-                                                                     leaf_head_of_queue_lifetime);\r
-                                       ib_port_info_set_vl_stall_count(p_pi,\r
-                                                                       sm->\r
-                                                                       p_subn->\r
-                                                                       opt.\r
-                                                                       leaf_vl_stall_count);\r
-                               } else {\r
-                                       ib_port_info_set_hoq_lifetime(p_pi,\r
-                                                                     sm->\r
-                                                                     p_subn->\r
-                                                                     opt.\r
-                                                                     head_of_queue_lifetime);\r
-                                       ib_port_info_set_vl_stall_count(p_pi,\r
-                                                                       sm->\r
-                                                                       p_subn->\r
-                                                                       opt.\r
-                                                                       vl_stall_count);\r
-                               }\r
-                       }\r
-                       if (ib_port_info_get_hoq_lifetime(p_pi) !=\r
-                           ib_port_info_get_hoq_lifetime(p_old_pi) ||\r
-                           ib_port_info_get_vl_stall_count(p_pi) !=\r
-                           ib_port_info_get_vl_stall_count(p_old_pi))\r
-                               send_set = TRUE;\r
-               }\r
-\r
-               ib_port_info_set_phy_and_overrun_err_thd(p_pi,\r
-                                                        sm->p_subn->opt.\r
-                                                        local_phy_errors_threshold,\r
-                                                        sm->p_subn->opt.\r
-                                                        overrun_errors_threshold);\r
-               if (memcmp(&p_pi->error_threshold, &p_old_pi->error_threshold,\r
-                          sizeof(p_pi->error_threshold)))\r
-                       send_set = TRUE;\r
-\r
-               /*\r
-                  Set the easy common parameters for all port types,\r
-                  then determine the neighbor MTU.\r
-                */\r
-               p_pi->link_width_enabled = p_old_pi->link_width_supported;\r
-               if (memcmp(&p_pi->link_width_enabled,\r
-                          &p_old_pi->link_width_enabled,\r
-                          sizeof(p_pi->link_width_enabled)))\r
-                       send_set = TRUE;\r
-\r
-               if (sm->p_subn->opt.force_link_speed &&\r
-                   (sm->p_subn->opt.force_link_speed != 15 ||\r
-                    ib_port_info_get_link_speed_enabled(p_pi) !=\r
-                    ib_port_info_get_link_speed_sup(p_pi))) {\r
-                       ib_port_info_set_link_speed_enabled(p_pi,\r
-                                                           sm->p_subn->opt.\r
-                                                           force_link_speed);\r
-                       if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,\r
-                                  sizeof(p_pi->link_speed)))\r
-                               send_set = TRUE;\r
-               }\r
-\r
-               /* calc new op_vls and mtu */\r
-               op_vls =\r
-                   osm_physp_calc_link_op_vls(sm->p_log, sm->p_subn, p_physp);\r
-               mtu = osm_physp_calc_link_mtu(sm->p_log, p_physp);\r
-\r
-               ib_port_info_set_neighbor_mtu(p_pi, mtu);\r
-               if (ib_port_info_get_neighbor_mtu(p_pi) !=\r
-                   ib_port_info_get_neighbor_mtu(p_old_pi))\r
-                       send_set = TRUE;\r
-\r
-               ib_port_info_set_op_vls(p_pi, op_vls);\r
-               if (ib_port_info_get_op_vls(p_pi) !=\r
-                   ib_port_info_get_op_vls(p_old_pi))\r
-                       send_set = TRUE;\r
-\r
-               /* provide the vl_high_limit from the qos mgr */\r
-               if (sm->p_subn->opt.qos &&\r
-                   p_physp->vl_high_limit != p_old_pi->vl_high_limit) {\r
-                       send_set = TRUE;\r
-                       p_pi->vl_high_limit = p_physp->vl_high_limit;\r
-               }\r
-       }\r
-\r
-Send:\r
-       if (port_state != IB_LINK_NO_CHANGE &&\r
-           port_state != ib_port_info_get_port_state(p_old_pi)) {\r
-               send_set = TRUE;\r
-               if (port_state == IB_LINK_ACTIVE)\r
-                       context.pi_context.active_transition = TRUE;\r
-               else\r
-                       context.pi_context.active_transition = FALSE;\r
-       }\r
-\r
-       context.pi_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);\r
-       context.pi_context.set_method = TRUE;\r
-       context.pi_context.light_sweep = FALSE;\r
-\r
-       /* We need to send the PortInfoSet request with the new sm_lid\r
-          in the following cases:\r
-          1. There is a change in the values (send_set == TRUE)\r
-          2. This is a switch external port (so it wasn't handled yet by\r
-          osm_lid_mgr) and first_time_master_sweep flag on the subnet is TRUE,\r
-          which means the SM just became master, and it then needs to send at\r
-          PortInfoSet to every port.\r
-        */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH && port_num\r
-           && sm->p_subn->first_time_master_sweep == TRUE)\r
-               send_set = TRUE;\r
-\r
-       if (!send_set)\r
-               goto Exit;\r
-\r
-       status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                            payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,\r
-                            cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);\r
-       if (status)\r
-               ret = -1;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return ret;\r
-}\r
-\r
-static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                IN const uint8_t link_state)\r
-{\r
-       osm_physp_t *p_physp;\r
-       uint32_t i, num_physp;\r
-       int ret = 0;\r
-       uint8_t current_state;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Node 0x%" PRIx64 " going to %s\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-               ib_get_port_state_str(link_state));\r
-\r
-       /*\r
-          Set the PortInfo for every Physical Port associated\r
-          with this Port.  Start iterating with port 1, since the linkstate\r
-          is not applicable to the management port on switches.\r
-        */\r
-       num_physp = osm_node_get_num_physp(p_node);\r
-       for (i = 0; i < num_physp; i++) {\r
-               /*\r
-                  Don't bother doing anything if this Physical Port is not valid.\r
-                  or if the state of the port is already better then the\r
-                  specified state.\r
-                */\r
-               p_physp = osm_node_get_physp_ptr(p_node, (uint8_t) i);\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               current_state = osm_physp_get_port_state(p_physp);\r
-               if (current_state == IB_LINK_DOWN)\r
-                       continue;\r
-\r
-               /*\r
-                  Normally we only send state update if state is lower\r
-                  then required state. However, we need to send update if\r
-                  no state change required.\r
-                */\r
-               if (link_state != IB_LINK_NO_CHANGE &&\r
-                   link_state <= current_state)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                               "Physical port %u already %s. Skipping\n",\r
-                               p_physp->port_num,\r
-                               ib_get_port_state_str(current_state));\r
-               else if (link_mgr_set_physp_pi(sm, p_physp, link_state))\r
-                       ret = -1;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return ret;\r
-}\r
-\r
-int osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)\r
-{\r
-       cl_qmap_t *p_node_guid_tbl;\r
-       osm_node_t *p_node;\r
-       int ret = 0;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_node_guid_tbl = &sm->p_subn->node_guid_tbl;\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);\r
-            p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);\r
-            p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item))\r
-               if (link_mgr_process_node(sm, p_node, link_state))\r
-                       ret = -1;\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_log.c b/branches/opensm_3/user/opensm/osm_log.c
deleted file mode 100644 (file)
index d67a0b5..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_log_t.\r
- * This object represents the log file.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <opensm/osm_log.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <stdarg.h>\r
-#include <fcntl.h>\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <errno.h>\r
-\r
-static int log_exit_count = 0;\r
-\r
-#ifndef __WIN__\r
-#include <sys/time.h>\r
-#include <unistd.h>\r
-#include <complib/cl_timer.h>\r
-\r
-static char *month_str[] = {\r
-       "Jan",\r
-       "Feb",\r
-       "Mar",\r
-       "Apr",\r
-       "May",\r
-       "Jun",\r
-       "Jul",\r
-       "Aug",\r
-       "Sep",\r
-       "Oct",\r
-       "Nov",\r
-       "Dec"\r
-};\r
-#else\r
-void OsmReportState(IN const char *p_str);\r
-#endif                         /* ndef __WIN__ */\r
-\r
-#ifndef __WIN__\r
-\r
-static void truncate_log_file(osm_log_t * p_log)\r
-{\r
-       int fd = fileno(p_log->out_port);\r
-       if (ftruncate(fd, 0) < 0)\r
-               fprintf(stderr, "truncate_log_file: cannot truncate: %s\n",\r
-                       strerror(errno));\r
-       if (lseek(fd, 0, SEEK_SET) < 0)\r
-               fprintf(stderr, "truncate_log_file: cannot rewind: %s\n",\r
-                       strerror(errno));\r
-       p_log->count = 0;\r
-}\r
-\r
-#else                          /* Windows */\r
-\r
-static void truncate_log_file(osm_log_t * p_log)\r
-{\r
-       int fd = _fileno(p_log->out_port);\r
-       HANDLE hFile = (HANDLE) _get_osfhandle(fd);\r
-\r
-       if (_lseek(fd, 0, SEEK_SET) < 0)\r
-               fprintf(stderr, "truncate_log_file: cannot rewind: %s\n",\r
-                       strerror(errno));\r
-       SetEndOfFile(hFile);\r
-       p_log->count = 0;\r
-}\r
-#endif                         /* ndef __WIN__ */\r
-\r
-void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,\r
-            IN const char *p_str, ...)\r
-{\r
-       char buffer[LOG_ENTRY_SIZE_MAX];\r
-       va_list args;\r
-       int ret;\r
-#ifdef __WIN__\r
-       SYSTEMTIME st;\r
-       uint32_t pid = GetCurrentThreadId();\r
-#else\r
-       pid_t pid = 0;\r
-       time_t tim;\r
-       struct tm result;\r
-       uint64_t time_usecs;\r
-       uint32_t usecs;\r
-#endif                         /* __WIN__ */\r
-\r
-       /* If this is a call to syslog - always print it */\r
-       if (!(verbosity & p_log->level))\r
-               return;\r
-\r
-       va_start(args, p_str);\r
-#ifndef __WIN__\r
-       if (p_log->log_prefix == NULL)\r
-               vsprintf(buffer, p_str, args);\r
-       else {\r
-               int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);\r
-               vsprintf(buffer + n, p_str, args);\r
-       }\r
-#else\r
-       if (p_log->log_prefix == NULL)\r
-               _vsnprintf(buffer, sizeof(buffer), (LPSTR)p_str, args);\r
-       else {\r
-               int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);\r
-               _vsnprintf(buffer + n, (sizeof(buffer) - n), (LPSTR)p_str, args);\r
-       }\r
-#endif\r
-       va_end(args);\r
-\r
-       /* this is a call to the syslog */\r
-       if (verbosity & OSM_LOG_SYS) {\r
-               syslog(LOG_INFO, "%s\n", buffer);\r
-\r
-               /* SYSLOG should go to stdout too */\r
-               if (p_log->out_port != stdout) {\r
-                       printf("%s\n", buffer);\r
-                       fflush(stdout);\r
-               }\r
-#ifdef __WIN__\r
-               OsmReportState(buffer);\r
-#endif                         /* __WIN__ */\r
-       }\r
-\r
-       /* regular log to default out_port */\r
-       cl_spinlock_acquire(&p_log->lock);\r
-\r
-       if (p_log->max_size && p_log->count > p_log->max_size) {\r
-               /* truncate here */\r
-               fprintf(stderr,\r
-                       "osm_log: log file exceeds the limit %lu. Truncating.\n",\r
-                       p_log->max_size);\r
-               truncate_log_file(p_log);\r
-       }\r
-#ifdef __WIN__\r
-       GetLocalTime(&st);\r
-_retry:\r
-       ret =\r
-           fprintf(p_log->out_port,\r
-                   "[%02d:%02d:%02d:%03d][%04X] 0x%02x -> %s",\r
-                   st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,\r
-                   pid, verbosity, buffer);\r
-#else\r
-       time_usecs = cl_get_time_stamp();\r
-       tim = time_usecs / 1000000;\r
-       usecs = time_usecs % 1000000;\r
-       localtime_r(&tim, &result);\r
-       pid = pthread_self();\r
-_retry:\r
-       ret =\r
-           fprintf(p_log->out_port,\r
-                   "%s %02d %02d:%02d:%02d %06d [%04X] 0x%02x -> %s",\r
-                   (result.tm_mon <\r
-                    12 ? month_str[result.tm_mon] : "???"),\r
-                   result.tm_mday, result.tm_hour, result.tm_min,\r
-                   result.tm_sec, usecs, pid, verbosity, buffer);\r
-#endif\r
-\r
-       /*  flush log */\r
-       if (ret > 0 &&\r
-           (p_log->flush || (verbosity & (OSM_LOG_ERROR | OSM_LOG_SYS)))\r
-           && fflush(p_log->out_port) < 0)\r
-               ret = -1;\r
-\r
-       if (ret >= 0) {\r
-               log_exit_count = 0;\r
-               p_log->count += ret;\r
-       } else if (log_exit_count < 3) {\r
-               log_exit_count++;\r
-               if (errno == ENOSPC && p_log->max_size) {\r
-                       fprintf(stderr,\r
-                               "osm_log: write failed: %s. Truncating log file.\n",\r
-                               strerror(errno));\r
-                       truncate_log_file(p_log);\r
-                       goto _retry;\r
-               }\r
-               fprintf(stderr, "osm_log: write failed: %s\n", strerror(errno));\r
-       }\r
-\r
-       cl_spinlock_release(&p_log->lock);\r
-}\r
-\r
-void osm_log_raw(IN osm_log_t * p_log, IN osm_log_level_t verbosity,\r
-                IN const char *p_buf)\r
-{\r
-       if (p_log->level & verbosity) {\r
-               cl_spinlock_acquire(&p_log->lock);\r
-               printf("%s", p_buf);\r
-               cl_spinlock_release(&p_log->lock);\r
-\r
-               /*\r
-                  Flush log on errors too.\r
-                */\r
-               if (p_log->flush || (verbosity & OSM_LOG_ERROR))\r
-                       fflush(stdout);\r
-       }\r
-}\r
-\r
-void osm_log_msg_box(IN osm_log_t * log, osm_log_level_t level,\r
-                    const char *func_name, const char *msg)\r
-{\r
-#define MSG_BOX_LENGTH 66\r
-       char buf[MSG_BOX_LENGTH + 1];\r
-       int i, n;\r
-\r
-       if (!osm_log_is_active(log, level))\r
-               return;\r
-\r
-       n = (MSG_BOX_LENGTH - strlen(msg)) / 2 - 1;\r
-       if (n < 0)\r
-               n = 0;\r
-       for (i = 0; i < n; i++)\r
-               sprintf(buf + i, "*");\r
-       n += snprintf(buf + n, sizeof(buf) - n, " %s ", msg);\r
-       for (i = n; i < MSG_BOX_LENGTH; i++)\r
-               buf[i] = '*';\r
-       buf[i] = '\0';\r
-\r
-       osm_log(log, level, "%s:\n\n\n"\r
-               "*********************************************"\r
-               "*********************\n%s\n"\r
-               "*********************************************"\r
-               "*********************\n\n\n", func_name, buf);\r
-}\r
-\r
-boolean_t osm_is_debug(void)\r
-{\r
-#if defined( _DEBUG_ )\r
-       return TRUE;\r
-#else\r
-       return FALSE;\r
-#endif                         /* defined( _DEBUG_ ) */\r
-}\r
-\r
-static int open_out_port(IN osm_log_t * p_log)\r
-{\r
-       struct stat st;\r
-\r
-       if (p_log->accum_log_file)\r
-               p_log->out_port = fopen(p_log->log_file_name, "a+");\r
-       else\r
-               p_log->out_port = fopen(p_log->log_file_name, "w+");\r
-\r
-       if (!p_log->out_port) {\r
-               syslog(LOG_CRIT, "Cannot open file \'%s\' for %s: %s\n",\r
-                      p_log->log_file_name,\r
-                      p_log->accum_log_file ? "appending" : "writing",\r
-                      strerror(errno));\r
-               fprintf(stderr, "Cannot open file \'%s\': %s\n",\r
-                       p_log->log_file_name, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       if (fstat(fileno(p_log->out_port), &st) == 0)\r
-               p_log->count = st.st_size;\r
-\r
-       syslog(LOG_NOTICE, "%s log file opened\n", p_log->log_file_name);\r
-\r
-       if (p_log->daemon) {\r
-               dup2(fileno(p_log->out_port), 0);\r
-               dup2(fileno(p_log->out_port), 1);\r
-               dup2(fileno(p_log->out_port), 2);\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_log_reopen_file(osm_log_t * p_log)\r
-{\r
-       int ret;\r
-\r
-       if (p_log->out_port == stdout || p_log->out_port == stderr)\r
-               return 0;\r
-       cl_spinlock_acquire(&p_log->lock);\r
-       fclose(p_log->out_port);\r
-       ret = open_out_port(p_log);\r
-       cl_spinlock_release(&p_log->lock);\r
-       return ret;\r
-}\r
-\r
-ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush,\r
-                               IN uint8_t log_flags, IN const char *log_file,\r
-                               IN unsigned long max_size,\r
-                               IN boolean_t accum_log_file)\r
-{\r
-       p_log->level = log_flags | OSM_LOG_SYS;\r
-       p_log->flush = flush;\r
-       p_log->count = 0;\r
-       p_log->max_size = max_size << 20; /* convert size in MB to bytes */\r
-       p_log->accum_log_file = accum_log_file;\r
-       p_log->log_file_name = (char *)log_file;\r
-\r
-       openlog("OpenSM", LOG_CONS | LOG_PID, LOG_USER);\r
-\r
-       if (log_file == NULL || !strcmp(log_file, "-") ||\r
-           !strcmp(log_file, "stdout"))\r
-               p_log->out_port = stdout;\r
-       else if (!strcmp(log_file, "stderr"))\r
-               p_log->out_port = stderr;\r
-       else if (open_out_port(p_log))\r
-               return IB_ERROR;\r
-\r
-       if (cl_spinlock_init(&p_log->lock) == CL_SUCCESS)\r
-               return IB_SUCCESS;\r
-       else\r
-               return IB_ERROR;\r
-}\r
-\r
-ib_api_status_t osm_log_init(IN osm_log_t * p_log, IN boolean_t flush,\r
-                            IN uint8_t log_flags, IN const char *log_file,\r
-                            IN boolean_t accum_log_file)\r
-{\r
-       return osm_log_init_v2(p_log, flush, log_flags, log_file, 0,\r
-                              accum_log_file);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mad_pool.c b/branches/opensm_3/user/opensm/osm_mad_pool.c
deleted file mode 100644 (file)
index 62dff41..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mad_pool_t.\r
- * This object represents a pool of management datagram (MAD) objects.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_madw.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool)\r
-{\r
-       CL_ASSERT(p_pool);\r
-\r
-       memset(p_pool, 0, sizeof(*p_pool));\r
-}\r
-\r
-void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool)\r
-{\r
-       CL_ASSERT(p_pool);\r
-}\r
-\r
-ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool)\r
-{\r
-       p_pool->mads_out = 0;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * p_pool,\r
-                            IN osm_bind_handle_t h_bind,\r
-                            IN uint32_t total_size,\r
-                            IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osm_madw_t *p_madw;\r
-       ib_mad_t *p_mad;\r
-\r
-       CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);\r
-       CL_ASSERT(total_size);\r
-\r
-       /*\r
-          First, acquire a mad wrapper from the mad wrapper pool.\r
-        */\r
-       p_madw = malloc(sizeof(*p_madw));\r
-       if (p_madw == NULL)\r
-               goto Exit;\r
-\r
-       osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);\r
-\r
-       /*\r
-          Next, acquire a wire mad of the specified size.\r
-        */\r
-       p_mad = osm_vendor_get(h_bind, total_size, &p_madw->vend_wrap);\r
-       if (p_mad == NULL) {\r
-               /* Don't leak wrappers! */\r
-               free(p_madw);\r
-               p_madw = NULL;\r
-               goto Exit;\r
-       }\r
-\r
-       cl_atomic_inc(&p_pool->mads_out);\r
-       /*\r
-          Finally, attach the wire MAD to this wrapper.\r
-        */\r
-       osm_madw_set_mad(p_madw, p_mad);\r
-\r
-Exit:\r
-       return p_madw;\r
-}\r
-\r
-osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool,\r
-                                    IN osm_bind_handle_t h_bind,\r
-                                    IN uint32_t total_size,\r
-                                    IN const ib_mad_t * p_mad,\r
-                                    IN const osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osm_madw_t *p_madw;\r
-\r
-       CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);\r
-       CL_ASSERT(total_size);\r
-       CL_ASSERT(p_mad);\r
-\r
-       /*\r
-          First, acquire a mad wrapper from the mad wrapper pool.\r
-        */\r
-       p_madw = malloc(sizeof(*p_madw));\r
-       if (p_madw == NULL)\r
-               goto Exit;\r
-\r
-       /*\r
-          Finally, initialize the wrapper object.\r
-        */\r
-       cl_atomic_inc(&p_pool->mads_out);\r
-       osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);\r
-       osm_madw_set_mad(p_madw, p_mad);\r
-\r
-Exit:\r
-       return p_madw;\r
-}\r
-\r
-osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool)\r
-{\r
-       osm_madw_t *p_madw;\r
-\r
-       p_madw = malloc(sizeof(*p_madw));\r
-       if (!p_madw)\r
-               return NULL;\r
-\r
-       osm_madw_init(p_madw, 0, 0, 0);\r
-       osm_madw_set_mad(p_madw, 0);\r
-       cl_atomic_inc(&p_pool->mads_out);\r
-\r
-       return p_madw;\r
-}\r
-\r
-void osm_mad_pool_put(IN osm_mad_pool_t * p_pool, IN osm_madw_t * p_madw)\r
-{\r
-       CL_ASSERT(p_madw);\r
-\r
-       /*\r
-          First, return the wire mad to the pool\r
-        */\r
-       if (p_madw->p_mad)\r
-               osm_vendor_put(p_madw->h_bind, &p_madw->vend_wrap);\r
-\r
-       /*\r
-          Return the mad wrapper to the wrapper pool\r
-        */\r
-       free(p_madw);\r
-       cl_atomic_dec(&p_pool->mads_out);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c b/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c
deleted file mode 100644 (file)
index 4e05332..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mft_rcv_t.\r
- * This object represents the Multicast Forwarding Table Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_sm.h>\r
-\r
-void osm_mft_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_smp_t *p_smp;\r
-       uint32_t block_num;\r
-       uint8_t position;\r
-       osm_switch_t *p_sw;\r
-       osm_mft_context_t *p_mft_context;\r
-       uint16_t *p_block;\r
-       ib_net64_t node_guid;\r
-       ib_api_status_t status;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_block = ib_smp_get_payload_ptr(p_smp);\r
-       block_num = cl_ntoh32(p_smp->attr_mod) & IB_MCAST_BLOCK_ID_MASK_HO;\r
-       position = (uint8_t) ((cl_ntoh32(p_smp->attr_mod) &\r
-                              IB_MCAST_POSITION_MASK_HO) >>\r
-                             IB_MCAST_POSITION_SHIFT);\r
-\r
-       /*\r
-          Acquire the switch object for this switch.\r
-        */\r
-       p_mft_context = osm_madw_get_mft_context_ptr(p_madw);\r
-       node_guid = p_mft_context->node_guid;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Setting MFT block %u, position %u, "\r
-               "Switch 0x%016" PRIx64 ", TID 0x%" PRIx64 "\n",\r
-               block_num, position, cl_ntoh64(node_guid),\r
-               cl_ntoh64(p_smp->trans_id));\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-       p_sw = osm_get_switch_by_guid(sm->p_subn, node_guid);\r
-\r
-       if (!p_sw) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0801: "\r
-                       "MFT received for nonexistent node "\r
-                       "0x%016" PRIx64 "\n", cl_ntoh64(node_guid));\r
-       } else {\r
-               status = osm_switch_set_mft_block(p_sw, p_block,\r
-                                                 (uint16_t) block_num,\r
-                                                 position);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0802: "\r
-                               "Setting MFT block failed (%s)"\r
-                               ", Switch 0x%016" PRIx64\r
-                               " (%s), block %u, position %u\n",\r
-                               ib_get_err_str(status), cl_ntoh64(node_guid),\r
-                               p_sw->p_node->print_desc, block_num, position);\r
-               }\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mcast_mgr.c b/branches/opensm_3/user/opensm/osm_mcast_mgr.c
deleted file mode 100644 (file)
index 32da52f..0000000
+++ /dev/null
@@ -1,1171 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mcast_mgr_t.\r
- * This file implements the Multicast Manager object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-\r
-typedef struct osm_mcast_work_obj {\r
-       cl_list_item_t list_item;\r
-       osm_port_t *p_port;\r
-       cl_map_item_t map_item;\r
-} osm_mcast_work_obj_t;\r
-\r
-static osm_mcast_work_obj_t *mcast_work_obj_new(IN osm_port_t * p_port)\r
-{\r
-       osm_mcast_work_obj_t *p_obj;\r
-\r
-       /*\r
-          clean allocated memory to avoid assertion when trying to insert to\r
-          qlist.\r
-          see cl_qlist_insert_tail(): CL_ASSERT(p_list_item->p_list != p_list)\r
-        */\r
-       p_obj = malloc(sizeof(*p_obj));\r
-       if (p_obj) {\r
-               memset(p_obj, 0, sizeof(*p_obj));\r
-               p_obj->p_port = p_port;\r
-       }\r
-\r
-       return p_obj;\r
-}\r
-\r
-static void mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj)\r
-{\r
-       free(p_wobj);\r
-}\r
-\r
-static int make_port_list(cl_qlist_t * list, osm_mgrp_box_t * mbox)\r
-{\r
-       cl_qmap_t map;\r
-       cl_map_item_t *map_item;\r
-       cl_list_item_t *list_item;\r
-       osm_mgrp_t *mgrp=NULL;\r
-       osm_mcm_port_t *mcm_port=NULL;\r
-       osm_mcast_work_obj_t *wobj;\r
-\r
-       cl_qmap_init(&map);\r
-       cl_qlist_init(list);\r
-\r
-       for (list_item = cl_qlist_head(&mbox->mgrp_list);\r
-            list_item != cl_qlist_end(&mbox->mgrp_list);\r
-            list_item = cl_qlist_next(list_item)) {\r
-               mgrp = cl_item_obj(list_item, mgrp, list_item);\r
-               for (map_item = cl_qmap_head(&mgrp->mcm_port_tbl);\r
-                    map_item != cl_qmap_end(&mgrp->mcm_port_tbl);\r
-                    map_item = cl_qmap_next(map_item)) {\r
-                       /* Acquire the port object for this port guid, then\r
-                          create the new worker object to build the list. */\r
-                       mcm_port = cl_item_obj(map_item, mcm_port, map_item);\r
-                       if (cl_qmap_get(&map, mcm_port->port->guid) !=\r
-                           cl_qmap_end(&map))\r
-                               continue;\r
-                       wobj = mcast_work_obj_new(mcm_port->port);\r
-                       if (!wobj)\r
-                               return -1;\r
-                       cl_qlist_insert_tail(list, &wobj->list_item);\r
-                       cl_qmap_insert(&map, mcm_port->port->guid,\r
-                                      &wobj->map_item);\r
-               }\r
-       }\r
-       return 0;\r
-}\r
-\r
-static void drop_port_list(cl_qlist_t * list)\r
-{\r
-       while (cl_qlist_count(list))\r
-               mcast_work_obj_delete((osm_mcast_work_obj_t *)\r
-                                     cl_qlist_remove_head(list));\r
-}\r
-\r
-/**********************************************************************\r
- Recursively remove nodes from the tree\r
- *********************************************************************/\r
-static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)\r
-{\r
-       uint8_t i;\r
-\r
-       for (i = 0; i < p_mtn->max_children; i++) {\r
-               if (p_mtn->child_array[i] &&\r
-                   (p_mtn->child_array[i] != OSM_MTREE_LEAF))\r
-                       mcast_mgr_purge_tree_node(p_mtn->child_array[i]);\r
-               p_mtn->child_array[i] = NULL;\r
-       }\r
-\r
-       free(p_mtn);\r
-}\r
-\r
-static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_box_t * mbox)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       if (mbox->root)\r
-               mcast_mgr_purge_tree_node(mbox->root);\r
-       mbox->root = NULL;\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void create_mgrp_switch_map(cl_qmap_t * m, cl_qlist_t * port_list)\r
-{\r
-       osm_mcast_work_obj_t *wobj=NULL;\r
-       osm_port_t *port;\r
-       osm_switch_t *sw;\r
-       ib_net64_t guid;\r
-       cl_list_item_t *i;\r
-\r
-       cl_qmap_init(m);\r
-       for (i = cl_qlist_head(port_list); i != cl_qlist_end(port_list);\r
-            i = cl_qlist_next(i)) {\r
-               wobj = cl_item_obj(i, wobj, list_item);\r
-               port = wobj->p_port;\r
-               if (port->p_node->sw) {\r
-                       sw = port->p_node->sw;\r
-                       sw->is_mc_member = 1;\r
-               } else {\r
-                       sw = port->p_physp->p_remote_physp->p_node->sw;\r
-                       sw->num_of_mcm++;\r
-               }\r
-               guid = osm_node_get_node_guid(sw->p_node);\r
-               if (cl_qmap_get(m, guid) == cl_qmap_end(m))\r
-                       cl_qmap_insert(m, guid, &sw->mgrp_item);\r
-       }\r
-}\r
-\r
-static void destroy_mgrp_switch_map(cl_qmap_t * m)\r
-{\r
-       osm_switch_t *sw=NULL;\r
-       cl_map_item_t *i;\r
-\r
-       for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {\r
-               sw = cl_item_obj(i, sw, mgrp_item);\r
-               sw->num_of_mcm = 0;\r
-               sw->is_mc_member = 0;\r
-       }\r
-       cl_qmap_remove_all(m);\r
-}\r
-\r
-/**********************************************************************\r
- Calculate the maximal "min hops" from the given switch to any\r
- of the group HCAs\r
- **********************************************************************/\r
-#ifdef OSM_VENDOR_INTF_ANAFA\r
-static float mcast_mgr_compute_avg_hops(osm_sm_t * sm, cl_qmap_t * m,\r
-                                       const osm_switch_t * this_sw)\r
-{\r
-       float avg_hops = 0;\r
-       uint32_t hops = 0;\r
-       uint32_t num_ports = 0;\r
-       uint16_t lid;\r
-       uint32_t least_hops;\r
-       cl_map_item_t *i;\r
-       osm_switch_t *sw;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {\r
-               sw = cl_item_obj(i, sw, mcast_item);\r
-               lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));\r
-               least_hops = osm_switch_get_least_hops(this_sw, lid);\r
-               /* for all host that are MC members and attached to the switch,\r
-                  we should add the (least_hops + 1) * number_of_such_hosts.\r
-                  If switch itself is in the MC, we should add the least_hops only */\r
-               hops += (least_hops + 1) * sw->num_of_mcm +\r
-                   least_hops * sw->is_mc_member;\r
-               num_ports += sw->num_of_mcm + sw->is_mc_member;\r
-       }\r
-\r
-       /* We shouldn't be here if there aren't any ports in the group. */\r
-       CL_ASSERT(num_ports);\r
-\r
-       avg_hops = (float)(hops / num_ports);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return avg_hops;\r
-}\r
-#else\r
-static float mcast_mgr_compute_max_hops(osm_sm_t * sm, cl_qmap_t * m,\r
-                                       const osm_switch_t * this_sw)\r
-{\r
-       uint32_t max_hops = 0, hops;\r
-       uint16_t lid;\r
-       cl_map_item_t *i;\r
-       osm_switch_t *sw=NULL;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          For each member of the multicast group, compute the\r
-          number of hops to its base LID.\r
-        */\r
-       for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) {\r
-               sw = cl_item_obj(i, sw, mgrp_item);\r
-               lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));\r
-               hops = osm_switch_get_least_hops(this_sw, lid);\r
-               if (!sw->is_mc_member)\r
-                       hops += 1;\r
-               if (hops > max_hops)\r
-                       max_hops = hops;\r
-       }\r
-\r
-       /* Note that at this point we might get (max_hops == 0),\r
-          which means that there's only one member in the mcast\r
-          group, and it's the current switch */\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return (float)max_hops;\r
-}\r
-#endif\r
-\r
-/**********************************************************************\r
-   This function attempts to locate the optimal switch for the\r
-   center of the spanning tree.  The current algorithm chooses\r
-   a switch with the lowest average hop count to the members\r
-   of the multicast group.\r
-**********************************************************************/\r
-static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,\r
-                                                  cl_qlist_t * list)\r
-{\r
-       cl_qmap_t mgrp_sw_map;\r
-       cl_qmap_t *p_sw_tbl;\r
-       osm_switch_t *p_sw, *p_best_sw = NULL;\r
-       float hops = 0;\r
-       float best_hops = 10000;        /* any big # will do */\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_sw_tbl = &sm->p_subn->sw_guid_tbl;\r
-\r
-       create_mgrp_switch_map(&mgrp_sw_map, list);\r
-       for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);\r
-            p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl);\r
-            p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {\r
-               if (!osm_switch_supports_mcast(p_sw))\r
-                       continue;\r
-\r
-#ifdef OSM_VENDOR_INTF_ANAFA\r
-               hops = mcast_mgr_compute_avg_hops(sm, &mgrp_sw_map, p_sw);\r
-#else\r
-               hops = mcast_mgr_compute_max_hops(sm, &mgrp_sw_map, p_sw);\r
-#endif\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Switch 0x%016" PRIx64 ", hops = %f\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)), hops);\r
-\r
-               if (hops < best_hops) {\r
-                       p_best_sw = p_sw;\r
-                       best_hops = hops;\r
-               }\r
-       }\r
-\r
-       if (p_best_sw)\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Best switch is 0x%" PRIx64 " (%s), hops = %f\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_best_sw->p_node)),\r
-                       p_best_sw->p_node->print_desc, best_hops);\r
-       else\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "No multicast capable switches detected\n");\r
-\r
-       destroy_mgrp_switch_map(&mgrp_sw_map);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return p_best_sw;\r
-}\r
-\r
-/**********************************************************************\r
-   This function returns the existing or optimal root switch for the tree.\r
-**********************************************************************/\r
-static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list)\r
-{\r
-       osm_switch_t *p_sw = NULL;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          We always look for the best multicast tree root switch.\r
-          Otherwise since we always start with a a single join\r
-          the root will be always on the first switch attached to it.\r
-          - Very bad ...\r
-        */\r
-       p_sw = mcast_mgr_find_optimal_switch(sm, list);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return p_sw;\r
-}\r
-\r
-static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,\r
-                                  uint32_t block_num, uint32_t position)\r
-{\r
-       osm_node_t *p_node;\r
-       osm_dr_path_t *p_path;\r
-       osm_madw_context_t context;\r
-       ib_api_status_t status;\r
-       uint32_t block_id_ho;\r
-       osm_mcast_tbl_t *p_tbl;\r
-       ib_net16_t block[IB_MCAST_BLOCK_SIZE];\r
-       int ret = 0;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));\r
-\r
-       /*\r
-          Send multicast forwarding table blocks to the switch\r
-          as long as the switch indicates it has blocks needing\r
-          configuration.\r
-        */\r
-\r
-       context.mft_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.mft_context.set_method = TRUE;\r
-\r
-       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-\r
-       if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num,\r
-                                   (uint8_t) position, block)) {\r
-               block_id_ho = block_num + (position << 28);\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Writing MFT block %u position %u to switch 0x%" PRIx64\r
-                       "\n", block_num, position,\r
-                       cl_ntoh64(context.mft_context.node_guid));\r
-\r
-               status = osm_req_set(sm, p_path, (void *)block, sizeof(block),\r
-                                    IB_MAD_ATTR_MCAST_FWD_TBL,\r
-                                    cl_hton32(block_id_ho), CL_DISP_MSGID_NONE,\r
-                                    &context);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: "\r
-                               "Sending multicast fwd. tbl. block to %s failed (%s)\n",\r
-                               p_node->print_desc, ib_get_err_str(status));\r
-                       ret = -1;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return ret;\r
-}\r
-\r
-/**********************************************************************\r
-  This is part of the recursive function to compute the paths in the\r
-  spanning tree that emanate from this switch.  On input, the p_list\r
-  contains the group members that must be routed from this switch.\r
-**********************************************************************/\r
-static void mcast_mgr_subdivide(osm_sm_t * sm, uint16_t mlid_ho,\r
-                               osm_switch_t * p_sw, cl_qlist_t * p_list,\r
-                               cl_qlist_t * list_array, uint8_t array_size)\r
-{\r
-       uint8_t port_num;\r
-       boolean_t ignore_existing;\r
-       osm_mcast_work_obj_t *p_wobj;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          For Multicast Groups, we don't want to count on previous\r
-          configurations - since we can easily generate a storm\r
-          by loops.\r
-        */\r
-       ignore_existing = TRUE;\r
-\r
-       /*\r
-          Subdivide the set of ports into non-overlapping subsets\r
-          that will be routed to other switches.\r
-        */\r
-       while ((p_wobj =\r
-               (osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list)) !=\r
-              (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) {\r
-               port_num =\r
-                   osm_switch_recommend_mcast_path(p_sw, p_wobj->p_port,\r
-                                                   mlid_ho, ignore_existing);\r
-               if (port_num == OSM_NO_PATH) {\r
-                       /*\r
-                          This typically occurs if the switch does not support\r
-                          multicast and the multicast tree must branch at this\r
-                          switch.\r
-                        */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A03: "\r
-                               "Error routing MLID 0x%X through switch 0x%"\r
-                               PRIx64 " %s\n"\r
-                               "\t\t\t\tNo multicast paths from this switch "\r
-                               "for port with LID %u\n", mlid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),\r
-                               p_sw->p_node->print_desc,\r
-                               cl_ntoh16(osm_port_get_base_lid\r
-                                         (p_wobj->p_port)));\r
-                       mcast_work_obj_delete(p_wobj);\r
-                       continue;\r
-               }\r
-\r
-               if (port_num > array_size) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A04: "\r
-                               "Error routing MLID 0x%X through switch 0x%"\r
-                               PRIx64 " %s\n"\r
-                               "\t\t\t\tNo multicast paths from this switch "\r
-                               "to port with LID %u\n", mlid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),\r
-                               p_sw->p_node->print_desc,\r
-                               cl_ntoh16(osm_port_get_base_lid\r
-                                         (p_wobj->p_port)));\r
-                       mcast_work_obj_delete(p_wobj);\r
-                       /* This is means OpenSM has a bug. */\r
-                       CL_ASSERT(FALSE);\r
-                       continue;\r
-               }\r
-\r
-               cl_qlist_insert_tail(&list_array[port_num], &p_wobj->list_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * list)\r
-{\r
-       if (osm_log_is_active(sm->p_log, OSM_LOG_ERROR)) {\r
-               osm_mcast_work_obj_t *wobj=NULL;\r
-               cl_list_item_t *i;\r
-               for (i = cl_qlist_head(list); i != cl_qlist_end(list);\r
-                    i = cl_qlist_next(i)) {\r
-                       wobj = cl_item_obj(i, wobj, list_item);\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A06: "\r
-                               "Unable to route for port 0x%" PRIx64 "\n",\r
-                               osm_port_get_guid(wobj->p_port));\r
-               }\r
-       }\r
-       drop_port_list(list);\r
-}\r
-\r
-/**********************************************************************\r
-  This is the recursive function to compute the paths in the spanning\r
-  tree that emanate from this switch.  On input, the p_list contains\r
-  the group members that must be routed from this switch.\r
-\r
-  The function returns the newly created mtree node element.\r
-**********************************************************************/\r
-static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, uint16_t mlid_ho,\r
-                                         osm_switch_t * p_sw,\r
-                                         cl_qlist_t * p_list, uint8_t depth,\r
-                                         uint8_t upstream_port,\r
-                                         uint8_t * p_max_depth)\r
-{\r
-       uint8_t max_children;\r
-       osm_mtree_node_t *p_mtn = NULL;\r
-       cl_qlist_t *list_array = NULL;\r
-       uint8_t i;\r
-       ib_net64_t node_guid;\r
-       osm_mcast_work_obj_t *p_wobj;\r
-       cl_qlist_t *p_port_list;\r
-       size_t count;\r
-       osm_mcast_tbl_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_sw);\r
-       CL_ASSERT(p_list);\r
-       CL_ASSERT(p_max_depth);\r
-\r
-       node_guid = osm_node_get_node_guid(p_sw->p_node);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Routing MLID 0x%X through switch 0x%" PRIx64\r
-               " %s, %u nodes at depth %u\n",\r
-               mlid_ho, cl_ntoh64(node_guid), p_sw->p_node->print_desc,\r
-               cl_qlist_count(p_list), depth);\r
-\r
-       CL_ASSERT(cl_qlist_count(p_list) > 0);\r
-\r
-       depth++;\r
-\r
-       if (depth >= 64) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "Maximal hops number is reached for MLID 0x%x."\r
-                       " Break processing.", mlid_ho);\r
-               mcast_mgr_purge_list(sm, p_list);\r
-               goto Exit;\r
-       }\r
-\r
-       if (depth > *p_max_depth) {\r
-               CL_ASSERT(depth == *p_max_depth + 1);\r
-               *p_max_depth = depth;\r
-       }\r
-\r
-       if (osm_switch_supports_mcast(p_sw) == FALSE) {\r
-               /*\r
-                  This switch doesn't do multicast.  Clean-up.\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A14: "\r
-                       "Switch 0x%" PRIx64 " %s does not support multicast\n",\r
-                       cl_ntoh64(node_guid), p_sw->p_node->print_desc);\r
-\r
-               /*\r
-                  Deallocate all the work objects on this branch of the tree.\r
-                */\r
-               mcast_mgr_purge_list(sm, p_list);\r
-               goto Exit;\r
-       }\r
-\r
-       p_mtn = osm_mtree_node_new(p_sw);\r
-       if (p_mtn == NULL) {\r
-               /*\r
-                  We are unable to continue routing down this\r
-                  leg of the tree.  Clean-up.\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A15: "\r
-                       "Insufficient memory to build multicast tree\n");\r
-\r
-               /*\r
-                  Deallocate all the work objects on this branch of the tree.\r
-                */\r
-               mcast_mgr_purge_list(sm, p_list);\r
-               goto Exit;\r
-       }\r
-\r
-       max_children = osm_mtree_node_get_max_children(p_mtn);\r
-\r
-       CL_ASSERT(max_children > 1);\r
-\r
-       /*\r
-          Prepare an empty list for each port in the switch.\r
-          TO DO - this list array could probably be moved\r
-          inside the switch element to save on malloc thrashing.\r
-        */\r
-       list_array = malloc(sizeof(cl_qlist_t) * max_children);\r
-       if (list_array == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A16: "\r
-                       "Unable to allocate list array\n");\r
-               mcast_mgr_purge_list(sm, p_list);\r
-               osm_mtree_destroy(p_mtn);\r
-               p_mtn = NULL;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(list_array, 0, sizeof(cl_qlist_t) * max_children);\r
-\r
-       for (i = 0; i < max_children; i++)\r
-               cl_qlist_init(&list_array[i]);\r
-\r
-       mcast_mgr_subdivide(sm, mlid_ho, p_sw, p_list, list_array, max_children);\r
-\r
-       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-\r
-       /*\r
-          Add the upstream port to the forwarding table unless\r
-          we're at the root of the spanning tree.\r
-        */\r
-       if (depth > 1) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Adding upstream port %u\n", upstream_port);\r
-\r
-               CL_ASSERT(upstream_port);\r
-               osm_mcast_tbl_set(p_tbl, mlid_ho, upstream_port);\r
-       }\r
-\r
-       /*\r
-          For each port that was allocated some routes,\r
-          recurse into this function to continue building the tree\r
-          if the node on the other end of that port is another switch.\r
-          Otherwise, the node is an endpoint, and we've found a leaf\r
-          of the tree.  Mark leaves with our special pointer value.\r
-        */\r
-\r
-       for (i = 0; i < max_children; i++) {\r
-               const osm_physp_t *p_physp;\r
-               const osm_physp_t *p_remote_physp;\r
-               osm_node_t *p_node;\r
-               const osm_node_t *p_remote_node;\r
-\r
-               p_port_list = &list_array[i];\r
-\r
-               count = cl_qlist_count(p_port_list);\r
-\r
-               /*\r
-                  There should be no children routed through the upstream port!\r
-                */\r
-               CL_ASSERT(upstream_port == 0 || i != upstream_port ||\r
-                         (i == upstream_port && count == 0));\r
-\r
-               if (count == 0)\r
-                       continue;       /* No routes down this port. */\r
-\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Routing %u destinations via switch port %u\n",\r
-                       count, i);\r
-\r
-               /*\r
-                  This port routes frames for this mcast group.  Therefore,\r
-                  set the appropriate bit in the multicast forwarding\r
-                  table for this switch.\r
-                */\r
-               osm_mcast_tbl_set(p_tbl, mlid_ho, i);\r
-               if (i == 0) {\r
-                       /* This means we are adding the switch to the MC group.\r
-                          We do not need to continue looking at the remote\r
-                          port, just needed to add the port to the table */\r
-                       CL_ASSERT(count == 1);\r
-\r
-                       p_wobj = (osm_mcast_work_obj_t *)\r
-                           cl_qlist_remove_head(p_port_list);\r
-                       mcast_work_obj_delete(p_wobj);\r
-                       continue;\r
-               }\r
-\r
-               p_node = p_sw->p_node;\r
-               p_remote_node = osm_node_get_remote_node(p_node, i, NULL);\r
-               if (!p_remote_node)\r
-                       continue;\r
-\r
-               if (osm_node_get_type(p_remote_node) == IB_NODE_TYPE_SWITCH) {\r
-                       /*\r
-                          Acquire a pointer to the remote switch then recurse.\r
-                        */\r
-                       CL_ASSERT(p_remote_node->sw);\r
-\r
-                       p_physp = osm_node_get_physp_ptr(p_node, i);\r
-                       CL_ASSERT(p_physp);\r
-\r
-                       p_remote_physp = osm_physp_get_remote(p_physp);\r
-                       CL_ASSERT(p_remote_physp);\r
-\r
-                       p_mtn->child_array[i] =\r
-                           mcast_mgr_branch(sm, mlid_ho, p_remote_node->sw,\r
-                                            p_port_list, depth,\r
-                                            osm_physp_get_port_num\r
-                                            (p_remote_physp), p_max_depth);\r
-               } else {\r
-                       /*\r
-                          The neighbor node is not a switch, so this\r
-                          must be a leaf.\r
-                        */\r
-                       CL_ASSERT(count == 1);\r
-\r
-                       p_mtn->child_array[i] = OSM_MTREE_LEAF;\r
-                       p_wobj = (osm_mcast_work_obj_t *)\r
-                           cl_qlist_remove_head(p_port_list);\r
-\r
-                       CL_ASSERT(cl_is_qlist_empty(p_port_list));\r
-\r
-                       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                               "Found leaf for port 0x%016" PRIx64\r
-                               " on switch port %u\n",\r
-                               cl_ntoh64(osm_port_get_guid(p_wobj->p_port)),\r
-                               i);\r
-                       mcast_work_obj_delete(p_wobj);\r
-               }\r
-       }\r
-\r
-       free(list_array);\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return p_mtn;\r
-}\r
-\r
-static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,\r
-                                                    osm_mgrp_box_t * mbox)\r
-{\r
-       cl_qlist_t port_list;\r
-       uint32_t num_ports;\r
-       osm_switch_t *p_sw;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint8_t max_depth = 0;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          TO DO - for now, just blow away the old tree.\r
-          In the future we'll need to construct the tree based\r
-          on multicast forwarding table information if the user wants to\r
-          preserve existing multicast routes.\r
-        */\r
-       mcast_mgr_purge_tree(sm, mbox);\r
-\r
-       /* build the first "subset" containing all member ports */\r
-       if (make_port_list(&port_list, mbox)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: "\r
-                       "Insufficient memory to make port list\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       num_ports = cl_qlist_count(&port_list);\r
-       if (num_ports == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "MLID 0x%X has no members - nothing to do\n",\r
-                       mbox->mlid);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          This function builds the single spanning tree recursively.\r
-          At each stage, the ports to be reached are divided into\r
-          non-overlapping subsets of member ports that can be reached through\r
-          a given switch port.  Construction then moves down each\r
-          branch, and the process starts again with each branch computing\r
-          for its own subset of the member ports.\r
-\r
-          The maximum recursion depth is at worst the maximum hop count in the\r
-          subnet, which is spec limited to 64.\r
-        */\r
-\r
-       /*\r
-          Locate the switch around which to create the spanning\r
-          tree for this multicast group.\r
-        */\r
-       p_sw = mcast_mgr_find_root_switch(sm, &port_list);\r
-       if (p_sw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A08: "\r
-                       "Unable to locate a suitable switch for group 0x%X\n",\r
-                       mbox->mlid);\r
-               drop_port_list(&port_list);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       mbox->root = mcast_mgr_branch(sm, mbox->mlid, p_sw, &port_list, 0, 0,\r
-                                     &max_depth);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Configured MLID 0x%X for %u ports, max tree depth = %u\n",\r
-               mbox->mlid, num_ports, max_depth);\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-#if 0\r
-/* unused */\r
-void osm_mcast_mgr_set_table(osm_sm_t * sm, IN const osm_mgrp_t * p_mgrp,\r
-                            IN const osm_mtree_node_t * p_mtn)\r
-{\r
-       uint8_t i;\r
-       uint8_t max_children;\r
-       osm_mtree_node_t *p_child_mtn;\r
-       uint16_t mlid_ho;\r
-       osm_mcast_tbl_t *p_tbl;\r
-       osm_switch_t *p_sw;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));\r
-       p_sw = osm_mtree_node_get_switch_ptr(p_mtn);\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Configuring MLID 0x%X on switch 0x%" PRIx64 "\n",\r
-               mlid_ho, osm_node_get_node_guid(p_sw->p_node));\r
-\r
-       /*\r
-          For every child of this tree node, set the corresponding\r
-          bit in the switch's mcast table.\r
-        */\r
-       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-       max_children = osm_mtree_node_get_max_children(p_mtn);\r
-\r
-       CL_ASSERT(max_children <= osm_switch_get_num_ports(p_sw));\r
-\r
-       osm_mcast_tbl_clear_mlid(p_tbl, mlid_ho);\r
-\r
-       for (i = 0; i < max_children; i++) {\r
-               p_child_mtn = osm_mtree_node_get_child(p_mtn, i);\r
-               if (p_child_mtn == NULL)\r
-                       continue;\r
-\r
-               osm_mcast_tbl_set(p_tbl, mlid_ho, i);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-#endif\r
-\r
-static void mcast_mgr_clear(osm_sm_t * sm, uint16_t mlid)\r
-{\r
-       osm_switch_t *p_sw;\r
-       cl_qmap_t *p_sw_tbl;\r
-       osm_mcast_tbl_t *p_mcast_tbl;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /* Walk the switches and clear the routing entries for this MLID. */\r
-       p_sw_tbl = &sm->p_subn->sw_guid_tbl;\r
-       p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);\r
-       while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {\r
-               p_mcast_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-               osm_mcast_tbl_clear_mlid(p_mcast_tbl, mlid);\r
-               p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-#if 0\r
-/* TO DO - make this real -- at least update spanning tree */\r
-/**********************************************************************\r
-   Lock must be held on entry.\r
-**********************************************************************/\r
-ib_api_status_t osm_mcast_mgr_process_single(osm_sm_t * sm,\r
-                                            IN ib_net16_t const mlid,\r
-                                            IN ib_net64_t const port_guid,\r
-                                            IN uint8_t const join_state)\r
-{\r
-       uint8_t port_num;\r
-       uint16_t mlid_ho;\r
-       ib_net64_t sw_guid;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-       osm_node_t *p_remote_node;\r
-       osm_mcast_tbl_t *p_mcast_tbl;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(mlid);\r
-       CL_ASSERT(port_guid);\r
-\r
-       mlid_ho = cl_ntoh16(mlid);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Attempting to add port 0x%" PRIx64 " to MLID 0x%X, "\r
-               "\n\t\t\t\tjoin state = 0x%X\n",\r
-               cl_ntoh64(port_guid), mlid_ho, join_state);\r
-\r
-       /*\r
-          Acquire the Port object.\r
-        */\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A01: "\r
-                       "Unable to acquire port object for 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(port_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_physp = p_port->p_physp;\r
-       if (p_physp == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A05: "\r
-                       "Unable to acquire phsyical port object for 0x%" PRIx64\r
-                       "\n", cl_ntoh64(port_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_remote_physp = osm_physp_get_remote(p_physp);\r
-       if (p_remote_physp == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A11: "\r
-                       "Unable to acquire remote phsyical port object "\r
-                       "for 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_remote_node = osm_physp_get_node_ptr(p_remote_physp);\r
-\r
-       CL_ASSERT(p_remote_node);\r
-\r
-       sw_guid = osm_node_get_node_guid(p_remote_node);\r
-\r
-       if (osm_node_get_type(p_remote_node) != IB_NODE_TYPE_SWITCH) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A22: "\r
-                       "Remote node not a switch node 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(sw_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (!p_remote_node->sw) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A12: "\r
-                       "No switch object 0x%" PRIx64 "\n", cl_ntoh64(sw_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_switch_is_in_mcast_tree(p_remote_node->sw, mlid_ho)) {\r
-               /*\r
-                  We're in luck. The switch attached to this port\r
-                  is already in the multicast group, so we can just\r
-                  add the specified port as a new leaf of the tree.\r
-                */\r
-               if (join_state & (IB_JOIN_STATE_FULL | IB_JOIN_STATE_NON)) {\r
-                       /*\r
-                          This node wants to receive multicast frames.\r
-                          Get the switch port number to which the new member port\r
-                          is attached, then configure this single mcast table.\r
-                        */\r
-                       port_num = osm_physp_get_port_num(p_remote_physp);\r
-                       CL_ASSERT(port_num);\r
-\r
-                       p_mcast_tbl =\r
-                           osm_switch_get_mcast_tbl_ptr(p_remote_node->sw);\r
-                       osm_mcast_tbl_set(p_mcast_tbl, mlid_ho, port_num);\r
-               } else {\r
-                       if (join_state & IB_JOIN_STATE_SEND_ONLY)\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Success.  Nothing to do for send"\r
-                                       "only member\n");\r
-                       else {\r
-                               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A13: "\r
-                                       "Unknown join state 0x%X\n",\r
-                                       join_state);\r
-                               status = IB_ERROR;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       } else\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Unable to add port\n");\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-#endif\r
-\r
-/**********************************************************************\r
- Process the entire group.\r
- NOTE : The lock should be held externally!\r
- **********************************************************************/\r
-static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_mgrp_box_t *mbox;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Processing multicast group with lid 0x%X\n", mlid);\r
-\r
-       /* Clear the multicast tables to start clean, then build\r
-          the spanning tree which sets the mcast table bits for each\r
-          port in the group. */\r
-       mcast_mgr_clear(sm, mlid);\r
-\r
-       mbox = osm_get_mbox_by_mlid(sm->p_subn, cl_hton16(mlid));\r
-       if (mbox) {\r
-               status = mcast_mgr_build_spanning_tree(sm, mbox);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A17: "\r
-                               "Unable to create spanning tree (%s) for mlid "\r
-                               "0x%x\n", ib_get_err_str(status), mlid);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-static int mcast_mgr_set_mftables(osm_sm_t * sm)\r
-{\r
-       cl_qmap_t *p_sw_tbl = &sm->p_subn->sw_guid_tbl;\r
-       osm_switch_t *p_sw;\r
-       osm_mcast_tbl_t *p_tbl;\r
-       int block_notdone, ret = 0;\r
-       int16_t block_num, max_block = -1;\r
-\r
-       p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);\r
-       while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {\r
-               p_sw->mft_block_num = 0;\r
-               p_sw->mft_position = 0;\r
-               p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-               if (osm_mcast_tbl_get_max_block_in_use(p_tbl) > max_block)\r
-                       max_block = osm_mcast_tbl_get_max_block_in_use(p_tbl);\r
-               p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-       }\r
-\r
-       /* Stripe the MFT blocks across the switches */\r
-       for (block_num = 0; block_num <= max_block; block_num++) {\r
-               block_notdone = 1;\r
-               while (block_notdone) {\r
-                       block_notdone = 0;\r
-                       p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);\r
-                       while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {\r
-                               if (p_sw->mft_block_num == block_num) {\r
-                                       block_notdone = 1;\r
-                                       if (mcast_mgr_set_mft_block(sm, p_sw,\r
-                                                                   p_sw->mft_block_num,\r
-                                                                   p_sw->mft_position))\r
-                                               ret = -1;\r
-                                       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-                                       if (++p_sw->mft_position > p_tbl->max_position) {\r
-                                               p_sw->mft_position = 0;\r
-                                               p_sw->mft_block_num++;\r
-                                       }\r
-                               }\r
-                               p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-                       }\r
-               }\r
-       }\r
-\r
-       return ret;\r
-}\r
-\r
-static int alloc_mfts(osm_sm_t * sm)\r
-{\r
-       int i;\r
-       cl_map_item_t *item;\r
-       osm_switch_t *p_sw;\r
-\r
-       for (i = sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i >= 0;\r
-            i--)\r
-               if (sm->p_subn->mboxes[i])\r
-                       break;\r
-       if (i < 0)\r
-               return 0;\r
-\r
-       /* Now, walk switches and (re)allocate multicast tables */\r
-       for (item = cl_qmap_head(&sm->p_subn->sw_guid_tbl);\r
-            item != cl_qmap_end(&sm->p_subn->sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *) item;\r
-               if (osm_mcast_tbl_realloc(&p_sw->mcast_tbl, i))\r
-                       return -1;\r
-       }\r
-       return 0;\r
-}\r
-\r
-int osm_mcast_mgr_process(osm_sm_t * sm)\r
-{\r
-       int i, ret = 0;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /* While holding the lock, iterate over all the established\r
-          multicast groups, servicing each in turn.\r
-          Then, download the multicast tables to the switches. */\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       /* If there are no switches in the subnet we have nothing to do. */\r
-       if (cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "No switches in subnet. Nothing to do\n");\r
-               goto exit;\r
-       }\r
-\r
-       if (alloc_mfts(sm)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 0A07: alloc_mfts failed\n");\r
-               ret = -1;\r
-               goto exit;\r
-       }\r
-\r
-       for (i = 0; i <= sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;\r
-            i++)\r
-               if (sm->p_subn->mboxes[i] || sm->mlids_req[i])\r
-                       mcast_mgr_process_mlid(sm, i + IB_LID_MCAST_START_HO);\r
-\r
-       memset(sm->mlids_req, 0, sm->mlids_req_max);\r
-       sm->mlids_req_max = 0;\r
-\r
-       ret = mcast_mgr_set_mftables(sm);\r
-\r
-exit:\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-\r
-       return ret;\r
-}\r
-\r
-/**********************************************************************\r
-  This is the function that is invoked during idle time to handle the\r
-  process request for mcast groups where join/leave/delete was required.\r
- **********************************************************************/\r
-int osm_mcast_mgr_process_mgroups(osm_sm_t * sm)\r
-{\r
-       int ret = 0;\r
-       unsigned i;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       /* If there are no switches in the subnet we have nothing to do. */\r
-       if (cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "No switches in subnet. Nothing to do\n");\r
-               goto exit;\r
-       }\r
-\r
-       if (alloc_mfts(sm)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 0A09: alloc_mfts failed\n");\r
-               ret = -1;\r
-               goto exit;\r
-       }\r
-\r
-       for (i = 0; i <= sm->mlids_req_max; i++) {\r
-               if (!sm->mlids_req[i])\r
-                       continue;\r
-               sm->mlids_req[i] = 0;\r
-               mcast_mgr_process_mlid(sm, i + IB_LID_MCAST_START_HO);\r
-       }\r
-\r
-       memset(sm->mlids_req, 0, sm->mlids_req_max);\r
-       sm->mlids_req_max = 0;\r
-\r
-       ret = mcast_mgr_set_mftables(sm);\r
-\r
-       osm_dump_mcast_routes(sm->p_subn->p_osm);\r
-\r
-exit:\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mcast_tbl.c b/branches/opensm_3/user/opensm/osm_mcast_tbl.c
deleted file mode 100644 (file)
index 0121c58..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mcast_tbl_t.\r
- * This object represents a multicast forwarding table.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_math.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_mcast_tbl.h>\r
-\r
-void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,\r
-                       IN uint16_t capacity)\r
-{\r
-       CL_ASSERT(p_tbl);\r
-       CL_ASSERT(num_ports);\r
-\r
-       memset(p_tbl, 0, sizeof(*p_tbl));\r
-\r
-       p_tbl->max_block_in_use = -1;\r
-\r
-       if (capacity == 0) {\r
-               /*\r
-                  This switch apparently doesn't support multicast.\r
-                  Everything is initialized to zero already, so return.\r
-                */\r
-               return;\r
-       }\r
-\r
-       p_tbl->num_entries = capacity;\r
-       p_tbl->num_ports = num_ports;\r
-       p_tbl->max_position =\r
-           (uint8_t) ((ROUNDUP(num_ports, IB_MCAST_MASK_SIZE) /\r
-                       IB_MCAST_MASK_SIZE) - 1);\r
-\r
-       p_tbl->max_block = (uint16_t) ((ROUNDUP(p_tbl->num_entries,\r
-                                               IB_MCAST_BLOCK_SIZE) /\r
-                                       IB_MCAST_BLOCK_SIZE) - 1);\r
-}\r
-\r
-void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl)\r
-{\r
-       free(p_tbl->p_mask_tbl);\r
-}\r
-\r
-void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,\r
-                      IN uint8_t port)\r
-{\r
-       unsigned mlid_offset, mask_offset, bit_mask;\r
-       int16_t block_num;\r
-\r
-       CL_ASSERT(p_tbl && p_tbl->p_mask_tbl);\r
-       CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);\r
-       CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);\r
-\r
-       mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;\r
-       mask_offset = port / IB_MCAST_MASK_SIZE;\r
-       bit_mask = cl_ntoh16((uint16_t) (1 << (port % IB_MCAST_MASK_SIZE)));\r
-       (*p_tbl->p_mask_tbl)[mlid_offset][mask_offset] |= bit_mask;\r
-\r
-       block_num = (int16_t) (mlid_offset / IB_MCAST_BLOCK_SIZE);\r
-\r
-       if (block_num > p_tbl->max_block_in_use)\r
-               p_tbl->max_block_in_use = (uint16_t) block_num;\r
-}\r
-\r
-int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset)\r
-{\r
-       size_t mft_depth, size;\r
-       uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];\r
-\r
-       if (mlid_offset < p_tbl->mft_depth)\r
-               goto done;\r
-\r
-       /*\r
-          The number of bytes needed in the mask table is:\r
-          The (maximum bit mask 'position' + 1) times the\r
-          number of bytes in each bit mask times the\r
-          number of MLIDs supported by the table.\r
-\r
-          We must always allocate the array with the maximum position\r
-          since it is (and must be) defined that way the table structure\r
-          in order to create a pointer to a two dimensional array.\r
-        */\r
-       mft_depth = (mlid_offset / IB_MCAST_BLOCK_SIZE + 1) * IB_MCAST_BLOCK_SIZE;\r
-       size = mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8;\r
-       p_mask_tbl = realloc(p_tbl->p_mask_tbl, size);\r
-       if (!p_mask_tbl)\r
-               return -1;\r
-       memset((uint8_t *)p_mask_tbl + p_tbl->mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8,\r
-              0,\r
-              size - p_tbl->mft_depth * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8);\r
-       p_tbl->p_mask_tbl = p_mask_tbl;\r
-       p_tbl->mft_depth = mft_depth;\r
-done:\r
-       p_tbl->max_mlid_ho = mlid_offset + IB_LID_MCAST_START_HO;\r
-       return 0;\r
-}\r
-\r
-boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,\r
-                               IN uint16_t mlid_ho, IN uint8_t port_num)\r
-{\r
-       unsigned mlid_offset, mask_offset, bit_mask;\r
-\r
-       CL_ASSERT(p_tbl);\r
-\r
-       if (p_tbl->p_mask_tbl) {\r
-               CL_ASSERT(port_num <=\r
-                         (p_tbl->max_position + 1) * IB_MCAST_MASK_SIZE);\r
-               CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);\r
-               CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);\r
-\r
-               mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;\r
-               mask_offset = port_num / IB_MCAST_MASK_SIZE;\r
-               bit_mask = cl_ntoh16((uint16_t)\r
-                                    (1 << (port_num % IB_MCAST_MASK_SIZE)));\r
-               return (((*p_tbl->\r
-                         p_mask_tbl)[mlid_offset][mask_offset] & bit_mask) ==\r
-                       bit_mask);\r
-       }\r
-\r
-       return FALSE;\r
-}\r
-\r
-boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,\r
-                                   IN uint16_t mlid_ho)\r
-{\r
-       unsigned mlid_offset;\r
-       uint8_t position;\r
-       uint16_t result = 0;\r
-\r
-       CL_ASSERT(p_tbl);\r
-\r
-       if (p_tbl->p_mask_tbl) {\r
-               CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);\r
-               CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho);\r
-\r
-               mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;\r
-\r
-               for (position = 0; position <= p_tbl->max_position; position++)\r
-                       result |= (*p_tbl->p_mask_tbl)[mlid_offset][position];\r
-       }\r
-\r
-       return (result != 0);\r
-}\r
-\r
-ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,\r
-                                       IN const ib_net16_t * p_block,\r
-                                       IN int16_t block_num,\r
-                                       IN uint8_t position)\r
-{\r
-       uint32_t i;\r
-       uint16_t mlid_start_ho;\r
-\r
-       CL_ASSERT(p_tbl);\r
-       CL_ASSERT(p_block);\r
-\r
-       if (block_num > p_tbl->max_block)\r
-               return IB_INVALID_PARAMETER;\r
-\r
-       if (position > p_tbl->max_position)\r
-               return IB_INVALID_PARAMETER;\r
-\r
-       mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);\r
-\r
-       if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->mft_depth)\r
-               return IB_INVALID_PARAMETER;\r
-\r
-       for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)\r
-               (*p_tbl->p_mask_tbl)[mlid_start_ho + i][position] = p_block[i];\r
-\r
-       if (block_num > p_tbl->max_block_in_use)\r
-               p_tbl->max_block_in_use = (uint16_t) block_num;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho)\r
-{\r
-       unsigned mlid_offset;\r
-\r
-       CL_ASSERT(p_tbl);\r
-       CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);\r
-\r
-       mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;\r
-       if (p_tbl->p_mask_tbl && mlid_offset < p_tbl->mft_depth)\r
-               memset((uint8_t *)p_tbl->p_mask_tbl + mlid_offset * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8,\r
-                      0,\r
-                      (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8);\r
-}\r
-\r
-boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl,\r
-                                 IN int16_t block_num, IN uint8_t position,\r
-                                 OUT ib_net16_t * p_block)\r
-{\r
-       uint32_t i;\r
-       uint16_t mlid_start_ho;\r
-\r
-       CL_ASSERT(p_tbl);\r
-       CL_ASSERT(p_block);\r
-       CL_ASSERT(block_num * IB_MCAST_BLOCK_SIZE <= p_tbl->mft_depth);\r
-\r
-       if (block_num > p_tbl->max_block_in_use)\r
-               return FALSE;\r
-\r
-       if (position > p_tbl->max_position) {\r
-               /*\r
-                  Caller shouldn't do this for efficiency's sake...\r
-                */\r
-               memset(p_block, 0, IB_SMP_DATA_SIZE);\r
-               return TRUE;\r
-       }\r
-\r
-       mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);\r
-\r
-       for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)\r
-               p_block[i] = (*p_tbl->p_mask_tbl)[mlid_start_ho + i][position];\r
-\r
-       return TRUE;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mcm_port.c b/branches/opensm_3/user/opensm/osm_mcm_port.c
deleted file mode 100644 (file)
index 17a6117..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mcm_port_t.\r
- * This object represents the membership of a port in a multicast group.\r
- * This object is part of the OpenSM family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <opensm/osm_mcm_port.h>\r
-#include <opensm/osm_multicast.h>\r
-\r
-osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp,\r
-                                IN ib_member_rec_t *mcmr, IN boolean_t proxy)\r
-{\r
-       osm_mcm_port_t *p_mcm;\r
-\r
-       p_mcm = malloc(sizeof(*p_mcm));\r
-       if (p_mcm) {\r
-               memset(p_mcm, 0, sizeof(*p_mcm));\r
-               p_mcm->port = port;\r
-               p_mcm->mgrp = mgrp;\r
-               p_mcm->port_gid = mcmr->port_gid;\r
-               p_mcm->scope_state = mcmr->scope_state;\r
-               p_mcm->proxy_join = proxy;\r
-       }\r
-\r
-       return p_mcm;\r
-}\r
-\r
-void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm)\r
-{\r
-       CL_ASSERT(p_mcm);\r
-       free(p_mcm);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mesh.c b/branches/opensm_3/user/opensm/osm_mesh.c
deleted file mode 100644 (file)
index 662c609..0000000
+++ /dev/null
@@ -1,1735 +0,0 @@
-/*\r
- * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008,2009      System Fabric Works, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *      routines to analyze certain meshes\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_mesh.h>\r
-#include <opensm/osm_ucast_lash.h>\r
-\r
-#define MAX_DEGREE     (8)\r
-#define MAX_DIMENSION  (8)\r
-#define LARGE          (0x7fffffff)\r
-\r
-/*\r
- * characteristic polynomials for selected 1d through 8d tori\r
- */\r
-static const struct mesh_info {\r
-       int dimension;                  /* dimension of the torus */\r
-       int size[MAX_DIMENSION];        /* size of the torus */\r
-       unsigned int degree;            /* degree of polynomial */\r
-       int poly[MAX_DEGREE+1];         /* polynomial */\r
-} mesh_info[] = {\r
-       {0, {0},       0, {0},                                  },\r
-\r
-       {1, {2},       1, {0, -1},                              },\r
-       {1, {3},       2, {-1, 0, 1},                           },\r
-       {1, {5},       2, {-9, 0, 1},                           },\r
-       {1, {6},       2, {-36, 0, 1},                          },\r
-\r
-       {2, {2, 2},    2, {-4, 0, 1},                           },\r
-       {2, {3, 2},    3, {8, 9, 0, -1},                        },\r
-       {2, {5, 2},    3, {24, 17, 0, -1},                      },\r
-       {2, {6, 2},    3, {32, 24, 0, -1},                      },\r
-       {2, {3, 3},    4, {-15, -32, -18, 0, 1},                },\r
-       {2, {5, 3},    4, {-39, -64, -26, 0, 1},                },\r
-       {2, {6, 3},    4, {-48, -80, -33, 0, 1},                },\r
-       {2, {5, 5},    4, {-63, -96, -34, 0, 1},                },\r
-       {2, {6, 5},    4, {-48, -112, -41, 0, 1},               },\r
-       {2, {6, 6},    4, {0, -128, -48, 0, 1},                 },\r
-\r
-       {3, {2, 2, 2}, 3, {16, 12, 0, -1},                      },\r
-       {3, {3, 2, 2}, 4, {-28, -48, -21, 0, 1},                },\r
-       {3, {5, 2, 2}, 4, {-60, -80, -29, 0, 1},                },\r
-       {3, {6, 2, 2}, 4, {-64, -96, -36, 0, 1},                },\r
-       {3, {3, 3, 2}, 5, {48, 127, 112, 34, 0, -1},            },\r
-       {3, {5, 3, 2}, 5, {96, 215, 160, 42, 0, -1},            },\r
-       {3, {6, 3, 2}, 5, {96, 232, 184, 49, 0, -1},            },\r
-       {3, {5, 5, 2}, 5, {144, 303, 208, 50, 0, -1},           },\r
-       {3, {6, 5, 2}, 5, {96, 296, 232, 57, 0, -1},            },\r
-       {3, {6, 6, 2}, 5, {0, 256, 256, 64, 0, -1},             },\r
-       {3, {3, 3, 3}, 6, {-81, -288, -381, -224, -51, 0, 1},   },\r
-       {3, {5, 3, 3}, 6, {-153, -480, -557, -288, -59, 0, 1},  },\r
-       {3, {6, 3, 3}, 6, {-144, -480, -591, -320, -66, 0, 1},  },\r
-       {3, {5, 5, 3}, 6, {-225, -672, -733, -352, -67, 0, 1},  },\r
-       {3, {6, 5, 3}, 6, {-144, -576, -743, -384, -74, 0, 1},  },\r
-       {3, {6, 6, 3}, 6, {0, -384, -720, -416, -81, 0, 1},     },\r
-       {3, {5, 5, 5}, 6, {-297, -864, -909, -416, -75, 0, 1},  },\r
-       {3, {6, 5, 5}, 6, {-144, -672, -895, -448, -82, 0, 1},  },\r
-       {3, {6, 6, 5}, 6, {0, -384, -848, -480, -89, 0, 1},     },\r
-       {3, {6, 6, 6}, 6, {0, 0, -768, -512, -96, 0, 1},        },\r
-\r
-       {4, {2, 2, 2, 2},       4, {-48, -64, -24, 0, 1},       },\r
-       {4, {3, 2, 2, 2},       5, {80, 180, 136, 37, 0, -1},   },\r
-       {4, {5, 2, 2, 2},       5, {144, 276, 184, 45, 0, -1},  },\r
-       {4, {6, 2, 2, 2},       5, {128, 288, 208, 52, 0, -1},  },\r
-       {4, {3, 3, 2, 2},       6, {-132, -416, -487, -256, -54, 0, 1}, },\r
-       {4, {5, 3, 2, 2},       6, {-228, -640, -671, -320, -62, 0, 1}, },\r
-       {4, {6, 3, 2, 2},       6, {-192, -608, -700, -352, -69, 0, 1}, },\r
-       {4, {5, 5, 2, 2},       6, {-324, -864, -855, -384, -70, 0, 1}, },\r
-       {4, {6, 5, 2, 2},       6, {-192, -736, -860, -416, -77, 0, 1}, },\r
-       {4, {6, 6, 2, 2},       6, {0, -512, -832, -448, -84, 0, 1},    },\r
-       {4, {3, 3, 3, 2},       7, {216, 873, 1392, 1101, 440, 75, 0, -1},      },\r
-       {4, {5, 3, 3, 2},       7, {360, 1329, 1936, 1405, 520, 83, 0, -1},     },\r
-       {4, {6, 3, 3, 2},       7, {288, 1176, 1872, 1455, 560, 90, 0, -1},     },\r
-       {4, {5, 5, 3, 2},       7, {504, 1785, 2480, 1709, 600, 91, 0, -1},     },\r
-       {4, {6, 5, 3, 2},       7, {288, 1368, 2272, 1735, 640, 98, 0, -1},     },\r
-       {4, {6, 6, 3, 2},       7, {0, 768, 1920, 1728, 680, 105, 0, -1},       },\r
-       {4, {5, 5, 5, 2},       7, {648, 2241, 3024, 2013, 680, 99, 0, -1},     },\r
-       {4, {6, 5, 5, 2},       7, {288, 1560, 2672, 2015, 720, 106, 0, -1},    },\r
-       {4, {6, 6, 5, 2},       7, {0, 768, 2176, 1984, 760, 113, 0, -1},       },\r
-       {4, {6, 6, 6, 2},       7, {0, 0, 1536, 1920, 800, 120, 0, -1}, },\r
-       {4, {3, 3, 3, 3},       8, {-351, -1728, -3492, -3712, -2202, -704, -100, 0, 1},        },\r
-       {4, {5, 3, 3, 3},       8, {-567, -2592, -4860, -4800, -2658, -800, -108, 0, 1},        },\r
-       {4, {6, 3, 3, 3},       8, {-432, -2160, -4401, -4672, -2733, -848, -115, 0, 1},        },\r
-       {4, {5, 5, 3, 3},       8, {-783, -3456, -6228, -5888, -3114, -896, -116, 0, 1},        },\r
-       {4, {6, 5, 3, 3},       8, {-432, -2448, -5241, -5568, -3165, -944, -123, 0, 1},        },\r
-       {4, {6, 6, 3, 3},       8, {0, -1152, -3888, -5056, -3183, -992, -130, 0, 1},   },\r
-       {4, {5, 5, 5, 3},       8, {-999, -4320, -7596, -6976, -3570, -992, -124, 0, 1},        },\r
-       {4, {6, 5, 5, 3},       8, {-432, -2736, -6081, -6464, -3597, -1040, -131, 0, 1},       },\r
-       {4, {6, 6, 5, 3},       8, {0, -1152, -4272, -5760, -3591, -1088, -138, 0, 1},  },\r
-       {4, {6, 6, 6, 3},       8, {0, 0, -2304, -4864, -3552, -1136, -145, 0, 1},      },\r
-\r
-       {5, {2, 2, 2, 2, 2},    5, {128, 240, 160, 40, 0, -1},  },\r
-       {5, {3, 2, 2, 2, 2},    6, {-208, -576, -600, -288, -57, 0, 1}, },\r
-       {5, {5, 2, 2, 2, 2},    6, {-336, -832, -792, -352, -65, 0, 1}, },\r
-       {5, {6, 2, 2, 2, 2},    6, {-256, -768, -816, -384, -72, 0, 1}, },\r
-       {5, {3, 3, 2, 2, 2},    7, {336, 1228, 1776, 1287, 480, 78, 0, -1},     },\r
-       {5, {5, 3, 2, 2, 2},    7, {528, 1772, 2368, 1599, 560, 86, 0, -1},     },\r
-       {5, {6, 3, 2, 2, 2},    7, {384, 1504, 2256, 1644, 600, 93, 0, -1},     },\r
-       {5, {5, 5, 2, 2, 2},    7, {720, 2316, 2960, 1911, 640, 94, 0, -1},     },\r
-       {5, {6, 5, 2, 2, 2},    7, {384, 1760, 2704, 1932, 680, 101, 0, -1},    },\r
-       {5, {6, 6, 2, 2, 2},    7, {0, 1024, 2304, 1920, 720, 108, 0, -1},      },\r
-       {5, {3, 3, 3, 2, 2},    8, {-540, -2448, -4557, -4480, -2481, -752, -103, 0, 1},        },\r
-       {5, {5, 3, 3, 2, 2},    8, {-828, -3504, -6101, -5632, -2945, -848, -111, 0, 1},        },\r
-       {5, {6, 3, 3, 2, 2},    8, {-576, -2784, -5412, -5440, -3015, -896, -118, 0, 1},        },\r
-       {5, {5, 5, 3, 2, 2},    8, {-1116, -4560, -7645, -6784, -3409, -944, -119, 0, 1},       },\r
-       {5, {6, 5, 3, 2, 2},    8, {-576, -3168, -6404, -6400, -3455, -992, -126, 0, 1},        },\r
-       {5, {6, 6, 3, 2, 2},    8, {0, -1536, -4800, -5824, -3468, -1040, -133, 0, 1},  },\r
-       {5, {5, 5, 5, 2, 2},    8, {-1404, -5616, -9189, -7936, -3873, -1040, -127, 0, 1},      },\r
-       {5, {6, 5, 5, 2, 2},    8, {-576, -3552, -7396, -7360, -3895, -1088, -134, 0, 1},       },\r
-       {5, {6, 6, 5, 2, 2},    8, {0, -1536, -5312, -6592, -3884, -1136, -141, 0, 1},  },\r
-       {5, {6, 6, 6, 2, 2},    8, {0, 0, -3072, -5632, -3840, -1184, -148, 0, 1},      },\r
-\r
-       {6, {2, 2, 2, 2, 2, 2}, 6, {-320, -768, -720, -320, -60, 0, 1}, },\r
-       {6, {3, 2, 2, 2, 2, 2}, 7, {512, 1680, 2208, 1480, 520, 81, 0, -1},     },\r
-       {6, {5, 2, 2, 2, 2, 2}, 7, {768, 2320, 2848, 1800, 600, 89, 0, -1},     },\r
-       {6, {6, 2, 2, 2, 2, 2}, 7, {512, 1920, 2688, 1840, 640, 96, 0, -1},     },\r
-       {6, {3, 3, 2, 2, 2, 2}, 8, {-816, -3392, -5816, -5312, -2767, -800, -106, 0, 1},        },\r
-       {6, {5, 3, 2, 2, 2, 2}, 8, {-1200, -4672, -7544, -6528, -3239, -896, -114, 0, 1},       },\r
-       {6, {6, 3, 2, 2, 2, 2}, 8, {-768, -3584, -6608, -6272, -3304, -944, -121, 0, 1},        },\r
-       {6, {5, 5, 2, 2, 2, 2}, 8, {-1584, -5952, -9272, -7744, -3711, -992, -122, 0, 1},       },\r
-       {6, {6, 5, 2, 2, 2, 2}, 8, {-768, -4096, -7760, -7296, -3752, -1040, -129, 0, 1},       },\r
-       {6, {6, 6, 2, 2, 2, 2}, 8, {0, -2048, -5888, -6656, -3760, -1088, -136, 0, 1},  },\r
-\r
-       {7, {2, 2, 2, 2, 2, 2, 2},      7, {768, 2240, 2688, 1680, 560, 84, 0, -1},     },\r
-       {7, {3, 2, 2, 2, 2, 2, 2},      8, {-1216, -4608, -7280, -6208, -3060, -848, -109, 0, 1},       },\r
-       {7, {5, 2, 2, 2, 2, 2, 2},      8, {-1728, -6144, -9200, -7488, -3540, -944, -117, 0, 1},       },\r
-       {7, {6, 2, 2, 2, 2, 2, 2},      8, {-1024, -4608, -8000, -7168, -3600, -992, -124, 0, 1},       },\r
-\r
-       {8, {2, 2, 2, 2, 2, 2, 2, 2},   8, {-1792, -6144, -8960, -7168, -3360, -896, -112, 0, 1},       },\r
-\r
-       /*\r
-        * mesh errors\r
-        */\r
-       {2, {6, 6},                     4, {-192, -256, -80, 0, 1}, },\r
-\r
-       {-1, {0,}, 0, {0, },                                    },\r
-};\r
-\r
-/*\r
- * per fabric mesh info\r
- */\r
-typedef struct _mesh {\r
-       int num_class;                  /* number of switch classes */\r
-       int *class_type;                /* index of first switch found for each class */\r
-       int *class_count;               /* population of each class */\r
-       int dimension;                  /* mesh dimension */\r
-       int *size;                      /* an array to hold size of mesh */\r
-       int dim_order[MAX_DIMENSION];\r
-} mesh_t;\r
-\r
-typedef struct sort_ctx {\r
-       lash_t *p_lash;\r
-       mesh_t *mesh;\r
-} sort_ctx_t;\r
-\r
-typedef struct comp {\r
-       int index;\r
-       sort_ctx_t ctx;\r
-} comp_t;\r
-\r
-/*\r
- * poly_alloc\r
- *\r
- * allocate a polynomial of degree n\r
- */\r
-static int *poly_alloc(lash_t *p_lash, int n)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int *p;\r
-\r
-       if (!(p = calloc(n+1, sizeof(int))))\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Failed allocating poly - out of memory\n");\r
-\r
-       return p;\r
-}\r
-\r
-/*\r
- * print a polynomial\r
- */\r
-static char *poly_print(int n, int *coeff)\r
-{\r
-       static char str[(MAX_DEGREE+1)*20];\r
-       char *p = str;\r
-       int i;\r
-       int first = 1;\r
-       int t;\r
-       int sign;\r
-\r
-       str[0] = 0;\r
-\r
-       for (i = 0; i <= n; i++) {\r
-               if (!coeff[i])\r
-                       continue;\r
-\r
-               if (coeff[i] < 0) {\r
-                       sign = 1;\r
-                       t = -coeff[i];\r
-               } else {\r
-                       sign = 0;\r
-                       t = coeff[i];\r
-               }\r
-\r
-               p += sprintf(p, "%s", sign? "-" : (first? "" : "+"));\r
-               first = 0;\r
-\r
-               if (t != 1 || i == 0)\r
-                       p += sprintf(p, "%d", t);\r
-\r
-               if (i)\r
-                       p += sprintf(p, "x");\r
-               if (i > 1)\r
-                       p += sprintf(p, "^%d", i);\r
-       }\r
-\r
-       return str;\r
-}\r
-\r
-/*\r
- * poly_diff\r
- *\r
- * return a nonzero value if polynomials differ else 0\r
- */\r
-static int poly_diff(unsigned int n, const int *p, switch_t *s)\r
-{\r
-       if (s->node->num_links != n)\r
-               return 1;\r
-\r
-       return memcmp(p, s->node->poly, n*sizeof(int));\r
-}\r
-\r
-/*\r
- * m_free\r
- *\r
- * free a square matrix of rank l\r
- */\r
-static void m_free(int **m, int l)\r
-{\r
-       int i;\r
-\r
-       if (m) {\r
-               for (i = 0; i < l; i++) {\r
-                       if (m[i])\r
-                               free(m[i]);\r
-               }\r
-               free(m);\r
-       }\r
-}\r
-\r
-/*\r
- * m_alloc\r
- *\r
- * allocate a square matrix of rank l\r
- */\r
-static int **m_alloc(lash_t *p_lash, int l)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i;\r
-       int **m = NULL;\r
-\r
-       do {\r
-               if (!(m = calloc(l, sizeof(int *))))\r
-                       break;\r
-\r
-               for (i = 0; i < l; i++) {\r
-                       if (!(m[i] = calloc(l, sizeof(int))))\r
-                               break;\r
-               }\r
-               if (i != l)\r
-                       break;\r
-\r
-               return m;\r
-       } while (0);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-               "Failed allocating matrix - out of memory\n");\r
-\r
-       m_free(m, l);\r
-       return NULL;\r
-}\r
-\r
-/*\r
- * pm_free\r
- *\r
- * free a square matrix of rank l of polynomials\r
- */\r
-static void pm_free(int ***m, int l)\r
-{\r
-       int i, j;\r
-\r
-       if (m) {\r
-               for (i = 0; i < l; i++) {\r
-                       if (m[i]) {\r
-                               for (j = 0; j < l; j++) {\r
-                                       if (m[i][j])\r
-                                               free(m[i][j]);\r
-                               }\r
-                               free(m[i]);\r
-                       }\r
-               }\r
-               free(m);\r
-       }\r
-}\r
-\r
-/*\r
- * pm_alloc\r
- *\r
- * allocate a square matrix of rank l of polynomials of degree n\r
- */\r
-static int ***pm_alloc(lash_t *p_lash, int l, int n)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i, j;\r
-       int ***m = NULL;\r
-\r
-       do {\r
-               if (!(m = calloc(l, sizeof(int **))))\r
-                       break;\r
-\r
-               for (i = 0; i < l; i++) {\r
-                       if (!(m[i] = calloc(l, sizeof(int *))))\r
-                               break;\r
-\r
-                       for (j = 0; j < l; j++) {\r
-                               if (!(m[i][j] = calloc(n+1, sizeof(int))))\r
-                                       break;\r
-                       }\r
-                       if (j != l)\r
-                               break;\r
-               }\r
-               if (i != l)\r
-                       break;\r
-\r
-               return m;\r
-       } while (0);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-               "Failed allocating matrix - out of memory\n");\r
-\r
-       pm_free(m, l);\r
-       return NULL;\r
-}\r
-\r
-static int determinant(lash_t *p_lash, int n, int rank, int ***m, int *p);\r
-\r
-/*\r
- * sub_determinant\r
- *\r
- * compute the determinant of a submatrix of matrix of rank l of polynomials of degree n\r
- * with row and col removed in poly. caller must free poly\r
- */\r
-static int sub_determinant(lash_t *p_lash, int n, int l, int row, int col,\r
-                          int ***matrix, int **poly)\r
-{\r
-       int ret = -1;\r
-       int ***m = NULL;\r
-       int *p = NULL;\r
-       int i, j, k, x, y;\r
-       int rank = l - 1;\r
-\r
-       do {\r
-               if (!(p = poly_alloc(p_lash, n))) {\r
-                       break;\r
-               }\r
-\r
-               if (rank <= 0) {\r
-                       p[0] = 1;\r
-                       ret = 0;\r
-                       break;\r
-               }\r
-\r
-               if (!(m = pm_alloc(p_lash, rank, n))) {\r
-                       free(p);\r
-                       p = NULL;\r
-                       break;\r
-               }\r
-\r
-               x = 0;\r
-               for (i = 0; i < l; i++) {\r
-                       if (i == row)\r
-                               continue;\r
-\r
-                       y = 0;\r
-                       for (j = 0; j < l; j++) {\r
-                               if (j == col)\r
-                                       continue;\r
-\r
-                               for (k = 0; k <= n; k++)\r
-                                       m[x][y][k] = matrix[i][j][k];\r
-\r
-                               y++;\r
-                       }\r
-                       x++;\r
-               }\r
-\r
-               if (determinant(p_lash, n, rank, m, p)) {\r
-                       free(p);\r
-                       p = NULL;\r
-                       break;\r
-               }\r
-\r
-               ret = 0;\r
-       } while (0);\r
-\r
-       pm_free(m, rank);\r
-       *poly = p;\r
-       return ret;\r
-}\r
-\r
-/*\r
- * determinant\r
- *\r
- * compute the determinant of matrix m of rank of polynomials of degree deg\r
- * and add the result to polynomial p allocated by caller\r
- */\r
-static int determinant(lash_t *p_lash, int deg, int rank, int ***m, int *p)\r
-{\r
-       int i, j, k;\r
-       int *q;\r
-       int sign = 1;\r
-\r
-       /*\r
-        * handle simple case of 1x1 matrix\r
-        */\r
-       if (rank == 1) {\r
-               for (i = 0; i <= deg; i++)\r
-                       p[i] += m[0][0][i];\r
-       }\r
-\r
-       /*\r
-        * handle simple case of 2x2 matrix\r
-        */\r
-       else if (rank == 2) {\r
-               for (i = 0; i <= deg; i++) {\r
-                       if (m[0][0][i] == 0)\r
-                               continue;\r
-\r
-                       for (j = 0; j <= deg; j++) {\r
-                               if (m[1][1][j] == 0)\r
-                                       continue;\r
-\r
-                               p[i+j] += m[0][0][i]*m[1][1][j];\r
-                       }\r
-               }\r
-\r
-               for (i = 0; i <= deg; i++) {\r
-                       if (m[0][1][i] == 0)\r
-                               continue;\r
-\r
-                       for (j = 0; j <= deg; j++) {\r
-                               if (m[1][0][j] == 0)\r
-                                       continue;\r
-\r
-                               p[i+j] -= m[0][1][i]*m[1][0][j];\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-        * handle the general case\r
-        */\r
-       else {\r
-               for (i = 0; i < rank; i++) {\r
-                       if (sub_determinant(p_lash, deg, rank, 0, i, m, &q))\r
-                               return -1;\r
-\r
-                       for (j = 0; j <= deg; j++) {\r
-                               if (m[0][i][j] == 0)\r
-                                       continue;\r
-\r
-                               for (k = 0; k <= deg; k++) {\r
-                                       if (q[k] == 0)\r
-                                               continue;\r
-\r
-                                       p[j+k] += sign*m[0][i][j]*q[k];\r
-                               }\r
-                       }\r
-\r
-                       free(q);\r
-                       sign = -sign;\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/*\r
- * char_poly\r
- *\r
- * compute the characteristic polynomial of matrix of rank\r
- * by computing the determinant of m-x*I and return in poly\r
- * as an array. caller must free poly\r
- */\r
-static int char_poly(lash_t *p_lash, int rank, int **matrix, int **poly)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int ret = -1;\r
-       int i, j;\r
-       int ***m = NULL;\r
-       int *p = NULL;\r
-       int deg = rank;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       do {\r
-               if (!matrix)\r
-                       break;\r
-\r
-               if (!(p = poly_alloc(p_lash, deg)))\r
-                       break;\r
-\r
-               if (!(m = pm_alloc(p_lash, rank, deg))) {\r
-                       free(p);\r
-                       p = NULL;\r
-                       break;\r
-               }\r
-\r
-               for (i = 0; i < rank; i++) {\r
-                       for (j = 0; j < rank; j++) {\r
-                               m[i][j][0] = matrix[i][j];\r
-                       }\r
-                       m[i][i][1] = -1;\r
-               }\r
-\r
-               if (determinant(p_lash, deg, rank, m, p)) {\r
-                       free(p);\r
-                       p = NULL;\r
-                       break;\r
-               }\r
-\r
-               ret = 0;\r
-       } while (0);\r
-\r
-       pm_free(m, rank);\r
-       *poly = p;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return ret;\r
-}\r
-\r
-/*\r
- * get_switch_metric\r
- *\r
- * compute the matrix of minimum distances between each of\r
- * the adjacent switch nodes to sw along paths\r
- * that do not go through sw. do calculation by\r
- * relaxation method\r
- * allocate space for the matrix and save in node_t structure\r
- */\r
-static int get_switch_metric(lash_t *p_lash, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int ret = -1;\r
-       unsigned int i, j, change;\r
-       int sw1, sw2, sw3;\r
-       switch_t *s = p_lash->switches[sw];\r
-       switch_t *s1, *s2, *s3;\r
-       int **m;\r
-       mesh_node_t *node = s->node;\r
-       unsigned int num_links = node->num_links;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       do {\r
-               if (!(m = m_alloc(p_lash, num_links)))\r
-                       break;\r
-\r
-               for (i = 0; i < num_links; i++) {\r
-                       sw1 = node->links[i]->switch_id;\r
-                       s1 = p_lash->switches[sw1];\r
-\r
-                       /* make all distances big except s1 to itself */\r
-                       for (sw2 = 0; sw2 < p_lash->num_switches; sw2++)\r
-                               p_lash->switches[sw2]->node->temp = LARGE;\r
-\r
-                       s1->node->temp = 0;\r
-\r
-                       do {\r
-                               change = 0;\r
-\r
-                               for (sw2 = 0; sw2 < p_lash->num_switches; sw2++) {\r
-                                       s2 = p_lash->switches[sw2];\r
-                                       if (s2->node->temp == LARGE)\r
-                                               continue;\r
-                                       for (j = 0; j < s2->node->num_links; j++) {\r
-                                               sw3 = s2->node->links[j]->switch_id;\r
-                                               s3 = p_lash->switches[sw3];\r
-\r
-                                               if (sw3 == sw)\r
-                                                       continue;\r
-\r
-                                               if ((s2->node->temp + 1) < s3->node->temp) {\r
-                                                       s3->node->temp = s2->node->temp + 1;\r
-                                                       change++;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       } while (change);\r
-\r
-                       for (j = 0; j < num_links; j++) {\r
-                               sw2 = node->links[j]->switch_id;\r
-                               s2 = p_lash->switches[sw2];\r
-                               m[i][j] = s2->node->temp;\r
-                       }\r
-               }\r
-\r
-               if (char_poly(p_lash, num_links, m, &node->poly)) {\r
-                       m_free(m, num_links);\r
-                       m = NULL;\r
-                       break;\r
-               }\r
-\r
-               ret = 0;\r
-       } while (0);\r
-\r
-       node->matrix = m;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return ret;\r
-}\r
-\r
-/*\r
- * classify_switch\r
- *\r
- * add switch to histogram of switch types\r
- * we keep a reference to the first switch\r
- * found of each type as an exemplar\r
- */\r
-static void classify_switch(lash_t *p_lash, mesh_t *mesh, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i;\r
-       switch_t *s = p_lash->switches[sw];\r
-       switch_t *s1;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!s->node->poly)\r
-               goto done;\r
-\r
-       for (i = 0; i < mesh->num_class; i++) {\r
-               s1 = p_lash->switches[mesh->class_type[i]];\r
-\r
-               if (poly_diff(s->node->num_links, s->node->poly, s1))\r
-                       continue;\r
-\r
-               mesh->class_count[i]++;\r
-               goto done;\r
-       }\r
-\r
-       mesh->class_type[mesh->num_class] = sw;\r
-       mesh->class_count[mesh->num_class] = 1;\r
-       mesh->num_class++;\r
-\r
-done:\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * classify_mesh_type\r
- *\r
- * try to look up node polynomial in table\r
- */\r
-static void classify_mesh_type(lash_t *p_lash, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i;\r
-       switch_t *s = p_lash->switches[sw];\r
-       const struct mesh_info *t;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!s->node->poly)\r
-               goto done;\r
-\r
-       for (i = 1; (t = &mesh_info[i])->dimension != -1; i++) {\r
-               if (poly_diff(t->degree, t->poly, s))\r
-                       continue;\r
-\r
-               s->node->type = i;\r
-               s->node->dimension = t->dimension;\r
-               OSM_LOG_EXIT(p_log);\r
-               return;\r
-       }\r
-\r
-done:\r
-       s->node->type = 0;\r
-       OSM_LOG_EXIT(p_log);\r
-       return;\r
-}\r
-\r
-/*\r
- * remove_edges\r
- *\r
- * remove type from nodes that have fewer links\r
- * than adjacent nodes\r
- */\r
-static void remove_edges(lash_t *p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int sw;\r
-       mesh_node_t *n, *nn;\r
-       unsigned i;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (sw = 0; sw < p_lash->num_switches; sw++) {\r
-               n = p_lash->switches[sw]->node;\r
-               if (!n->type)\r
-                       continue;\r
-\r
-               for (i = 0; i < n->num_links; i++) {\r
-                       nn = p_lash->switches[n->links[i]->switch_id]->node;\r
-\r
-                       if (nn->num_links > n->num_links) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                       "removed edge switch %s\n",\r
-                                       p_lash->switches[sw]->p_sw->p_node->print_desc);\r
-                               n->type = -1;\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * get_local_geometry\r
- *\r
- * analyze the local geometry around each switch\r
- */\r
-static int get_local_geometry(lash_t *p_lash, mesh_t *mesh)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int sw;\r
-       int status = 0;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (sw = 0; sw < p_lash->num_switches; sw++) {\r
-               /*\r
-                * skip switches with more links than MAX_DEGREE\r
-                * since they will never match a known case\r
-                */\r
-               if (p_lash->switches[sw]->node->num_links > MAX_DEGREE)\r
-                       continue;\r
-\r
-               if (get_switch_metric(p_lash, sw)) {\r
-                       status = -1;\r
-                       goto Exit;\r
-               }\r
-               classify_mesh_type(p_lash, sw);\r
-       }\r
-\r
-       remove_edges(p_lash);\r
-\r
-       for (sw = 0; sw < p_lash->num_switches; sw++) {\r
-               if (p_lash->switches[sw]->node->type < 0)\r
-                       continue;\r
-               classify_switch(p_lash, mesh, sw);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-static void print_axis(lash_t *p_lash, char *p, int sw, int port)\r
-{\r
-       mesh_node_t *node = p_lash->switches[sw]->node;\r
-       char *name = p_lash->switches[sw]->p_sw->p_node->print_desc;\r
-       int c = node->axes[port];\r
-\r
-       p += sprintf(p, "%s[%d] = ", name, port);\r
-       if (c)\r
-               p += sprintf(p, "%s%c -> ", ((c - 1) & 1) ? "-" : "+", 'X' + (c - 1)/2);\r
-       else\r
-               p += sprintf(p, "N/A -> ");\r
-       p += sprintf(p, "%s\n",\r
-                    p_lash->switches[node->links[port]->switch_id]->p_sw->p_node->print_desc);\r
-}\r
-\r
-/*\r
- * seed_axes\r
- *\r
- * assign axes to the links of the seed switch\r
- * assumes switch is of type cartesian mesh\r
- * axes are numbered 1 to n i.e. +x => 1 -x => 2 etc.\r
- * this assumes that if all distances are 2 that\r
- * an axis has only 2 nodes so +A and -A collapse to +A\r
- */\r
-static void seed_axes(lash_t *p_lash, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       mesh_node_t *node = p_lash->switches[sw]->node;\r
-       int n = node->num_links;\r
-       int i, j, c;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!node->matrix || !node->dimension)\r
-               goto done;\r
-\r
-       for (c = 1; c <= 2*node->dimension; c++) {\r
-               /*\r
-                * find the next unassigned axis\r
-                */\r
-               for (i = 0; i < n; i++) {\r
-                       if (!node->axes[i])\r
-                               break;\r
-               }\r
-\r
-               node->axes[i] = c++;\r
-\r
-               /*\r
-                * find the matching opposite direction\r
-                */\r
-               for (j = 0; j < n; j++) {\r
-                       if (node->axes[j] || j == i)\r
-                               continue;\r
-\r
-                       if (node->matrix[i][j] != 2)\r
-                               break;\r
-               }\r
-\r
-               if (j != n) {\r
-                       node->axes[j] = c;\r
-               }\r
-       }\r
-\r
-       if (osm_log_is_active(p_log, OSM_LOG_DEBUG)) {\r
-               char buf[256], *p;\r
-\r
-               for (i = 0; i < n; i++) {\r
-                       p = buf;\r
-                       print_axis(p_lash, p, sw, i);\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG, "%s", buf);\r
-               }\r
-       }\r
-\r
-done:\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * opposite\r
- *\r
- * compute the opposite of axis for switch\r
- */\r
-static inline int opposite(switch_t *s, int axis)\r
-{\r
-       unsigned i, j;\r
-       int negaxis = 1 + (1 ^ (axis - 1));\r
-\r
-       if (!s->node->matrix)\r
-               return 0;\r
-\r
-       for (i = 0; i < s->node->num_links; i++) {\r
-               if (s->node->axes[i] == axis) {\r
-                       for (j = 0; j < s->node->num_links; j++) {\r
-                               if (j == i)\r
-                                       continue;\r
-                               if (s->node->matrix[i][j] != 2)\r
-                                       return negaxis;\r
-                       }\r
-\r
-                       return axis;\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/*\r
- * make_geometry\r
- *\r
- * induce a geometry on the switches\r
- */\r
-static void make_geometry(lash_t *p_lash, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int num_switches = p_lash->num_switches;\r
-       int sw1, sw2;\r
-       switch_t *s, *s1, *s2, *seed;\r
-       unsigned int i, j, k, l, n, m;\r
-       unsigned int change;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       s = p_lash->switches[sw];\r
-\r
-       if (!s->node->matrix)\r
-               goto done;\r
-\r
-       /*\r
-        * assign axes to seed switch\r
-        */\r
-       seed_axes(p_lash, sw);\r
-       seed = p_lash->switches[sw];\r
-\r
-       /*\r
-        * induce axes in other switches until\r
-        * there is no more change\r
-        */\r
-       do {\r
-               change = 0;\r
-\r
-               /* phase 1 opposites */\r
-               for (sw1 = 0; sw1 < num_switches; sw1++) {\r
-                       s1 = p_lash->switches[sw1];\r
-                       n = s1->node->num_links;\r
-\r
-                       /*\r
-                        * ignore chain fragments\r
-                        */\r
-                       if (n < seed->node->num_links && n <= 2)\r
-                               continue;\r
-\r
-                       /*\r
-                        * only process 'mesh' switches\r
-                        */\r
-                       if (!s1->node->matrix)\r
-                               continue;\r
-\r
-                       for (i = 0; i < n; i++) {\r
-                               if (!s1->node->axes[i])\r
-                                       continue;\r
-\r
-                               /*\r
-                                * can't tell across if more than one\r
-                                * likely looking link\r
-                                */\r
-                               m = 0;\r
-                               for (j = 0; j < n; j++) {\r
-                                       if (j == i)\r
-                                               continue;\r
-\r
-                                       if (s1->node->matrix[i][j] != 2)\r
-                                               m++;\r
-                               }\r
-\r
-                               if (m != 1) {\r
-                                       continue;\r
-                               }\r
-\r
-                               for (j = 0; j < n; j++) {\r
-                                       if (j == i)\r
-                                               continue;\r
-\r
-                                       /* Rule out opposite nodes when distance greater than 4 */\r
-                                       if (s1->node->matrix[i][j] != 2 &&\r
-                                           s1->node->matrix[i][j] <= 4) {\r
-                                               if (s1->node->axes[j]) {\r
-                                                       if (s1->node->axes[j] != opposite(seed, s1->node->axes[i])) {\r
-                                                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                                                       "phase 1 mismatch\n");\r
-                                                       }\r
-                                               } else {\r
-                                                       s1->node->axes[j] = opposite(seed, s1->node->axes[i]);\r
-                                                       change++;\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /* phase 2 switch to switch */\r
-               for (sw1 = 0; sw1 < num_switches; sw1++) {\r
-                       s1 = p_lash->switches[sw1];\r
-                       n = s1->node->num_links;\r
-\r
-                       if (!s1->node->matrix)\r
-                               continue;\r
-\r
-                       for (i = 0; i < n; i++) {\r
-                               int l2 = s1->node->links[i]->link_id;\r
-\r
-                               if (!s1->node->axes[i])\r
-                                       continue;\r
-\r
-                               if (l2 == -1) {\r
-                                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                               "no reverse link\n");\r
-                                       continue;\r
-                               }\r
-\r
-                               sw2 = s1->node->links[i]->switch_id;\r
-                               s2 = p_lash->switches[sw2];\r
-\r
-                               if (!s2->node->matrix)\r
-                                       continue;\r
-\r
-                               if (!s2->node->axes[l2]) {\r
-                                       /*\r
-                                        * set axis to opposite of s1->axes[i]\r
-                                        */\r
-                                       s2->node->axes[l2] = opposite(seed, s1->node->axes[i]);\r
-                                       change++;\r
-                               } else {\r
-                                       if (s2->node->axes[l2] != opposite(seed, s1->node->axes[i])) {\r
-                                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                                       "phase 2 mismatch\n");\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               /* Phase 3 corners */\r
-               for (sw1 = 0; sw1 < num_switches; sw1++) {\r
-                       s = p_lash->switches[sw1];\r
-                       n = s->node->num_links;\r
-\r
-                       if (!s->node->matrix)\r
-                               continue;\r
-\r
-                       for (i = 0; i < n; i++) {\r
-                               if (!s->node->axes[i])\r
-                                       continue;\r
-\r
-                               for (j = 0; j < n; j++) {\r
-                                       if (i == j || !s->node->axes[j] || s->node->matrix[i][j] != 2)\r
-                                               continue;\r
-\r
-                                       s1 = p_lash->switches[s->node->links[i]->switch_id];\r
-                                       s2 = p_lash->switches[s->node->links[j]->switch_id];\r
-\r
-                                       /*\r
-                                        * find switch (other than s1) that neighbors i and j\r
-                                        * have in common\r
-                                        */\r
-                                       for (k = 0; k < s1->node->num_links; k++) {\r
-                                               if (s1->node->links[k]->switch_id == sw1)\r
-                                                       continue;\r
-\r
-                                               for (l = 0; l < s2->node->num_links; l++) {\r
-                                                       if (s2->node->links[l]->switch_id == sw1)\r
-                                                               continue;\r
-\r
-                                                       if (s1->node->links[k]->switch_id == s2->node->links[l]->switch_id) {\r
-                                                               if (s1->node->axes[k]) {\r
-                                                                       if (s1->node->axes[k] != s->node->axes[j]) {\r
-                                                                               OSM_LOG(p_log, OSM_LOG_DEBUG, "phase 3 mismatch\n");\r
-                                                                       }\r
-                                                               } else {\r
-                                                                       s1->node->axes[k] = s->node->axes[j];\r
-                                                                       change++;\r
-                                                               }\r
-\r
-                                                               if (s2->node->axes[l]) {\r
-                                                                       if (s2->node->axes[l] != s->node->axes[i]) {\r
-                                                                               OSM_LOG(p_log, OSM_LOG_DEBUG, "phase 3 mismatch\n");\r
-                                                                       }\r
-                                                               } else {\r
-                                                                       s2->node->axes[l] = s->node->axes[i];\r
-                                                                       change++;\r
-                                                               }\r
-                                                               goto next_j;\r
-                                                       }\r
-                                               }\r
-                                       }\r
-next_j:\r
-                                       ;\r
-                               }\r
-                       }\r
-               }\r
-       } while (change);\r
-\r
-done:\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * return |a| < |b|\r
- */\r
-static inline int ltmag(int a, int b)\r
-{\r
-       int a1 = (a >= 0)? a : -a;\r
-       int b1 = (b >= 0)? b : -b;\r
-\r
-       return (a1 < b1) || (a1 == b1 && a > b);\r
-}\r
-\r
-/*\r
- * reorder_node_links\r
- *\r
- * reorder the links out of a switch in sign/dimension order\r
- */\r
-static int reorder_node_links(lash_t *p_lash, mesh_t *mesh, int sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       switch_t *s = p_lash->switches[sw];\r
-       mesh_node_t *node = s->node;\r
-       int n = node->num_links;\r
-       link_t **links;\r
-       int *axes;\r
-       int i, j, k, l;\r
-       int c;\r
-       int next = 0;\r
-       int dimension = mesh->dimension;\r
-\r
-       if (!(links = calloc(n, sizeof(link_t *)))) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Failed allocating links array - out of memory\n");\r
-               return -1;\r
-       }\r
-\r
-       if (!(axes = calloc(n, sizeof(int)))) {\r
-               free(links);\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Failed allocating axes array - out of memory\n");\r
-               return -1;\r
-       }\r
-\r
-       /*\r
-        * find the links with axes\r
-        */\r
-       for (i = 0; i < dimension; i++) {\r
-               j = mesh->dim_order[i];\r
-               for (k = 1; k <= 2; k++) {\r
-                       c = 2*j + k;\r
-\r
-                       if (node->coord[j] > 0)\r
-                               c = opposite(s, c);\r
-\r
-                       for (l = 0; l < n; l++) {\r
-                               if (!node->links[l])\r
-                                       continue;\r
-                               if (node->axes[l] == c) {\r
-                                       links[next] = node->links[l];\r
-                                       axes[next] = node->axes[l];\r
-                                       node->links[l] = NULL;\r
-                                       next++;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-        * get the rest\r
-        */\r
-       for (i = 0; i < n; i++) {\r
-               if (!node->links[i])\r
-                       continue;\r
-\r
-               links[next] = node->links[i];\r
-               axes[next] = node->axes[i];\r
-               node->links[i] = NULL;\r
-               next++;\r
-       }\r
-\r
-       for (i = 0; i < n; i++) {\r
-               node->links[i] = links[i];\r
-               node->axes[i] = axes[i];\r
-       }\r
-\r
-       free(links);\r
-       free(axes);\r
-\r
-       return 0;\r
-}\r
-\r
-/*\r
- * make_coord\r
- */\r
-static int make_coord(lash_t *p_lash, mesh_t *mesh, int seed)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       unsigned int i, j, k;\r
-       int sw;\r
-       switch_t *s, *s1;\r
-       unsigned int change;\r
-       unsigned int dimension = mesh->dimension;\r
-       int num_switches = p_lash->num_switches;\r
-       int assigned_axes = 0, unassigned_axes = 0;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (sw = 0; sw < num_switches; sw++) {\r
-               s = p_lash->switches[sw];\r
-\r
-               s->node->coord = calloc(dimension, sizeof(int));\r
-               if (!s->node->coord) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                               "Failed allocating coord - out of memory\n");\r
-                       OSM_LOG_EXIT(p_log);\r
-                       return -1;\r
-               }\r
-\r
-               for (i = 0; i < dimension; i++)\r
-                       s->node->coord[i] = (sw == seed) ? 0 : LARGE;\r
-\r
-               for (i = 0; i < s->node->num_links; i++)\r
-                       if (s->node->axes[i] == 0)\r
-                               unassigned_axes++;\r
-                       else\r
-                               assigned_axes++;\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "%d/%d unassigned/assigned axes\n",\r
-               unassigned_axes, assigned_axes);\r
-\r
-       do {\r
-               change = 0;\r
-\r
-               for (sw = 0; sw < num_switches; sw++) {\r
-                       s = p_lash->switches[sw];\r
-\r
-                       if (s->node->coord[0] == LARGE)\r
-                               continue;\r
-\r
-                       for (j = 0; j < s->node->num_links; j++) {\r
-                               if (!s->node->axes[j])\r
-                                       continue;\r
-\r
-                               s1 = p_lash->switches[s->node->links[j]->switch_id];\r
-\r
-                               for (k = 0; k < dimension; k++) {\r
-                                       int coord = s->node->coord[k];\r
-                                       unsigned axis = s->node->axes[j] - 1;\r
-\r
-                                       if (k == axis/2)\r
-                                               coord += (axis & 1)? -1 : +1;\r
-\r
-                                       if (ltmag(coord, s1->node->coord[k])) {\r
-                                               s1->node->coord[k] = coord;\r
-                                               change++;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       } while (change);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-/*\r
- * measure geometry\r
- */\r
-static int measure_geometry(lash_t *p_lash, mesh_t *mesh)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i, j;\r
-       int sw;\r
-       switch_t *s;\r
-       int dimension = mesh->dimension;\r
-       int num_switches = p_lash->num_switches;\r
-       int max[MAX_DIMENSION];\r
-       int min[MAX_DIMENSION];\r
-       int size[MAX_DIMENSION];\r
-       int max_size;\r
-       int max_index;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       mesh->size = calloc(dimension, sizeof(int));\r
-       if (!mesh->size) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Failed allocating size - out of memory\n");\r
-               OSM_LOG_EXIT(p_log);\r
-               return -1;\r
-       }\r
-\r
-       for (i = 0; i < dimension; i++) {\r
-               max[i] = -LARGE;\r
-               min[i] = LARGE;\r
-       }\r
-\r
-       for (sw = 0; sw < num_switches; sw++) {\r
-               s = p_lash->switches[sw];\r
-\r
-               for (i = 0; i < dimension; i++) {\r
-                       if (s->node->coord[i] == LARGE)\r
-                               continue;\r
-                       if (s->node->coord[i] > max[i])\r
-                               max[i] = s->node->coord[i];\r
-                       if (s->node->coord[i] < min[i])\r
-                               min[i] = s->node->coord[i];\r
-               }\r
-       }\r
-\r
-       for (i = 0; i < dimension; i++)\r
-               mesh->size[i] = size[i] = max[i] - min[i] + 1;\r
-\r
-       /*\r
-        * find an order of dimensions that places largest\r
-        * sizes first since this seems to work best with LASH\r
-        */\r
-       for (j = 0; j < dimension; j++) {\r
-               max_size = -1;\r
-               max_index = -1;\r
-\r
-               for (i = 0; i < dimension; i++) {\r
-                       if (size[i] > max_size) {\r
-                               max_size = size[i];\r
-                               max_index = i;\r
-                       }\r
-               }\r
-\r
-               mesh->dim_order[j] = max_index;\r
-               size[max_index] = -1;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-/*\r
- * reorder links\r
- */\r
-static int reorder_links(lash_t *p_lash, mesh_t *mesh)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int sw;\r
-       int num_switches = p_lash->num_switches;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (sw = 0; sw < num_switches; sw++) {\r
-               if (reorder_node_links(p_lash, mesh, sw)) {\r
-                       OSM_LOG_EXIT(p_log);\r
-                       return -1;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-/*\r
- * compare two switches in a sort\r
- */\r
-static int OSM_CDECL compare_switches(const void *p1, const void *p2)\r
-{\r
-       const comp_t *cp1 = p1, *cp2 = p2;\r
-       const sort_ctx_t *ctx = &cp1->ctx;\r
-       switch_t *s1 = ctx->p_lash->switches[cp1->index];\r
-       switch_t *s2 = ctx->p_lash->switches[cp2->index];\r
-       int i, j;\r
-       int ret;\r
-\r
-       for (i = 0; i < ctx->mesh->dimension; i++) {\r
-               j = ctx->mesh->dim_order[i];\r
-               if ((ret = s1->node->coord[j] - s2->node->coord[j]));\r
-                       return ret;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/*\r
- * sort_switches - reorder switch array\r
- */\r
-static void sort_switches(lash_t *p_lash, mesh_t *mesh)\r
-{\r
-       unsigned int i, j;\r
-       unsigned int num_switches = p_lash->num_switches;\r
-       comp_t *comp;\r
-       int *reverse;\r
-       switch_t *s;\r
-       switch_t **switches;\r
-\r
-       comp = malloc(num_switches * sizeof(comp_t));\r
-       reverse = malloc(num_switches * sizeof(int));\r
-       switches = malloc(num_switches * sizeof(switch_t *));\r
-       if (!comp || !reverse || !switches) {\r
-               OSM_LOG(&p_lash->p_osm->log, OSM_LOG_ERROR,\r
-                       "Failed memory allocation - switches not sorted!\n");\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-               comp[i].index = i;\r
-               comp[i].ctx.mesh = mesh;\r
-               comp[i].ctx.p_lash = p_lash;\r
-       }\r
-\r
-       qsort(comp, num_switches, sizeof(comp_t), compare_switches);\r
-\r
-       for (i = 0; i < num_switches; i++)\r
-               reverse[comp[i].index] = i;\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-               s = p_lash->switches[comp[i].index];\r
-               switches[i] = s;\r
-               s->id = i;\r
-               for (j = 0; j < s->node->num_links; j++)\r
-                       s->node->links[j]->switch_id =\r
-                               reverse[s->node->links[j]->switch_id];\r
-       }\r
-\r
-       for (i = 0; i < num_switches; i++)\r
-               p_lash->switches[i] = switches[i];\r
-\r
-Exit:\r
-       if (switches)\r
-               free(switches);\r
-       if (comp)\r
-               free(comp);\r
-       if (reverse)\r
-               free(reverse);\r
-}\r
-\r
-/*\r
- * osm_mesh_delete - free per mesh resources\r
- */\r
-static void mesh_delete(mesh_t *mesh)\r
-{\r
-       if (mesh) {\r
-               if (mesh->class_type)\r
-                       free(mesh->class_type);\r
-\r
-               if (mesh->class_count)\r
-                       free(mesh->class_count);\r
-\r
-               if (mesh->size)\r
-                       free(mesh->size);\r
-\r
-               free(mesh);\r
-       }\r
-}\r
-\r
-/*\r
- * osm_mesh_create - allocate per mesh resources\r
- */\r
-static mesh_t *mesh_create(lash_t *p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       mesh_t *mesh;\r
-\r
-       if(!(mesh = calloc(1, sizeof(mesh_t))))\r
-               goto err;\r
-\r
-       if (!(mesh->class_type = calloc(p_lash->num_switches, sizeof(int))))\r
-               goto err;\r
-\r
-       if (!(mesh->class_count = calloc(p_lash->num_switches, sizeof(int))))\r
-               goto err;\r
-\r
-       return mesh;\r
-\r
-err:\r
-       mesh_delete(mesh);\r
-       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-               "Failed allocating mesh - out of memory\n");\r
-       return NULL;\r
-}\r
-\r
-/*\r
- * osm_mesh_node_delete - cleanup per switch resources\r
- */\r
-void osm_mesh_node_delete(lash_t *p_lash, switch_t *sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       unsigned i;\r
-       mesh_node_t *node = sw->node;\r
-       unsigned num_ports = sw->p_sw->num_ports;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (node) {\r
-               for (i = 0; i < num_ports; i++)\r
-                       if (node->links[i])\r
-                               free(node->links[i]);\r
-\r
-               if (node->poly)\r
-                       free(node->poly);\r
-\r
-               if (node->matrix) {\r
-                       for (i = 0; i < node->num_links; i++) {\r
-                               if (node->matrix[i])\r
-                                       free(node->matrix[i]);\r
-                       }\r
-                       free(node->matrix);\r
-               }\r
-\r
-               if (node->axes)\r
-                       free(node->axes);\r
-\r
-               if (node->coord)\r
-                       free(node->coord);\r
-\r
-               free(node);\r
-\r
-               sw->node = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * osm_mesh_node_create - allocate per switch resources\r
- */\r
-int osm_mesh_node_create(lash_t *p_lash, switch_t *sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       unsigned i;\r
-       mesh_node_t *node;\r
-       unsigned num_ports = sw->p_sw->num_ports;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!(node = sw->node = calloc(1, sizeof(mesh_node_t) + num_ports * sizeof(link_t *))))\r
-               goto err;\r
-\r
-       for (i = 0; i < num_ports; i++)\r
-               if (!(node->links[i] = calloc(1, sizeof(link_t) + num_ports * sizeof(int))))\r
-                       goto err;\r
-\r
-       if (!(node->axes = calloc(num_ports, sizeof(int))))\r
-               goto err;\r
-\r
-       for (i = 0; i < num_ports; i++) {\r
-               node->links[i]->switch_id = NONE;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-\r
-err:\r
-       osm_mesh_node_delete(p_lash, sw);\r
-       OSM_LOG(p_log, OSM_LOG_ERROR,\r
-               "Failed allocating mesh node - out of memory\n");\r
-       OSM_LOG_EXIT(p_log);\r
-       return -1;\r
-}\r
-\r
-static void dump_mesh(lash_t *p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int sw;\r
-       int num_switches = p_lash->num_switches;\r
-       int dimension;\r
-       int i, j, k, n;\r
-       switch_t *s, *s2;\r
-       char buf[256];\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       for (sw = 0; sw < num_switches; sw++) {\r
-               s = p_lash->switches[sw];\r
-               dimension = s->node->dimension;\r
-               n = sprintf(buf, "[");\r
-               for (i = 0; i < dimension; i++) {\r
-                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                     "%2d", s->node->coord[i]);\r
-                       if (n > sizeof(buf))\r
-                               n = sizeof(buf);\r
-                       if (i != dimension - 1) {\r
-                               n += snprintf(buf + n, sizeof(buf) - n, "%s", ",");\r
-                               if (n > sizeof(buf))\r
-                                       n = sizeof(buf);\r
-                       }\r
-               }\r
-               n += snprintf(buf + n, sizeof(buf) - n, "]");\r
-               if (n > sizeof(buf))\r
-                       n = sizeof(buf);\r
-               for (j = 0; j < s->node->num_links; j++) {\r
-                       s2 = p_lash->switches[s->node->links[j]->switch_id];\r
-                       n += snprintf(buf + n, sizeof(buf) - n, " [%d]->[", j);\r
-                       if (n > sizeof(buf))\r
-                               n = sizeof(buf);\r
-                       for (k = 0; k < dimension; k++) {\r
-                               n += snprintf(buf + n, sizeof(buf) - n, "%2d",\r
-                                             s2->node->coord[k]);\r
-                               if (n > sizeof(buf))\r
-                                       n = sizeof(buf);\r
-                               if (k != dimension - 1) {\r
-                                       n += snprintf(buf + n, sizeof(buf) - n,\r
-                                                     ",");\r
-                                       if (n > sizeof(buf))\r
-                                               n = sizeof(buf);\r
-                               }\r
-                       }\r
-                       n += snprintf(buf + n, sizeof(buf) - n, "]");\r
-                       if (n > sizeof(buf))\r
-                               n = sizeof(buf);\r
-               }\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "%s\n", buf);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-/*\r
- * osm_do_mesh_analysis\r
- */\r
-int osm_do_mesh_analysis(lash_t *p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       mesh_t *mesh;\r
-       int max_class = -1;\r
-       int max_class_num = 0;\r
-       int max_class_type = -1;\r
-       int i;\r
-       switch_t *s;\r
-       char buf[256], *p;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       mesh = mesh_create(p_lash);\r
-       if (!mesh)\r
-               goto err;\r
-\r
-       if (get_local_geometry(p_lash, mesh))\r
-               goto err;\r
-\r
-       if (mesh->num_class == 0) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "found no likely mesh nodes - done\n");\r
-               goto done;\r
-       }\r
-\r
-       /*\r
-        * find dominant switch class\r
-        */\r
-       OSM_LOG(p_log, OSM_LOG_INFO, "found %d node class%s\n",\r
-               mesh->num_class, (mesh->num_class == 1)? "" : "es");\r
-       for (i = 0; i < mesh->num_class; i++) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "class[%d] has %d members with type = %d\n",\r
-                       i, mesh->class_count[i],\r
-                       p_lash->switches[mesh->class_type[i]]->node->type);\r
-               if (mesh->class_count[i] > max_class_num) {\r
-                       max_class = i;\r
-                       max_class_num = mesh->class_count[i];\r
-                       max_class_type = mesh->class_type[i];\r
-               }\r
-       }\r
-\r
-       s = p_lash->switches[max_class_type];\r
-\r
-       p = buf;\r
-       p += sprintf(p, "%snode shape is ",\r
-                   (mesh->num_class == 1) ? "" : "most common ");\r
-\r
-       if (s->node->type) {\r
-               const struct mesh_info *t = &mesh_info[s->node->type];\r
-\r
-               for (i = 0; i < t->dimension; i++) {\r
-                       p += sprintf(p, "%s%d%s", i? " x " : "", t->size[i],\r
-                               (t->size[i] == 6)? "+" : "");\r
-               }\r
-               p += sprintf(p, " mesh\n");\r
-\r
-               mesh->dimension = t->dimension;\r
-       } else {\r
-               p += sprintf(p, "unknown geometry\n");\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO, "poly = %s\n",\r
-               poly_print(s->node->num_links, s->node->poly));\r
-\r
-       if (s->node->type) {\r
-               make_geometry(p_lash, max_class_type);\r
-\r
-               if (make_coord(p_lash, mesh, max_class_type))\r
-                       goto err;\r
-\r
-               if (measure_geometry(p_lash, mesh))\r
-                       goto err;\r
-\r
-               if (reorder_links(p_lash, mesh))\r
-                       goto err;\r
-\r
-               sort_switches(p_lash, mesh);\r
-\r
-               p = buf;\r
-               p += sprintf(p, "found ");\r
-               for (i = 0; i < mesh->dimension; i++)\r
-                       p += sprintf(p, "%s%d", i? " x " : "", mesh->size[i]);\r
-               p += sprintf(p, " mesh\n");\r
-\r
-               OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);\r
-       }\r
-\r
-       if (osm_log_is_active(p_log, OSM_LOG_DEBUG))\r
-               dump_mesh(p_lash);\r
-\r
-done:\r
-       mesh_delete(mesh);\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-\r
-err:\r
-       mesh_delete(mesh);\r
-       OSM_LOG_EXIT(p_log);\r
-       return -1;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_mtree.c b/branches/opensm_3/user/opensm/osm_mtree.c
deleted file mode 100644 (file)
index f36993c..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mtree_node_t.\r
- * This file implements the Multicast Tree object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_mtree.h>\r
-\r
-osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw)\r
-{\r
-       osm_mtree_node_t *p_mtn;\r
-       uint32_t i;\r
-\r
-       p_mtn = malloc(sizeof(osm_mtree_node_t) +\r
-                      sizeof(void *) * (p_sw->num_ports - 1));\r
-       if (!p_mtn)\r
-               return NULL;\r
-\r
-       memset(p_mtn, 0, sizeof(*p_mtn));\r
-       p_mtn->p_sw = p_sw;\r
-       p_mtn->max_children = p_sw->num_ports;\r
-       for (i = 0; i < p_mtn->max_children; i++)\r
-               p_mtn->child_array[i] = NULL;\r
-\r
-       return p_mtn;\r
-}\r
-\r
-void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)\r
-{\r
-       uint32_t i;\r
-\r
-       if (p_mtn == NULL)\r
-               return;\r
-\r
-       if (p_mtn->child_array != NULL)\r
-               for (i = 0; i < p_mtn->max_children; i++)\r
-                       if ((p_mtn->child_array[i] != NULL) &&\r
-                           (p_mtn->child_array[i] != OSM_MTREE_LEAF))\r
-                               osm_mtree_destroy(p_mtn->child_array[i]);\r
-\r
-       free(p_mtn);\r
-}\r
-\r
-#if 0\r
-static void mtree_dump(IN osm_mtree_node_t * p_mtn)\r
-{\r
-       uint32_t i;\r
-\r
-       if (p_mtn == NULL)\r
-               return;\r
-\r
-       printf("GUID:0x%016" PRIx64 " max_children:%u\n",\r
-              cl_ntoh64(p_mtn->p_sw->p_node->node_info.node_guid),\r
-              p_mtn->max_children);\r
-       if (p_mtn->child_array != NULL) {\r
-               for (i = 0; i < p_mtn->max_children; i++) {\r
-                       printf("i=%d\n", i);\r
-                       if ((p_mtn->child_array[i] != NULL)\r
-                           && (p_mtn->child_array[i] != OSM_MTREE_LEAF))\r
-                               mtree_dump(p_mtn->child_array[i]);\r
-               }\r
-       }\r
-}\r
-#endif\r
diff --git a/branches/opensm_3/user/opensm/osm_multicast.c b/branches/opensm_3/user/opensm/osm_multicast.c
deleted file mode 100644 (file)
index 1dab430..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of multicast functions.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_mcm_port.h>\r
-#include <opensm/osm_mtree.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-static osm_mgrp_box_t *mgrp_box_new(uint16_t mlid)\r
-{\r
-       osm_mgrp_box_t *mbox = malloc(sizeof(*mbox));\r
-       if (!mbox)\r
-               return NULL;\r
-\r
-       memset(mbox, 0, sizeof(*mbox));\r
-       mbox->mlid = mlid;\r
-       cl_qlist_init(&mbox->mgrp_list);\r
-\r
-       return mbox;\r
-}\r
-\r
-void mgrp_box_delete(osm_mgrp_box_t *mbox)\r
-{\r
-       osm_mtree_destroy(mbox->root);\r
-       free(mbox);\r
-}\r
-\r
-void mgrp_delete(IN osm_mgrp_t * p_mgrp)\r
-{\r
-       osm_mcm_port_t *p_mcm_port;\r
-       osm_mcm_port_t *p_next_mcm_port;\r
-\r
-       CL_ASSERT(p_mgrp);\r
-\r
-       p_next_mcm_port =\r
-           (osm_mcm_port_t *) cl_qmap_head(&p_mgrp->mcm_port_tbl);\r
-       while (p_next_mcm_port !=\r
-              (osm_mcm_port_t *) cl_qmap_end(&p_mgrp->mcm_port_tbl)) {\r
-               p_mcm_port = p_next_mcm_port;\r
-               p_next_mcm_port =\r
-                   (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item);\r
-               osm_mcm_port_delete(p_mcm_port);\r
-       }\r
-\r
-       free(p_mgrp);\r
-}\r
-\r
-void osm_mgrp_box_delete(osm_mgrp_box_t *mbox)\r
-{\r
-       osm_mgrp_t *mgrp=NULL;\r
-       while(cl_qlist_count(&mbox->mgrp_list)) {\r
-               mgrp = cl_item_obj(cl_qlist_remove_head(&mbox->mgrp_list),\r
-                                  mgrp, list_item);\r
-               mgrp_delete(mgrp);\r
-       }\r
-       mgrp_box_delete(mbox);\r
-}\r
-\r
-osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,\r
-                        IN ib_member_rec_t * mcmr)\r
-{\r
-       osm_mgrp_t *p_mgrp;\r
-       osm_mgrp_box_t *mbox;\r
-\r
-       p_mgrp = (osm_mgrp_t *) malloc(sizeof(*p_mgrp));\r
-       if (!p_mgrp)\r
-               return NULL;\r
-\r
-       memset(p_mgrp, 0, sizeof(*p_mgrp));\r
-       cl_qmap_init(&p_mgrp->mcm_port_tbl);\r
-       p_mgrp->mlid = mlid;\r
-       p_mgrp->mcmember_rec = *mcmr;\r
-\r
-       mbox = osm_get_mbox_by_mlid(subn, p_mgrp->mlid);\r
-       if (!mbox && !(mbox = mgrp_box_new(cl_ntoh16(p_mgrp->mlid)))) {\r
-               free(p_mgrp);\r
-               return NULL;\r
-       }\r
-\r
-       cl_qlist_insert_tail(&mbox->mgrp_list, &p_mgrp->list_item);\r
-       subn->mboxes[mbox->mlid - IB_LID_MCAST_START_HO] = mbox;\r
-\r
-       cl_fmap_insert(&subn->mgrp_mgid_tbl, &p_mgrp->mcmember_rec.mgid,\r
-                      &p_mgrp->map_item);\r
-\r
-       return p_mgrp;\r
-}\r
-\r
-void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp)\r
-{\r
-       osm_mgrp_box_t *mbox;\r
-       osm_mcm_port_t *mcm_port;\r
-\r
-       if (mgrp->full_members)\r
-               return;\r
-\r
-       while (cl_qmap_count(&mgrp->mcm_port_tbl)) {\r
-               mcm_port = (osm_mcm_port_t *)cl_qmap_head(&mgrp->mcm_port_tbl);\r
-               cl_qmap_remove_item(&mgrp->mcm_port_tbl, &mcm_port->map_item);\r
-               cl_qlist_remove_item(&mcm_port->port->mcm_list,\r
-                                    &mcm_port->list_item);\r
-               osm_mcm_port_delete(mcm_port);\r
-       }\r
-\r
-       if (mgrp->well_known)\r
-               return;\r
-\r
-       cl_fmap_remove_item(&subn->mgrp_mgid_tbl, &mgrp->map_item);\r
-\r
-       mbox = osm_get_mbox_by_mlid(subn, mgrp->mlid);\r
-       cl_qlist_remove_item(&mbox->mgrp_list, &mgrp->list_item);\r
-       if (cl_is_qlist_empty(&mbox->mgrp_list)) {\r
-               subn->mboxes[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL;\r
-               mgrp_box_delete(mbox);\r
-       }\r
-       free(mgrp);\r
-}\r
-\r
-static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log,\r
-                            osm_mgrp_t * mgrp, unsigned num)\r
-{\r
-       ib_mad_notice_attr_t notice;\r
-       ib_api_status_t status;\r
-\r
-       notice.generic_type = 0x83;     /* generic SubnMgt type */\r
-       ib_notice_set_prod_type_ho(&notice, 4); /* A Class Manager generator */\r
-       notice.g_or_v.generic.trap_num = CL_HTON16(num);\r
-       /* The sm_base_lid is saved in network order already. */\r
-       notice.issuer_lid = subn->sm_base_lid;\r
-       /* following o14-12.1.11 and table 120 p726 */\r
-       /* we need to provide the MGID */\r
-       memcpy(&notice.data_details.ntc_64_67.gid,\r
-              &mgrp->mcmember_rec.mgid, sizeof(ib_gid_t));\r
-\r
-       /* According to page 653 - the issuer gid in this case of trap\r
-          is the SM gid, since the SM is the initiator of this trap. */\r
-       notice.issuer_gid.unicast.prefix = subn->opt.subnet_prefix;\r
-       notice.issuer_gid.unicast.interface_id = subn->sm_port_guid;\r
-\r
-       if ((status = osm_report_notice(log, subn, &notice)))\r
-               OSM_LOG(log, OSM_LOG_ERROR, "ERR 7601: "\r
-                       "Error sending trap reports (%s)\n",\r
-                       ib_get_err_str(status));\r
-}\r
-\r
-osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,\r
-                                 IN osm_mgrp_t * mgrp, osm_port_t *port,\r
-                                 IN ib_member_rec_t *mcmr, IN boolean_t proxy)\r
-{\r
-       osm_mcm_port_t *mcm_port;\r
-       cl_map_item_t *prev_item;\r
-       uint8_t prev_join_state = 0, join_state = mcmr->scope_state;\r
-       uint8_t prev_scope;\r
-\r
-       if (osm_log_is_active(log, OSM_LOG_VERBOSE)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               OSM_LOG(log, OSM_LOG_VERBOSE, "Port 0x%016" PRIx64 " joining "\r
-                       "MC group %s (mlid 0x%x)\n", cl_ntoh64(port->guid),\r
-                       inet_ntop(AF_INET6, mgrp->mcmember_rec.mgid.raw,\r
-                                 gid_str, sizeof(gid_str)),\r
-                       cl_ntoh16(mgrp->mlid));\r
-       }\r
-\r
-       mcm_port = osm_mcm_port_new(port, mgrp, mcmr, proxy);\r
-       if (!mcm_port)\r
-               return NULL;\r
-\r
-       /*\r
-          prev_item = cl_qmap_insert(...)\r
-          Pointer to the item in the map with the specified key.  If insertion\r
-          was successful, this is the pointer to the item.  If an item with the\r
-          specified key already exists in the map, the pointer to that item is\r
-          returned.\r
-        */\r
-       prev_item = cl_qmap_insert(&mgrp->mcm_port_tbl, port->guid,\r
-                                  &mcm_port->map_item);\r
-\r
-       /* if already exists - revert the insertion and only update join state */\r
-       if (prev_item != &mcm_port->map_item) {\r
-               osm_mcm_port_delete(mcm_port);\r
-               mcm_port = (osm_mcm_port_t *) prev_item;\r
-\r
-               ib_member_get_scope_state(mcm_port->scope_state, &prev_scope,\r
-                                         &prev_join_state);\r
-               mcm_port->scope_state =\r
-                   ib_member_set_scope_state(prev_scope,\r
-                                             prev_join_state | join_state);\r
-       } else {\r
-               cl_qlist_insert_tail(&port->mcm_list, &mcm_port->list_item);\r
-               osm_sm_reroute_mlid(&subn->p_osm->sm, mgrp->mlid);\r
-       }\r
-\r
-       /* o15.0.1.11: copy the join state */\r
-       mcmr->scope_state = mcm_port->scope_state;\r
-\r
-       if ((join_state & IB_JOIN_STATE_FULL) &&\r
-           !(prev_join_state & IB_JOIN_STATE_FULL) &&\r
-           ++mgrp->full_members == 1)\r
-               mgrp_send_notice(subn, log, mgrp, 66);\r
-\r
-       subn->p_osm->sa.dirty = TRUE;\r
-       return mcm_port;\r
-}\r
-\r
-void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,\r
-                         osm_mcm_port_t * mcm_port, ib_member_rec_t *mcmr)\r
-{\r
-       uint8_t join_state = mcmr->scope_state & 0xf;\r
-       uint8_t port_join_state, new_join_state;\r
-\r
-       /*\r
-        * according to the same o15-0.1.14 we get the stored\r
-        * JoinState and the request JoinState and they must be\r
-        * opposite to leave - otherwise just update it\r
-        */\r
-       port_join_state = mcm_port->scope_state & 0x0F;\r
-       new_join_state = port_join_state & ~join_state;\r
-\r
-       if (osm_log_is_active(log, OSM_LOG_VERBOSE)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               OSM_LOG(log, OSM_LOG_VERBOSE,\r
-                       "Port 0x%" PRIx64 " leaving MC group %s (mlid 0x%x)\n",\r
-                       cl_ntoh64(mcm_port->port->guid),\r
-                       inet_ntop(AF_INET6, mgrp->mcmember_rec.mgid.raw,\r
-                                 gid_str, sizeof(gid_str)),\r
-                       cl_ntoh16(mgrp->mlid));\r
-       }\r
-\r
-       if (new_join_state) {\r
-               mcm_port->scope_state =\r
-                   new_join_state | (mcm_port->scope_state & 0xf0);\r
-               OSM_LOG(log, OSM_LOG_DEBUG,\r
-                       "updating port 0x%" PRIx64 " JoinState 0x%x -> 0x%x\n",\r
-                       cl_ntoh64(mcm_port->port->guid),\r
-                       port_join_state, new_join_state);\r
-               mcmr->scope_state = mcm_port->scope_state;\r
-       } else {\r
-               mcmr->scope_state = mcm_port->scope_state;\r
-               OSM_LOG(log, OSM_LOG_DEBUG, "removing port 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(mcm_port->port->guid));\r
-               cl_qmap_remove_item(&mgrp->mcm_port_tbl, &mcm_port->map_item);\r
-               cl_qlist_remove_item(&mcm_port->port->mcm_list,\r
-                                    &mcm_port->list_item);\r
-               osm_mcm_port_delete(mcm_port);\r
-               osm_sm_reroute_mlid(&subn->p_osm->sm, mgrp->mlid);\r
-       }\r
-\r
-       /* no more full members so the group will be deleted after re-route\r
-          but only if it is not a well known group */\r
-       if ((port_join_state & IB_JOIN_STATE_FULL) &&\r
-           !(new_join_state & IB_JOIN_STATE_FULL) &&\r
-           --mgrp->full_members == 0) {\r
-               mgrp_send_notice(subn, log, mgrp, 67);\r
-               osm_mgrp_cleanup(subn, mgrp);\r
-       }\r
-\r
-       subn->p_osm->sa.dirty = TRUE;\r
-}\r
-\r
-void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,\r
-                         ib_net64_t port_guid)\r
-{\r
-       ib_member_rec_t mcmrec;\r
-       cl_map_item_t *item = cl_qmap_get(&mgrp->mcm_port_tbl, port_guid);\r
-\r
-       if (item != cl_qmap_end(&mgrp->mcm_port_tbl)) {\r
-               mcmrec.scope_state = 0xf;\r
-               osm_mgrp_remove_port(subn, log, mgrp, (osm_mcm_port_t *) item,\r
-                                    &mcmrec);\r
-       }\r
-}\r
-\r
-osm_mcm_port_t *osm_mgrp_get_mcm_port(IN const osm_mgrp_t * p_mgrp,\r
-                                     IN ib_net64_t port_guid)\r
-{\r
-       cl_map_item_t *item = cl_qmap_get(&p_mgrp->mcm_port_tbl, port_guid);\r
-       if (item != cl_qmap_end(&p_mgrp->mcm_port_tbl))\r
-               return (osm_mcm_port_t *)item;\r
-       return NULL;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_node.c b/branches/opensm_3/user/opensm/osm_node.c
deleted file mode 100644 (file)
index e6d7ccd..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_node_t.\r
- * This object represents an Infiniband Node.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_madw.h>\r
-\r
-void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,\r
-                        IN const osm_madw_t * p_madw)\r
-{\r
-       ib_net64_t port_guid;\r
-       ib_smp_t *p_smp;\r
-       ib_node_info_t *p_ni;\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-       port_guid = p_ni->port_guid;\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-\r
-       osm_physp_init(&p_node->physp_table[port_num],\r
-                      port_guid, port_num, p_node,\r
-                      osm_madw_get_bind_handle(p_madw),\r
-                      p_smp->hop_count, p_smp->initial_path);\r
-}\r
-\r
-osm_node_t *osm_node_new(IN const osm_madw_t * p_madw)\r
-{\r
-       osm_node_t *p_node;\r
-       ib_smp_t *p_smp;\r
-       ib_node_info_t *p_ni;\r
-       uint8_t i;\r
-       uint32_t size;\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       /*\r
-          The node object already contains one physical port object.\r
-          Therefore, subtract 1 from the number of physical ports\r
-          used by the switch.  This is not done for CA's since they\r
-          need to occupy 1 more physp than they physically have since\r
-          we still reserve room for a "port 0".\r
-        */\r
-       size = p_ni->num_ports;\r
-\r
-       p_node = malloc(sizeof(*p_node) + sizeof(osm_physp_t) * size);\r
-       if (!p_node)\r
-               return NULL;\r
-\r
-       memset(p_node, 0, sizeof(*p_node) + sizeof(osm_physp_t) * size);\r
-       p_node->node_info = *p_ni;\r
-       p_node->physp_tbl_size = size + 1;\r
-\r
-       /*\r
-          Construct Physical Port objects owned by this Node.\r
-          Then, initialize the Physical Port through with we\r
-          discovered this port.\r
-          For switches, all ports have the same GUID.\r
-          For CAs and routers, each port has a different GUID, so we only\r
-          know the GUID for the port that responded to our\r
-          Get(NodeInfo).\r
-        */\r
-       for (i = 0; i < p_node->physp_tbl_size; i++)\r
-               osm_physp_construct(&p_node->physp_table[i]);\r
-\r
-       if (p_ni->node_type == IB_NODE_TYPE_SWITCH)\r
-               for (i = 0; i <= p_ni->num_ports; i++)\r
-                       osm_node_init_physp(p_node, i, p_madw);\r
-       else\r
-               osm_node_init_physp(p_node,\r
-                                   ib_node_info_get_local_port_num(p_ni),\r
-                                   p_madw);\r
-       p_node->print_desc = strdup(OSM_NODE_DESC_UNKNOWN);\r
-\r
-       return p_node;\r
-}\r
-\r
-static void node_destroy(IN osm_node_t * p_node)\r
-{\r
-       uint16_t i;\r
-\r
-       /*\r
-          Cleanup all physports\r
-        */\r
-       for (i = 0; i < p_node->physp_tbl_size; i++)\r
-               osm_physp_destroy(&p_node->physp_table[i]);\r
-\r
-       /* cleanup printable node_desc field */\r
-       if (p_node->print_desc)\r
-               free(p_node->print_desc);\r
-}\r
-\r
-void osm_node_delete(IN OUT osm_node_t ** p_node)\r
-{\r
-       CL_ASSERT(p_node && *p_node);\r
-       node_destroy(*p_node);\r
-       free(*p_node);\r
-       *p_node = NULL;\r
-}\r
-\r
-void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                  IN osm_node_t * p_remote_node, IN uint8_t remote_port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       p_remote_physp = osm_node_get_physp_ptr(p_remote_node, remote_port_num);\r
-\r
-       if (p_physp->p_remote_physp)\r
-               p_physp->p_remote_physp->p_remote_physp = NULL;\r
-       if (p_remote_physp->p_remote_physp)\r
-               p_remote_physp->p_remote_physp->p_remote_physp = NULL;\r
-\r
-       osm_physp_link(p_physp, p_remote_physp);\r
-}\r
-\r
-void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                    IN osm_node_t * p_remote_node, IN uint8_t remote_port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);\r
-\r
-       if (osm_node_link_exists(p_node, port_num,\r
-                                p_remote_node, remote_port_num)) {\r
-\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               p_remote_physp =\r
-                   osm_node_get_physp_ptr(p_remote_node, remote_port_num);\r
-\r
-               osm_physp_unlink(p_physp, p_remote_physp);\r
-       }\r
-}\r
-\r
-boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,\r
-                              IN osm_node_t * p_remote_node,\r
-                              IN uint8_t remote_port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       p_remote_physp = osm_node_get_physp_ptr(p_remote_node, remote_port_num);\r
-\r
-       return osm_physp_link_exists(p_physp, p_remote_physp);\r
-}\r
-\r
-boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,\r
-                                       IN uint8_t port_num,\r
-                                       IN osm_node_t * p_remote_node,\r
-                                       IN uint8_t remote_port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       CL_ASSERT(remote_port_num < p_remote_node->physp_tbl_size);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       p_remote_physp = osm_node_get_physp_ptr(p_remote_node, remote_port_num);\r
-\r
-       return (p_physp && p_remote_physp);\r
-}\r
-\r
-boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       return osm_physp_has_any_link(p_physp);\r
-}\r
-\r
-osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,\r
-                                    IN uint8_t port_num,\r
-                                    OUT uint8_t * p_remote_port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-       if (!p_physp || !osm_physp_has_any_link(p_physp))\r
-               return NULL;\r
-\r
-       p_remote_physp = osm_physp_get_remote(p_physp);\r
-       if (p_remote_port_num)\r
-               *p_remote_port_num = osm_physp_get_port_num(p_remote_physp);\r
-\r
-       return osm_physp_get_node_ptr(p_remote_physp);\r
-}\r
-\r
-/**********************************************************************\r
- The lock must be held before calling this function.\r
-**********************************************************************/\r
-ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,\r
-                                       IN uint32_t port_num)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-       CL_ASSERT(port_num < p_node->physp_tbl_size);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       if (p_physp) {\r
-               p_remote_physp = osm_physp_get_remote(p_physp);\r
-               return osm_physp_get_base_lid(p_remote_physp);\r
-       }\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_node_desc_rcv.c b/branches/opensm_3/user/opensm/osm_node_desc_rcv.c
deleted file mode 100644 (file)
index 53161fa..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_nd_rcv_t.\r
- * This object represents the NodeDescription Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_subnet.h>\r
-\r
-static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                             IN const ib_node_desc_t * p_nd)\r
-{\r
-       char *tmp_desc;\r
-       char print_desc[IB_NODE_DESCRIPTION_SIZE + 1];\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       memcpy(&p_node->node_desc.description, p_nd, sizeof(*p_nd));\r
-\r
-       /* also set up a printable version */\r
-       memcpy(print_desc, p_nd, sizeof(*p_nd));\r
-       print_desc[IB_NODE_DESCRIPTION_SIZE] = '\0';\r
-       tmp_desc = remap_node_name(sm->p_subn->p_osm->node_name_map,\r
-                                  cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                                  print_desc);\r
-\r
-       /* make a copy for this node to "own" */\r
-       if (p_node->print_desc)\r
-               free(p_node->print_desc);\r
-       p_node->print_desc = tmp_desc;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)), p_node->print_desc);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_nd_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_node_desc_t *p_nd;\r
-       ib_smp_t *p_smp;\r
-       osm_node_t *p_node;\r
-       ib_net64_t node_guid;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_nd = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       /* Acquire the node object and add the node description. */\r
-       node_guid = osm_madw_get_nd_context_ptr(p_madw)->node_guid;\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-       p_node = osm_get_node_by_guid(sm->p_subn, node_guid);\r
-       if (!p_node)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0B01: "\r
-                       "NodeDescription received for nonexistent node "\r
-                       "0x%" PRIx64 "\n", cl_ntoh64(node_guid));\r
-       else\r
-               nd_rcv_process_nd(sm, p_node, p_nd);\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_node_info_rcv.c b/branches/opensm_3/user/opensm/osm_node_info_rcv.c
deleted file mode 100755 (executable)
index 3e18d0f..0000000
+++ /dev/null
@@ -1,804 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_ni_rcv_t.\r
- * This object represents the NodeInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_router.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-\r
-static void report_duplicated_guid(IN osm_sm_t * sm, osm_physp_t * p_physp,\r
-                                  osm_node_t * p_neighbor_node,\r
-                                  const uint8_t port_num)\r
-{\r
-       osm_physp_t *p_old, *p_new;\r
-       osm_dr_path_t path;\r
-\r
-       p_old = p_physp->p_remote_physp;\r
-       p_new = osm_node_get_physp_ptr(p_neighbor_node, port_num);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D01: "\r
-               "Found duplicated node.\n"\r
-               "Node 0x%" PRIx64 " port %u is reachable from remote node "\r
-               "0x%" PRIx64 " port %u and remote node 0x%" PRIx64 " port %u.\n"\r
-               "Paths are:\n",\r
-               cl_ntoh64(p_physp->p_node->node_info.node_guid),\r
-               p_physp->port_num,\r
-               cl_ntoh64(p_old->p_node->node_info.node_guid), p_old->port_num,\r
-               cl_ntoh64(p_new->p_node->node_info.node_guid), p_new->port_num);\r
-\r
-       osm_dump_dr_path(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),\r
-                        OSM_LOG_ERROR);\r
-\r
-       path = *osm_physp_get_dr_path_ptr(p_new);\r
-       if (osm_dr_path_extend(&path, port_num))\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D05: "\r
-                       "DR path with hop count %d couldn't be extended\n",\r
-                       path.hop_count);\r
-       osm_dump_dr_path(sm->p_log, &path, OSM_LOG_ERROR);\r
-\r
-       osm_log(sm->p_log, OSM_LOG_SYS,\r
-               "FATAL: duplicated guids or 12x lane reversal\n");\r
-}\r
-\r
-static void requery_dup_node_info(IN osm_sm_t * sm, osm_physp_t * p_physp,\r
-                                 unsigned count)\r
-{\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t path;\r
-       cl_status_t status;\r
-\r
-       path = *osm_physp_get_dr_path_ptr(p_physp->p_remote_physp);\r
-       if (osm_dr_path_extend(&path, p_physp->p_remote_physp->port_num)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D08: "\r
-                       "DR path with hop count %d couldn't be extended\n",\r
-                       path.hop_count);\r
-               return;\r
-       }\r
-\r
-       context.ni_context.node_guid =\r
-           p_physp->p_remote_physp->p_node->node_info.port_guid;\r
-       context.ni_context.port_num = p_physp->p_remote_physp->port_num;\r
-       context.ni_context.dup_node_guid = p_physp->p_node->node_info.node_guid;\r
-       context.ni_context.dup_port_num = p_physp->port_num;\r
-       context.ni_context.dup_count = count;\r
-\r
-       status = osm_req_get(sm, &path, IB_MAD_ATTR_NODE_INFO, 0,\r
-                            CL_DISP_MSGID_NONE, &context);\r
-\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D02: "\r
-                       "Failure initiating NodeInfo request (%s)\n",\r
-                       ib_get_err_str(status));\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node,\r
-                            const uint8_t port_num,\r
-                            const osm_ni_context_t * p_ni_context)\r
-{\r
-       osm_node_t *p_neighbor_node;\r
-       osm_physp_t *p_physp;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          A special case exists in which the node we're trying to\r
-          link is our own node.  In this case, the guid value in\r
-          the ni_context will be zero.\r
-        */\r
-       if (p_ni_context->node_guid == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Nothing to link for our own node 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-               goto _exit;\r
-       }\r
-\r
-       p_neighbor_node = osm_get_node_by_guid(sm->p_subn,\r
-                                              p_ni_context->node_guid);\r
-       if (!p_neighbor_node) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D10: "\r
-                       "Unexpected removal of neighbor node 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(p_ni_context->node_guid));\r
-               goto _exit;\r
-       }\r
-\r
-       /* When setting the link, ports on both\r
-          sides of the link should be initialized */\r
-       CL_ASSERT(osm_node_link_has_valid_ports(p_node, port_num,\r
-                                               p_neighbor_node,\r
-                                               p_ni_context->port_num));\r
-\r
-       if (osm_node_link_exists(p_node, port_num,\r
-                                p_neighbor_node, p_ni_context->port_num)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Link already exists\n");\r
-               goto _exit;\r
-       }\r
-\r
-       if (osm_node_has_any_link(p_node, port_num) &&\r
-           sm->p_subn->force_heavy_sweep == FALSE &&\r
-           (!p_ni_context->dup_count ||\r
-            (p_ni_context->dup_node_guid == osm_node_get_node_guid(p_node) &&\r
-             p_ni_context->dup_port_num == port_num))) {\r
-               /*\r
-                  Uh oh...\r
-                  This could be reconnected ports, but also duplicated GUID\r
-                  (2 nodes have the same guid) or a 12x link with lane reversal\r
-                  that is not configured correctly.\r
-                  We will try to recover by querying NodeInfo again.\r
-                  In order to catch even fast port moving to new location(s)\r
-                  and back we will count up to 5.\r
-                  Some crazy reconnections (newly created switch loop right\r
-                  before targeted CA) will not be catched this way. So in worst\r
-                  case - report GUID duplication and request new discovery.\r
-                  When switch node is targeted NodeInfo querying will be done\r
-                  in opposite order, this is much stronger check, unfortunately\r
-                  it is impossible with CAs.\r
-                */\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               if (p_ni_context->dup_count > 5) {\r
-                       report_duplicated_guid(sm, p_physp, p_neighbor_node,\r
-                                              p_ni_context->port_num);\r
-                       sm->p_subn->force_heavy_sweep = TRUE;\r
-               } else if (p_node->sw)\r
-                       requery_dup_node_info(sm, p_physp->p_remote_physp,\r
-                                             p_ni_context->dup_count + 1);\r
-               else\r
-                       requery_dup_node_info(sm, p_physp,\r
-                                             p_ni_context->dup_count + 1);\r
-       }\r
-\r
-       /*\r
-          When there are only two nodes with exact same guids (connected back\r
-          to back) - the previous check for duplicated guid will not catch\r
-          them. But the link will be from the port to itself...\r
-          Enhanced Port 0 is an exception to this\r
-        */\r
-       if (osm_node_get_node_guid(p_node) == p_ni_context->node_guid &&\r
-           port_num == p_ni_context->port_num &&\r
-           port_num != 0 && cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Duplicate GUID found by link from a port to itself:"\r
-                       "node 0x%" PRIx64 ", port number %u\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)), port_num);\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               osm_dump_dr_path(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),\r
-                                OSM_LOG_VERBOSE);\r
-\r
-               if (sm->p_subn->opt.exit_on_fatal == TRUE) {\r
-                       osm_log(sm->p_log, OSM_LOG_SYS,\r
-                               "Errors on subnet. Duplicate GUID found "\r
-                               "by link from a port to itself. "\r
-                               "See verbose opensm.log for more details\n");\r
-                       exit(1);\r
-               }\r
-       }\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Creating new link between:\n\t\t\t\tnode 0x%" PRIx64\r
-               ", port number %u and\n\t\t\t\tnode 0x%" PRIx64\r
-               ", port number %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)), port_num,\r
-               cl_ntoh64(p_ni_context->node_guid), p_ni_context->port_num);\r
-\r
-       if (sm->ucast_mgr.cache_valid)\r
-               osm_ucast_cache_check_new_link(&sm->ucast_mgr, p_node, port_num,\r
-                                              p_neighbor_node,\r
-                                              p_ni_context->port_num);\r
-\r
-       osm_node_link(p_node, port_num, p_neighbor_node,\r
-                     p_ni_context->port_num);\r
-\r
-_exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node,\r
-                                IN const osm_madw_t * madw)\r
-{\r
-       osm_madw_context_t context;\r
-       osm_physp_t *physp;\r
-       ib_node_info_t *ni;\r
-       unsigned port, num_ports;\r
-       ib_api_status_t status;\r
-\r
-       ni = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(madw));\r
-\r
-       if (ni->node_type == IB_NODE_TYPE_SWITCH) {\r
-               port = 0;\r
-               num_ports = osm_node_get_num_physp(node);\r
-       } else {\r
-               port = ib_node_info_get_local_port_num(ni);\r
-               num_ports = port + 1;\r
-       }\r
-\r
-       physp = osm_node_get_physp_ptr(node, port);\r
-\r
-       context.pi_context.node_guid = osm_node_get_node_guid(node);\r
-       context.pi_context.port_guid = osm_physp_get_port_guid(physp);\r
-       context.pi_context.set_method = FALSE;\r
-       context.pi_context.light_sweep = FALSE;\r
-       context.pi_context.active_transition = FALSE;\r
-\r
-       for (; port < num_ports; port++) {\r
-               status = osm_req_get(sm, osm_physp_get_dr_path_ptr(physp),\r
-                                    IB_MAD_ATTR_PORT_INFO, cl_hton32(port),\r
-                                    CL_DISP_MSGID_NONE, &context);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR OD02: "\r
-                               "Failure initiating PortInfo request (%s)\n",\r
-                               ib_get_err_str(status));\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t * p_physp)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_madw_context_t context;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       context.nd_context.node_guid =\r
-           osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));\r
-\r
-       status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                            IB_MAD_ATTR_NODE_DESC, 0, CL_DISP_MSGID_NONE,\r
-                            &context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D03: "\r
-                       "Failure initiating NodeDescription request (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_get_node_desc(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                IN const osm_madw_t * p_madw)\r
-{\r
-       ib_node_info_t *p_ni;\r
-       ib_smp_t *p_smp;\r
-       uint8_t port_num;\r
-       osm_physp_t *p_physp = NULL;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-       port_num = ib_node_info_get_local_port_num(p_ni);\r
-\r
-       /*\r
-          Request PortInfo & NodeDescription attributes for the port\r
-          that responded to the NodeInfo attribute.\r
-          Because this is a channel adapter or router, we are\r
-          not allowed to request PortInfo for the other ports.\r
-          Set the context union properly, so the recipient\r
-          knows which node & port are relevant.\r
-        */\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-       osm_req_get_node_desc(sm, p_physp);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,\r
-                                           IN osm_node_t * p_node,\r
-                                           IN const osm_madw_t * p_madw)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       ni_rcv_get_port_info(sm, p_node, p_madw);\r
-\r
-       /*\r
-          A node guid of 0 is the corner case that indicates\r
-          we discovered our own node.  Initialize the subnet\r
-          object with the SM's own port guid.\r
-        */\r
-       if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)\r
-               sm->p_subn->sm_port_guid = p_node->node_info.port_guid;\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,\r
-                                                IN osm_node_t * p_node,\r
-                                                IN const osm_madw_t * p_madw)\r
-{\r
-       ib_node_info_t *p_ni;\r
-       ib_smp_t *p_smp;\r
-       osm_port_t *p_port;\r
-       osm_port_t *p_port_check;\r
-       uint8_t port_num;\r
-       osm_physp_t *p_physp;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_bind_handle_t h_bind;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-       port_num = ib_node_info_get_local_port_num(p_ni);\r
-       h_bind = osm_madw_get_bind_handle(p_madw);\r
-\r
-       /*\r
-          Determine if we have encountered this node through a\r
-          previously undiscovered port.  If so, build the new\r
-          port object.\r
-        */\r
-       p_port = osm_get_port_by_guid(sm->p_subn, p_ni->port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Creating new port object with GUID 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(p_ni->port_guid));\r
-\r
-               osm_node_init_physp(p_node, port_num, p_madw);\r
-\r
-               p_port = osm_port_new(p_ni, p_node);\r
-               if (p_port == NULL) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D04: "\r
-                               "Unable to create new port object\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               /*\r
-                  Add the new port object to the database.\r
-                */\r
-               p_port_check =\r
-                   (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,\r
-                                                 p_ni->port_guid,\r
-                                                 &p_port->map_item);\r
-               if (p_port_check != p_port) {\r
-                       /*\r
-                          We should never be here!\r
-                          Somehow, this port GUID already exists in the table.\r
-                        */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D12: "\r
-                               "Port 0x%" PRIx64 " already in the database!\n",\r
-                               cl_ntoh64(p_ni->port_guid));\r
-\r
-                       osm_port_delete(&p_port);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* If we are a master, then this means the port is new on the subnet.\r
-                  Mark it as new - need to send trap 64 for these ports.\r
-                  The condition that we are master is true, since if we are in discovering\r
-                  state (meaning we woke up from standby or we are just initializing),\r
-                  then these ports may be new to us, but are not new on the subnet.\r
-                  If we are master, then the subnet as we know it is the updated one,\r
-                  and any new ports we encounter should cause trap 64. C14-72.1.1 */\r
-               if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER)\r
-                       p_port->is_new = 1;\r
-\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       } else {\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               /*\r
-                  Update the DR Path to the port,\r
-                  in case the old one is no longer available.\r
-                */\r
-               p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-\r
-               osm_dr_path_init(p_dr_path, h_bind, p_smp->hop_count,\r
-                                p_smp->initial_path);\r
-       }\r
-\r
-       ni_rcv_get_port_info(sm, p_node, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                 IN const osm_madw_t * p_madw)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t *path;\r
-       ib_smp_t *p_smp;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /* update DR path of already initialized switch port 0 */\r
-       path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));\r
-       osm_dr_path_init(path, osm_madw_get_bind_handle(p_madw),\r
-                        p_smp->hop_count, p_smp->initial_path);\r
-\r
-       context.si_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.si_context.set_method = FALSE;\r
-       context.si_context.light_sweep = FALSE;\r
-\r
-       /* Request a SwitchInfo attribute */\r
-       status = osm_req_get(sm, path, IB_MAD_ATTR_SWITCH_INFO,\r
-                            0, CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS)\r
-               /* continue despite error */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D06: "\r
-                       "Failure initiating SwitchInfo request (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-       if (p_node->discovery_count == 1)\r
-               ni_rcv_get_port_info(sm, p_node, p_madw);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_existing_switch(IN osm_sm_t * sm,\r
-                                          IN osm_node_t * p_node,\r
-                                          IN const osm_madw_t * p_madw)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          If this switch has already been probed during this sweep,\r
-          then don't bother reprobing it.\r
-          There is one exception - if the node has been visited, but\r
-          for some reason we don't have the switch object (this can happen\r
-          if the SwitchInfo mad didn't reach the SM) then we want\r
-          to retry to probe the switch.\r
-        */\r
-       if (p_node->discovery_count == 1)\r
-               ni_rcv_process_switch(sm, p_node, p_madw);\r
-       else if (!p_node->sw) {\r
-               /* we don't have the SwitchInfo - retry to get it */\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Retry to get SwitchInfo on node GUID:0x%" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-               ni_rcv_process_switch(sm, p_node, p_madw);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_new_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                     IN const osm_madw_t * p_madw)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       ni_rcv_process_switch(sm, p_node, p_madw);\r
-\r
-       /*\r
-          A node guid of 0 is the corner case that indicates\r
-          we discovered our own node.  Initialize the subnet\r
-          object with the SM's own port guid.\r
-        */\r
-       if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)\r
-               sm->p_subn->sm_port_guid = p_node->node_info.port_guid;\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must NOT be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)\r
-{\r
-       osm_node_t *p_node;\r
-       osm_node_t *p_node_check;\r
-       osm_port_t *p_port;\r
-       osm_port_t *p_port_check;\r
-       osm_router_t *p_rtr = NULL;\r
-       osm_router_t *p_rtr_check;\r
-       cl_qmap_t *p_rtr_guid_tbl;\r
-       ib_node_info_t *p_ni;\r
-       ib_smp_t *p_smp;\r
-       osm_ni_context_t *p_ni_context;\r
-       uint8_t port_num;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-       p_ni_context = osm_madw_get_ni_context_ptr(p_madw);\r
-       port_num = ib_node_info_get_local_port_num(p_ni);\r
-\r
-       osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_VERBOSE);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Discovered new %s node,"\r
-               "\n\t\t\t\tGUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",\r
-               ib_get_node_type_str(p_ni->node_type),\r
-               cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id));\r
-\r
-       p_node = osm_node_new(p_madw);\r
-       if (p_node == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: "\r
-                       "Unable to create new node object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Create a new port object to represent this node's physical\r
-          ports in the port table.\r
-        */\r
-       p_port = osm_port_new(p_ni, p_node);\r
-       if (p_port == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D14: "\r
-                       "Unable to create new port object\n");\r
-               osm_node_delete(&p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Add the new port object to the database.\r
-        */\r
-       p_port_check =\r
-           (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,\r
-                                         p_ni->port_guid, &p_port->map_item);\r
-       if (p_port_check != p_port) {\r
-               /*\r
-                  We should never be here!\r
-                  Somehow, this port GUID already exists in the table.\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D15: "\r
-                       "Duplicate Port GUID 0x%" PRIx64\r
-                       "! Found by the two directed routes:\n",\r
-                       cl_ntoh64(p_ni->port_guid));\r
-               osm_dump_dr_path(sm->p_log,\r
-                                osm_physp_get_dr_path_ptr(p_port->p_physp),\r
-                                OSM_LOG_ERROR);\r
-               osm_dump_dr_path(sm->p_log,\r
-                                osm_physp_get_dr_path_ptr(p_port_check->\r
-                                                          p_physp),\r
-                                OSM_LOG_ERROR);\r
-               osm_port_delete(&p_port);\r
-               osm_node_delete(&p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       /* If we are a master, then this means the port is new on the subnet.\r
-          Mark it as new - need to send trap 64 on these ports.\r
-          The condition that we are master is true, since if we are in discovering\r
-          state (meaning we woke up from standby or we are just initializing),\r
-          then these ports may be new to us, but are not new on the subnet.\r
-          If we are master, then the subnet as we know it is the updated one,\r
-          and any new ports we encounter should cause trap 64. C14-72.1.1 */\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER)\r
-               p_port->is_new = 1;\r
-\r
-       /* If there were RouterInfo or other router attribute,\r
-          this would be elsewhere */\r
-       if (p_ni->node_type == IB_NODE_TYPE_ROUTER) {\r
-               if ((p_rtr = osm_router_new(p_port)) == NULL)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1A: "\r
-                               "Unable to create new router object\n");\r
-               else {\r
-                       p_rtr_guid_tbl = &sm->p_subn->rtr_guid_tbl;\r
-                       p_rtr_check =\r
-                           (osm_router_t *) cl_qmap_insert(p_rtr_guid_tbl,\r
-                                                           p_ni->port_guid,\r
-                                                           &p_rtr->map_item);\r
-                       if (p_rtr_check != p_rtr)\r
-                               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1B: "\r
-                                       "Unable to add port GUID:0x%016" PRIx64\r
-                                       " to router table\n",\r
-                                       cl_ntoh64(p_ni->port_guid));\r
-               }\r
-       }\r
-\r
-       p_node_check =\r
-           (osm_node_t *) cl_qmap_insert(&sm->p_subn->node_guid_tbl,\r
-                                         p_ni->node_guid, &p_node->map_item);\r
-       if (p_node_check != p_node) {\r
-               /*\r
-                  This node must have been inserted by another thread.\r
-                  This is unexpected, but is not an error.\r
-                  We can simply clean-up, since the other thread will\r
-                  see this processing through to completion.\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Discovery race detected at node 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(p_ni->node_guid));\r
-               osm_node_delete(&p_node);\r
-               p_node = p_node_check;\r
-               ni_rcv_set_links(sm, p_node, port_num, p_ni_context);\r
-               goto Exit;\r
-       } else\r
-               ni_rcv_set_links(sm, p_node, port_num, p_ni_context);\r
-\r
-       p_node->discovery_count++;\r
-       ni_rcv_get_node_desc(sm, p_node, p_madw);\r
-\r
-       switch (p_ni->node_type) {\r
-       case IB_NODE_TYPE_CA:\r
-       case IB_NODE_TYPE_ROUTER:\r
-               ni_rcv_process_new_ca_or_router(sm, p_node, p_madw);\r
-               break;\r
-       case IB_NODE_TYPE_SWITCH:\r
-               ni_rcv_process_new_switch(sm, p_node, p_madw);\r
-               break;\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: "\r
-                       "Unknown node type %u with GUID 0x%" PRIx64 "\n",\r
-                       p_ni->node_type, cl_ntoh64(p_ni->node_guid));\r
-               break;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void ni_rcv_process_existing(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                   IN const osm_madw_t * p_madw)\r
-{\r
-       ib_node_info_t *p_ni;\r
-       ib_smp_t *p_smp;\r
-       osm_ni_context_t *p_ni_context;\r
-       uint8_t port_num;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-       p_ni_context = osm_madw_get_ni_context_ptr(p_madw);\r
-       port_num = ib_node_info_get_local_port_num(p_ni);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Rediscovered %s node 0x%" PRIx64 " TID 0x%" PRIx64\r
-               ", discovered %u times already\n",\r
-               ib_get_node_type_str(p_ni->node_type),\r
-               cl_ntoh64(p_ni->node_guid),\r
-               cl_ntoh64(p_smp->trans_id), p_node->discovery_count);\r
-\r
-       /*\r
-          If we haven't already encountered this existing node\r
-          on this particular sweep, then process further.\r
-        */\r
-       p_node->discovery_count++;\r
-\r
-       switch (p_ni->node_type) {\r
-       case IB_NODE_TYPE_CA:\r
-       case IB_NODE_TYPE_ROUTER:\r
-               ni_rcv_process_existing_ca_or_router(sm, p_node, p_madw);\r
-               break;\r
-\r
-       case IB_NODE_TYPE_SWITCH:\r
-               ni_rcv_process_existing_switch(sm, p_node, p_madw);\r
-               break;\r
-\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D09: "\r
-                       "Unknown node type %u with GUID 0x%" PRIx64 "\n",\r
-                       p_ni->node_type, cl_ntoh64(p_ni->node_guid));\r
-               break;\r
-       }\r
-\r
-       ni_rcv_set_links(sm, p_node, port_num, p_ni_context);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_ni_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_node_info_t *p_ni;\r
-       ib_smp_t *p_smp;\r
-       osm_node_t *p_node;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_ni = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);\r
-\r
-       if (p_ni->node_guid == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: "\r
-                       "Got Zero Node GUID! Found on the directed route:\n");\r
-               osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_ni->port_guid == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D17: "\r
-                       "Got Zero Port GUID! Found on the directed route:\n");\r
-               osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Determine if this node has already been discovered,\r
-          and process accordingly.\r
-          During processing of this node, hold the shared lock.\r
-        */\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-       p_node = osm_get_node_by_guid(sm->p_subn, p_ni->node_guid);\r
-\r
-       osm_dump_node_info(sm->p_log, p_ni, OSM_LOG_DEBUG);\r
-\r
-       if (!p_node)\r
-               ni_rcv_process_new(sm, p_madw);\r
-       else\r
-               ni_rcv_process_existing(sm, p_node, p_madw);\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_opensm.c b/branches/opensm_3/user/opensm/osm_opensm.c
deleted file mode 100644 (file)
index 7c988d1..0000000
+++ /dev/null
@@ -1,483 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_opensm_t.\r
- * This object represents the opensm super object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_dispatcher.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_version.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_vl15intf.h>\r
-#include <opensm/osm_event_plugin.h>\r
-\r
-struct routing_engine_module {\r
-       const char *name;\r
-       int (*setup) (struct osm_routing_engine *, osm_opensm_t *);\r
-};\r
-\r
-extern int osm_ucast_minhop_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-extern int osm_ucast_updn_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-extern int osm_ucast_file_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-extern int osm_ucast_ftree_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-extern int osm_ucast_lash_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-extern int osm_ucast_dor_setup(struct osm_routing_engine *, osm_opensm_t *);\r
-\r
-const static struct routing_engine_module routing_modules[] = {\r
-       {"minhop", osm_ucast_minhop_setup},\r
-       {"updn", osm_ucast_updn_setup},\r
-       {"file", osm_ucast_file_setup},\r
-       {"ftree", osm_ucast_ftree_setup},\r
-       {"lash", osm_ucast_lash_setup},\r
-       {"dor", osm_ucast_dor_setup},\r
-       {NULL, NULL}\r
-};\r
-\r
-const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)\r
-{\r
-       switch (type) {\r
-       case OSM_ROUTING_ENGINE_TYPE_NONE:\r
-               return "none";\r
-       case OSM_ROUTING_ENGINE_TYPE_MINHOP:\r
-               return "minhop";\r
-       case OSM_ROUTING_ENGINE_TYPE_UPDN:\r
-               return "updn";\r
-       case OSM_ROUTING_ENGINE_TYPE_FILE:\r
-               return "file";\r
-       case OSM_ROUTING_ENGINE_TYPE_FTREE:\r
-               return "ftree";\r
-       case OSM_ROUTING_ENGINE_TYPE_LASH:\r
-               return "lash";\r
-       case OSM_ROUTING_ENGINE_TYPE_DOR:\r
-               return "dor";\r
-       default:\r
-               break;\r
-       }\r
-       return "unknown";\r
-}\r
-\r
-osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)\r
-{\r
-       /* For legacy reasons, consider a NULL pointer and the string\r
-        * "null" as the minhop routing engine.\r
-        */\r
-       if (!str || !strcasecmp(str, "null")\r
-           || !strcasecmp(str, "minhop"))\r
-               return OSM_ROUTING_ENGINE_TYPE_MINHOP;\r
-       else if (!strcasecmp(str, "none"))\r
-               return OSM_ROUTING_ENGINE_TYPE_NONE;\r
-       else if (!strcasecmp(str, "updn"))\r
-               return OSM_ROUTING_ENGINE_TYPE_UPDN;\r
-       else if (!strcasecmp(str, "file"))\r
-               return OSM_ROUTING_ENGINE_TYPE_FILE;\r
-       else if (!strcasecmp(str, "ftree"))\r
-               return OSM_ROUTING_ENGINE_TYPE_FTREE;\r
-       else if (!strcasecmp(str, "lash"))\r
-               return OSM_ROUTING_ENGINE_TYPE_LASH;\r
-       else if (!strcasecmp(str, "dor"))\r
-               return OSM_ROUTING_ENGINE_TYPE_DOR;\r
-       else\r
-               return OSM_ROUTING_ENGINE_TYPE_UNKNOWN;\r
-}\r
-\r
-static void append_routing_engine(osm_opensm_t *osm,\r
-                                 struct osm_routing_engine *routing_engine)\r
-{\r
-       struct osm_routing_engine *r;\r
-\r
-       routing_engine->next = NULL;\r
-\r
-       if (!osm->routing_engine_list) {\r
-               osm->routing_engine_list = routing_engine;\r
-               return;\r
-       }\r
-\r
-       r = osm->routing_engine_list;\r
-       while (r->next)\r
-               r = r->next;\r
-\r
-       r->next = routing_engine;\r
-}\r
-\r
-static void setup_routing_engine(osm_opensm_t *osm, const char *name)\r
-{\r
-       struct osm_routing_engine *re;\r
-       const struct routing_engine_module *m;\r
-\r
-       for (m = routing_modules; m->name && *m->name; m++) {\r
-               if (!strcmp(m->name, name)) {\r
-                       re = malloc(sizeof(struct osm_routing_engine));\r
-                       if (!re) {\r
-                               OSM_LOG(&osm->log, OSM_LOG_VERBOSE,\r
-                                       "memory allocation failed\n");\r
-                               return;\r
-                       }\r
-                       memset(re, 0, sizeof(struct osm_routing_engine));\r
-\r
-                       re->name = m->name;\r
-                       if (m->setup(re, osm)) {\r
-                               OSM_LOG(&osm->log, OSM_LOG_VERBOSE,\r
-                                       "setup of routing"\r
-                                       " engine \'%s\' failed\n", name);\r
-                               return;\r
-                       }\r
-                       OSM_LOG(&osm->log, OSM_LOG_DEBUG,\r
-                               "\'%s\' routing engine set up\n", re->name);\r
-                       append_routing_engine(osm, re);\r
-                       return;\r
-               }\r
-       }\r
-\r
-       OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-               "cannot find or setup routing engine \'%s\'\n", name);\r
-}\r
-\r
-static void setup_routing_engines(osm_opensm_t *osm, const char *engine_names)\r
-{\r
-       char *name, *str, *p;\r
-\r
-       if (!engine_names || !*engine_names) {\r
-               setup_routing_engine(osm, "minhop");\r
-               return;\r
-       }\r
-\r
-       str = strdup(engine_names);\r
-       name = strtok_r(str, ", \t\n", &p);\r
-       while (name && *name) {\r
-               setup_routing_engine(osm, name);\r
-               name = strtok_r(NULL, ", \t\n", &p);\r
-       }\r
-       free(str);\r
-\r
-       if (!osm->routing_engine_list)\r
-               setup_routing_engine(osm, "minhop");\r
-}\r
-\r
-void osm_opensm_construct(IN osm_opensm_t * p_osm)\r
-{\r
-       memset(p_osm, 0, sizeof(*p_osm));\r
-       p_osm->osm_version = OSM_VERSION;\r
-       osm_subn_construct(&p_osm->subn);\r
-       osm_sm_construct(&p_osm->sm);\r
-       osm_sa_construct(&p_osm->sa);\r
-       osm_db_construct(&p_osm->db);\r
-       osm_mad_pool_construct(&p_osm->mad_pool);\r
-       osm_vl15_construct(&p_osm->vl15);\r
-       osm_log_construct(&p_osm->log);\r
-}\r
-\r
-static void destroy_routing_engines(osm_opensm_t *osm)\r
-{\r
-       struct osm_routing_engine *r, *next;\r
-\r
-       next = osm->routing_engine_list;\r
-       while (next) {\r
-               r = next;\r
-               next = r->next;\r
-               if (r->delete)\r
-                       r->delete(r->context);\r
-               free(r);\r
-       }\r
-}\r
-\r
-static void destroy_plugins(osm_opensm_t *osm)\r
-{\r
-       osm_epi_plugin_t *p;\r
-       /* remove from the list, and destroy it */\r
-       while (!cl_is_qlist_empty(&osm->plugin_list)){\r
-               p = (osm_epi_plugin_t *)cl_qlist_remove_head(&osm->plugin_list);\r
-               /* plugin is responsible for freeing its own resources */\r
-               osm_epi_destroy(p);\r
-       }\r
-}\r
-\r
-void osm_opensm_destroy(IN osm_opensm_t * p_osm)\r
-{\r
-       /* in case of shutdown through exit proc - no ^C */\r
-       osm_exit_flag = TRUE;\r
-\r
-       /*\r
-        * First of all, clear the is_sm bit.\r
-        */\r
-       if (p_osm->sm.mad_ctrl.h_bind)\r
-               osm_vendor_set_sm(p_osm->sm.mad_ctrl.h_bind, FALSE);\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       /* Shutdown the PerfMgr */\r
-       osm_perfmgr_shutdown(&p_osm->perfmgr);\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-       /* shut down the SA\r
-        * - unbind from QP1 messages\r
-        */\r
-       osm_sa_shutdown(&p_osm->sa);\r
-\r
-       /* shut down the SM\r
-        * - make sure the SM sweeper thread exited\r
-        * - unbind from QP0 messages\r
-        */\r
-       osm_sm_shutdown(&p_osm->sm);\r
-\r
-       /* cleanup all messages on VL15 fifo that were not sent yet */\r
-       osm_vl15_shutdown(&p_osm->vl15, &p_osm->mad_pool);\r
-\r
-       /* shut down the dispatcher - so no new messages cross */\r
-       cl_disp_shutdown(&p_osm->disp);\r
-\r
-       /* dump SA DB */\r
-       osm_sa_db_file_dump(p_osm);\r
-\r
-       /* do the destruction in reverse order as init */\r
-       destroy_plugins(p_osm);\r
-       destroy_routing_engines(p_osm);\r
-       osm_sa_destroy(&p_osm->sa);\r
-       osm_sm_destroy(&p_osm->sm);\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       osm_perfmgr_destroy(&p_osm->perfmgr);\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-       osm_db_destroy(&p_osm->db);\r
-       osm_vl15_destroy(&p_osm->vl15, &p_osm->mad_pool);\r
-       osm_mad_pool_destroy(&p_osm->mad_pool);\r
-       osm_vendor_delete(&p_osm->p_vendor);\r
-       osm_subn_destroy(&p_osm->subn);\r
-       cl_disp_destroy(&p_osm->disp);\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_cond_destroy(&p_osm->stats.cond);\r
-       pthread_mutex_destroy(&p_osm->stats.mutex);\r
-#else\r
-       cl_event_destroy(&p_osm->stats.event);\r
-#endif\r
-       close_node_name_map(p_osm->node_name_map);\r
-\r
-       cl_plock_destroy(&p_osm->lock);\r
-\r
-       osm_log_destroy(&p_osm->log);\r
-}\r
-\r
-static void load_plugins(osm_opensm_t *osm, const char *plugin_names)\r
-{\r
-       osm_epi_plugin_t *epi;\r
-       char *p_names, *name, *p;\r
-\r
-       p_names = strdup(plugin_names);\r
-       name = strtok_r(p_names, " \t\n", &p);\r
-       while (name && *name) {\r
-               epi = osm_epi_construct(osm, name);\r
-               if (!epi)\r
-                       osm_log(&osm->log, OSM_LOG_ERROR,\r
-                               "cannot load plugin \'%s\'\n", name);\r
-               else\r
-                       cl_qlist_insert_tail(&osm->plugin_list, &epi->list);\r
-               name = strtok_r(NULL, " \t\n", &p);\r
-       }\r
-       free(p_names);\r
-}\r
-\r
-ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,\r
-                               IN const osm_subn_opt_t * p_opt)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       /* Can't use log macros here, since we're initializing the log */\r
-       osm_opensm_construct(p_osm);\r
-\r
-       if (p_opt->daemon)\r
-               p_osm->log.daemon = 1;\r
-\r
-       status = osm_log_init_v2(&p_osm->log, p_opt->force_log_flush,\r
-                                p_opt->log_flags, p_opt->log_file,\r
-                                p_opt->log_max_size, p_opt->accum_log_file);\r
-       if (status != IB_SUCCESS)\r
-               return status;\r
-       p_osm->log.log_prefix = p_opt->log_prefix;\r
-\r
-       /* If there is a log level defined - add the OSM_VERSION to it */\r
-       osm_log(&p_osm->log,\r
-               osm_log_get_level(&p_osm->log) & (OSM_LOG_SYS ^ 0xFF), "%s\n",\r
-               p_osm->osm_version);\r
-       /* Write the OSM_VERSION to the SYS_LOG */\r
-       osm_log(&p_osm->log, OSM_LOG_SYS, "%s\n", p_osm->osm_version);  /* Format Waived */\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "[\n");     /* Format Waived */\r
-\r
-       status = cl_plock_init(&p_osm->lock);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_mutex_init(&p_osm->stats.mutex, NULL);\r
-       pthread_cond_init(&p_osm->stats.cond, NULL);\r
-#else\r
-       status = cl_event_init(&p_osm->stats.event, FALSE);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-#endif\r
-\r
-       if (p_opt->single_thread) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_INFO,\r
-                       "Forcing single threaded dispatcher\n");\r
-               status = cl_disp_init(&p_osm->disp, 1, "opensm");\r
-       } else {\r
-               /*\r
-                * Normal behavior is to initialize the dispatcher with\r
-                * one thread per CPU, as specified by a thread count of '0'.\r
-                */\r
-               status = cl_disp_init(&p_osm->disp, 0, "opensm");\r
-       }\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_subn_init(&p_osm->subn, p_osm, p_opt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_osm->p_vendor =\r
-           osm_vendor_new(&p_osm->log, p_opt->transaction_timeout);\r
-       if (p_osm->p_vendor == NULL) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       status = osm_mad_pool_init(&p_osm->mad_pool);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_vl15_init(&p_osm->vl15, p_osm->p_vendor,\r
-                              &p_osm->log, &p_osm->stats,\r
-                              p_opt->max_wire_smps);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* the DB is in use by the SM and SA so init before */\r
-       status = osm_db_init(&p_osm->db, &p_osm->log);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_sm_init(&p_osm->sm, &p_osm->subn, &p_osm->db,\r
-                            p_osm->p_vendor, &p_osm->mad_pool, &p_osm->vl15,\r
-                            &p_osm->log, &p_osm->stats, &p_osm->disp,\r
-                            &p_osm->lock);\r
-\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_sa_init(&p_osm->sm, &p_osm->sa, &p_osm->subn,\r
-                            p_osm->p_vendor, &p_osm->mad_pool, &p_osm->log,\r
-                            &p_osm->stats, &p_osm->disp, &p_osm->lock);\r
-\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       cl_qlist_init(&p_osm->plugin_list);\r
-\r
-       if (p_opt->event_plugin_name)\r
-               load_plugins(p_osm, p_opt->event_plugin_name);\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       status = osm_perfmgr_init(&p_osm->perfmgr, p_osm, p_opt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-       setup_routing_engines(p_osm, p_opt->routing_engine_names);\r
-\r
-       p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;\r
-\r
-       p_osm->node_name_map = open_node_name_map(p_opt->node_name_map_name);\r
-\r
-Exit:\r
-       OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "]\n");     /* Format Waived */\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(&p_osm->log);\r
-\r
-       status = osm_sm_bind(&p_osm->sm, guid);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_sa_bind(&p_osm->sa, guid);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       status = osm_perfmgr_bind(&p_osm->perfmgr, guid);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-       /* setting IS_SM in capability mask */\r
-       OSM_LOG(&p_osm->log, OSM_LOG_INFO, "Setting IS_SM on port 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(guid));\r
-       osm_vendor_set_sm(p_osm->sm.mad_ctrl.h_bind, TRUE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osm->log);\r
-       return status;\r
-}\r
-\r
-void osm_opensm_report_event(osm_opensm_t *osm, osm_epi_event_id_t event_id,\r
-                            void *event_data)\r
-{\r
-       cl_list_item_t *item;\r
-\r
-       for (item = cl_qlist_head(&osm->plugin_list);\r
-            item != cl_qlist_end(&osm->plugin_list);\r
-            item = cl_qlist_next(item)) {\r
-               osm_epi_plugin_t *p = (osm_epi_plugin_t *)item;\r
-               if (p->impl->report)\r
-                       p->impl->report(p->plugin_data, event_id, event_data);\r
-       }\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_perfmgr.c b/branches/opensm_3/user/opensm/osm_perfmgr.c
deleted file mode 100644 (file)
index ce271aa..0000000
+++ /dev/null
@@ -1,1284 +0,0 @@
-/*\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- * Copyright (c) 2007-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_perfmgr_t.\r
- * This object implements an IBA performance manager.\r
- *\r
- * Author:\r
- *    Ira Weiny, LLNL\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-#include <stdlib.h>\r
-#include <stdint.h>\r
-#include <string.h>\r
-#include <poll.h>\r
-#include <errno.h>\r
-#include <sys/time.h>\r
-#include <netinet/in.h>\r
-#include <float.h>\r
-#include <arpa/inet.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_thread.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-#define PERFMGR_INITIAL_TID_VALUE 0xcafe\r
-\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-struct {\r
-       double fastest_us;\r
-       double slowest_us;\r
-       double avg_us;\r
-       uint64_t num;\r
-} perfmgr_mad_stats = {\r
-fastest_us: DBL_MAX, slowest_us: DBL_MIN, avg_us: 0, num:0};\r
-\r
-/* diff must be something which can fit in a susecond_t */\r
-static inline void update_mad_stats(struct timeval *diff)\r
-{\r
-       double new = (diff->tv_sec * 1000000) + diff->tv_usec;\r
-       if (new < perfmgr_mad_stats.fastest_us)\r
-               perfmgr_mad_stats.fastest_us = new;\r
-       if (new > perfmgr_mad_stats.slowest_us)\r
-               perfmgr_mad_stats.slowest_us = new;\r
-\r
-       perfmgr_mad_stats.avg_us =\r
-           ((perfmgr_mad_stats.avg_us * perfmgr_mad_stats.num) + new)\r
-           / (perfmgr_mad_stats.num + 1);\r
-       perfmgr_mad_stats.num++;\r
-}\r
-\r
-static inline void clear_mad_stats(void)\r
-{\r
-       perfmgr_mad_stats.fastest_us = DBL_MAX;\r
-       perfmgr_mad_stats.slowest_us = DBL_MIN;\r
-       perfmgr_mad_stats.avg_us = 0;\r
-       perfmgr_mad_stats.num = 0;\r
-}\r
-\r
-/* after and diff can be the same struct */\r
-static inline void diff_time(struct timeval *before, struct timeval *after,\r
-                            struct timeval *diff)\r
-{\r
-       struct timeval tmp = *after;\r
-       if (tmp.tv_usec < before->tv_usec) {\r
-               tmp.tv_sec--;\r
-               tmp.tv_usec += 1000000;\r
-       }\r
-       diff->tv_sec = tmp.tv_sec - before->tv_sec;\r
-       diff->tv_usec = tmp.tv_usec - before->tv_usec;\r
-}\r
-#endif\r
-\r
-/**********************************************************************\r
- * Internal helper functions.\r
- **********************************************************************/\r
-static void init_monitored_nodes(osm_perfmgr_t * pm)\r
-{\r
-       cl_qmap_init(&pm->monitored_map);\r
-       pm->remove_list = NULL;\r
-       cl_event_construct(&pm->sig_query);\r
-       cl_event_init(&pm->sig_query, FALSE);\r
-}\r
-\r
-static void mark_for_removal(osm_perfmgr_t * pm, monitored_node_t * node)\r
-{\r
-       if (pm->remove_list) {\r
-               node->next = pm->remove_list;\r
-               pm->remove_list = node;\r
-       } else {\r
-               node->next = NULL;\r
-               pm->remove_list = node;\r
-       }\r
-}\r
-\r
-static void remove_marked_nodes(osm_perfmgr_t * pm)\r
-{\r
-       while (pm->remove_list) {\r
-               monitored_node_t *next = pm->remove_list->next;\r
-\r
-               cl_qmap_remove_item(&pm->monitored_map,\r
-                                   (cl_map_item_t *) (pm->remove_list));\r
-\r
-               if (pm->remove_list->name)\r
-                       free(pm->remove_list->name);\r
-               free(pm->remove_list);\r
-               pm->remove_list = next;\r
-       }\r
-}\r
-\r
-static inline void decrement_outstanding_queries(osm_perfmgr_t * pm)\r
-{\r
-       cl_atomic_dec(&pm->outstanding_queries);\r
-       cl_event_signal(&pm->sig_query);\r
-}\r
-\r
-/**********************************************************************\r
- * Receive the MAD from the vendor layer and post it for processing by\r
- * the dispatcher.\r
- **********************************************************************/\r
-static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,\r
-                                     osm_madw_t * p_req_madw)\r
-{\r
-       osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_context;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       osm_madw_copy_context(p_madw, p_req_madw);\r
-       osm_mad_pool_put(pm->mad_pool, p_req_madw);\r
-\r
-       decrement_outstanding_queries(pm);\r
-\r
-       /* post this message for later processing. */\r
-       if (cl_disp_post(pm->pc_disp_h, OSM_MSG_MAD_PORT_COUNTERS,\r
-                        p_madw, NULL, NULL) != CL_SUCCESS) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C01: "\r
-                       "PerfMgr Dispatcher post failed\n");\r
-               osm_mad_pool_put(pm->mad_pool, p_madw);\r
-       }\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Process MAD send errors.\r
- **********************************************************************/\r
-static void perfmgr_mad_send_err_callback(void *bind_context,\r
-                                         osm_madw_t * p_madw)\r
-{\r
-       osm_perfmgr_t *pm = (osm_perfmgr_t *) bind_context;\r
-       osm_madw_context_t *context = &p_madw->context;\r
-       uint64_t node_guid = context->perfmgr_context.node_guid;\r
-       uint8_t port = context->perfmgr_context.port;\r
-       cl_map_item_t *p_node;\r
-       monitored_node_t *p_mon_node;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       /*\r
-        * get the monitored node struct to have the printable name\r
-        * for log messages\r
-        */\r
-       if ((p_node = cl_qmap_get(&pm->monitored_map, node_guid)) ==\r
-           cl_qmap_end(&pm->monitored_map)) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C15: GUID 0x%016"\r
-                       PRIx64 " not found in monitored map\n", node_guid);\r
-               goto Exit;\r
-       }\r
-       p_mon_node = (monitored_node_t *) p_node;\r
-\r
-       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C02: %s (0x%" PRIx64\r
-               ") port %u\n", p_mon_node->name, p_mon_node->guid, port);\r
-\r
-       if (pm->subn->opt.perfmgr_redir && p_madw->status == IB_TIMEOUT) {\r
-               /* First, find the node in the monitored map */\r
-               cl_plock_acquire(pm->lock);\r
-               /* Now, validate port number */\r
-               if (port >= p_mon_node->num_ports) {\r
-                       cl_plock_release(pm->lock);\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C16: "\r
-                               "Invalid port num %u for %s (GUID 0x%016"\r
-                               PRIx64 ") num ports %u\n", port,\r
-                               p_mon_node->name, p_mon_node->guid,\r
-                               p_mon_node->num_ports);\r
-                       goto Exit;\r
-               }\r
-               /* Clear redirection info */\r
-               p_mon_node->redir_port[port].redir_lid = 0;\r
-               p_mon_node->redir_port[port].redir_qp = 0;\r
-               cl_plock_release(pm->lock);\r
-       }\r
-\r
-Exit:\r
-       osm_mad_pool_put(pm->mad_pool, p_madw);\r
-\r
-       decrement_outstanding_queries(pm);\r
-\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Bind the PerfMgr to the vendor layer for MAD sends/receives\r
- **********************************************************************/\r
-ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * pm, ib_net64_t port_guid)\r
-{\r
-       osm_bind_info_t bind_info;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       if (pm->bind_handle != OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR,\r
-                       "ERR 4C03: Multiple binds not allowed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       bind_info.port_guid = port_guid;\r
-       bind_info.mad_class = IB_MCLASS_PERF;\r
-       bind_info.class_version = 1;\r
-       bind_info.is_responder = FALSE;\r
-       bind_info.is_report_processor = FALSE;\r
-       bind_info.is_trap_processor = FALSE;\r
-       bind_info.recv_q_size = OSM_PM_DEFAULT_QP1_RCV_SIZE;\r
-       bind_info.send_q_size = OSM_PM_DEFAULT_QP1_SEND_SIZE;\r
-       bind_info.timeout = pm->subn->opt.transaction_timeout;\r
-       bind_info.retries = pm->subn->opt.transaction_retries;\r
-\r
-       OSM_LOG(pm->log, OSM_LOG_VERBOSE,\r
-               "Binding to port GUID 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       pm->bind_handle = osm_vendor_bind(pm->vendor, &bind_info, pm->mad_pool,\r
-                                         perfmgr_mad_recv_callback,\r
-                                         perfmgr_mad_send_err_callback, pm);\r
-\r
-       if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {\r
-               status = IB_ERROR;\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR,\r
-                       "ERR 4C04: Vendor specific bind failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(pm->log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * Unbind the PerfMgr from the vendor layer for MAD sends/receives\r
- **********************************************************************/\r
-static void perfmgr_mad_unbind(osm_perfmgr_t * pm)\r
-{\r
-       OSM_LOG_ENTER(pm->log);\r
-       if (pm->bind_handle == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C05: No previous bind\n");\r
-               goto Exit;\r
-       }\r
-       osm_vendor_unbind(pm->bind_handle);\r
-Exit:\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Given a monitored node and a port, return the qp\r
- **********************************************************************/\r
-static ib_net32_t get_qp(monitored_node_t * mon_node, uint8_t port)\r
-{\r
-       ib_net32_t qp = IB_QP1;\r
-\r
-       if (mon_node && mon_node->num_ports && port < mon_node->num_ports &&\r
-           mon_node->redir_port[port].redir_lid &&\r
-           mon_node->redir_port[port].redir_qp)\r
-               qp = mon_node->redir_port[port].redir_qp;\r
-\r
-       return qp;\r
-}\r
-\r
-/**********************************************************************\r
- * Given a node, a port, and an optional monitored node,\r
- * return the appropriate lid to query that port\r
- **********************************************************************/\r
-static ib_net16_t get_lid(osm_node_t * p_node, uint8_t port,\r
-                         monitored_node_t * mon_node)\r
-{\r
-       if (mon_node && mon_node->num_ports && port < mon_node->num_ports &&\r
-           mon_node->redir_port[port].redir_lid)\r
-               return mon_node->redir_port[port].redir_lid;\r
-\r
-       switch (p_node->node_info.node_type) {\r
-       case IB_NODE_TYPE_CA:\r
-       case IB_NODE_TYPE_ROUTER:\r
-               return osm_node_get_base_lid(p_node, port);\r
-       case IB_NODE_TYPE_SWITCH:\r
-               return osm_node_get_base_lid(p_node, 0);\r
-       default:\r
-               return 0;\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Form and send the Port Counters MAD for a single port.\r
- **********************************************************************/\r
-static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,\r
-                                          ib_net16_t dest_lid,\r
-                                          ib_net32_t dest_qp, uint8_t port,\r
-                                          uint8_t mad_method,\r
-                                          osm_madw_context_t * p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_port_counters_t *port_counter = NULL;\r
-       ib_perfmgt_mad_t *pm_mad = NULL;\r
-       osm_madw_t *p_madw = NULL;\r
-\r
-       OSM_LOG_ENTER(perfmgr->log);\r
-\r
-       p_madw = osm_mad_pool_get(perfmgr->mad_pool, perfmgr->bind_handle,\r
-                                 MAD_BLOCK_SIZE, NULL);\r
-       if (p_madw == NULL)\r
-               return IB_INSUFFICIENT_MEMORY;\r
-\r
-       pm_mad = osm_madw_get_perfmgt_mad_ptr(p_madw);\r
-\r
-       /* build the mad */\r
-       pm_mad->header.base_ver = 1;\r
-       pm_mad->header.mgmt_class = IB_MCLASS_PERF;\r
-       pm_mad->header.class_ver = 1;\r
-       pm_mad->header.method = mad_method;\r
-       pm_mad->header.status = 0;\r
-       pm_mad->header.class_spec = 0;\r
-       pm_mad->header.trans_id =\r
-           cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id));\r
-       pm_mad->header.attr_id = IB_MAD_ATTR_PORT_CNTRS;\r
-       pm_mad->header.resv = 0;\r
-       pm_mad->header.attr_mod = 0;\r
-\r
-       port_counter = (ib_port_counters_t *) & pm_mad->data;\r
-       memset(port_counter, 0, sizeof(*port_counter));\r
-       port_counter->port_select = port;\r
-       port_counter->counter_select = 0xFFFF;\r
-\r
-       p_madw->mad_addr.dest_lid = dest_lid;\r
-       p_madw->mad_addr.addr_type.gsi.remote_qp = dest_qp;\r
-       p_madw->mad_addr.addr_type.gsi.remote_qkey =\r
-           cl_hton32(IB_QP1_WELL_KNOWN_Q_KEY);\r
-       /* FIXME what about other partitions */\r
-       p_madw->mad_addr.addr_type.gsi.pkey_ix = 0;\r
-       p_madw->mad_addr.addr_type.gsi.service_level = 0;\r
-       p_madw->mad_addr.addr_type.gsi.global_route = FALSE;\r
-       p_madw->resp_expected = TRUE;\r
-\r
-       if (p_context)\r
-               p_madw->context = *p_context;\r
-\r
-       status = osm_vendor_send(perfmgr->bind_handle, p_madw, TRUE);\r
-\r
-       if (status == IB_SUCCESS) {\r
-               /* pause thread if there are too many outstanding requests */\r
-               cl_atomic_inc(&(perfmgr->outstanding_queries));\r
-               if (perfmgr->outstanding_queries >\r
-                   perfmgr->max_outstanding_queries) {\r
-                       perfmgr->sweep_state = PERFMGR_SWEEP_SUSPENDED;\r
-                       cl_event_wait_on(&perfmgr->sig_query, EVENT_NO_TIMEOUT,\r
-                                        TRUE);\r
-                       perfmgr->sweep_state = PERFMGR_SWEEP_ACTIVE;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(perfmgr->log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * sweep the node_guid_tbl and collect the node guids to be tracked\r
- **********************************************************************/\r
-static void collect_guids(cl_map_item_t * p_map_item, void *context)\r
-{\r
-       osm_node_t *node = (osm_node_t *) p_map_item;\r
-       uint64_t node_guid = cl_ntoh64(node->node_info.node_guid);\r
-       osm_perfmgr_t *pm = (osm_perfmgr_t *) context;\r
-       monitored_node_t *mon_node = NULL;\r
-       uint32_t num_ports;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       if (cl_qmap_get(&pm->monitored_map, node_guid)\r
-           == cl_qmap_end(&pm->monitored_map)) {\r
-               /* if not already in map add it */\r
-               num_ports = osm_node_get_num_physp(node);\r
-               mon_node = malloc(sizeof(*mon_node) +\r
-                                 sizeof(redir_t) * num_ports);\r
-               if (!mon_node) {\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C06: "\r
-                               "malloc failed: not handling node %s"\r
-                               "(GUID 0x%" PRIx64 ")\n", node->print_desc,\r
-                               node_guid);\r
-                       goto Exit;\r
-               }\r
-               memset(mon_node, 0,\r
-                      sizeof(*mon_node) + sizeof(redir_t) * num_ports);\r
-               mon_node->guid = node_guid;\r
-               mon_node->name = strdup(node->print_desc);\r
-               mon_node->num_ports = num_ports;\r
-               /* check for enhanced switch port 0 */\r
-               mon_node->esp0 = (node->sw &&\r
-                                 ib_switch_info_is_enhanced_port0(&node->sw->\r
-                                                                  switch_info));\r
-               cl_qmap_insert(&pm->monitored_map, node_guid,\r
-                              (cl_map_item_t *) mon_node);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * query the Port Counters of all the nodes in the subnet.\r
- **********************************************************************/\r
-static void perfmgr_query_counters(cl_map_item_t * p_map_item, void *context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_perfmgr_t *pm = context;\r
-       osm_node_t *node = NULL;\r
-       monitored_node_t *mon_node = (monitored_node_t *) p_map_item;\r
-       osm_madw_context_t mad_context;\r
-       uint64_t node_guid = 0;\r
-       ib_net32_t remote_qp;\r
-       uint8_t port, num_ports = 0;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       cl_plock_acquire(pm->lock);\r
-       node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));\r
-       if (!node) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR,\r
-                       "ERR 4C07: Node \"%s\" (guid 0x%" PRIx64\r
-                       ") no longer exists so removing from PerfMgr monitoring\n",\r
-                       mon_node->name, mon_node->guid);\r
-               mark_for_removal(pm, mon_node);\r
-               goto Exit;\r
-       }\r
-\r
-       num_ports = osm_node_get_num_physp(node);\r
-       node_guid = cl_ntoh64(node->node_info.node_guid);\r
-\r
-       /* make sure there is a database object ready to store this info */\r
-       if (perfmgr_db_create_entry(pm->db, node_guid, mon_node->esp0,\r
-                                   num_ports, node->print_desc) !=\r
-           PERFMGR_EVENT_DB_SUCCESS) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR,\r
-                       "ERR 4C08: DB create entry failed for 0x%"\r
-                       PRIx64 " (%s) : %s\n", node_guid, node->print_desc,\r
-                       strerror(errno));\r
-               goto Exit;\r
-       }\r
-\r
-       /* issue the query for each port */\r
-       for (port = mon_node->esp0 ? 0 : 1; port < num_ports; port++) {\r
-               ib_net16_t lid;\r
-\r
-               if (!osm_node_get_physp_ptr(node, port))\r
-                       continue;\r
-\r
-               lid = get_lid(node, port, mon_node);\r
-               if (lid == 0) {\r
-                       OSM_LOG(pm->log, OSM_LOG_DEBUG, "WARN: node 0x%" PRIx64\r
-                               " port %d (%s): port out of range, skipping\n",\r
-                               cl_ntoh64(node->node_info.node_guid), port,\r
-                               node->print_desc);\r
-                       continue;\r
-               }\r
-\r
-               remote_qp = get_qp(mon_node, port);\r
-\r
-               mad_context.perfmgr_context.node_guid = node_guid;\r
-               mad_context.perfmgr_context.port = port;\r
-               mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_GET;\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-               gettimeofday(&mad_context.perfmgr_context.query_start, NULL);\r
-#endif\r
-               OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Getting stats for node 0x%"\r
-                       PRIx64 " port %d (lid %u) (%s)\n", node_guid, port,\r
-                       cl_ntoh16(lid), node->print_desc);\r
-               status = perfmgr_send_pc_mad(pm, lid, remote_qp, port,\r
-                                            IB_MAD_METHOD_GET, &mad_context);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C09: "\r
-                               "Failed to issue port counter query for node 0x%"\r
-                               PRIx64 " port %d (%s)\n",\r
-                               node->node_info.node_guid, port,\r
-                               node->print_desc);\r
-       }\r
-Exit:\r
-       cl_plock_release(pm->lock);\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Discovery stuff.\r
- * This code should not be here, but merged with main OpenSM\r
- **********************************************************************/\r
-extern int wait_for_pending_transactions(osm_stats_t * stats);\r
-extern void osm_drop_mgr_process(IN osm_sm_t * sm);\r
-\r
-static int sweep_hop_1(osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_bind_handle_t h_bind;\r
-       osm_madw_context_t context;\r
-       osm_node_t *p_node;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_dr_path_t hop_1_path;\r
-       ib_net64_t port_guid;\r
-       uint8_t port_num;\r
-       uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];\r
-       uint8_t num_ports;\r
-       osm_physp_t *p_ext_physp;\r
-\r
-       port_guid = sm->p_subn->sm_port_guid;\r
-\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 4C81: No SM port object\n");\r
-               return -1;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       port_num = ib_node_info_get_local_port_num(&p_node->node_info);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Probing hop 1 on local port %u\n", port_num);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-       CL_ASSERT(p_physp);\r
-\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-       h_bind = osm_dr_path_get_bind_handle(p_dr_path);\r
-\r
-       CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);\r
-\r
-       memset(path_array, 0, sizeof(path_array));\r
-       /* the hop_1 operations depend on the type of our node.\r
-        * Currently - legal nodes that can host SM are SW and CA */\r
-       switch (osm_node_get_type(p_node)) {\r
-       case IB_NODE_TYPE_CA:\r
-       case IB_NODE_TYPE_ROUTER:\r
-               memset(&context, 0, sizeof(context));\r
-               context.ni_context.node_guid = osm_node_get_node_guid(p_node);\r
-               context.ni_context.port_num = port_num;\r
-\r
-               path_array[1] = port_num;\r
-\r
-               osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);\r
-               status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,\r
-                                    CL_DISP_MSGID_NONE, &context);\r
-\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C82: "\r
-                               "Request for NodeInfo failed\n");\r
-               break;\r
-\r
-       case IB_NODE_TYPE_SWITCH:\r
-               /* Need to go over all the ports of the switch, and send a node_info\r
-                * from them. This doesn't include the port 0 of the switch, which\r
-                * hosts the SM.\r
-                * Note: We'll send another switchInfo on port 0, since if no ports\r
-                * are connected, we still want to get some response, and have the\r
-                * subnet come up.\r
-                */\r
-               num_ports = osm_node_get_num_physp(p_node);\r
-               for (port_num = 0; port_num < num_ports; port_num++) {\r
-                       /* go through the port only if the port is not DOWN */\r
-                       p_ext_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (!p_ext_physp || ib_port_info_get_port_state\r
-                           (&p_ext_physp->port_info) <= IB_LINK_DOWN)\r
-                               continue;\r
-\r
-                       memset(&context, 0, sizeof(context));\r
-                       context.ni_context.node_guid =\r
-                           osm_node_get_node_guid(p_node);\r
-                       context.ni_context.port_num = port_num;\r
-\r
-                       path_array[1] = port_num;\r
-\r
-                       osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);\r
-                       status = osm_req_get(sm, &hop_1_path,\r
-                                            IB_MAD_ATTR_NODE_INFO, 0,\r
-                                            CL_DISP_MSGID_NONE, &context);\r
-\r
-                       if (status != IB_SUCCESS)\r
-                               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C84: "\r
-                                       "Request for NodeInfo failed\n");\r
-               }\r
-               break;\r
-\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 4C83: Unknown node type %d\n",\r
-                       osm_node_get_type(p_node));\r
-       }\r
-\r
-       return status;\r
-}\r
-\r
-static unsigned is_sm_port_down(osm_sm_t * sm)\r
-{\r
-       ib_net64_t port_guid;\r
-       osm_port_t *p_port;\r
-\r
-       port_guid = sm->p_subn->sm_port_guid;\r
-       if (port_guid == 0)\r
-               return 1;\r
-\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4C85: "\r
-                       "SM port with GUID:%016" PRIx64 " is unknown\n",\r
-                       cl_ntoh64(port_guid));\r
-               return 1;\r
-       }\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       return osm_physp_get_port_state(p_port->p_physp) == IB_LINK_DOWN;\r
-}\r
-\r
-static int sweep_hop_0(osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status;\r
-       osm_dr_path_t dr_path;\r
-       osm_bind_handle_t h_bind;\r
-       uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];\r
-\r
-       memset(path_array, 0, sizeof(path_array));\r
-\r
-       h_bind = osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl);\r
-       if (h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "No bound ports\n");\r
-               return -1;\r
-       }\r
-\r
-       osm_dr_path_init(&dr_path, h_bind, 0, path_array);\r
-       status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,\r
-                            CL_DISP_MSGID_NONE, NULL);\r
-\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 4C86: Request for NodeInfo failed\n");\r
-\r
-       return status;\r
-}\r
-\r
-static void reset_node_count(cl_map_item_t * p_map_item, void *cxt)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) p_map_item;\r
-       p_node->discovery_count = 0;\r
-}\r
-\r
-static void reset_port_count(cl_map_item_t * p_map_item, void *cxt)\r
-{\r
-       osm_port_t *p_port = (osm_port_t *) p_map_item;\r
-       p_port->discovery_count = 0;\r
-}\r
-\r
-static void reset_switch_count(cl_map_item_t * p_map_item, void *cxt)\r
-{\r
-       osm_switch_t *p_sw = (osm_switch_t *) p_map_item;\r
-       p_sw->need_update = 0;\r
-}\r
-\r
-static int perfmgr_discovery(osm_opensm_t * osm)\r
-{\r
-       int ret;\r
-\r
-       CL_PLOCK_ACQUIRE(&osm->lock);\r
-       cl_qmap_apply_func(&osm->subn.node_guid_tbl, reset_node_count, NULL);\r
-       cl_qmap_apply_func(&osm->subn.port_guid_tbl, reset_port_count, NULL);\r
-       cl_qmap_apply_func(&osm->subn.sw_guid_tbl, reset_switch_count, NULL);\r
-       CL_PLOCK_RELEASE(&osm->lock);\r
-\r
-       osm->subn.in_sweep_hop_0 = TRUE;\r
-\r
-       ret = sweep_hop_0(&osm->sm);\r
-       if (ret)\r
-               goto _exit;\r
-\r
-       if (wait_for_pending_transactions(&osm->stats))\r
-               goto _exit;\r
-\r
-       if (is_sm_port_down(&osm->sm)) {\r
-               OSM_LOG(&osm->log, OSM_LOG_VERBOSE, "SM port is down\n");\r
-               goto _drop;\r
-       }\r
-\r
-       osm->subn.in_sweep_hop_0 = FALSE;\r
-\r
-       ret = sweep_hop_1(&osm->sm);\r
-       if (ret)\r
-               goto _exit;\r
-\r
-       if (wait_for_pending_transactions(&osm->stats))\r
-               goto _exit;\r
-\r
-_drop:\r
-       osm_drop_mgr_process(&osm->sm);\r
-\r
-_exit:\r
-       return ret;\r
-}\r
-\r
-/**********************************************************************\r
- * Main PerfMgr processor - query the performance counters.\r
- **********************************************************************/\r
-void osm_perfmgr_process(osm_perfmgr_t * pm)\r
-{\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-       struct timeval before, after;\r
-#endif\r
-\r
-       if (pm->state != PERFMGR_STATE_ENABLED)\r
-               return;\r
-\r
-       if (pm->subn->sm_state == IB_SMINFO_STATE_STANDBY ||\r
-           pm->subn->sm_state == IB_SMINFO_STATE_NOTACTIVE)\r
-               perfmgr_discovery(pm->subn->p_osm);\r
-\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-       gettimeofday(&before, NULL);\r
-#endif\r
-       pm->sweep_state = PERFMGR_SWEEP_ACTIVE;\r
-       /* With the global lock held, collect the node guids */\r
-       /* FIXME we should be able to track SA notices\r
-        * and not have to sweep the node_guid_tbl each pass\r
-        */\r
-       OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Gathering PerfMgr stats\n");\r
-       cl_plock_acquire(pm->lock);\r
-       cl_qmap_apply_func(&pm->subn->node_guid_tbl, collect_guids, pm);\r
-       cl_plock_release(pm->lock);\r
-\r
-       /* then for each node query their counters */\r
-       cl_qmap_apply_func(&pm->monitored_map, perfmgr_query_counters, pm);\r
-\r
-       /* clean out any nodes found to be removed during the sweep */\r
-       remove_marked_nodes(pm);\r
-\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-       /* spin on outstanding queries */\r
-       while (pm->outstanding_queries > 0)\r
-               cl_event_wait_on(&pm->sig_sweep, 1000, TRUE);\r
-\r
-       gettimeofday(&after, NULL);\r
-       diff_time(&before, &after, &after);\r
-       osm_log(pm->log, OSM_LOG_INFO,\r
-               "PerfMgr total sweep time : %ld.%06ld s\n"\r
-               "        fastest mad      : %g us\n"\r
-               "        slowest mad      : %g us\n"\r
-               "        average mad      : %g us\n",\r
-               after.tv_sec, after.tv_usec, perfmgr_mad_stats.fastest_us,\r
-               perfmgr_mad_stats.slowest_us, perfmgr_mad_stats.avg_us);\r
-       clear_mad_stats();\r
-#endif\r
-\r
-       pm->sweep_state = PERFMGR_SWEEP_SLEEP;\r
-}\r
-\r
-/**********************************************************************\r
- * PerfMgr timer - loop continuously and signal SM to run PerfMgr\r
- * processor if enabled.\r
- **********************************************************************/\r
-static void perfmgr_sweep(void *arg)\r
-{\r
-       osm_perfmgr_t *pm = arg;\r
-\r
-       if (pm->state == PERFMGR_STATE_ENABLED)\r
-               osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP);\r
-       cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);\r
-}\r
-\r
-void osm_perfmgr_shutdown(osm_perfmgr_t * pm)\r
-{\r
-       OSM_LOG_ENTER(pm->log);\r
-       cl_timer_stop(&pm->sweep_timer);\r
-       cl_disp_unregister(pm->pc_disp_h);\r
-       perfmgr_mad_unbind(pm);\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-void osm_perfmgr_destroy(osm_perfmgr_t * pm)\r
-{\r
-       OSM_LOG_ENTER(pm->log);\r
-       perfmgr_db_destroy(pm->db);\r
-       cl_timer_destroy(&pm->sweep_timer);\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Detect if someone else on the network could have cleared the counters\r
- * without us knowing.  This is easy to detect because the counters never\r
- * wrap but are "sticky"\r
- *\r
- * The one time this will not work is if the port is getting errors fast\r
- * enough to have the reading overtake the previous reading.  In this case,\r
- * counters will be missed.\r
- **********************************************************************/\r
-static void perfmgr_check_oob_clear(osm_perfmgr_t * pm,\r
-                                   monitored_node_t * mon_node, uint8_t port,\r
-                                   perfmgr_db_err_reading_t * cr,\r
-                                   perfmgr_db_data_cnt_reading_t * dc)\r
-{\r
-       perfmgr_db_err_reading_t prev_err;\r
-       perfmgr_db_data_cnt_reading_t prev_dc;\r
-\r
-       if (perfmgr_db_get_prev_err(pm->db, mon_node->guid, port, &prev_err)\r
-           != PERFMGR_EVENT_DB_SUCCESS) {\r
-               OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Failed to find previous "\r
-                       "error reading for %s (guid 0x%" PRIx64 ") port %u\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-               return;\r
-       }\r
-\r
-       if (cr->symbol_err_cnt < prev_err.symbol_err_cnt ||\r
-           cr->link_err_recover < prev_err.link_err_recover ||\r
-           cr->link_downed < prev_err.link_downed ||\r
-           cr->rcv_err < prev_err.rcv_err ||\r
-           cr->rcv_rem_phys_err < prev_err.rcv_rem_phys_err ||\r
-           cr->rcv_switch_relay_err < prev_err.rcv_switch_relay_err ||\r
-           cr->xmit_discards < prev_err.xmit_discards ||\r
-           cr->xmit_constraint_err < prev_err.xmit_constraint_err ||\r
-           cr->rcv_constraint_err < prev_err.rcv_constraint_err ||\r
-           cr->link_integrity < prev_err.link_integrity ||\r
-           cr->buffer_overrun < prev_err.buffer_overrun ||\r
-           cr->vl15_dropped < prev_err.vl15_dropped) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C0A: "\r
-                       "Detected an out of band error clear "\r
-                       "on %s (0x%" PRIx64 ") port %u\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-               perfmgr_db_clear_prev_err(pm->db, mon_node->guid, port);\r
-       }\r
-\r
-       /* FIXME handle extended counters */\r
-       if (perfmgr_db_get_prev_dc(pm->db, mon_node->guid, port, &prev_dc)\r
-           != PERFMGR_EVENT_DB_SUCCESS) {\r
-               OSM_LOG(pm->log, OSM_LOG_VERBOSE,\r
-                       "Failed to find previous data count "\r
-                       "reading for %s (0x%" PRIx64 ") port %u\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-               return;\r
-       }\r
-\r
-       if (dc->xmit_data < prev_dc.xmit_data ||\r
-           dc->rcv_data < prev_dc.rcv_data ||\r
-           dc->xmit_pkts < prev_dc.xmit_pkts ||\r
-           dc->rcv_pkts < prev_dc.rcv_pkts) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR,\r
-                       "PerfMgr: ERR 4C0B: Detected an out of band data counter "\r
-                       "clear on node %s (0x%" PRIx64 ") port %u\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-               perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Return 1 if the value is "close" to overflowing\r
- **********************************************************************/\r
-static int counter_overflow_4(uint8_t val)\r
-{\r
-       return (val >= 10);\r
-}\r
-\r
-static int counter_overflow_8(uint8_t val)\r
-{\r
-       return (val >= (UINT8_MAX - (UINT8_MAX / 4)));\r
-}\r
-\r
-static int counter_overflow_16(ib_net16_t val)\r
-{\r
-       return (cl_ntoh16(val) >= (UINT16_MAX - (UINT16_MAX / 4)));\r
-}\r
-\r
-static int counter_overflow_32(ib_net32_t val)\r
-{\r
-       return (cl_ntoh32(val) >= (UINT32_MAX - (UINT32_MAX / 4)));\r
-}\r
-\r
-/**********************************************************************\r
- * Check if the port counters have overflowed and if so issue a clear\r
- * MAD to the port.\r
- **********************************************************************/\r
-static void perfmgr_check_overflow(osm_perfmgr_t * pm,\r
-                                  monitored_node_t * mon_node, uint8_t port,\r
-                                  ib_port_counters_t * pc)\r
-{\r
-       osm_madw_context_t mad_context;\r
-       ib_api_status_t status;\r
-       ib_net32_t remote_qp;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       if (counter_overflow_16(pc->symbol_err_cnt) ||\r
-           counter_overflow_8(pc->link_err_recover) ||\r
-           counter_overflow_8(pc->link_downed) ||\r
-           counter_overflow_16(pc->rcv_err) ||\r
-           counter_overflow_16(pc->rcv_rem_phys_err) ||\r
-           counter_overflow_16(pc->rcv_switch_relay_err) ||\r
-           counter_overflow_16(pc->xmit_discards) ||\r
-           counter_overflow_8(pc->xmit_constraint_err) ||\r
-           counter_overflow_8(pc->rcv_constraint_err) ||\r
-           counter_overflow_4(PC_LINK_INT(pc->link_int_buffer_overrun)) ||\r
-           counter_overflow_4(PC_BUF_OVERRUN(pc->link_int_buffer_overrun)) ||\r
-           counter_overflow_16(pc->vl15_dropped) ||\r
-           counter_overflow_32(pc->xmit_data) ||\r
-           counter_overflow_32(pc->rcv_data) ||\r
-           counter_overflow_32(pc->xmit_pkts) ||\r
-           counter_overflow_32(pc->rcv_pkts)) {\r
-               osm_node_t *p_node = NULL;\r
-               ib_net16_t lid = 0;\r
-\r
-               osm_log(pm->log, OSM_LOG_VERBOSE,\r
-                       "PerfMgr: Counter overflow: %s (0x%" PRIx64\r
-                       ") port %d; clearing counters\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-\r
-               cl_plock_acquire(pm->lock);\r
-               p_node =\r
-                   osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));\r
-               lid = get_lid(p_node, port, mon_node);\r
-               cl_plock_release(pm->lock);\r
-               if (lid == 0) {\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C0C: "\r
-                               "Failed to clear counters for %s (0x%"\r
-                               PRIx64 ") port %d; failed to get lid\n",\r
-                               mon_node->name, mon_node->guid, port);\r
-                       goto Exit;\r
-               }\r
-\r
-               remote_qp = get_qp(NULL, port);\r
-\r
-               mad_context.perfmgr_context.node_guid = mon_node->guid;\r
-               mad_context.perfmgr_context.port = port;\r
-               mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_SET;\r
-               /* clear port counters */\r
-               status = perfmgr_send_pc_mad(pm, lid, remote_qp, port,\r
-                                            IB_MAD_METHOD_SET, &mad_context);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 4C11: "\r
-                               "Failed to send clear counters MAD for %s (0x%"\r
-                               PRIx64 ") port %d\n",\r
-                               mon_node->name, mon_node->guid, port);\r
-\r
-               perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Check values for logging of errors\r
- **********************************************************************/\r
-static void perfmgr_log_events(osm_perfmgr_t * pm,\r
-                              monitored_node_t * mon_node, uint8_t port,\r
-                              perfmgr_db_err_reading_t * reading)\r
-{\r
-       perfmgr_db_err_reading_t prev_read;\r
-       time_t time_diff = 0;\r
-       perfmgr_db_err_t err =\r
-           perfmgr_db_get_prev_err(pm->db, mon_node->guid, port, &prev_read);\r
-\r
-       if (err != PERFMGR_EVENT_DB_SUCCESS) {\r
-               OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Failed to find previous "\r
-                       "reading for %s (0x%" PRIx64 ") port %u\n",\r
-                       mon_node->name, mon_node->guid, port);\r
-               return;\r
-       }\r
-       time_diff = (reading->time - prev_read.time);\r
-\r
-       /* FIXME these events should be defineable by the user in a config\r
-        * file somewhere. */\r
-       if (reading->symbol_err_cnt > prev_read.symbol_err_cnt)\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0D: "\r
-                       "Found %" PRIu64 " Symbol errors in %lu sec on %s (0x%"\r
-                       PRIx64 ") port %u\n",\r
-                       reading->symbol_err_cnt - prev_read.symbol_err_cnt,\r
-                       time_diff, mon_node->name, mon_node->guid, port);\r
-\r
-       if (reading->rcv_err > prev_read.rcv_err)\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0E: "\r
-                       "Found %" PRIu64\r
-                       " Receive errors in %lu sec on %s (0x%" PRIx64\r
-                       ") port %u\n", reading->rcv_err - prev_read.rcv_err,\r
-                       time_diff, mon_node->name, mon_node->guid, port);\r
-\r
-       if (reading->xmit_discards > prev_read.xmit_discards)\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C0F: "\r
-                       "Found %" PRIu64 " Xmit Discards in %lu sec on %s (0x%"\r
-                       PRIx64 ") port %u\n",\r
-                       reading->xmit_discards - prev_read.xmit_discards,\r
-                       time_diff, mon_node->name, mon_node->guid, port);\r
-}\r
-\r
-/**********************************************************************\r
- * The dispatcher uses a thread pool which will call this function when\r
- * there is a thread available to process the mad received on the wire.\r
- **********************************************************************/\r
-static void pc_recv_process(void *context, void *data)\r
-{\r
-       osm_perfmgr_t *pm = context;\r
-       osm_madw_t *p_madw = data;\r
-       osm_madw_context_t *mad_context = &p_madw->context;\r
-       ib_port_counters_t *wire_read =\r
-           (ib_port_counters_t *) & osm_madw_get_perfmgt_mad_ptr(p_madw)->data;\r
-       ib_mad_t *p_mad = osm_madw_get_mad_ptr(p_madw);\r
-       uint64_t node_guid = mad_context->perfmgr_context.node_guid;\r
-       uint8_t port = mad_context->perfmgr_context.port;\r
-       perfmgr_db_err_reading_t err_reading;\r
-       perfmgr_db_data_cnt_reading_t data_reading;\r
-       cl_map_item_t *p_node;\r
-       monitored_node_t *p_mon_node;\r
-\r
-       OSM_LOG_ENTER(pm->log);\r
-\r
-       /*\r
-        * get the monitored node struct to have the printable name\r
-        * for log messages\r
-        */\r
-       if ((p_node = cl_qmap_get(&pm->monitored_map, node_guid)) ==\r
-           cl_qmap_end(&pm->monitored_map)) {\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C12: GUID 0x%016"\r
-                       PRIx64 " not found in monitored map\n", node_guid);\r
-               goto Exit;\r
-       }\r
-       p_mon_node = (monitored_node_t *) p_node;\r
-\r
-       OSM_LOG(pm->log, OSM_LOG_VERBOSE,\r
-               "Processing received MAD status 0x%x context 0x%"\r
-               PRIx64 " port %u\n", p_mad->status, node_guid, port);\r
-\r
-       CL_ASSERT(p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS ||\r
-                 p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO);\r
-\r
-       /* Response could also be redirection (IBM eHCA PMA does this) */\r
-       if (p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               ib_class_port_info_t *cpi =\r
-                   (ib_class_port_info_t *) &\r
-                   (osm_madw_get_perfmgt_mad_ptr(p_madw)->data);\r
-               ib_api_status_t status;\r
-\r
-               OSM_LOG(pm->log, OSM_LOG_VERBOSE,\r
-                       "Redirection to LID %u GID %s QP 0x%x received\n",\r
-                       cl_ntoh16(cpi->redir_lid),\r
-                       inet_ntop(AF_INET6, cpi->redir_gid.raw, gid_str,\r
-                                 sizeof gid_str), cl_ntoh32(cpi->redir_qp));\r
-\r
-               /* LID or GID redirection ? */\r
-               /* For GID redirection, need to get PathRecord from SA */\r
-               if (cpi->redir_lid == 0) {\r
-                       OSM_LOG(pm->log, OSM_LOG_VERBOSE,\r
-                               "GID redirection not currently implemented!\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               if (!pm->subn->opt.perfmgr_redir) {\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C16: "\r
-                               "redirection requested but disabled\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               /* LID redirection support (easier than GID redirection) */\r
-               cl_plock_acquire(pm->lock);\r
-               /* Now, validate port number */\r
-               if (port >= p_mon_node->num_ports) {\r
-                       cl_plock_release(pm->lock);\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C13: "\r
-                               "Invalid port num %d for GUID 0x%016"\r
-                               PRIx64 " num ports %d\n", port, node_guid,\r
-                               p_mon_node->num_ports);\r
-                       goto Exit;\r
-               }\r
-               p_mon_node->redir_port[port].redir_lid = cpi->redir_lid;\r
-               p_mon_node->redir_port[port].redir_qp = cpi->redir_qp;\r
-               cl_plock_release(pm->lock);\r
-\r
-               /* Finally, reissue the query to the redirected location */\r
-               status = perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,\r
-                                            port, mad_context->perfmgr_context.\r
-                                            mad_method, mad_context);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 4C14: "\r
-                               "Failed to send redirected MAD with method 0x%x for node 0x%"\r
-                               PRIx64 " port %d\n",\r
-                               mad_context->perfmgr_context.mad_method,\r
-                               node_guid, port);\r
-               goto Exit;\r
-       }\r
-\r
-       perfmgr_db_fill_err_read(wire_read, &err_reading);\r
-       /* FIXME separate query for extended counters if they are supported\r
-        * on the port.\r
-        */\r
-       perfmgr_db_fill_data_cnt_read_pc(wire_read, &data_reading);\r
-\r
-       /* detect an out of band clear on the port */\r
-       if (mad_context->perfmgr_context.mad_method != IB_MAD_METHOD_SET)\r
-               perfmgr_check_oob_clear(pm, p_mon_node, port, &err_reading,\r
-                                       &data_reading);\r
-\r
-       /* log any critical events from this reading */\r
-       perfmgr_log_events(pm, p_mon_node, port, &err_reading);\r
-\r
-       if (mad_context->perfmgr_context.mad_method == IB_MAD_METHOD_GET) {\r
-               perfmgr_db_add_err_reading(pm->db, node_guid, port,\r
-                                          &err_reading);\r
-               perfmgr_db_add_dc_reading(pm->db, node_guid, port,\r
-                                         &data_reading);\r
-       } else {\r
-               perfmgr_db_clear_prev_err(pm->db, node_guid, port);\r
-               perfmgr_db_clear_prev_dc(pm->db, node_guid, port);\r
-       }\r
-\r
-       perfmgr_check_overflow(pm, p_mon_node, port, wire_read);\r
-\r
-#if ENABLE_OSM_PERF_MGR_PROFILE\r
-       do {\r
-               struct timeval proc_time;\r
-               gettimeofday(&proc_time, NULL);\r
-               diff_time(&p_madw->context.perfmgr_context.query_start,\r
-                         &proc_time, &proc_time);\r
-               update_mad_stats(&proc_time);\r
-       } while (0);\r
-#endif\r
-\r
-Exit:\r
-       osm_mad_pool_put(pm->mad_pool, p_madw);\r
-\r
-       OSM_LOG_EXIT(pm->log);\r
-}\r
-\r
-/**********************************************************************\r
- * Initialize the PerfMgr object\r
- **********************************************************************/\r
-ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm,\r
-                                const osm_subn_opt_t * p_opt)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(&osm->log);\r
-\r
-       OSM_LOG(&osm->log, OSM_LOG_VERBOSE, "Initializing PerfMgr\n");\r
-\r
-       memset(pm, 0, sizeof(*pm));\r
-\r
-       cl_event_construct(&pm->sig_sweep);\r
-       cl_event_init(&pm->sig_sweep, FALSE);\r
-       pm->subn = &osm->subn;\r
-       pm->sm = &osm->sm;\r
-       pm->log = &osm->log;\r
-       pm->mad_pool = &osm->mad_pool;\r
-       pm->vendor = osm->p_vendor;\r
-       pm->trans_id = PERFMGR_INITIAL_TID_VALUE;\r
-       pm->lock = &osm->lock;\r
-       pm->state =\r
-           p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;\r
-       pm->sweep_time_s = p_opt->perfmgr_sweep_time_s;\r
-       pm->max_outstanding_queries = p_opt->perfmgr_max_outstanding_queries;\r
-       pm->osm = osm;\r
-\r
-       status = cl_timer_init(&pm->sweep_timer, perfmgr_sweep, pm);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = IB_INSUFFICIENT_RESOURCES;\r
-       pm->db = perfmgr_db_construct(pm);\r
-       if (!pm->db) {\r
-               pm->state = PERFMGR_STATE_NO_DB;\r
-               goto Exit;\r
-       }\r
-\r
-       pm->pc_disp_h = cl_disp_register(&osm->disp, OSM_MSG_MAD_PORT_COUNTERS,\r
-                                        pc_recv_process, pm);\r
-       if (pm->pc_disp_h == CL_DISP_INVALID_HANDLE) {\r
-               perfmgr_db_destroy(pm->db);\r
-               goto Exit;\r
-       }\r
-\r
-       init_monitored_nodes(pm);\r
-\r
-       cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(pm->log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * Clear the counters from the db\r
- **********************************************************************/\r
-void osm_perfmgr_clear_counters(osm_perfmgr_t * pm)\r
-{\r
-       /**\r
-        * FIXME todo issue clear on the fabric?\r
-        */\r
-       perfmgr_db_clear_counters(pm->db);\r
-       osm_log(pm->log, OSM_LOG_INFO, "PerfMgr counters cleared\n");\r
-}\r
-\r
-/*******************************************************************\r
- * Dump the DB information to the file specified\r
- *******************************************************************/\r
-void osm_perfmgr_dump_counters(osm_perfmgr_t * pm, perfmgr_db_dump_t dump_type)\r
-{\r
-       char path[256];\r
-       char *file_name;\r
-       if (pm->subn->opt.event_db_dump_file)\r
-               file_name = pm->subn->opt.event_db_dump_file;\r
-       else {\r
-               snprintf(path, sizeof(path), "%s/%s",\r
-                        pm->subn->opt.dump_files_dir,\r
-                        OSM_PERFMGR_DEFAULT_DUMP_FILE);\r
-               file_name = path;\r
-       }\r
-       if (perfmgr_db_dump(pm->db, file_name, dump_type) != 0)\r
-               OSM_LOG(pm->log, OSM_LOG_ERROR, "Failed to dump file %s : %s",\r
-                       file_name, strerror(errno));\r
-}\r
-\r
-/*******************************************************************\r
- * Print the DB information to the fp specified\r
- *******************************************************************/\r
-void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp)\r
-{\r
-       uint64_t guid = strtoull(nodename, NULL, 0);\r
-       if (guid == 0 && errno)\r
-               perfmgr_db_print_by_name(pm->db, nodename, fp);\r
-       else\r
-               perfmgr_db_print_by_guid(pm->db, guid, fp);\r
-}\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
diff --git a/branches/opensm_3/user/opensm/osm_perfmgr_db.c b/branches/opensm_3/user/opensm/osm_perfmgr_db.c
deleted file mode 100644 (file)
index ee0a92a..0000000
+++ /dev/null
@@ -1,818 +0,0 @@
-/*\r
- * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-\r
-#include <stdlib.h>\r
-#include <errno.h>\r
-#include <limits.h>\r
-#include <dlfcn.h>\r
-#include <sys/stat.h>\r
-\r
-#include <opensm/osm_perfmgr_db.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-static void free_node(db_node_t * node);\r
-\r
-/** =========================================================================\r
- */\r
-perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)\r
-{\r
-       perfmgr_db_t *db = malloc(sizeof(*db));\r
-       if (!db)\r
-               return NULL;\r
-\r
-       cl_qmap_init(&db->pc_data);\r
-       cl_plock_construct(&db->lock);\r
-       cl_plock_init(&db->lock);\r
-       db->perfmgr = perfmgr;\r
-       return db;\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-void perfmgr_db_destroy(perfmgr_db_t * db)\r
-{\r
-       cl_map_item_t *item, *next_item;\r
-\r
-       if (db) {\r
-               item = cl_qmap_head(&db->pc_data);\r
-               while (item != cl_qmap_end(&db->pc_data)) {\r
-                       next_item = cl_qmap_next(item);\r
-                       free_node((db_node_t *)item);\r
-                       item = next_item;\r
-               }\r
-               cl_plock_destroy(&db->lock);\r
-               free(db);\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Internal call db->lock should be held when calling\r
- **********************************************************************/\r
-static inline db_node_t *get(perfmgr_db_t * db, uint64_t guid)\r
-{\r
-       cl_map_item_t *rc = cl_qmap_get(&db->pc_data, guid);\r
-       const cl_map_item_t *end = cl_qmap_end(&db->pc_data);\r
-\r
-       if (rc == end)\r
-               return NULL;\r
-       return (db_node_t *) rc;\r
-}\r
-\r
-static inline perfmgr_db_err_t bad_node_port(db_node_t * node, uint8_t port)\r
-{\r
-       if (!node)\r
-               return PERFMGR_EVENT_DB_GUIDNOTFOUND;\r
-       if (port >= node->num_ports || (!node->esp0 && port == 0))\r
-               return PERFMGR_EVENT_DB_PORTNOTFOUND;\r
-       return PERFMGR_EVENT_DB_SUCCESS;\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static db_node_t *malloc_node(uint64_t guid, boolean_t esp0,\r
-                             uint8_t num_ports, char *name)\r
-{\r
-       int i = 0;\r
-       time_t cur_time = 0;\r
-       db_node_t *rc = malloc(sizeof(*rc));\r
-       if (!rc)\r
-               return NULL;\r
-\r
-       rc->ports = calloc(num_ports, sizeof(db_port_t));\r
-       if (!rc->ports)\r
-               goto free_rc;\r
-       rc->num_ports = num_ports;\r
-       rc->node_guid = guid;\r
-       rc->esp0 = esp0;\r
-\r
-       cur_time = time(NULL);\r
-       for (i = 0; i < num_ports; i++) {\r
-               rc->ports[i].last_reset = cur_time;\r
-               rc->ports[i].err_previous.time = cur_time;\r
-               rc->ports[i].dc_previous.time = cur_time;\r
-       }\r
-       snprintf(rc->node_name, sizeof(rc->node_name), "%s", name);\r
-\r
-       return rc;\r
-\r
-free_rc:\r
-       free(rc);\r
-       return NULL;\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void free_node(db_node_t * node)\r
-{\r
-       if (!node)\r
-               return;\r
-       if (node->ports)\r
-               free(node->ports);\r
-       free(node);\r
-}\r
-\r
-/* insert nodes to the database */\r
-static perfmgr_db_err_t insert(perfmgr_db_t * db, db_node_t * node)\r
-{\r
-       cl_map_item_t *rc = cl_qmap_insert(&db->pc_data, node->node_guid,\r
-                                          (cl_map_item_t *) node);\r
-\r
-       if ((void *)rc != (void *)node)\r
-               return PERFMGR_EVENT_DB_FAIL;\r
-       return PERFMGR_EVENT_DB_SUCCESS;\r
-}\r
-\r
-perfmgr_db_err_t\r
-perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0,\r
-                       uint8_t num_ports, char *name)\r
-{\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-\r
-       cl_plock_excl_acquire(&db->lock);\r
-       if (!get(db, guid)) {\r
-               db_node_t *pc_node = malloc_node(guid, esp0, num_ports,\r
-                                                name);\r
-               if (!pc_node) {\r
-                       rc = PERFMGR_EVENT_DB_NOMEM;\r
-                       goto Exit;\r
-               }\r
-               if (insert(db, pc_node)) {\r
-                       free_node(pc_node);\r
-                       rc = PERFMGR_EVENT_DB_FAIL;\r
-                       goto Exit;\r
-               }\r
-       }\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-/**********************************************************************\r
- * Dump a reading vs the previous reading to stdout\r
- **********************************************************************/\r
-static inline void\r
-debug_dump_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,\r
-                      db_port_t * port, perfmgr_db_err_reading_t * cur)\r
-{\r
-       osm_log_t *log = db->perfmgr->log;\r
-\r
-       if (!osm_log_is_active(log, OSM_LOG_DEBUG))\r
-               return;         /* optimize this a bit */\r
-\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "GUID 0x%" PRIx64 " Port %u:\n", guid, port_num);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "sym %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->symbol_err_cnt, port->err_previous.symbol_err_cnt,\r
-               port->err_total.symbol_err_cnt);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "ler %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->link_err_recover, port->err_previous.link_err_recover,\r
-               port->err_total.link_err_recover);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "ld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->link_downed, port->err_previous.link_downed,\r
-               port->err_total.link_downed);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "re %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_err,\r
-               port->err_previous.rcv_err, port->err_total.rcv_err);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "rrp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->rcv_rem_phys_err, port->err_previous.rcv_rem_phys_err,\r
-               port->err_total.rcv_rem_phys_err);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "rsr %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->rcv_switch_relay_err,\r
-               port->err_previous.rcv_switch_relay_err,\r
-               port->err_total.rcv_switch_relay_err);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->xmit_discards, port->err_previous.xmit_discards,\r
-               port->err_total.xmit_discards);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "xce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->xmit_constraint_err,\r
-               port->err_previous.xmit_constraint_err,\r
-               port->err_total.xmit_constraint_err);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "rce %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->rcv_constraint_err, port->err_previous.rcv_constraint_err,\r
-               port->err_total.rcv_constraint_err);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "li %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->link_integrity, port->err_previous.link_integrity,\r
-               port->err_total.link_integrity);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "bo %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->buffer_overrun, port->err_previous.buffer_overrun,\r
-               port->err_total.buffer_overrun);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "vld %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->vl15_dropped, port->err_previous.vl15_dropped,\r
-               port->err_total.vl15_dropped);\r
-}\r
-\r
-/**********************************************************************\r
- * perfmgr_db_err_reading_t functions\r
- **********************************************************************/\r
-perfmgr_db_err_t\r
-perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,\r
-                          perfmgr_db_err_reading_t * reading)\r
-{\r
-       db_port_t *p_port = NULL;\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_err_reading_t *previous = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-       osm_epi_pe_event_t epi_pe_data;\r
-\r
-       cl_plock_excl_acquire(&db->lock);\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_port = &(node->ports[port]);\r
-       previous = &(node->ports[port].err_previous);\r
-\r
-       debug_dump_err_reading(db, guid, port, p_port, reading);\r
-\r
-       epi_pe_data.time_diff_s = (reading->time - previous->time);\r
-       osm_epi_create_port_id(&epi_pe_data.port_id, guid, port,\r
-                              node->node_name);\r
-\r
-       /* calculate changes from previous reading */\r
-       epi_pe_data.symbol_err_cnt =\r
-           (reading->symbol_err_cnt - previous->symbol_err_cnt);\r
-       p_port->err_total.symbol_err_cnt += epi_pe_data.symbol_err_cnt;\r
-       epi_pe_data.link_err_recover =\r
-           (reading->link_err_recover - previous->link_err_recover);\r
-       p_port->err_total.link_err_recover += epi_pe_data.link_err_recover;\r
-       epi_pe_data.link_downed =\r
-           (reading->link_downed - previous->link_downed);\r
-       p_port->err_total.link_downed += epi_pe_data.link_downed;\r
-       epi_pe_data.rcv_err = (reading->rcv_err - previous->rcv_err);\r
-       p_port->err_total.rcv_err += epi_pe_data.rcv_err;\r
-       epi_pe_data.rcv_rem_phys_err =\r
-           (reading->rcv_rem_phys_err - previous->rcv_rem_phys_err);\r
-       p_port->err_total.rcv_rem_phys_err += epi_pe_data.rcv_rem_phys_err;\r
-       epi_pe_data.rcv_switch_relay_err =\r
-           (reading->rcv_switch_relay_err - previous->rcv_switch_relay_err);\r
-       p_port->err_total.rcv_switch_relay_err +=\r
-           epi_pe_data.rcv_switch_relay_err;\r
-       epi_pe_data.xmit_discards =\r
-           (reading->xmit_discards - previous->xmit_discards);\r
-       p_port->err_total.xmit_discards += epi_pe_data.xmit_discards;\r
-       epi_pe_data.xmit_constraint_err =\r
-           (reading->xmit_constraint_err - previous->xmit_constraint_err);\r
-       p_port->err_total.xmit_constraint_err +=\r
-           epi_pe_data.xmit_constraint_err;\r
-       epi_pe_data.rcv_constraint_err =\r
-           (reading->rcv_constraint_err - previous->rcv_constraint_err);\r
-       p_port->err_total.rcv_constraint_err += epi_pe_data.rcv_constraint_err;\r
-       epi_pe_data.link_integrity =\r
-           (reading->link_integrity - previous->link_integrity);\r
-       p_port->err_total.link_integrity += epi_pe_data.link_integrity;\r
-       epi_pe_data.buffer_overrun =\r
-           (reading->buffer_overrun - previous->buffer_overrun);\r
-       p_port->err_total.buffer_overrun += epi_pe_data.buffer_overrun;\r
-       epi_pe_data.vl15_dropped =\r
-           (reading->vl15_dropped - previous->vl15_dropped);\r
-       p_port->err_total.vl15_dropped += epi_pe_data.vl15_dropped;\r
-\r
-       p_port->err_previous = *reading;\r
-\r
-       osm_opensm_report_event(db->perfmgr->osm, OSM_EVENT_ID_PORT_ERRORS,\r
-                               &epi_pe_data);\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid,\r
-                                        uint8_t port,\r
-                                        perfmgr_db_err_reading_t * reading)\r
-{\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-\r
-       cl_plock_acquire(&db->lock);\r
-\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       *reading = node->ports[port].err_previous;\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-perfmgr_db_err_t\r
-perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port)\r
-{\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_err_reading_t *previous = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-\r
-       cl_plock_excl_acquire(&db->lock);\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       previous = &(node->ports[port].err_previous);\r
-\r
-       memset(previous, 0, sizeof(*previous));\r
-       node->ports[port].err_previous.time = time(NULL);\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-static inline void\r
-debug_dump_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,\r
-                     db_port_t * port, perfmgr_db_data_cnt_reading_t * cur)\r
-{\r
-       osm_log_t *log = db->perfmgr->log;\r
-       if (!osm_log_is_active(log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->xmit_data, port->dc_previous.xmit_data,\r
-               port->dc_total.xmit_data);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "rd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_data,\r
-               port->dc_previous.rcv_data, port->dc_total.rcv_data);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "xp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",\r
-               cur->xmit_pkts, port->dc_previous.xmit_pkts,\r
-               port->dc_total.xmit_pkts);\r
-       osm_log(log, OSM_LOG_DEBUG,\r
-               "rp %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n", cur->rcv_pkts,\r
-               port->dc_previous.rcv_pkts, port->dc_total.rcv_pkts);\r
-}\r
-\r
-/**********************************************************************\r
- * perfmgr_db_data_cnt_reading_t functions\r
- **********************************************************************/\r
-perfmgr_db_err_t\r
-perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,\r
-                         perfmgr_db_data_cnt_reading_t * reading)\r
-{\r
-       db_port_t *p_port = NULL;\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_data_cnt_reading_t *previous = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-       osm_epi_dc_event_t epi_dc_data;\r
-\r
-       cl_plock_excl_acquire(&db->lock);\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_port = &node->ports[port];\r
-       previous = &node->ports[port].dc_previous;\r
-\r
-       debug_dump_dc_reading(db, guid, port, p_port, reading);\r
-\r
-       epi_dc_data.time_diff_s = reading->time - previous->time;\r
-       osm_epi_create_port_id(&epi_dc_data.port_id, guid, port,\r
-                              node->node_name);\r
-\r
-       /* calculate changes from previous reading */\r
-       epi_dc_data.xmit_data = reading->xmit_data - previous->xmit_data;\r
-       p_port->dc_total.xmit_data += epi_dc_data.xmit_data;\r
-       epi_dc_data.rcv_data = reading->rcv_data - previous->rcv_data;\r
-       p_port->dc_total.rcv_data += epi_dc_data.rcv_data;\r
-       epi_dc_data.xmit_pkts = reading->xmit_pkts - previous->xmit_pkts;\r
-       p_port->dc_total.xmit_pkts += epi_dc_data.xmit_pkts;\r
-       epi_dc_data.rcv_pkts = reading->rcv_pkts - previous->rcv_pkts;\r
-       p_port->dc_total.rcv_pkts += epi_dc_data.rcv_pkts;\r
-       epi_dc_data.unicast_xmit_pkts =\r
-           reading->unicast_xmit_pkts - previous->unicast_xmit_pkts;\r
-       p_port->dc_total.unicast_xmit_pkts += epi_dc_data.unicast_xmit_pkts;\r
-       epi_dc_data.unicast_rcv_pkts =\r
-           reading->unicast_rcv_pkts - previous->unicast_rcv_pkts;\r
-       p_port->dc_total.unicast_rcv_pkts += epi_dc_data.unicast_rcv_pkts;\r
-       epi_dc_data.multicast_xmit_pkts =\r
-           reading->multicast_xmit_pkts - previous->multicast_xmit_pkts;\r
-       p_port->dc_total.multicast_xmit_pkts += epi_dc_data.multicast_xmit_pkts;\r
-       epi_dc_data.multicast_rcv_pkts =\r
-           reading->multicast_rcv_pkts - previous->multicast_rcv_pkts;\r
-       p_port->dc_total.multicast_rcv_pkts += epi_dc_data.multicast_rcv_pkts;\r
-\r
-       p_port->dc_previous = *reading;\r
-\r
-       osm_opensm_report_event(db->perfmgr->osm,\r
-                               OSM_EVENT_ID_PORT_DATA_COUNTERS, &epi_dc_data);\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,\r
-                                       uint8_t port,\r
-                                       perfmgr_db_data_cnt_reading_t * reading)\r
-{\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-\r
-       cl_plock_acquire(&db->lock);\r
-\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       *reading = node->ports[port].dc_previous;\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-perfmgr_db_err_t\r
-perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port)\r
-{\r
-       db_node_t *node = NULL;\r
-       perfmgr_db_data_cnt_reading_t *previous = NULL;\r
-       perfmgr_db_err_t rc = PERFMGR_EVENT_DB_SUCCESS;\r
-\r
-       cl_plock_excl_acquire(&db->lock);\r
-       node = get(db, guid);\r
-       if ((rc = bad_node_port(node, port)) != PERFMGR_EVENT_DB_SUCCESS)\r
-               goto Exit;\r
-\r
-       previous = &node->ports[port].dc_previous;\r
-\r
-       memset(previous, 0, sizeof(*previous));\r
-       node->ports[port].dc_previous.time = time(NULL);\r
-\r
-Exit:\r
-       cl_plock_release(&db->lock);\r
-       return rc;\r
-}\r
-\r
-static void clear_counters(cl_map_item_t * const p_map_item, void *context)\r
-{\r
-       db_node_t *node = (db_node_t *) p_map_item;\r
-       int i = 0;\r
-       time_t ts = time(NULL);\r
-\r
-       for (i = 0; i < node->num_ports; i++) {\r
-               node->ports[i].err_total.symbol_err_cnt = 0;\r
-               node->ports[i].err_total.link_err_recover = 0;\r
-               node->ports[i].err_total.link_downed = 0;\r
-               node->ports[i].err_total.rcv_err = 0;\r
-               node->ports[i].err_total.rcv_rem_phys_err = 0;\r
-               node->ports[i].err_total.rcv_switch_relay_err = 0;\r
-               node->ports[i].err_total.xmit_discards = 0;\r
-               node->ports[i].err_total.xmit_constraint_err = 0;\r
-               node->ports[i].err_total.rcv_constraint_err = 0;\r
-               node->ports[i].err_total.link_integrity = 0;\r
-               node->ports[i].err_total.buffer_overrun = 0;\r
-               node->ports[i].err_total.vl15_dropped = 0;\r
-               node->ports[i].err_total.time = ts;\r
-\r
-               node->ports[i].dc_total.xmit_data = 0;\r
-               node->ports[i].dc_total.rcv_data = 0;\r
-               node->ports[i].dc_total.xmit_pkts = 0;\r
-               node->ports[i].dc_total.rcv_pkts = 0;\r
-               node->ports[i].dc_total.unicast_xmit_pkts = 0;\r
-               node->ports[i].dc_total.unicast_rcv_pkts = 0;\r
-               node->ports[i].dc_total.multicast_xmit_pkts = 0;\r
-               node->ports[i].dc_total.multicast_rcv_pkts = 0;\r
-               node->ports[i].dc_total.time = ts;\r
-\r
-               node->ports[i].last_reset = ts;\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Clear all the counters from the db\r
- **********************************************************************/\r
-void perfmgr_db_clear_counters(perfmgr_db_t * db)\r
-{\r
-       cl_plock_excl_acquire(&db->lock);\r
-       cl_qmap_apply_func(&db->pc_data, clear_counters, (void *)db);\r
-       cl_plock_release(&db->lock);\r
-#if 0\r
-       if (db->db_impl->clear_counters)\r
-               db->db_impl->clear_counters(db->db_data);\r
-#endif\r
-}\r
-\r
-/**********************************************************************\r
- * Output a tab delimited output of the port counters\r
- **********************************************************************/\r
-static void dump_node_mr(db_node_t * node, FILE * fp)\r
-{\r
-       int i = 0;\r
-\r
-       fprintf(fp, "\nName\tGUID\tPort\tLast Reset\t"\r
-               "%s\t%s\t"\r
-               "%s\t%s\t%s\t%s\t%s\t%s\t%s\t"\r
-               "%s\t%s\t%s\t%s\t%s\t%s\t%s\t"\r
-               "%s\t%s\t%s\t%s\n",\r
-               "symbol_err_cnt",\r
-               "link_err_recover",\r
-               "link_downed",\r
-               "rcv_err",\r
-               "rcv_rem_phys_err",\r
-               "rcv_switch_relay_err",\r
-               "xmit_discards",\r
-               "xmit_constraint_err",\r
-               "rcv_constraint_err",\r
-               "link_int_err",\r
-               "buf_overrun_err",\r
-               "vl15_dropped",\r
-               "xmit_data",\r
-               "rcv_data",\r
-               "xmit_pkts",\r
-               "rcv_pkts",\r
-               "unicast_xmit_pkts",\r
-               "unicast_rcv_pkts",\r
-               "multicast_xmit_pkts",\r
-               "multicast_rcv_pkts");\r
-       for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {\r
-               char *since = ctime(&node->ports[i].last_reset);\r
-               since[strlen(since) - 1] = '\0';        /* remove \n */\r
-\r
-               fprintf(fp,\r
-                       "%s\t0x%" PRIx64 "\t%d\t%s\t%" PRIu64 "\t%" PRIu64 "\t"\r
-                       "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t"\r
-                       "%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64\r
-                       "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64\r
-                       "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64\r
-                       "\t%" PRIu64 "\t%" PRIu64 "\n", node->node_name,\r
-                       node->node_guid, i, since,\r
-                       node->ports[i].err_total.symbol_err_cnt,\r
-                       node->ports[i].err_total.link_err_recover,\r
-                       node->ports[i].err_total.link_downed,\r
-                       node->ports[i].err_total.rcv_err,\r
-                       node->ports[i].err_total.rcv_rem_phys_err,\r
-                       node->ports[i].err_total.rcv_switch_relay_err,\r
-                       node->ports[i].err_total.xmit_discards,\r
-                       node->ports[i].err_total.xmit_constraint_err,\r
-                       node->ports[i].err_total.rcv_constraint_err,\r
-                       node->ports[i].err_total.link_integrity,\r
-                       node->ports[i].err_total.buffer_overrun,\r
-                       node->ports[i].err_total.vl15_dropped,\r
-                       node->ports[i].dc_total.xmit_data,\r
-                       node->ports[i].dc_total.rcv_data,\r
-                       node->ports[i].dc_total.xmit_pkts,\r
-                       node->ports[i].dc_total.rcv_pkts,\r
-                       node->ports[i].dc_total.unicast_xmit_pkts,\r
-                       node->ports[i].dc_total.unicast_rcv_pkts,\r
-                       node->ports[i].dc_total.multicast_xmit_pkts,\r
-                       node->ports[i].dc_total.multicast_rcv_pkts);\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * Output a human readable output of the port counters\r
- **********************************************************************/\r
-static void dump_node_hr(db_node_t * node, FILE * fp)\r
-{\r
-       int i = 0;\r
-\r
-       fprintf(fp, "\n");\r
-       for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {\r
-               char *since = ctime(&node->ports[i].last_reset);\r
-               since[strlen(since) - 1] = '\0';        /* remove \n */\r
-\r
-               fprintf(fp, "\"%s\" 0x%" PRIx64 " port %d (Since %s)\n"\r
-                       "     symbol_err_cnt       : %" PRIu64 "\n"\r
-                       "     link_err_recover     : %" PRIu64 "\n"\r
-                       "     link_downed          : %" PRIu64 "\n"\r
-                       "     rcv_err              : %" PRIu64 "\n"\r
-                       "     rcv_rem_phys_err     : %" PRIu64 "\n"\r
-                       "     rcv_switch_relay_err : %" PRIu64 "\n"\r
-                       "     xmit_discards        : %" PRIu64 "\n"\r
-                       "     xmit_constraint_err  : %" PRIu64 "\n"\r
-                       "     rcv_constraint_err   : %" PRIu64 "\n"\r
-                       "     link_integrity_err   : %" PRIu64 "\n"\r
-                       "     buf_overrun_err      : %" PRIu64 "\n"\r
-                       "     vl15_dropped         : %" PRIu64 "\n"\r
-                       "     xmit_data            : %" PRIu64 "\n"\r
-                       "     rcv_data             : %" PRIu64 "\n"\r
-                       "     xmit_pkts            : %" PRIu64 "\n"\r
-                       "     rcv_pkts             : %" PRIu64 "\n"\r
-                       "     unicast_xmit_pkts    : %" PRIu64 "\n"\r
-                       "     unicast_rcv_pkts     : %" PRIu64 "\n"\r
-                       "     multicast_xmit_pkts  : %" PRIu64 "\n"\r
-                       "     multicast_rcv_pkts   : %" PRIu64 "\n",\r
-                       node->node_name,\r
-                       node->node_guid,\r
-                       i,\r
-                       since,\r
-                       node->ports[i].err_total.symbol_err_cnt,\r
-                       node->ports[i].err_total.link_err_recover,\r
-                       node->ports[i].err_total.link_downed,\r
-                       node->ports[i].err_total.rcv_err,\r
-                       node->ports[i].err_total.rcv_rem_phys_err,\r
-                       node->ports[i].err_total.rcv_switch_relay_err,\r
-                       node->ports[i].err_total.xmit_discards,\r
-                       node->ports[i].err_total.xmit_constraint_err,\r
-                       node->ports[i].err_total.rcv_constraint_err,\r
-                       node->ports[i].err_total.link_integrity,\r
-                       node->ports[i].err_total.buffer_overrun,\r
-                       node->ports[i].err_total.vl15_dropped,\r
-                       node->ports[i].dc_total.xmit_data,\r
-                       node->ports[i].dc_total.rcv_data,\r
-                       node->ports[i].dc_total.xmit_pkts,\r
-                       node->ports[i].dc_total.rcv_pkts,\r
-                       node->ports[i].dc_total.unicast_xmit_pkts,\r
-                       node->ports[i].dc_total.unicast_rcv_pkts,\r
-                       node->ports[i].dc_total.multicast_xmit_pkts,\r
-                       node->ports[i].dc_total.multicast_rcv_pkts);\r
-       }\r
-}\r
-\r
-/* Define a context for the __db_dump callback */\r
-typedef struct {\r
-       FILE *fp;\r
-       perfmgr_db_dump_t dump_type;\r
-} dump_context_t;\r
-\r
-static void db_dump(cl_map_item_t * const p_map_item, void *context)\r
-{\r
-       db_node_t *node = (db_node_t *) p_map_item;\r
-       dump_context_t *c = (dump_context_t *) context;\r
-       FILE *fp = c->fp;\r
-\r
-       switch (c->dump_type) {\r
-       case PERFMGR_EVENT_DB_DUMP_MR:\r
-               dump_node_mr(node, fp);\r
-               break;\r
-       case PERFMGR_EVENT_DB_DUMP_HR:\r
-       default:\r
-               dump_node_hr(node, fp);\r
-               break;\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * print node data to fp\r
- **********************************************************************/\r
-void\r
-perfmgr_db_print_by_name(perfmgr_db_t * db, char *nodename, FILE *fp)\r
-{\r
-       cl_map_item_t *item;\r
-       db_node_t *node;\r
-\r
-       cl_plock_acquire(&db->lock);\r
-\r
-       /* find the node */\r
-       item = cl_qmap_head(&db->pc_data);\r
-       while (item != cl_qmap_end(&db->pc_data)) {\r
-               node = (db_node_t *)item;\r
-               if (strcmp(node->node_name, nodename) == 0) {\r
-                       dump_node_hr(node, fp);\r
-                       goto done;\r
-               }\r
-               item = cl_qmap_next(item);\r
-       }\r
-\r
-       fprintf(fp, "Node %s not found...\n", nodename);\r
-done:\r
-       cl_plock_release(&db->lock);\r
-}\r
-\r
-/**********************************************************************\r
- * print node data to fp\r
- **********************************************************************/\r
-void\r
-perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp)\r
-{\r
-       cl_map_item_t *node;\r
-\r
-       cl_plock_acquire(&db->lock);\r
-\r
-       node = cl_qmap_get(&db->pc_data, nodeguid);\r
-       if (node != cl_qmap_end(&db->pc_data))\r
-               dump_node_hr((db_node_t *)node, fp);\r
-       else\r
-               fprintf(fp, "Node 0x%" PRIx64 " not found...\n", nodeguid);\r
-\r
-       cl_plock_release(&db->lock);\r
-}\r
-\r
-/**********************************************************************\r
- * dump the data to the file "file"\r
- **********************************************************************/\r
-perfmgr_db_err_t\r
-perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type)\r
-{\r
-       dump_context_t context;\r
-\r
-       context.fp = fopen(file, "w+");\r
-       if (!context.fp)\r
-               return PERFMGR_EVENT_DB_FAIL;\r
-       context.dump_type = dump_type;\r
-\r
-       cl_plock_acquire(&db->lock);\r
-       cl_qmap_apply_func(&db->pc_data, db_dump, (void *)&context);\r
-       cl_plock_release(&db->lock);\r
-       fclose(context.fp);\r
-       return PERFMGR_EVENT_DB_SUCCESS;\r
-}\r
-\r
-/**********************************************************************\r
- * Fill in the various DB objects from their wire counter parts\r
- **********************************************************************/\r
-void\r
-perfmgr_db_fill_err_read(ib_port_counters_t * wire_read,\r
-                        perfmgr_db_err_reading_t * reading)\r
-{\r
-       reading->symbol_err_cnt = cl_ntoh16(wire_read->symbol_err_cnt);\r
-       reading->link_err_recover = cl_ntoh16(wire_read->link_err_recover);\r
-       reading->link_downed = wire_read->link_downed;\r
-       reading->rcv_err = wire_read->rcv_err;\r
-       reading->rcv_rem_phys_err = cl_ntoh16(wire_read->rcv_rem_phys_err);\r
-       reading->rcv_switch_relay_err =\r
-           cl_ntoh16(wire_read->rcv_switch_relay_err);\r
-       reading->xmit_discards = cl_ntoh16(wire_read->xmit_discards);\r
-       reading->xmit_constraint_err =\r
-           cl_ntoh16(wire_read->xmit_constraint_err);\r
-       reading->rcv_constraint_err = wire_read->rcv_constraint_err;\r
-       reading->link_integrity =\r
-           PC_LINK_INT(wire_read->link_int_buffer_overrun);\r
-       reading->buffer_overrun =\r
-           PC_BUF_OVERRUN(wire_read->link_int_buffer_overrun);\r
-       reading->vl15_dropped = cl_ntoh16(wire_read->vl15_dropped);\r
-       reading->time = time(NULL);\r
-}\r
-\r
-void\r
-perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read,\r
-                                perfmgr_db_data_cnt_reading_t * reading)\r
-{\r
-       reading->xmit_data = cl_ntoh32(wire_read->xmit_data);\r
-       reading->rcv_data = cl_ntoh32(wire_read->rcv_data);\r
-       reading->xmit_pkts = cl_ntoh32(wire_read->xmit_pkts);\r
-       reading->rcv_pkts = cl_ntoh32(wire_read->rcv_pkts);\r
-       reading->unicast_xmit_pkts = 0;\r
-       reading->unicast_rcv_pkts = 0;\r
-       reading->multicast_xmit_pkts = 0;\r
-       reading->multicast_rcv_pkts = 0;\r
-       reading->time = time(NULL);\r
-}\r
-\r
-void\r
-perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read,\r
-                                 perfmgr_db_data_cnt_reading_t * reading)\r
-{\r
-       reading->xmit_data = cl_ntoh64(wire_read->xmit_data);\r
-       reading->rcv_data = cl_ntoh64(wire_read->rcv_data);\r
-       reading->xmit_pkts = cl_ntoh64(wire_read->xmit_pkts);\r
-       reading->rcv_pkts = cl_ntoh64(wire_read->rcv_pkts);\r
-       reading->unicast_xmit_pkts = cl_ntoh64(wire_read->unicast_xmit_pkts);\r
-       reading->unicast_rcv_pkts = cl_ntoh64(wire_read->unicast_rcv_pkts);\r
-       reading->multicast_xmit_pkts =\r
-           cl_ntoh64(wire_read->multicast_xmit_pkts);\r
-       reading->multicast_rcv_pkts = cl_ntoh64(wire_read->multicast_rcv_pkts);\r
-       reading->time = time(NULL);\r
-}\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
diff --git a/branches/opensm_3/user/opensm/osm_pkey.c b/branches/opensm_3/user/opensm/osm_pkey.c
deleted file mode 100644 (file)
index de4fbb5..0000000
+++ /dev/null
@@ -1,427 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of opensm pkey manipulation functions.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-\r
-void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       cl_ptr_vector_construct(&p_pkey_tbl->blocks);\r
-       cl_ptr_vector_construct(&p_pkey_tbl->new_blocks);\r
-       cl_map_construct(&p_pkey_tbl->keys);\r
-}\r
-\r
-void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       ib_pkey_table_t *p_block;\r
-       uint16_t num_blocks, i;\r
-\r
-       num_blocks = (uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->blocks));\r
-       for (i = 0; i < num_blocks; i++)\r
-               if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->blocks, i)))\r
-                       free(p_block);\r
-       cl_ptr_vector_destroy(&p_pkey_tbl->blocks);\r
-\r
-       num_blocks =\r
-           (uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks));\r
-       for (i = 0; i < num_blocks; i++)\r
-               if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, i)))\r
-                       free(p_block);\r
-       cl_ptr_vector_destroy(&p_pkey_tbl->new_blocks);\r
-\r
-       cl_map_remove_all(&p_pkey_tbl->keys);\r
-       cl_map_destroy(&p_pkey_tbl->keys);\r
-}\r
-\r
-ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       cl_ptr_vector_init(&p_pkey_tbl->blocks, 0, 1);\r
-       cl_ptr_vector_init(&p_pkey_tbl->new_blocks, 0, 1);\r
-       cl_map_init(&p_pkey_tbl->keys, 1);\r
-       cl_qlist_init(&p_pkey_tbl->pending);\r
-       p_pkey_tbl->used_blocks = 0;\r
-       p_pkey_tbl->max_blocks = 0;\r
-       return IB_SUCCESS;\r
-}\r
-\r
-void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       ib_pkey_table_t *p_block;\r
-       size_t b, num_blocks = cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks);\r
-\r
-       for (b = 0; b < num_blocks; b++)\r
-               if ((p_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, b)))\r
-                       memset(p_block, 0, sizeof(*p_block));\r
-}\r
-\r
-void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl)\r
-{\r
-       cl_list_item_t *p_item;\r
-\r
-       p_item = cl_qlist_remove_head(&p_pkey_tbl->pending);\r
-       while (p_item != cl_qlist_end(&p_pkey_tbl->pending)) {\r
-               free((osm_pending_pkey_t *) p_item);\r
-       }\r
-}\r
-\r
-ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                                IN uint16_t block, IN ib_pkey_table_t * p_tbl)\r
-{\r
-       uint16_t b, i;\r
-       ib_pkey_table_t *p_pkey_block;\r
-       uint16_t *p_prev_pkey;\r
-       ib_net16_t pkey;\r
-\r
-       /* make sure the block is allocated */\r
-       if (cl_ptr_vector_get_size(&p_pkey_tbl->blocks) > block)\r
-               p_pkey_block =\r
-                   (ib_pkey_table_t *) cl_ptr_vector_get(&p_pkey_tbl->blocks,\r
-                                                         block);\r
-       else\r
-               p_pkey_block = NULL;\r
-\r
-       if (!p_pkey_block) {\r
-               p_pkey_block =\r
-                   (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));\r
-               if (!p_pkey_block)\r
-                       return IB_ERROR;\r
-               memset(p_pkey_block, 0, sizeof(ib_pkey_table_t));\r
-               cl_ptr_vector_set(&p_pkey_tbl->blocks, block, p_pkey_block);\r
-       }\r
-\r
-       /* sets the block values */\r
-       memcpy(p_pkey_block, p_tbl, sizeof(ib_pkey_table_t));\r
-\r
-       /*\r
-          NOTE: as the spec does not require uniqueness of PKeys in\r
-          tables there is no other way but to refresh the entire keys map.\r
-\r
-          Moreover, if the same key exists but with full membership it should\r
-          have precedence on the key with limited membership !\r
-        */\r
-       cl_map_remove_all(&p_pkey_tbl->keys);\r
-\r
-       for (b = 0; b < cl_ptr_vector_get_size(&p_pkey_tbl->blocks); b++) {\r
-\r
-               p_pkey_block = cl_ptr_vector_get(&p_pkey_tbl->blocks, b);\r
-               if (!p_pkey_block)\r
-                       continue;\r
-\r
-               for (i = 0; i < IB_NUM_PKEY_ELEMENTS_IN_BLOCK; i++) {\r
-                       pkey = p_pkey_block->pkey_entry[i];\r
-                       if (ib_pkey_is_invalid(pkey))\r
-                               continue;\r
-\r
-                       /*\r
-                          ignore the PKey Full Member bit in the key but store\r
-                          the pointer to the table element as the map value\r
-                        */\r
-                       p_prev_pkey =\r
-                           cl_map_get(&p_pkey_tbl->keys,\r
-                                      ib_pkey_get_base(pkey));\r
-\r
-                       /* we only insert if no previous or it is not full member */\r
-                       if ((p_prev_pkey == NULL) ||\r
-                           (cl_ntoh16(*p_prev_pkey) < cl_ntoh16(pkey)))\r
-                               cl_map_insert(&p_pkey_tbl->keys,\r
-                                             ib_pkey_get_base(pkey),\r
-                                             &(p_pkey_block->pkey_entry[i])\r
-                                   );\r
-               }\r
-       }\r
-       return IB_SUCCESS;\r
-}\r
-\r
-/*\r
-  Store the given pkey in the "new" blocks array.\r
-  Also, make sure the regular block exists.\r
-*/\r
-ib_api_status_t osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                                          IN uint16_t block_idx,\r
-                                          IN uint8_t pkey_idx,\r
-                                          IN uint16_t pkey)\r
-{\r
-       ib_pkey_table_t *p_block;\r
-\r
-       if (!(p_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_idx))) {\r
-               p_block = (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));\r
-               if (!p_block)\r
-                       return IB_ERROR;\r
-               memset(p_block, 0, sizeof(ib_pkey_table_t));\r
-               cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, p_block);\r
-       }\r
-\r
-       p_block->pkey_entry[pkey_idx] = pkey;\r
-       if (p_pkey_tbl->used_blocks <= block_idx)\r
-               p_pkey_tbl->used_blocks = block_idx + 1;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                                       OUT uint16_t * p_block_idx,\r
-                                       OUT uint8_t * p_pkey_idx)\r
-{\r
-       ib_pkey_table_t *p_new_block;\r
-\r
-       CL_ASSERT(p_block_idx);\r
-       CL_ASSERT(p_pkey_idx);\r
-\r
-       while (*p_block_idx < p_pkey_tbl->max_blocks) {\r
-               if (*p_pkey_idx > IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1) {\r
-                       *p_pkey_idx = 0;\r
-                       (*p_block_idx)++;\r
-                       if (*p_block_idx >= p_pkey_tbl->max_blocks)\r
-                               return FALSE;\r
-               }\r
-\r
-               p_new_block =\r
-                   osm_pkey_tbl_new_block_get(p_pkey_tbl, *p_block_idx);\r
-\r
-               if (!p_new_block ||\r
-                   ib_pkey_is_invalid(p_new_block->pkey_entry[*p_pkey_idx]))\r
-                       return TRUE;\r
-               else\r
-                       (*p_pkey_idx)++;\r
-       }\r
-       return FALSE;\r
-}\r
-\r
-ib_api_status_t osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,\r
-                                              IN uint16_t * p_pkey,\r
-                                              OUT uint16_t * p_block_idx,\r
-                                              OUT uint8_t * p_pkey_idx)\r
-{\r
-       uint16_t num_of_blocks;\r
-       uint16_t block_index;\r
-       ib_pkey_table_t *block;\r
-\r
-       CL_ASSERT(p_block_idx != NULL);\r
-       CL_ASSERT(p_pkey_idx != NULL);\r
-\r
-       num_of_blocks = (uint16_t) cl_ptr_vector_get_size(&p_pkey_tbl->blocks);\r
-       for (block_index = 0; block_index < num_of_blocks; block_index++) {\r
-               block = osm_pkey_tbl_block_get(p_pkey_tbl, block_index);\r
-               if ((block->pkey_entry <= p_pkey) &&\r
-                   (p_pkey <\r
-                    block->pkey_entry + IB_NUM_PKEY_ELEMENTS_IN_BLOCK)) {\r
-                       *p_block_idx = block_index;\r
-                       *p_pkey_idx = (uint8_t) (p_pkey - block->pkey_entry);\r
-                       return IB_SUCCESS;\r
-               }\r
-       }\r
-       return IB_NOT_FOUND;\r
-}\r
-\r
-static boolean_t match_pkey(IN const ib_net16_t * pkey1,\r
-                           IN const ib_net16_t * pkey2)\r
-{\r
-\r
-       /* if both pkeys are not full member - this is not a match */\r
-       if (!(ib_pkey_is_full_member(*pkey1) || ib_pkey_is_full_member(*pkey2)))\r
-               return FALSE;\r
-\r
-       /* compare if the bases are the same. if they are - then\r
-          this is a match */\r
-       if (ib_pkey_get_base(*pkey1) != ib_pkey_get_base(*pkey2))\r
-               return FALSE;\r
-\r
-       return TRUE;\r
-}\r
-\r
-boolean_t osm_physp_share_this_pkey(IN const osm_physp_t * p_physp1,\r
-                                   IN const osm_physp_t * p_physp2,\r
-                                   IN ib_net16_t pkey)\r
-{\r
-       ib_net16_t *pkey1, *pkey2;\r
-\r
-       pkey1 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp1))->keys,\r
-                          ib_pkey_get_base(pkey));\r
-       pkey2 = cl_map_get(&(osm_physp_get_pkey_tbl(p_physp2))->keys,\r
-                          ib_pkey_get_base(pkey));\r
-       return (pkey1 && pkey2 && match_pkey(pkey1, pkey2));\r
-}\r
-\r
-ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,\r
-                                     IN const osm_physp_t * p_physp2)\r
-{\r
-       ib_net16_t *pkey1, *pkey2;\r
-       uint64_t pkey1_base, pkey2_base;\r
-       const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;\r
-       cl_map_iterator_t map_iter1, map_iter2;\r
-\r
-       pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);\r
-       pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);\r
-\r
-       map_iter1 = cl_map_head(&pkey_tbl1->keys);\r
-       map_iter2 = cl_map_head(&pkey_tbl2->keys);\r
-\r
-       /* we rely on the fact the map are sorted by pkey */\r
-       while ((map_iter1 != cl_map_end(&pkey_tbl1->keys)) &&\r
-              (map_iter2 != cl_map_end(&pkey_tbl2->keys))) {\r
-               pkey1 = (ib_net16_t *) cl_map_obj(map_iter1);\r
-               pkey2 = (ib_net16_t *) cl_map_obj(map_iter2);\r
-\r
-               if (match_pkey(pkey1, pkey2))\r
-                       return *pkey1;\r
-\r
-               /* advance the lower value if they are not equal */\r
-               pkey1_base = cl_map_key(map_iter1);\r
-               pkey2_base = cl_map_key(map_iter2);\r
-               if (pkey2_base == pkey1_base) {\r
-                       map_iter1 = cl_map_next(map_iter1);\r
-                       map_iter2 = cl_map_next(map_iter2);\r
-               } else if (pkey2_base < pkey1_base)\r
-                       map_iter2 = cl_map_next(map_iter2);\r
-               else\r
-                       map_iter1 = cl_map_next(map_iter1);\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,\r
-                              IN const osm_physp_t * p_physp_1,\r
-                              IN const osm_physp_t * p_physp_2)\r
-{\r
-       const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;\r
-\r
-       if (p_physp_1 == p_physp_2)\r
-               return TRUE;\r
-\r
-       pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp_1);\r
-       pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp_2);\r
-\r
-       /*\r
-          The spec: 10.9.2 does not require each phys port to have PKey Table.\r
-          So actually if it does not, we need to use the default port instead.\r
-\r
-          HACK: meanwhile we will ignore the check\r
-        */\r
-       if (cl_is_map_empty(&pkey_tbl1->keys)\r
-           || cl_is_map_empty(&pkey_tbl2->keys))\r
-               return TRUE;\r
-\r
-       return\r
-           !ib_pkey_is_invalid(osm_physp_find_common_pkey\r
-                               (p_physp_1, p_physp_2));\r
-}\r
-\r
-boolean_t osm_port_share_pkey(IN osm_log_t * p_log,\r
-                             IN const osm_port_t * p_port_1,\r
-                             IN const osm_port_t * p_port_2)\r
-{\r
-\r
-       osm_physp_t *p_physp1, *p_physp2;\r
-       boolean_t ret;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (!p_port_1 || !p_port_2) {\r
-               ret = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       p_physp1 = p_port_1->p_physp;\r
-       p_physp2 = p_port_2->p_physp;\r
-\r
-       if (!p_physp1 || !p_physp2) {\r
-               ret = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       ret = osm_physp_share_pkey(p_log, p_physp1, p_physp2);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return ret;\r
-}\r
-\r
-boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,\r
-                            IN const osm_physp_t * p_physp)\r
-{\r
-\r
-       ib_net16_t *p_pkey, pkey_base;\r
-       const osm_pkey_tbl_t *pkey_tbl;\r
-       boolean_t res = FALSE;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Search for PKey: 0x%04x\n", cl_ntoh16(pkey));\r
-\r
-       /* if the pkey given is an invalid pkey - return TRUE. */\r
-       if (ib_pkey_is_invalid(pkey)) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Given invalid PKey - we treat it loosely and allow it\n");\r
-               res = TRUE;\r
-               goto Exit;\r
-       }\r
-\r
-       pkey_base = ib_pkey_get_base(pkey);\r
-\r
-       pkey_tbl = osm_physp_get_pkey_tbl(p_physp);\r
-\r
-       p_pkey = cl_map_get(&pkey_tbl->keys, pkey_base);\r
-       if (p_pkey) {\r
-               res = TRUE;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "PKey 0x%04x was found\n", cl_ntoh16(pkey));\r
-       } else\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "PKey 0x%04x was not found\n", cl_ntoh16(pkey));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_pkey_mgr.c b/branches/opensm_3/user/opensm/osm_pkey_mgr.c
deleted file mode 100644 (file)
index 379079c..0000000
+++ /dev/null
@@ -1,520 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- * Implementation of the P_Key Manager (Partititon Manager).\r
- * This is part of the OpenSM.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-/*\r
-  The max number of pkey blocks for a physical port is located in\r
-  a different place for switch external ports (SwitchInfo) and the\r
-  rest of the ports (NodeInfo).\r
-*/\r
-static uint16_t\r
-pkey_mgr_get_physp_max_blocks(IN const osm_subn_t * p_subn,\r
-                             IN const osm_physp_t * p_physp)\r
-{\r
-       osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);\r
-       uint16_t num_pkeys = 0;\r
-\r
-       if (!p_node->sw || (osm_physp_get_port_num(p_physp) == 0))\r
-               num_pkeys = cl_ntoh16(p_node->node_info.partition_cap);\r
-       else\r
-               num_pkeys = cl_ntoh16(p_node->sw->switch_info.enforce_cap);\r
-       return ((num_pkeys + 31) / 32);\r
-}\r
-\r
-/*\r
- * Insert new pending pkey entry to the specific port pkey table\r
- * pending pkeys. New entries are inserted at the back.\r
- */\r
-static void\r
-pkey_mgr_process_physical_port(IN osm_log_t * p_log,\r
-                              IN osm_sm_t * sm,\r
-                              IN const ib_net16_t pkey,\r
-                              IN osm_physp_t * p_physp)\r
-{\r
-       osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);\r
-       osm_pkey_tbl_t *p_pkey_tbl;\r
-       ib_net16_t *p_orig_pkey;\r
-       char *stat = NULL;\r
-       osm_pending_pkey_t *p_pending;\r
-\r
-       p_pkey_tbl = &p_physp->pkeys;\r
-       p_pending = (osm_pending_pkey_t *) malloc(sizeof(osm_pending_pkey_t));\r
-       if (!p_pending) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0502: "\r
-                       "Failed to allocate new pending pkey entry for node "\r
-                       "0x%016" PRIx64 " port %u\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                       osm_physp_get_port_num(p_physp));\r
-               return;\r
-       }\r
-       p_pending->pkey = pkey;\r
-       p_orig_pkey = cl_map_get(&p_pkey_tbl->keys, ib_pkey_get_base(pkey));\r
-       if (!p_orig_pkey) {\r
-               p_pending->is_new = TRUE;\r
-               cl_qlist_insert_tail(&p_pkey_tbl->pending,\r
-                                    (cl_list_item_t *) p_pending);\r
-               stat = "inserted";\r
-       } else {\r
-               CL_ASSERT(ib_pkey_get_base(*p_orig_pkey) ==\r
-                         ib_pkey_get_base(pkey));\r
-               p_pending->is_new = FALSE;\r
-               if (osm_pkey_tbl_get_block_and_idx(p_pkey_tbl, p_orig_pkey,\r
-                                                  &p_pending->block,\r
-                                                  &p_pending->index) !=\r
-                   IB_SUCCESS) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0503: "\r
-                               "Failed to obtain P_Key 0x%04x block and index "\r
-                               "for node 0x%016" PRIx64 " port %u\n",\r
-                               cl_ntoh16(ib_pkey_get_base(pkey)),\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                               osm_physp_get_port_num(p_physp));\r
-                       return;\r
-               }\r
-               cl_qlist_insert_head(&p_pkey_tbl->pending,\r
-                                    (cl_list_item_t *) p_pending);\r
-               stat = "updated";\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "pkey 0x%04x was %s for node 0x%016" PRIx64 " port %u\n",\r
-               cl_ntoh16(pkey), stat,\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-               osm_physp_get_port_num(p_physp));\r
-}\r
-\r
-static void\r
-pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm,\r
-                                const osm_prtn_t * p_prtn,\r
-                                const boolean_t full)\r
-{\r
-       const cl_map_t *p_tbl =\r
-           full ? &p_prtn->full_guid_tbl : &p_prtn->part_guid_tbl;\r
-       cl_map_iterator_t i, i_next;\r
-       ib_net16_t pkey = p_prtn->pkey;\r
-       osm_physp_t *p_physp;\r
-\r
-       if (full)\r
-               pkey |= cl_hton16(0x8000);\r
-\r
-       i_next = cl_map_head(p_tbl);\r
-       while (i_next != cl_map_end(p_tbl)) {\r
-               i = i_next;\r
-               i_next = cl_map_next(i);\r
-               p_physp = cl_map_obj(i);\r
-               if (p_physp)\r
-                       pkey_mgr_process_physical_port(p_log, sm, pkey,\r
-                                                      p_physp);\r
-       }\r
-}\r
-\r
-static ib_api_status_t\r
-pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,\r
-                          IN const osm_physp_t * p_physp,\r
-                          IN const ib_pkey_table_t * block,\r
-                          IN const uint16_t block_index)\r
-{\r
-       osm_madw_context_t context;\r
-       osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);\r
-       uint32_t attr_mod;\r
-\r
-       context.pkey_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.pkey_context.port_guid = osm_physp_get_port_guid(p_physp);\r
-       context.pkey_context.set_method = TRUE;\r
-       attr_mod = block_index;\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)\r
-               attr_mod |= osm_physp_get_port_num(p_physp) << 16;\r
-       return osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                          (uint8_t *) block, sizeof(*block),\r
-                          IB_MAD_ATTR_P_KEY_TABLE,\r
-                          cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);\r
-}\r
-\r
-static ib_api_status_t\r
-pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,\r
-                          IN osm_physp_t * p_physp, IN const boolean_t enforce)\r
-{\r
-       osm_madw_context_t context;\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_port_info_t *p_pi;\r
-       ib_api_status_t status;\r
-\r
-       p_pi = &p_physp->port_info;\r
-\r
-       if ((p_pi->vl_enforce & 0xc) == (0xc) * (enforce == TRUE)) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "No need to update PortInfo for "\r
-                       "node 0x%016" PRIx64 " port %u (%s)\n",\r
-                       cl_ntoh64(osm_node_get_node_guid\r
-                                 (osm_physp_get_node_ptr(p_physp))),\r
-                       osm_physp_get_port_num(p_physp),\r
-                       p_physp->p_node->print_desc);\r
-               return IB_SUCCESS;\r
-       }\r
-\r
-       memcpy(payload, p_pi, sizeof(ib_port_info_t));\r
-       memset(payload + sizeof(ib_port_info_t), 0,\r
-              IB_SMP_DATA_SIZE - sizeof(ib_port_info_t));\r
-\r
-       p_pi = (ib_port_info_t *) payload;\r
-       if (enforce == TRUE)\r
-               p_pi->vl_enforce |= 0xc;\r
-       else\r
-               p_pi->vl_enforce &= ~0xc;\r
-       p_pi->state_info2 = 0;\r
-       ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);\r
-\r
-       context.pi_context.node_guid =\r
-           osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));\r
-       context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);\r
-       context.pi_context.set_method = TRUE;\r
-       context.pi_context.light_sweep = FALSE;\r
-       context.pi_context.active_transition = FALSE;\r
-\r
-       status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                            payload, sizeof(payload),\r
-                            IB_MAD_ATTR_PORT_INFO,\r
-                            cl_hton32(osm_physp_get_port_num(p_physp)),\r
-                            CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "\r
-                       "Failed to set PortInfo for "\r
-                       "node 0x%016" PRIx64 " port %u (%s)\n",\r
-                       cl_ntoh64(osm_node_get_node_guid\r
-                                 (osm_physp_get_node_ptr(p_physp))),\r
-                       osm_physp_get_port_num(p_physp),\r
-                       p_physp->p_node->print_desc);\r
-       else\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Set PortInfo for node 0x%016" PRIx64 " port %u (%s)\n",\r
-                       cl_ntoh64(osm_node_get_node_guid\r
-                                 (osm_physp_get_node_ptr(p_physp))),\r
-                       osm_physp_get_port_num(p_physp),\r
-                       p_physp->p_node->print_desc);\r
-       return status;\r
-}\r
-\r
-static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,\r
-                               const osm_port_t * const p_port)\r
-{\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       ib_pkey_table_t *block, *new_block;\r
-       osm_pkey_tbl_t *p_pkey_tbl;\r
-       uint16_t block_index;\r
-       uint8_t pkey_index;\r
-       uint16_t last_free_block_index = 0;\r
-       uint8_t last_free_pkey_index = 0;\r
-       uint16_t num_of_blocks;\r
-       uint16_t max_num_of_blocks;\r
-       ib_api_status_t status;\r
-       osm_pending_pkey_t *p_pending;\r
-       boolean_t found;\r
-       ib_pkey_table_t empty_block;\r
-       int ret = 0;\r
-\r
-       memset(&empty_block, 0, sizeof(ib_pkey_table_t));\r
-\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp)\r
-               return FALSE;\r
-\r
-       p_node = osm_physp_get_node_ptr(p_physp);\r
-       p_pkey_tbl = &p_physp->pkeys;\r
-       num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);\r
-       max_num_of_blocks =\r
-           pkey_mgr_get_physp_max_blocks(sm->p_subn, p_physp);\r
-       if (p_pkey_tbl->max_blocks > max_num_of_blocks) {\r
-               OSM_LOG(p_log, OSM_LOG_INFO,\r
-                       "Max number of blocks reduced from %u to %u "\r
-                       "for node 0x%016" PRIx64 " port %u (%s)\n",\r
-                       p_pkey_tbl->max_blocks, max_num_of_blocks,\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                       osm_physp_get_port_num(p_physp),\r
-                       p_physp->p_node->print_desc);\r
-       }\r
-       p_pkey_tbl->max_blocks = max_num_of_blocks;\r
-\r
-       osm_pkey_tbl_init_new_blocks(p_pkey_tbl);\r
-       p_pkey_tbl->used_blocks = 0;\r
-\r
-       /*\r
-          process every pending pkey in order -\r
-          first must be "updated" last are "new"\r
-        */\r
-       p_pending =\r
-           (osm_pending_pkey_t *) cl_qlist_remove_head(&p_pkey_tbl->pending);\r
-       while (p_pending !=\r
-              (osm_pending_pkey_t *) cl_qlist_end(&p_pkey_tbl->pending)) {\r
-               if (p_pending->is_new == FALSE) {\r
-                       block_index = p_pending->block;\r
-                       pkey_index = p_pending->index;\r
-                       found = TRUE;\r
-               } else {\r
-                       found = osm_pkey_find_next_free_entry(p_pkey_tbl,\r
-                                                             &last_free_block_index,\r
-                                                             &last_free_pkey_index);\r
-                       if (!found) {\r
-                               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0504: "\r
-                                       "Failed to find empty space for new pkey 0x%04x "\r
-                                       "for node 0x%016" PRIx64 " port %u (%s)\n",\r
-                                       cl_ntoh16(p_pending->pkey),\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_node)),\r
-                                       osm_physp_get_port_num(p_physp),\r
-                                       p_physp->p_node->print_desc);\r
-                       } else {\r
-                               block_index = last_free_block_index;\r
-                               pkey_index = last_free_pkey_index++;\r
-                       }\r
-               }\r
-\r
-               if (found) {\r
-                       if (IB_SUCCESS !=\r
-                           osm_pkey_tbl_set_new_entry(p_pkey_tbl, block_index,\r
-                                                      pkey_index,\r
-                                                      p_pending->pkey)) {\r
-                               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0505: "\r
-                                       "Failed to set PKey 0x%04x in block %u idx %u "\r
-                                       "for node 0x%016" PRIx64 " port %u (%s)\n",\r
-                                       cl_ntoh16(p_pending->pkey), block_index,\r
-                                       pkey_index,\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_node)),\r
-                                       osm_physp_get_port_num(p_physp),\r
-                                       p_physp->p_node->print_desc);\r
-                       }\r
-               }\r
-\r
-               free(p_pending);\r
-               p_pending =\r
-                   (osm_pending_pkey_t *) cl_qlist_remove_head(&p_pkey_tbl->\r
-                                                               pending);\r
-       }\r
-\r
-       /* now look for changes and store */\r
-       for (block_index = 0; block_index < num_of_blocks; block_index++) {\r
-               block = osm_pkey_tbl_block_get(p_pkey_tbl, block_index);\r
-               new_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);\r
-               if (!new_block)\r
-                       new_block = &empty_block;\r
-               if (block && !memcmp(new_block, block, sizeof(*block)))\r
-                       continue;\r
-\r
-               status =\r
-                   pkey_mgr_update_pkey_entry(sm, p_physp, new_block,\r
-                                              block_index);\r
-               if (status == IB_SUCCESS)\r
-                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                               "Updated pkey table block %d for node 0x%016"\r
-                               PRIx64 " port %u (%s)\n", block_index,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                               osm_physp_get_port_num(p_physp),\r
-                               p_physp->p_node->print_desc);\r
-               else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: "\r
-                               "pkey_mgr_update_pkey_entry() failed to update "\r
-                               "pkey table block %d for node 0x%016" PRIx64\r
-                               " port %u (%s)\n", block_index,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                               osm_physp_get_port_num(p_physp),\r
-                               p_physp->p_node->print_desc);\r
-                       ret = -1;\r
-               }\r
-       }\r
-\r
-       return ret;\r
-}\r
-\r
-static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,\r
-                                    const osm_subn_t * p_subn,\r
-                                    const osm_port_t * const p_port,\r
-                                    boolean_t enforce)\r
-{\r
-       osm_physp_t *p_physp, *peer;\r
-       osm_node_t *p_node;\r
-       ib_pkey_table_t *block, *peer_block;\r
-       const osm_pkey_tbl_t *p_pkey_tbl;\r
-       osm_pkey_tbl_t *p_peer_pkey_tbl;\r
-       uint16_t block_index;\r
-       uint16_t num_of_blocks;\r
-       uint16_t peer_max_blocks;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_pkey_table_t empty_block;\r
-       int ret = 0;\r
-\r
-       memset(&empty_block, 0, sizeof(ib_pkey_table_t));\r
-\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp)\r
-               return -1;\r
-       peer = osm_physp_get_remote(p_physp);\r
-       if (!peer)\r
-               return -1;\r
-       p_node = osm_physp_get_node_ptr(peer);\r
-       if (!p_node->sw || !p_node->sw->switch_info.enforce_cap)\r
-               return 0;\r
-\r
-       p_pkey_tbl = osm_physp_get_pkey_tbl(p_physp);\r
-       p_peer_pkey_tbl = &peer->pkeys;\r
-       num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);\r
-       peer_max_blocks = pkey_mgr_get_physp_max_blocks(p_subn, peer);\r
-       if (peer_max_blocks < p_pkey_tbl->used_blocks) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0508: "\r
-                       "Not enough pkey entries (%u < %u) on switch 0x%016"\r
-                       PRIx64 " port %u (%s). Clearing Enforcement bit\n",\r
-                       peer_max_blocks, num_of_blocks,\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                       osm_physp_get_port_num(peer),\r
-                       p_node->print_desc);\r
-               enforce = FALSE;\r
-               ret = -1;\r
-       }\r
-\r
-       if (pkey_mgr_enforce_partition(p_log, sm, peer, enforce))\r
-               ret = -1;\r
-\r
-       if (enforce == FALSE)\r
-               return ret;\r
-\r
-       p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;\r
-       for (block_index = 0; block_index < p_pkey_tbl->used_blocks;\r
-            block_index++) {\r
-               block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);\r
-               if (!block)\r
-                       block = &empty_block;\r
-\r
-               peer_block =\r
-                   osm_pkey_tbl_block_get(p_peer_pkey_tbl, block_index);\r
-               if (!peer_block\r
-                   || memcmp(peer_block, block, sizeof(*peer_block))) {\r
-                       status = pkey_mgr_update_pkey_entry(sm, peer, block,\r
-                                                           block_index);\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "\r
-                                       "pkey_mgr_update_pkey_entry() failed to update "\r
-                                       "pkey table block %d for node 0x%016"\r
-                                       PRIx64 " port %u (%s)\n", block_index,\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_node)),\r
-                                       osm_physp_get_port_num(peer),\r
-                                       p_node->print_desc);\r
-                               ret = -1;\r
-                       }\r
-               }\r
-       }\r
-\r
-       if (!ret)\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Pkey table was updated for node 0x%016" PRIx64\r
-                       " port %u (%s)\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                       osm_physp_get_port_num(peer), p_node->print_desc);\r
-\r
-       return ret;\r
-}\r
-\r
-int osm_pkey_mgr_process(IN osm_opensm_t * p_osm)\r
-{\r
-       cl_qmap_t *p_tbl;\r
-       cl_map_item_t *p_next;\r
-       osm_prtn_t *p_prtn;\r
-       osm_port_t *p_port;\r
-       int ret = 0;\r
-\r
-       CL_ASSERT(p_osm);\r
-\r
-       OSM_LOG_ENTER(&p_osm->log);\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(&p_osm->lock);\r
-\r
-       if (osm_prtn_make_partitions(&p_osm->log, &p_osm->subn) != IB_SUCCESS) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 0510: "\r
-                       "osm_prtn_make_partitions() failed\n");\r
-               ret = -1;\r
-               goto _err;\r
-       }\r
-\r
-       /* populate the pending pkey entries by scanning all partitions */\r
-       p_tbl = &p_osm->subn.prtn_pkey_tbl;\r
-       p_next = cl_qmap_head(p_tbl);\r
-       while (p_next != cl_qmap_end(p_tbl)) {\r
-               p_prtn = (osm_prtn_t *) p_next;\r
-               p_next = cl_qmap_next(p_next);\r
-               pkey_mgr_process_partition_table(&p_osm->log, &p_osm->sm,\r
-                                                p_prtn, FALSE);\r
-               pkey_mgr_process_partition_table(&p_osm->log, &p_osm->sm,\r
-                                                p_prtn, TRUE);\r
-       }\r
-\r
-       /* calculate and set new pkey tables */\r
-       p_tbl = &p_osm->subn.port_guid_tbl;\r
-       p_next = cl_qmap_head(p_tbl);\r
-       while (p_next != cl_qmap_end(p_tbl)) {\r
-               p_port = (osm_port_t *) p_next;\r
-               p_next = cl_qmap_next(p_next);\r
-               if (pkey_mgr_update_port(&p_osm->log, &p_osm->sm, p_port))\r
-                       ret = -1;\r
-               if ((osm_node_get_type(p_port->p_node) != IB_NODE_TYPE_SWITCH)\r
-                   && pkey_mgr_update_peer_port(&p_osm->log, &p_osm->sm,\r
-                                                &p_osm->subn, p_port,\r
-                                                !p_osm->subn.opt.\r
-                                                no_partition_enforcement))\r
-                       ret = -1;\r
-       }\r
-\r
-_err:\r
-       CL_PLOCK_RELEASE(&p_osm->lock);\r
-       OSM_LOG_EXIT(&p_osm->log);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_pkey_rcv.c b/branches/opensm_3/user/opensm/osm_pkey_rcv.c
deleted file mode 100644 (file)
index 709ef0b..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sm.h>\r
-\r
-/*\r
- * WE ONLY RECEIVE GET or SET responses\r
- */\r
-void osm_pkey_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_pkey_table_t *p_pkey_tbl;\r
-       ib_smp_t *p_smp;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       osm_pkey_context_t *p_context;\r
-       ib_net64_t port_guid;\r
-       ib_net64_t node_guid;\r
-       uint8_t port_num;\r
-       uint16_t block_num;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       p_context = osm_madw_get_pkey_context_ptr(p_madw);\r
-       p_pkey_tbl = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       port_guid = p_context->port_guid;\r
-       node_guid = p_context->node_guid;\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE);\r
-\r
-       cl_plock_excl_acquire(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4806: "\r
-                       "No port object for port with GUID 0x%" PRIx64\r
-                       "\n\t\t\t\tfor parent node GUID 0x%" PRIx64\r
-                       ", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),\r
-                       cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-               goto Exit;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       CL_ASSERT(p_node);\r
-\r
-       block_num = (uint16_t) ((cl_ntoh32(p_smp->attr_mod)) & 0x0000FFFF);\r
-       /* in case of a non switch node the attr modifier should be ignored */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {\r
-               port_num =\r
-                   (uint8_t) (((cl_ntoh32(p_smp->attr_mod)) & 0x00FF0000) >>\r
-                              16);\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       } else {\r
-               p_physp = p_port->p_physp;\r
-               port_num = p_physp->port_num;\r
-       }\r
-\r
-       /*\r
-          We do not care if this is a result of a set or get -\r
-          all we want is to update the subnet.\r
-        */\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Got GetResp(PKey) block:%u port_num %u with GUID 0x%"\r
-               PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"\r
-               PRIx64 "\n", block_num, port_num, cl_ntoh64(port_guid),\r
-               cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-\r
-       /*\r
-          Determine if we encountered a new Physical Port.\r
-          If so, ignore it.\r
-        */\r
-       if (!p_physp) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4807: "\r
-                       "Got invalid port number %u\n", port_num);\r
-               goto Exit;\r
-       }\r
-\r
-       osm_dump_pkey_block(sm->p_log, port_guid, block_num, port_num,\r
-                           p_pkey_tbl, OSM_LOG_DEBUG);\r
-\r
-       osm_physp_set_pkey_tbl(sm->p_log, sm->p_subn,\r
-                              p_physp, p_pkey_tbl, block_num);\r
-\r
-Exit:\r
-       cl_plock_release(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_port.c b/branches/opensm_3/user/opensm/osm_port.c
deleted file mode 100644 (file)
index 11cd01d..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_physp_t.\r
- * This object represents an Infiniband Port.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_switch.h>\r
-\r
-void osm_physp_construct(IN osm_physp_t * p_physp)\r
-{\r
-       memset(p_physp, 0, sizeof(*p_physp));\r
-       osm_dr_path_construct(&p_physp->dr_path);\r
-       cl_ptr_vector_construct(&p_physp->slvl_by_port);\r
-       osm_pkey_tbl_construct(&p_physp->pkeys);\r
-}\r
-\r
-void osm_physp_destroy(IN osm_physp_t * p_physp)\r
-{\r
-       size_t num_slvl, i;\r
-\r
-       /* the physp might be uninitialized */\r
-       if (p_physp->port_guid) {\r
-               /* free the SL2VL Tables */\r
-               num_slvl = cl_ptr_vector_get_size(&p_physp->slvl_by_port);\r
-               for (i = 0; i < num_slvl; i++)\r
-                       free(cl_ptr_vector_get(&p_physp->slvl_by_port, i));\r
-               cl_ptr_vector_destroy(&p_physp->slvl_by_port);\r
-\r
-               /* free the P_Key Tables */\r
-               osm_pkey_tbl_destroy(&p_physp->pkeys);\r
-\r
-               memset(p_physp, 0, sizeof(*p_physp));\r
-               osm_dr_path_construct(&p_physp->dr_path);       /* clear dr_path */\r
-       }\r
-}\r
-\r
-void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid,\r
-                   IN uint8_t port_num, IN const struct osm_node *p_node,\r
-                   IN osm_bind_handle_t h_bind, IN uint8_t hop_count,\r
-                   IN const uint8_t * p_initial_path)\r
-{\r
-       uint16_t num_slvl, i;\r
-       ib_slvl_table_t *p_slvl;\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       osm_physp_construct(p_physp);\r
-       p_physp->port_guid = port_guid;\r
-       p_physp->port_num = port_num;\r
-       p_physp->healthy = TRUE;\r
-       p_physp->need_update = 2;\r
-       p_physp->p_node = (struct osm_node *)p_node;\r
-\r
-       osm_dr_path_init(&p_physp->dr_path, h_bind, hop_count, p_initial_path);\r
-\r
-       /* allocate enough SL2VL tables */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)\r
-               /* we need node num ports + 1 SL2VL tables */\r
-               num_slvl = osm_node_get_num_physp(p_node) + 1;\r
-       else\r
-               /* An end node - we need only one SL2VL */\r
-               num_slvl = 1;\r
-\r
-       cl_ptr_vector_init(&p_physp->slvl_by_port, num_slvl, 1);\r
-       for (i = 0; i < num_slvl; i++) {\r
-               p_slvl = (ib_slvl_table_t *) malloc(sizeof(ib_slvl_table_t));\r
-               if (!p_slvl)\r
-                       break;\r
-               memset(p_slvl, 0, sizeof(ib_slvl_table_t));\r
-               cl_ptr_vector_set(&p_physp->slvl_by_port, i, p_slvl);\r
-       }\r
-\r
-       /* initialize the pkey table */\r
-       osm_pkey_tbl_init(&p_physp->pkeys);\r
-}\r
-\r
-void osm_port_delete(IN OUT osm_port_t ** pp_port)\r
-{\r
-       free(*pp_port);\r
-       *pp_port = NULL;\r
-}\r
-\r
-osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,\r
-                        IN osm_node_t * p_parent_node)\r
-{\r
-       osm_port_t *p_port;\r
-       ib_net64_t port_guid;\r
-       osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-\r
-       p_port = malloc(sizeof(*p_port));\r
-       if (!p_port)\r
-               return NULL;\r
-\r
-       memset(p_port, 0, sizeof(*p_port));\r
-       cl_qlist_init(&p_port->mcm_list);\r
-       p_port->p_node = (struct osm_node *)p_parent_node;\r
-       port_guid = p_ni->port_guid;\r
-       p_port->guid = port_guid;\r
-       port_num = p_ni->node_type == IB_NODE_TYPE_SWITCH ?\r
-           0 : ib_node_info_get_local_port_num(p_ni);\r
-\r
-       /*\r
-          Get the pointers to the physical node objects "owned" by this\r
-          logical port GUID.\r
-          For switches, port '0' is owned; for HCA's and routers,\r
-          only the singular part that has this GUID is owned.\r
-        */\r
-       p_physp = osm_node_get_physp_ptr(p_parent_node, port_num);\r
-       CL_ASSERT(port_guid == osm_physp_get_port_guid(p_physp));\r
-       p_port->p_physp = p_physp;\r
-\r
-       return p_port;\r
-}\r
-\r
-void osm_port_get_lid_range_ho(IN const osm_port_t * p_port,\r
-                              IN uint16_t * p_min_lid, IN uint16_t * p_max_lid)\r
-{\r
-       uint8_t lmc;\r
-\r
-       *p_min_lid = cl_ntoh16(osm_port_get_base_lid(p_port));\r
-       lmc = osm_port_get_lmc(p_port);\r
-       *p_max_lid = (uint16_t) (*p_min_lid + (1 << lmc) - 1);\r
-}\r
-\r
-uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log,\r
-                               IN const osm_physp_t * p_physp)\r
-{\r
-       const osm_physp_t *p_remote_physp;\r
-       uint8_t mtu;\r
-       uint8_t remote_mtu;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_remote_physp = osm_physp_get_remote(p_physp);\r
-       if (p_remote_physp) {\r
-               /* use the available MTU */\r
-               mtu = ib_port_info_get_mtu_cap(&p_physp->port_info);\r
-\r
-               remote_mtu =\r
-                   ib_port_info_get_mtu_cap(&p_remote_physp->port_info);\r
-\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Remote port 0x%016" PRIx64 " port = %u : "\r
-                       "MTU = %u. This Port MTU: %u\n",\r
-                       cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),\r
-                       osm_physp_get_port_num(p_remote_physp),\r
-                       remote_mtu, mtu);\r
-\r
-               if (mtu != remote_mtu) {\r
-                       if (mtu > remote_mtu)\r
-                               mtu = remote_mtu;\r
-\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "MTU mismatch between ports."\r
-                               "\n\t\t\t\tPort 0x%016" PRIx64 ", port %u"\r
-                               " and port 0x%016" PRIx64 ", port %u."\r
-                               "\n\t\t\t\tUsing lower MTU of %u\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                               osm_physp_get_port_num(p_physp),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_remote_physp)),\r
-                               osm_physp_get_port_num(p_remote_physp), mtu);\r
-               }\r
-       } else\r
-               mtu = ib_port_info_get_neighbor_mtu(&p_physp->port_info);\r
-\r
-       if (mtu == 0) {\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG, "ERR 4101: "\r
-                       "Invalid MTU = 0. Forcing correction to 256\n");\r
-               mtu = 1;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return mtu;\r
-}\r
-\r
-uint8_t osm_physp_calc_link_op_vls(IN osm_log_t * p_log,\r
-                                  IN const osm_subn_t * p_subn,\r
-                                  IN const osm_physp_t * p_physp)\r
-{\r
-       const osm_physp_t *p_remote_physp;\r
-       uint8_t op_vls;\r
-       uint8_t remote_op_vls;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_remote_physp = osm_physp_get_remote(p_physp);\r
-       if (p_remote_physp) {\r
-               /* use the available VLCap */\r
-               op_vls = ib_port_info_get_vl_cap(&p_physp->port_info);\r
-\r
-               remote_op_vls =\r
-                   ib_port_info_get_vl_cap(&p_remote_physp->port_info);\r
-\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Remote port 0x%016" PRIx64 " port = 0x%X : "\r
-                       "VL_CAP = %u. This port VL_CAP = %u\n",\r
-                       cl_ntoh64(osm_physp_get_port_guid(p_remote_physp)),\r
-                       osm_physp_get_port_num(p_remote_physp),\r
-                       remote_op_vls, op_vls);\r
-\r
-               if (op_vls != remote_op_vls) {\r
-                       if (op_vls > remote_op_vls)\r
-                               op_vls = remote_op_vls;\r
-\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "OP_VLS mismatch between ports."\r
-                               "\n\t\t\t\tPort 0x%016" PRIx64 ", port 0x%X"\r
-                               " and port 0x%016" PRIx64 ", port 0x%X."\r
-                               "\n\t\t\t\tUsing lower OP_VLS of %u\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                               osm_physp_get_port_num(p_physp),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_remote_physp)),\r
-                               osm_physp_get_port_num(p_remote_physp), op_vls);\r
-               }\r
-       } else\r
-               op_vls = ib_port_info_get_op_vls(&p_physp->port_info);\r
-\r
-       if (op_vls == 0) {\r
-               /* for non compliant implementations */\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "Invalid OP_VLS = 0. Forcing correction to 1 (VL0)\n");\r
-               op_vls = 1;\r
-       }\r
-\r
-       /* support user limitation of max_op_vls */\r
-       if (op_vls > p_subn->opt.max_op_vls)\r
-               op_vls = p_subn->opt.max_op_vls;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return op_vls;\r
-}\r
-\r
-static inline uint64_t ptr_to_key(void const *p)\r
-{\r
-       uint64_t k = 0;\r
-\r
-       memcpy(&k, p, sizeof(void *));\r
-       return k;\r
-}\r
-\r
-static inline void *key_to_ptr(uint64_t k)\r
-{\r
-       void *p = 0;\r
-\r
-       memcpy(&p, &k, sizeof(void *));\r
-       return p;\r
-}\r
-\r
-/**********************************************************************\r
- Traverse the fabric from the SM node following the DR path given and\r
- add every phys port traversed to the map. Avoid tracking the first and\r
- last phys ports (going into the first switch and into the target port).\r
- **********************************************************************/\r
-static cl_status_t physp_get_dr_physp_set(IN osm_log_t * p_log,\r
-                                         IN osm_subn_t const *p_subn,\r
-                                         IN osm_dr_path_t const *p_path,\r
-                                         OUT cl_map_t * p_physp_map)\r
-{\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       uint8_t hop;\r
-       cl_status_t status = CL_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* find the OSM node */\r
-       p_port = osm_get_port_by_guid(p_subn, p_subn->sm_port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4103: "\r
-                       "Failed to find the SM own port by guid\n");\r
-               status = CL_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* get the node of the SM */\r
-       p_node = p_port->p_node;\r
-\r
-       /*\r
-          traverse the path adding the nodes to the table\r
-          start after the first dummy hop and stop just before the\r
-          last one\r
-        */\r
-       for (hop = 1; hop < p_path->hop_count - 1; hop++) {\r
-               /* go out using the phys port of the path */\r
-               p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]);\r
-\r
-               /* make sure we got a valid port and it has a remote port */\r
-               if (!p_physp) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4104: "\r
-                               "DR Traversal stopped on invalid port at hop:%u\n",\r
-                               hop);\r
-                       status = CL_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* we track the ports we go out along the path */\r
-               if (hop > 1)\r
-                       cl_map_insert(p_physp_map, ptr_to_key(p_physp), NULL);\r
-\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Traversed through node: 0x%016" PRIx64\r
-                       " port:%u\n",\r
-                       cl_ntoh64(p_node->node_info.node_guid),\r
-                       p_path->path[hop]);\r
-\r
-               if (!(p_physp = osm_physp_get_remote(p_physp))) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4106: "\r
-                               "DR Traversal stopped on missing remote physp at hop:%u\n",\r
-                               hop);\r
-                       status = CL_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               p_node = osm_physp_get_node_ptr(p_physp);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-static void physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,\r
-                                    IN cl_map_t * p_visited_map,\r
-                                    IN osm_bind_handle_t * h_bind)\r
-{\r
-       cl_list_t tmpPortsList;\r
-       osm_physp_t *p_physp, *p_src_physp = NULL;\r
-       uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];\r
-       uint8_t i = 0;\r
-       osm_dr_path_t *p_dr_path;\r
-\r
-       cl_list_construct(&tmpPortsList);\r
-       cl_list_init(&tmpPortsList, 10);\r
-\r
-       cl_list_insert_head(&tmpPortsList, p_dest_physp);\r
-       /* get the output port where we need to come from */\r
-       p_physp = (osm_physp_t *) cl_map_get(p_visited_map,\r
-                                            ptr_to_key(p_dest_physp));\r
-       while (p_physp != NULL) {\r
-               cl_list_insert_head(&tmpPortsList, p_physp);\r
-               /* get the input port through where we reached the output port */\r
-               p_src_physp = p_physp;\r
-               p_physp = (osm_physp_t *) cl_map_get(p_visited_map,\r
-                                                    ptr_to_key(p_physp));\r
-               /* if we reached a null p_physp - this means we are at the begining\r
-                  of the path. Break. */\r
-               if (p_physp == NULL)\r
-                       break;\r
-               /* get the output port */\r
-               p_physp = (osm_physp_t *) cl_map_get(p_visited_map,\r
-                                                    ptr_to_key(p_physp));\r
-       }\r
-\r
-       memset(path_array, 0, sizeof(path_array));\r
-       p_physp = (osm_physp_t *) cl_list_remove_head(&tmpPortsList);\r
-       while (p_physp != NULL) {\r
-               i++;\r
-               path_array[i] = p_physp->port_num;\r
-               p_physp = (osm_physp_t *) cl_list_remove_head(&tmpPortsList);\r
-       }\r
-       if (p_src_physp) {\r
-               p_dr_path = osm_physp_get_dr_path_ptr(p_src_physp);\r
-               osm_dr_path_init(p_dr_path, h_bind, i, path_array);\r
-       }\r
-\r
-       cl_list_destroy(&tmpPortsList);\r
-}\r
-\r
-void osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log,\r
-                                                     IN osm_subn_t const\r
-                                                     *p_subn, IN osm_physp_t const\r
-                                                     *p_dest_physp,\r
-                                                     IN osm_bind_handle_t *\r
-                                                     h_bind)\r
-{\r
-       cl_map_t physp_map;\r
-       cl_map_t visited_map;\r
-       osm_dr_path_t *p_dr_path;\r
-       cl_list_t *p_currPortsList;\r
-       cl_list_t *p_nextPortsList;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp, *p_remote_physp;\r
-       ib_net64_t port_guid;\r
-       boolean_t next_list_is_full = TRUE, reached_dest = FALSE;\r
-       uint8_t num_ports, port_num;\r
-\r
-       p_nextPortsList = (cl_list_t *) malloc(sizeof(cl_list_t));\r
-       if (!p_nextPortsList)\r
-               return;\r
-\r
-       /*\r
-          initialize the map of all port participating in current dr path\r
-          not including first and last switches\r
-        */\r
-       cl_map_construct(&physp_map);\r
-       cl_map_init(&physp_map, 4);\r
-       cl_map_construct(&visited_map);\r
-       cl_map_init(&visited_map, 4);\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_dest_physp);\r
-       physp_get_dr_physp_set(p_log, p_subn, p_dr_path, &physp_map);\r
-\r
-       /*\r
-          BFS from OSM port until we find the target physp but avoid\r
-          going through mapped ports\r
-        */\r
-       cl_list_construct(p_nextPortsList);\r
-       cl_list_init(p_nextPortsList, 10);\r
-\r
-       port_guid = p_subn->sm_port_guid;\r
-\r
-       CL_ASSERT(port_guid);\r
-\r
-       p_port = osm_get_port_by_guid(p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4105: No SM port object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          HACK: We are assuming SM is running on HCA, so when getting the default\r
-          port we'll get the port connected to the rest of the subnet. If SM is\r
-          running on SWITCH - we should try to get a dr path from all switch ports.\r
-        */\r
-       p_physp = p_port->p_physp;\r
-\r
-       CL_ASSERT(p_physp);\r
-\r
-       cl_list_insert_tail(p_nextPortsList, p_physp);\r
-\r
-       while (next_list_is_full == TRUE) {\r
-               next_list_is_full = FALSE;\r
-               p_currPortsList = p_nextPortsList;\r
-               p_nextPortsList = (cl_list_t *) malloc(sizeof(cl_list_t));\r
-               if (!p_nextPortsList) {\r
-                       p_nextPortsList = p_currPortsList;\r
-                       goto Exit;\r
-               }\r
-               cl_list_construct(p_nextPortsList);\r
-               cl_list_init(p_nextPortsList, 10);\r
-               p_physp = (osm_physp_t *) cl_list_remove_head(p_currPortsList);\r
-               while (p_physp != NULL) {\r
-                       /* If we are in a switch - need to go out through all\r
-                          the other physical ports of the switch */\r
-                       num_ports = osm_node_get_num_physp(p_physp->p_node);\r
-\r
-                       for (port_num = 1; port_num < num_ports; port_num++) {\r
-                               if (osm_node_get_type(p_physp->p_node) ==\r
-                                   IB_NODE_TYPE_SWITCH)\r
-                                       p_remote_physp =\r
-                                           osm_node_get_physp_ptr(p_physp->\r
-                                                                  p_node,\r
-                                                                  port_num);\r
-                               else\r
-                                       /* this is HCA or router - the remote port is just the port connected\r
-                                          on the other side */\r
-                                       p_remote_physp =\r
-                                           p_physp->p_remote_physp;\r
-\r
-                               /*\r
-                                  make sure that all of the following occurred:\r
-                                  1. The port isn't NULL\r
-                                  2. This is not the port we came from\r
-                                  3. The port is not in the physp_map\r
-                                  4. This port haven't been visited before\r
-                                */\r
-                               if (p_remote_physp &&\r
-                                   p_remote_physp != p_physp &&\r
-                                   cl_map_get(&physp_map,\r
-                                              ptr_to_key(p_remote_physp))\r
-                                   == NULL\r
-                                   && cl_map_get(&visited_map,\r
-                                                 ptr_to_key\r
-                                                 (p_remote_physp)) == NULL) {\r
-                                       /* Insert the port into the visited_map, and save its source port */\r
-                                       cl_map_insert(&visited_map,\r
-                                                     ptr_to_key\r
-                                                     (p_remote_physp),\r
-                                                     p_physp);\r
-\r
-                                       /* Is this the p_dest_physp? */\r
-                                       if (p_remote_physp == p_dest_physp) {\r
-                                               /* update the new dr path */\r
-                                               physp_update_new_dr_path\r
-                                                   (p_dest_physp, &visited_map,\r
-                                                    h_bind);\r
-                                               reached_dest = TRUE;\r
-                                               break;\r
-                                       }\r
-\r
-                                       /* add the p_remote_physp to the nextPortsList */\r
-                                       cl_list_insert_tail(p_nextPortsList,\r
-                                                           p_remote_physp);\r
-                                       next_list_is_full = TRUE;\r
-                               }\r
-                       }\r
-\r
-                       p_physp = (osm_physp_t *)\r
-                           cl_list_remove_head(p_currPortsList);\r
-                       if (reached_dest == TRUE) {\r
-                               /* free the rest of the currPortsList */\r
-                               while (p_physp != NULL)\r
-                                       p_physp = (osm_physp_t *)\r
-                                           cl_list_remove_head\r
-                                           (p_currPortsList);\r
-                               /* free the nextPortsList, if items were added to it */\r
-                               p_physp = (osm_physp_t *)\r
-                                   cl_list_remove_head(p_nextPortsList);\r
-                               while (p_physp != NULL)\r
-                                       p_physp = (osm_physp_t *)\r
-                                           cl_list_remove_head\r
-                                           (p_nextPortsList);\r
-                               next_list_is_full = FALSE;\r
-                       }\r
-               }\r
-               cl_list_destroy(p_currPortsList);\r
-               free(p_currPortsList);\r
-       }\r
-\r
-       /* cleanup */\r
-Exit:\r
-       cl_list_destroy(p_nextPortsList);\r
-       free(p_nextPortsList);\r
-       cl_map_destroy(&physp_map);\r
-       cl_map_destroy(&visited_map);\r
-}\r
-\r
-boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp)\r
-{\r
-       osm_physp_t *p_remote_physp;\r
-\r
-       CL_ASSERT(p_physp);\r
-       p_remote_physp = p_physp->p_remote_physp;\r
-       if (p_remote_physp != NULL)\r
-               return ((p_physp->healthy) & (p_remote_physp->healthy));\r
-       /* the other side is not known - consider the link as healthy */\r
-       return TRUE;\r
-}\r
-\r
-void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,\r
-                           IN osm_physp_t * p_physp,\r
-                           IN ib_pkey_table_t * p_pkey_tbl,\r
-                           IN uint16_t block_num)\r
-{\r
-       uint16_t max_blocks;\r
-\r
-       CL_ASSERT(p_pkey_tbl);\r
-       /*\r
-          (14.2.5.7) - the block number valid values are 0-2047, and are\r
-          further limited by the size of the P_Key table specified by\r
-          the PartitionCap on the node.\r
-        */\r
-       if (!p_physp->p_node->sw || p_physp->port_num == 0)\r
-               /*\r
-                  The maximum blocks is defined in the node info: partition cap\r
-                  for CA, router, and switch management ports.\r
-                */\r
-               max_blocks =\r
-                   (cl_ntoh16(p_physp->p_node->node_info.partition_cap) +\r
-                    IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1)\r
-                   / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;\r
-       else\r
-               /*\r
-                  This is a switch, and not a management port. The maximum\r
-                  blocks is defined in the switch info: partition enforcement\r
-                  cap.\r
-                */\r
-               max_blocks =\r
-                   (cl_ntoh16(p_physp->p_node->sw->switch_info.enforce_cap) +\r
-                    IB_NUM_PKEY_ELEMENTS_IN_BLOCK -\r
-                    1) / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;\r
-\r
-       if (block_num >= max_blocks) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4108: "\r
-                       "Got illegal set for block number:%u "\r
-                       "For GUID: %" PRIx64 " port number:%u\n",\r
-                       block_num,\r
-                       cl_ntoh64(p_physp->p_node->node_info.node_guid),\r
-                       p_physp->port_num);\r
-               return;\r
-       }\r
-\r
-       osm_pkey_tbl_set(&p_physp->pkeys, block_num, p_pkey_tbl);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_port_info_rcv.c b/branches/opensm_3/user/opensm/osm_port_info_rcv.c
deleted file mode 100644 (file)
index ad3e81f..0000000
+++ /dev/null
@@ -1,618 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_pi_rcv_t.\r
- * This object represents the PortInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_remote_sm.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-\r
-static void pi_rcv_check_and_fix_lid(osm_log_t * log, ib_port_info_t * pi,\r
-                                    osm_physp_t * p)\r
-{\r
-       if (cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO) {\r
-               OSM_LOG(log, OSM_LOG_ERROR, "ERR 0F04: "\r
-                       "Got invalid base LID %u from the network. "\r
-                       "Corrected to %u\n", cl_ntoh16(pi->base_lid),\r
-                       cl_ntoh16(p->port_info.base_lid));\r
-               pi->base_lid = p->port_info.base_lid;\r
-       }\r
-}\r
-\r
-static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,\r
-                                  IN const ib_port_info_t * p_pi)\r
-{\r
-       osm_madw_context_t context;\r
-       ib_api_status_t status;\r
-       ib_net64_t port_guid;\r
-       uint8_t rate, mtu;\r
-       cl_qmap_t *p_sm_tbl;\r
-       osm_remote_sm_t *p_sm;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-       /* HACK extended port 0 should be handled too! */\r
-       if (osm_physp_get_port_num(p_physp) != 0) {\r
-               /* track the minimal endport MTU and rate */\r
-               mtu = ib_port_info_get_mtu_cap(p_pi);\r
-               if (mtu < sm->p_subn->min_ca_mtu) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Setting endport minimal MTU to:%u defined by port:0x%"\r
-                               PRIx64 "\n", mtu, cl_ntoh64(port_guid));\r
-                       sm->p_subn->min_ca_mtu = mtu;\r
-               }\r
-\r
-               rate = ib_port_info_compute_rate(p_pi);\r
-               if (rate < sm->p_subn->min_ca_rate) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Setting endport minimal rate to:%u defined by port:0x%"\r
-                               PRIx64 "\n", rate, cl_ntoh64(port_guid));\r
-                       sm->p_subn->min_ca_rate = rate;\r
-               }\r
-       }\r
-\r
-       if (port_guid != sm->p_subn->sm_port_guid) {\r
-               p_sm_tbl = &sm->p_subn->sm_guid_tbl;\r
-               if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {\r
-                       /*\r
-                        * Before querying the SM - we want to make sure we\r
-                        * clean its state, so if the querying fails we\r
-                        * recognize that this SM is not active.\r
-                        */\r
-                       p_sm =\r
-                           (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl,\r
-                                                           port_guid);\r
-                       if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl))\r
-                               /* clean it up */\r
-                               p_sm->smi.pri_state =\r
-                                   0xF0 & p_sm->smi.pri_state;\r
-                       if (sm->p_subn->opt.ignore_other_sm)\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Ignoring SM on port 0x%" PRIx64 "\n",\r
-                                       cl_ntoh64(port_guid));\r
-                       else {\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Detected another SM. Requesting SMInfo"\r
-                                       "\n\t\t\t\tPort 0x%" PRIx64 "\n",\r
-                                       cl_ntoh64(port_guid));\r
-\r
-                               /*\r
-                                  This port indicates it's an SM and\r
-                                  it's not our own port.\r
-                                  Acquire the SMInfo Attribute.\r
-                                */\r
-                               memset(&context, 0, sizeof(context));\r
-                               context.smi_context.set_method = FALSE;\r
-                               context.smi_context.port_guid = port_guid;\r
-                               status = osm_req_get(sm,\r
-                                                    osm_physp_get_dr_path_ptr\r
-                                                    (p_physp),\r
-                                                    IB_MAD_ATTR_SM_INFO, 0,\r
-                                                    CL_DISP_MSGID_NONE,\r
-                                                    &context);\r
-\r
-                               if (status != IB_SUCCESS)\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 0F05: "\r
-                                               "Failure requesting SMInfo (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                       }\r
-               } else {\r
-                       p_sm =\r
-                           (osm_remote_sm_t *) cl_qmap_remove(p_sm_tbl,\r
-                                                              port_guid);\r
-                       if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl))\r
-                               free(p_sm);\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                                      IN osm_physp_t * p_physp,\r
-                                      IN ib_port_info_t * p_pi)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_madw_context_t context;\r
-       osm_physp_t *p_remote_physp;\r
-       osm_node_t *p_remote_node;\r
-       uint8_t port_num;\r
-       uint8_t remote_port_num;\r
-       osm_dr_path_t path;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-          Check the state of the physical port.\r
-          If there appears to be something on the other end of the wire,\r
-          then ask for NodeInfo.  Ignore the switch management port.\r
-        */\r
-       port_num = osm_physp_get_port_num(p_physp);\r
-       /* if in_sweep_hop_0 is TRUE, then this means the SM is on the switch,\r
-          and we got switchInfo of our local switch. Do not continue\r
-          probing through the switch. */\r
-       if (port_num != 0 && sm->p_subn->in_sweep_hop_0 == FALSE) {\r
-               switch (ib_port_info_get_port_state(p_pi)) {\r
-               case IB_LINK_DOWN:\r
-                       p_remote_physp = osm_physp_get_remote(p_physp);\r
-                       if (p_remote_physp) {\r
-                               p_remote_node =\r
-                                   osm_physp_get_node_ptr(p_remote_physp);\r
-                               remote_port_num =\r
-                                   osm_physp_get_port_num(p_remote_physp);\r
-\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Unlinking local node 0x%" PRIx64\r
-                                       ", port %u"\r
-                                       "\n\t\t\t\tand remote node 0x%" PRIx64\r
-                                       ", port %u\n",\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_node)), port_num,\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_remote_node)),\r
-                                       remote_port_num);\r
-\r
-                               if (sm->ucast_mgr.cache_valid)\r
-                                       osm_ucast_cache_add_link(&sm->ucast_mgr,\r
-                                                                p_physp,\r
-                                                                p_remote_physp);\r
-\r
-                               osm_node_unlink(p_node, (uint8_t) port_num,\r
-                                               p_remote_node,\r
-                                               (uint8_t) remote_port_num);\r
-\r
-                       }\r
-                       break;\r
-\r
-               case IB_LINK_INIT:\r
-               case IB_LINK_ARMED:\r
-               case IB_LINK_ACTIVE:\r
-                       /*\r
-                          To avoid looping forever, only probe the port if it\r
-                          is NOT the port that responded to the SMP.\r
-\r
-                          Request node info from the other end of this link:\r
-                          1) Copy the current path from the parent node.\r
-                          2) Extend the path to the next hop thru this port.\r
-                          3) Request node info with the new path\r
-\r
-                        */\r
-                       if (p_pi->local_port_num !=\r
-                           osm_physp_get_port_num(p_physp)) {\r
-                               path = *osm_physp_get_dr_path_ptr(p_physp);\r
-\r
-                               if (osm_dr_path_extend(&path,\r
-                                                      osm_physp_get_port_num\r
-                                                      (p_physp))) {\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 0F08: "\r
-                                               "DR path with hop count %d couldn't be extended\n",\r
-                                               path.hop_count);\r
-                                       break;\r
-                               }\r
-\r
-                               memset(&context, 0, sizeof(context));\r
-                               context.ni_context.node_guid =\r
-                                   osm_node_get_node_guid(p_node);\r
-                               context.ni_context.port_num =\r
-                                   osm_physp_get_port_num(p_physp);\r
-\r
-                               status = osm_req_get(sm, &path,\r
-                                                    IB_MAD_ATTR_NODE_INFO, 0,\r
-                                                    CL_DISP_MSGID_NONE,\r
-                                                    &context);\r
-\r
-                               if (status != IB_SUCCESS)\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 0F02: "\r
-                                               "Failure initiating NodeInfo request (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                       } else\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Skipping SMP responder port %u\n",\r
-                                       p_pi->local_port_num);\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F03: "\r
-                               "Unknown link state = %u, port = %u\n",\r
-                               ib_port_info_get_port_state(p_pi),\r
-                               p_pi->local_port_num);\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (ib_port_info_get_port_state(p_pi) > IB_LINK_INIT && p_node->sw &&\r
-           p_node->sw->need_update == 1 && port_num != 0)\r
-               p_node->sw->need_update = 0;\r
-\r
-       if (p_physp->need_update)\r
-               sm->p_subn->ignore_existing_lfts = TRUE;\r
-\r
-       if (port_num == 0)\r
-               pi_rcv_check_and_fix_lid(sm->p_log, p_pi, p_physp);\r
-\r
-       /*\r
-          Update the PortInfo attribute.\r
-        */\r
-       osm_physp_set_port_info(p_physp, p_pi);\r
-\r
-       if (port_num == 0) {\r
-               /* Determine if base switch port 0 */\r
-               if (p_node->sw &&\r
-                   !ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info))\r
-                       /* PortState is not used on BSP0 but just in case it is DOWN */\r
-                       p_physp->port_info = *p_pi;\r
-               pi_rcv_process_endport(sm, p_physp, p_pi);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,\r
-                                            IN osm_node_t * p_node,\r
-                                            IN osm_physp_t * p_physp,\r
-                                            IN ib_port_info_t * p_pi)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       UNUSED_PARAM(p_node);\r
-\r
-       pi_rcv_check_and_fix_lid(sm->p_log, p_pi, p_physp);\r
-\r
-       osm_physp_set_port_info(p_physp, p_pi);\r
-\r
-       pi_rcv_process_endport(sm, p_physp, p_pi);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-#define IBM_VENDOR_ID  (0x5076)\r
-static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm,\r
-                          IN osm_node_t * p_node, IN osm_physp_t * p_physp)\r
-{\r
-\r
-       osm_madw_context_t context;\r
-       ib_api_status_t status;\r
-       osm_dr_path_t path;\r
-       uint8_t port_num;\r
-       uint16_t block_num, max_blocks;\r
-       uint32_t attr_mod_ho;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       path = *osm_physp_get_dr_path_ptr(p_physp);\r
-\r
-       context.pkey_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.pkey_context.port_guid = osm_physp_get_port_guid(p_physp);\r
-       context.pkey_context.set_method = FALSE;\r
-\r
-       port_num = p_physp->port_num;\r
-\r
-       if (!p_node->sw || port_num == 0)\r
-               /* The maximum blocks is defined by the node info partition cap\r
-                  for CA, router, and switch management ports. */\r
-               max_blocks =\r
-                   (cl_ntoh16(p_node->node_info.partition_cap) +\r
-                    IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1)\r
-                   / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;\r
-       else {\r
-               /* This is a switch, and not a management port. The maximum blocks\r
-                  is defined in the switch info partition enforcement cap. */\r
-\r
-               /* Check for IBM eHCA firmware defect in reporting partition enforcement cap */\r
-               if (cl_ntoh32(ib_node_info_get_vendor_id(&p_node->node_info)) ==\r
-                   IBM_VENDOR_ID)\r
-                       p_node->sw->switch_info.enforce_cap = 0;\r
-\r
-               /* Bail out if this is a switch with no partition enforcement capability */\r
-               if (cl_ntoh16(p_node->sw->switch_info.enforce_cap) == 0)\r
-                       goto Exit;\r
-\r
-               max_blocks = (cl_ntoh16(p_node->sw->switch_info.enforce_cap) +\r
-                             IB_NUM_PKEY_ELEMENTS_IN_BLOCK -\r
-                             1) / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;\r
-       }\r
-\r
-       for (block_num = 0; block_num < max_blocks; block_num++) {\r
-               if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH)\r
-                       attr_mod_ho = block_num;\r
-               else\r
-                       attr_mod_ho = block_num | (port_num << 16);\r
-               status = osm_req_get(sm, &path, IB_MAD_ATTR_P_KEY_TABLE,\r
-                                    cl_hton32(attr_mod_ho),\r
-                                    CL_DISP_MSGID_NONE, &context);\r
-\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0F12: "\r
-                               "Failure initiating PKeyTable request (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-static void pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,\r
-                                           IN osm_node_t * p_node,\r
-                                           IN osm_physp_t * p_physp)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       get_pkey_table(sm->p_log, sm, p_node, p_physp);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                              IN uint8_t port_num, IN osm_madw_t * p_madw)\r
-{\r
-       osm_physp_t *p_physp;\r
-       ib_net64_t port_guid;\r
-       ib_smp_t *p_smp;\r
-       ib_port_info_t *p_pi;\r
-       osm_pi_context_t *p_context;\r
-       osm_log_level_t level;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_context = osm_madw_get_pi_context_ptr(p_madw);\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       CL_ASSERT(p_physp);\r
-\r
-       port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_pi = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       /* check for error */\r
-       if (cl_ntoh16(p_smp->status) & 0x7fff) {\r
-               /* If port already ACTIVE, don't treat status 7 as error */\r
-               if (p_context->active_transition &&\r
-                   (cl_ntoh16(p_smp->status) & 0x7fff) == 0x1c) {\r
-                       level = OSM_LOG_INFO;\r
-                       OSM_LOG(sm->p_log, OSM_LOG_INFO,\r
-                               "Received error status 0x%x for SetResp() during ACTIVE transition\n",\r
-                               cl_ntoh16(p_smp->status) & 0x7fff);\r
-                       /* Should there be a subsequent Get to validate that port is ACTIVE ? */\r
-               } else {\r
-                       level = OSM_LOG_ERROR;\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F10: "\r
-                               "Received error status for SetResp()\n");\r
-               }\r
-               osm_dump_port_info(sm->p_log, osm_node_get_node_guid(p_node),\r
-                                  port_guid, port_num, p_pi, level);\r
-       }\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Received logical SetResp() for GUID 0x%" PRIx64\r
-               ", port num %u"\r
-               "\n\t\t\t\tfor parent node GUID 0x%" PRIx64\r
-               " TID 0x%" PRIx64 "\n",\r
-               cl_ntoh64(port_guid), port_num,\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-               cl_ntoh64(p_smp->trans_id));\r
-\r
-       osm_physp_set_port_info(p_physp, p_pi);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_pi_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_port_info_t *p_pi;\r
-       ib_smp_t *p_smp;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_node_t *p_node;\r
-       osm_pi_context_t *p_context;\r
-       ib_net64_t port_guid, node_guid;\r
-       uint8_t port_num;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(sm);\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_context = osm_madw_get_pi_context_ptr(p_madw);\r
-       p_pi = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_PORT_INFO);\r
-\r
-       port_num = (uint8_t) cl_ntoh32(p_smp->attr_mod);\r
-\r
-       port_guid = p_context->port_guid;\r
-       node_guid = p_context->node_guid;\r
-\r
-       osm_dump_port_info(sm->p_log, node_guid, port_guid, port_num, p_pi,\r
-                          OSM_LOG_DEBUG);\r
-\r
-       /* On receipt of client reregister, clear the reregister bit so\r
-          reregistering won't be sent again and again */\r
-       if (ib_port_info_get_client_rereg(p_pi)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Client reregister received on response\n");\r
-               ib_port_info_set_client_rereg(p_pi, 0);\r
-       }\r
-\r
-       /*\r
-          we might get a response during a light sweep looking for a change in\r
-          the status of a remote port that did not respond in earlier sweeps.\r
-          So if the context of the Get was light_sweep - we do not need to\r
-          do anything with the response - just flag that we need a heavy sweep\r
-        */\r
-       if (p_context->light_sweep == TRUE) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Got light sweep response from remote port of parent node "\r
-                       "GUID 0x%" PRIx64 " port 0x%016" PRIx64\r
-                       ", Commencing heavy sweep\n",\r
-                       cl_ntoh64(node_guid), cl_ntoh64(port_guid));\r
-               sm->p_subn->force_heavy_sweep = TRUE;\r
-               sm->p_subn->ignore_existing_lfts = TRUE;\r
-               goto Exit;\r
-       }\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F06: "\r
-                       "No port object for port with GUID 0x%" PRIx64\r
-                       "\n\t\t\t\tfor parent node GUID 0x%" PRIx64\r
-                       ", TID 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(port_guid),\r
-                       cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-               goto Exit;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       CL_ASSERT(p_node);\r
-\r
-       /*\r
-          If we were setting the PortInfo, then receiving\r
-          this attribute was not part of sweeping the subnet.\r
-          In this case, just update the PortInfo attribute.\r
-\r
-          In an unfortunate blunder, the IB spec defines the\r
-          return method for Set() as a GetResp().  Thus, we can't\r
-          use the method (what would have been SetResp()) to determine\r
-          our course of action.  So, we have to carry this extra\r
-          boolean around to determine if we were doing Get() or Set().\r
-        */\r
-       if (p_context->set_method)\r
-               pi_rcv_process_set(sm, p_node, port_num, p_madw);\r
-       else {\r
-               p_port->discovery_count++;\r
-\r
-               /*\r
-                  This PortInfo arrived because we did a Get() method,\r
-                  most likely due to a subnet sweep in progress.\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Discovered port num %u with GUID 0x%" PRIx64\r
-                       " for parent node GUID 0x%" PRIx64\r
-                       ", TID 0x%" PRIx64 "\n",\r
-                       port_num, cl_ntoh64(port_guid),\r
-                       cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-               CL_ASSERT(p_physp);\r
-\r
-               /* Update the directed route path to this port\r
-                  in case the old path is no longer usable. */\r
-               p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-               osm_dr_path_init(p_dr_path, osm_madw_get_bind_handle(p_madw),\r
-                                p_smp->hop_count, p_smp->initial_path);\r
-\r
-               /* if port just inited or reached INIT state (external reset)\r
-                  request update for port related tables */\r
-               p_physp->need_update =\r
-                   (ib_port_info_get_port_state(p_pi) == IB_LINK_INIT ||\r
-                    p_physp->need_update > 1) ? 1 : 0;\r
-\r
-               switch (osm_node_get_type(p_node)) {\r
-               case IB_NODE_TYPE_CA:\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       pi_rcv_process_ca_or_router_port(sm, p_node, p_physp,\r
-                                                        p_pi);\r
-                       break;\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       pi_rcv_process_switch_port(sm, p_node, p_physp, p_pi);\r
-                       break;\r
-               default:\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F07: "\r
-                               "Unknown node type %u with GUID 0x%" PRIx64\r
-                               "\n", osm_node_get_type(p_node),\r
-                               cl_ntoh64(node_guid));\r
-                       break;\r
-               }\r
-\r
-               /*\r
-                  Get the tables on the physp.\r
-                */\r
-               if (p_physp->need_update || sm->p_subn->need_update)\r
-                       pi_rcv_get_pkey_slvl_vla_tables(sm, p_node, p_physp);\r
-\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-Exit:\r
-       /*\r
-          Release the lock before jumping here!!\r
-        */\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_prtn.c b/branches/opensm_3/user/opensm/osm_prtn.c
deleted file mode 100644 (file)
index f2493ba..0000000
+++ /dev/null
@@ -1,388 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_prtn_t.\r
- * This object represents an IBA partition.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <stdio.h>\r
-#include <sys/stat.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_multicast.h>\r
-\r
-extern int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                     const char *file_name);\r
-\r
-static uint16_t global_pkey_counter;\r
-\r
-osm_prtn_t *osm_prtn_new(IN const char *name, IN uint16_t pkey)\r
-{\r
-       osm_prtn_t *p = malloc(sizeof(*p));\r
-       if (!p)\r
-               return NULL;\r
-\r
-       memset(p, 0, sizeof(*p));\r
-       p->pkey = pkey;\r
-       p->sl = OSM_DEFAULT_SL;\r
-       cl_map_construct(&p->full_guid_tbl);\r
-       cl_map_init(&p->full_guid_tbl, 32);\r
-       cl_map_construct(&p->part_guid_tbl);\r
-       cl_map_init(&p->part_guid_tbl, 32);\r
-\r
-       if (name && *name)\r
-               strncpy(p->name, name, sizeof(p->name));\r
-       else\r
-               snprintf(p->name, sizeof(p->name), "%04x", cl_ntoh16(pkey));\r
-\r
-       return p;\r
-}\r
-\r
-void osm_prtn_delete(IN OUT osm_prtn_t ** pp_prtn)\r
-{\r
-       osm_prtn_t *p = *pp_prtn;\r
-\r
-       cl_map_remove_all(&p->full_guid_tbl);\r
-       cl_map_destroy(&p->full_guid_tbl);\r
-       cl_map_remove_all(&p->part_guid_tbl);\r
-       cl_map_destroy(&p->part_guid_tbl);\r
-       free(p);\r
-       *pp_prtn = NULL;\r
-}\r
-\r
-ib_api_status_t osm_prtn_add_port(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                 osm_prtn_t * p, ib_net64_t guid,\r
-                                 boolean_t full)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       cl_map_t *p_tbl;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-\r
-       p_port = osm_get_port_by_guid(p_subn, guid);\r
-       if (!p_port) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "port 0x%" PRIx64 " not found\n", cl_ntoh64(guid));\r
-               return status;\r
-       }\r
-\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "no physical for port 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(guid));\r
-               return status;\r
-       }\r
-\r
-       if (cl_map_remove(&p->part_guid_tbl, guid) ||\r
-           cl_map_remove(&p->full_guid_tbl, guid))\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE, "port 0x%" PRIx64 " already "\r
-                       "in partition \'%s\' (0x%04x). Will overwrite\n",\r
-                       cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));\r
-\r
-       p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl;\r
-\r
-       if (cl_map_insert(p_tbl, guid, p_physp) == NULL)\r
-               return IB_INSUFFICIENT_MEMORY;\r
-\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                osm_prtn_t * p, unsigned type, boolean_t full)\r
-{\r
-       cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;\r
-       cl_map_item_t *p_item;\r
-       osm_port_t *p_port;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       p_item = cl_qmap_head(p_port_tbl);\r
-       while (p_item != cl_qmap_end(p_port_tbl)) {\r
-               p_port = (osm_port_t *) p_item;\r
-               p_item = cl_qmap_next(p_item);\r
-               if (!type || osm_node_get_type(p_port->p_node) == type) {\r
-                       status = osm_prtn_add_port(p_log, p_subn, p,\r
-                                                  osm_port_get_guid(p_port),\r
-                                                  full);\r
-                       if (status != IB_SUCCESS)\r
-                               goto _err;\r
-               }\r
-       }\r
-\r
-_err:\r
-       return status;\r
-}\r
-\r
-static const ib_gid_t osm_ipoib_mgid = {\r
-       {\r
-        0xff,                  /*  multicast field */\r
-        0x12,                  /*  non-permanent bit, link local scope */\r
-        0x40, 0x1b,            /*  IPv4 signature */\r
-        0xff, 0xff,            /*  16 bits of P_Key (to be filled in) */\r
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    /*  48 bits of zeros */\r
-        0xff, 0xff, 0xff, 0xff,        /*  32 bit IPv4 broadcast address */\r
-        },\r
-};\r
-\r
-/*\r
- * HACK: Until TS resolves their noncompliant join compmask,\r
- * we have to pre-define the MGID\r
- */\r
-static const ib_gid_t osm_ts_ipoib_mgid = {\r
-       {\r
-        0xff,                  /*  multicast field */\r
-        0x12,                  /*  non-permanent bit, link local scope */\r
-        0x40, 0x1b,            /*  IPv4 signature */\r
-        0xff, 0xff,            /*  16 bits of P_Key (to be filled in) */\r
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    /*  48 bits of zeros */\r
-        0x00, 0x00, 0x00, 0x01,        /*  32 bit IPv4 broadcast address */\r
-        },\r
-};\r
-\r
-ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                    osm_prtn_t * p, uint8_t rate, uint8_t mtu,\r
-                                    uint8_t scope)\r
-{\r
-       ib_member_rec_t mc_rec;\r
-       ib_net64_t comp_mask;\r
-       ib_net16_t pkey;\r
-       osm_mgrp_t *p_mgrp = NULL;\r
-       osm_sa_t *p_sa = &p_subn->p_osm->sa;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint8_t hop_limit;\r
-\r
-       pkey = p->pkey | cl_hton16(0x8000);\r
-       if (!scope)\r
-               scope = OSM_DEFAULT_MGRP_SCOPE;\r
-       hop_limit = (scope == IB_MC_SCOPE_LINK_LOCAL) ? 0 : IB_HOPLIMIT_MAX;\r
-\r
-       memset(&mc_rec, 0, sizeof(mc_rec));\r
-\r
-       mc_rec.mgid = osm_ipoib_mgid;   /* ipv4 broadcast group */\r
-       memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));\r
-\r
-       mc_rec.qkey = CL_HTON32(0x0b1b);\r
-       mc_rec.mtu = (mtu ? mtu : OSM_DEFAULT_MGRP_MTU) | (2 << 6);     /* 2048 Bytes */\r
-       mc_rec.tclass = 0;\r
-       mc_rec.pkey = pkey;\r
-       mc_rec.rate = (rate ? rate : OSM_DEFAULT_MGRP_RATE) | (2 << 6); /* 10Gb/sec */\r
-       mc_rec.pkt_life = p_subn->opt.subnet_timeout;\r
-       mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p->sl, 0, hop_limit);\r
-       /* Scope in MCMemberRecord (if present) needs to be consistent with MGID */\r
-       mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);\r
-       ib_mgid_set_scope(&mc_rec.mgid, scope);\r
-\r
-       /* don't update rate, mtu */\r
-       comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL |\r
-           IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;\r
-       status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,\r
-                                                     &p_mgrp);\r
-       if (!p_mgrp || status != IB_SUCCESS)\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Failed to create MC group with pkey 0x%04x\n",\r
-                       cl_ntoh16(pkey));\r
-       if (p_mgrp) {\r
-               p_mgrp->well_known = TRUE;\r
-               p->mgrp = p_mgrp;\r
-       }\r
-\r
-       /* workaround for TS */\r
-       /* FIXME: remove this upon TS fixes */\r
-       mc_rec.mgid = osm_ts_ipoib_mgid;\r
-       memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));\r
-       /* Scope in MCMemberRecord (if present) needs to be consistent with MGID */\r
-       mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);\r
-       ib_mgid_set_scope(&mc_rec.mgid, scope);\r
-\r
-       status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,\r
-                                                     &p_mgrp);\r
-       if (p_mgrp) {\r
-               p_mgrp->well_known = TRUE;\r
-               if (!p->mgrp)\r
-                       p->mgrp = p_mgrp;\r
-       }\r
-\r
-       return status;\r
-}\r
-\r
-static uint16_t generate_pkey(osm_subn_t * p_subn)\r
-{\r
-       uint16_t pkey;\r
-\r
-       cl_qmap_t *m = &p_subn->prtn_pkey_tbl;\r
-       while (global_pkey_counter < cl_ntoh16(IB_DEFAULT_PARTIAL_PKEY) - 1) {\r
-               pkey = ++global_pkey_counter;\r
-               pkey = cl_hton16(pkey);\r
-               if (cl_qmap_get(m, pkey) == cl_qmap_end(m))\r
-                       return pkey;\r
-       }\r
-       return 0;\r
-}\r
-\r
-osm_prtn_t *osm_prtn_find_by_name(osm_subn_t * p_subn, const char *name)\r
-{\r
-       cl_map_item_t *p_next;\r
-       osm_prtn_t *p;\r
-\r
-       p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);\r
-       while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {\r
-               p = (osm_prtn_t *) p_next;\r
-               p_next = cl_qmap_next(&p->map_item);\r
-               if (!strncmp(p->name, name, sizeof(p->name)))\r
-                       return p;\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                             const char *name, uint16_t pkey)\r
-{\r
-       osm_prtn_t *p = NULL, *p_check;\r
-\r
-       pkey &= cl_hton16((uint16_t) ~ 0x8000);\r
-\r
-       if (!pkey) {\r
-               if (name && (p = osm_prtn_find_by_name(p_subn, name)))\r
-                       return p;\r
-               if (!(pkey = generate_pkey(p_subn)))\r
-                       return NULL;\r
-       }\r
-\r
-       p = osm_prtn_new(name, pkey);\r
-       if (!p) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "Unable to create"\r
-                       " partition \'%s\' (0x%04x)\n", name, cl_ntoh16(pkey));\r
-               return NULL;\r
-       }\r
-\r
-       p_check = (osm_prtn_t *) cl_qmap_insert(&p_subn->prtn_pkey_tbl,\r
-                                               p->pkey, &p->map_item);\r
-       if (p != p_check) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE, "Duplicated partition"\r
-                       " definition: \'%s\' (0x%04x) prev name \'%s\'"\r
-                       ".  Will use it\n",\r
-                       name, cl_ntoh16(pkey), p_check->name);\r
-               osm_prtn_delete(&p);\r
-               p = p_check;\r
-       }\r
-\r
-       return p;\r
-}\r
-\r
-static ib_api_status_t prtn_make_default(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                        boolean_t no_config)\r
-{\r
-       ib_api_status_t status = IB_UNKNOWN_ERROR;\r
-       osm_prtn_t *p;\r
-\r
-       p = osm_prtn_make_new(p_log, p_subn, "Default",\r
-                             IB_DEFAULT_PARTIAL_PKEY);\r
-       if (!p)\r
-               goto _err;\r
-       status = osm_prtn_add_all(p_log, p_subn, p, 0, no_config);\r
-       if (status != IB_SUCCESS)\r
-               goto _err;\r
-       cl_map_remove(&p->part_guid_tbl, p_subn->sm_port_guid);\r
-       status =\r
-           osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE);\r
-\r
-       if (no_config)\r
-               osm_prtn_add_mcgroup(p_log, p_subn, p, 0, 0, 0);\r
-\r
-_err:\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)\r
-{\r
-       struct stat statbuf;\r
-       const char *file_name;\r
-       boolean_t is_config = TRUE;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       cl_map_item_t *p_next;\r
-       osm_prtn_t *p;\r
-\r
-       file_name = p_subn->opt.partition_config_file ?\r
-           p_subn->opt.partition_config_file : OSM_DEFAULT_PARTITION_CONFIG_FILE;\r
-       if (stat(file_name, &statbuf))\r
-               is_config = FALSE;\r
-\r
-       /* clean up current port maps */\r
-       p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);\r
-       while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {\r
-               p = (osm_prtn_t *) p_next;\r
-               p_next = cl_qmap_next(&p->map_item);\r
-               cl_map_remove_all(&p->part_guid_tbl);\r
-               cl_map_remove_all(&p->full_guid_tbl);\r
-       }\r
-\r
-       global_pkey_counter = 0;\r
-\r
-       status = prtn_make_default(p_log, p_subn, !is_config);\r
-       if (status != IB_SUCCESS)\r
-               goto _err;\r
-\r
-       if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name))\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE, "Partition configuration "\r
-                       "was not fully processed\n");\r
-\r
-       /* and now clean up empty partitions */\r
-       p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);\r
-       while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {\r
-               p = (osm_prtn_t *) p_next;\r
-               p_next = cl_qmap_next(&p->map_item);\r
-               if (cl_map_count(&p->part_guid_tbl) == 0 &&\r
-                   cl_map_count(&p->full_guid_tbl) == 0) {\r
-                       cl_qmap_remove_item(&p_subn->prtn_pkey_tbl,\r
-                                           (cl_map_item_t *) p);\r
-                       osm_prtn_delete(&p);\r
-               }\r
-       }\r
-\r
-_err:\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_prtn_config.c b/branches/opensm_3/user/opensm/osm_prtn_config.c
deleted file mode 100644 (file)
index 7f0e646..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-/*\r
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of opensm partition management configuration\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <errno.h>\r
-#include <ctype.h>\r
-\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_log.h>\r
-\r
-struct part_conf {\r
-       osm_log_t *p_log;\r
-       osm_subn_t *p_subn;\r
-       osm_prtn_t *p_prtn;\r
-       unsigned is_ipoib, mtu, rate, sl, scope_mask;\r
-       boolean_t full;\r
-};\r
-\r
-extern osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                    const char *name, uint16_t pkey);\r
-extern ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                                       osm_prtn_t * p, unsigned type,\r
-                                       boolean_t full);\r
-extern ib_api_status_t osm_prtn_add_port(osm_log_t * p_log,\r
-                                        osm_subn_t * p_subn, osm_prtn_t * p,\r
-                                        ib_net64_t guid, boolean_t full);\r
-extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,\r
-                                           osm_subn_t * p_subn, osm_prtn_t * p,\r
-                                           uint8_t rate,\r
-                                           uint8_t mtu, uint8_t scope);\r
-\r
-static int partition_create(unsigned lineno, struct part_conf *conf,\r
-                           char *name, char *id, char *flag, char *flag_val)\r
-{\r
-       uint16_t pkey;\r
-       unsigned int scope;\r
-\r
-       if (!id && name && isdigit(*name)) {\r
-               id = name;\r
-               name = NULL;\r
-       }\r
-\r
-       if (id) {\r
-               char *end;\r
-\r
-               pkey = (uint16_t) strtoul(id, &end, 0);\r
-               if (end == id || *end)\r
-                       return -1;\r
-       } else\r
-               pkey = 0;\r
-\r
-       conf->p_prtn = osm_prtn_make_new(conf->p_log, conf->p_subn,\r
-                                        name, cl_hton16(pkey));\r
-       if (!conf->p_prtn)\r
-               return -1;\r
-\r
-       if (!conf->p_subn->opt.qos && conf->sl != OSM_DEFAULT_SL) {\r
-               OSM_LOG(conf->p_log, OSM_LOG_DEBUG, "Overriding SL %d"\r
-                       " to default SL %d on partition %s"\r
-                       " as QoS is not enabled.\n",\r
-                       conf->sl, OSM_DEFAULT_SL, name);\r
-               conf->sl = OSM_DEFAULT_SL;\r
-       }\r
-       conf->p_prtn->sl = (uint8_t) conf->sl;\r
-\r
-       if (!conf->is_ipoib)\r
-               return 0;\r
-\r
-       if (!conf->scope_mask) {\r
-               osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,\r
-                                    (uint8_t) conf->rate,\r
-                                    (uint8_t) conf->mtu,\r
-                                    0);\r
-               return 0;\r
-       }\r
-\r
-       for (scope = 0; scope < 16; scope++) {\r
-               if (((1<<scope) & conf->scope_mask) == 0)\r
-                       continue;\r
-\r
-               osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,\r
-                                    (uint8_t) conf->rate,\r
-                                    (uint8_t) conf->mtu,\r
-                                    (uint8_t) scope);\r
-       }\r
-       return 0;\r
-}\r
-\r
-static int partition_add_flag(unsigned lineno, struct part_conf *conf,\r
-                             char *flag, char *val)\r
-{\r
-       int len = strlen(flag);\r
-       if (!strncmp(flag, "ipoib", len)) {\r
-               conf->is_ipoib = 1;\r
-       } else if (!strncmp(flag, "mtu", len)) {\r
-               if (!val || (conf->mtu = strtoul(val, NULL, 0)) == 0)\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "flag \'mtu\' requires valid value"\r
-                               " - skipped\n", lineno);\r
-       } else if (!strncmp(flag, "rate", len)) {\r
-               if (!val || (conf->rate = strtoul(val, NULL, 0)) == 0)\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "flag \'rate\' requires valid value"\r
-                               " - skipped\n", lineno);\r
-       } else if (!strncmp(flag, "scope", len)) {\r
-               unsigned int scope;\r
-               if (!val || (scope = strtoul(val, NULL, 0)) == 0 || scope > 0xF)\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "flag \'scope\' requires valid value"\r
-                               " - skipped\n", lineno);\r
-               else\r
-                       conf->scope_mask |= (1<<scope);\r
-       } else if (!strncmp(flag, "sl", len)) {\r
-               unsigned sl;\r
-               char *end;\r
-\r
-               if (!val || !*val || (sl = strtoul(val, &end, 0)) > 15 ||\r
-                   (*end && !isspace(*end)))\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "flag \'sl\' requires valid value"\r
-                               " - skipped\n", lineno);\r
-               else\r
-                       conf->sl = sl;\r
-       } else if (!strncmp(flag, "defmember", len)) {\r
-               if (!val || (strncmp(val, "limited", strlen(val))\r
-                            && strncmp(val, "full", strlen(val))))\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "flag \'defmember\' requires valid value (limited or full)"\r
-                               " - skipped\n", lineno);\r
-               else\r
-                       conf->full = strncmp(val, "full", strlen(val)) == 0;\r
-       } else {\r
-               OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                       "PARSE WARN: line %d: "\r
-                       "unrecognized partition flag \'%s\'"\r
-                       " - ignored\n", lineno, flag);\r
-       }\r
-       return 0;\r
-}\r
-\r
-static int partition_add_port(unsigned lineno, struct part_conf *conf,\r
-                             char *name, char *flag)\r
-{\r
-       osm_prtn_t *p = conf->p_prtn;\r
-       ib_net64_t guid;\r
-       boolean_t full = conf->full;\r
-\r
-       if (!name || !*name || !strncmp(name, "NONE", strlen(name)))\r
-               return 0;\r
-\r
-       if (flag) {\r
-               /* reset default membership to limited */\r
-               full = FALSE;\r
-               if (!strncmp(flag, "full", strlen(flag)))\r
-                       full = TRUE;\r
-               else if (strncmp(flag, "limited", strlen(flag))) {\r
-                       OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,\r
-                               "PARSE WARN: line %d: "\r
-                               "unrecognized port flag \'%s\'."\r
-                               " Assume \'limited\'\n", lineno, flag);\r
-               }\r
-       }\r
-\r
-       if (!strncmp(name, "ALL", strlen(name))) {\r
-               return osm_prtn_add_all(conf->p_log, conf->p_subn, p,\r
-                                       0, full) == IB_SUCCESS ? 0 : -1;\r
-       } else if (!strncmp(name, "ALL_CAS", strlen(name))) {\r
-               return osm_prtn_add_all(conf->p_log, conf->p_subn, p,\r
-                                       IB_NODE_TYPE_CA, full) == IB_SUCCESS ? 0 : -1;\r
-       } else if (!strncmp(name, "ALL_SWITCHES", strlen(name))) {\r
-               return osm_prtn_add_all(conf->p_log, conf->p_subn, p,\r
-                                       IB_NODE_TYPE_SWITCH, full) == IB_SUCCESS ? 0 : -1;\r
-       } else if (!strncmp(name, "ALL_ROUTERS", strlen(name))) {\r
-               return osm_prtn_add_all(conf->p_log, conf->p_subn, p,\r
-                                       IB_NODE_TYPE_ROUTER, full) == IB_SUCCESS ? 0 : -1;\r
-       } else if (!strncmp(name, "SELF", strlen(name))) {\r
-               guid = cl_ntoh64(conf->p_subn->sm_port_guid);\r
-       } else {\r
-               char *end;\r
-               guid = strtoull(name, &end, 0);\r
-               if (!guid || *end)\r
-                       return -1;\r
-       }\r
-\r
-       if (osm_prtn_add_port(conf->p_log, conf->p_subn, p,\r
-                             cl_hton64(guid), full) != IB_SUCCESS)\r
-               return -1;\r
-\r
-       return 0;\r
-}\r
-\r
-/* conf file parser */\r
-\r
-#define STRIP_HEAD_SPACES(p) while (*(p) == ' ' || *(p) == '\t' || \\r
-               *(p) == '\n') { (p)++; }\r
-#define STRIP_TAIL_SPACES(p) { char *q = (p) + strlen(p); \\r
-                               while ( q != (p) && ( *q == '\0' || \\r
-                                       *q == ' ' || *q == '\t' || \\r
-                                       *q == '\n')) { *q-- = '\0'; }; }\r
-\r
-static int parse_name_token(char *str, char **name, char **val)\r
-{\r
-       int len = 0;\r
-       char *p, *q;\r
-\r
-       *name = *val = NULL;\r
-\r
-       p = str;\r
-\r
-       while (*p == ' ' || *p == '\t' || *p == '\n')\r
-               p++;\r
-\r
-       q = strchr(p, '=');\r
-       if (q)\r
-               *q++ = '\0';\r
-\r
-       len = strlen(str) + 1;\r
-       str = q;\r
-\r
-       q = p + strlen(p);\r
-       while (q != p && (*q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))\r
-               *q-- = '\0';\r
-\r
-       *name = p;\r
-\r
-       p = str;\r
-       if (!p)\r
-               return len;\r
-\r
-       while (*p == ' ' || *p == '\t' || *p == '\n')\r
-               p++;\r
-\r
-       q = p + strlen(p);\r
-       len += (int)(q - str) + 1;\r
-       while (q != p && (*q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))\r
-               *q-- = '\0';\r
-       *val = p;\r
-\r
-       return len;\r
-}\r
-\r
-static struct part_conf *new_part_conf(osm_log_t * p_log, osm_subn_t * p_subn)\r
-{\r
-       static struct part_conf part;\r
-       struct part_conf *conf = &part;\r
-\r
-       memset(conf, 0, sizeof(*conf));\r
-       conf->p_log = p_log;\r
-       conf->p_subn = p_subn;\r
-       conf->p_prtn = NULL;\r
-       conf->is_ipoib = 0;\r
-       conf->sl = OSM_DEFAULT_SL;\r
-       conf->full = FALSE;\r
-       return conf;\r
-}\r
-\r
-static int flush_part_conf(struct part_conf *conf)\r
-{\r
-       memset(conf, 0, sizeof(*conf));\r
-       return 0;\r
-}\r
-\r
-static int parse_part_conf(struct part_conf *conf, char *str, int lineno)\r
-{\r
-       int ret, len = 0;\r
-       char *name, *id, *flag, *flval;\r
-       char *q, *p;\r
-\r
-       p = str;\r
-       if (*p == '\t' || *p == '\0' || *p == '\n')\r
-               p++;\r
-\r
-       len += (int)(p - str);\r
-       str = p;\r
-\r
-       if (conf->p_prtn)\r
-               goto skip_header;\r
-\r
-       q = strchr(p, ':');\r
-       if (!q) {\r
-               OSM_LOG(conf->p_log, OSM_LOG_ERROR, "PARSE ERROR: line %d: "\r
-                       "no partition definition found\n", lineno);\r
-               fprintf(stderr, "\nPARSE ERROR: line %d: "\r
-                       "no partition definition found\n", lineno);\r
-               return -1;\r
-       }\r
-\r
-       *q++ = '\0';\r
-       str = q;\r
-\r
-       name = id = flag = flval = NULL;\r
-\r
-       q = strchr(p, ',');\r
-       if (q)\r
-               *q = '\0';\r
-\r
-       ret = parse_name_token(p, &name, &id);\r
-       p += ret;\r
-       len += ret;\r
-\r
-       while (q) {\r
-               flag = flval = NULL;\r
-               q = strchr(p, ',');\r
-               if (q)\r
-                       *q++ = '\0';\r
-               ret = parse_name_token(p, &flag, &flval);\r
-               if (!flag) {\r
-                       OSM_LOG(conf->p_log, OSM_LOG_ERROR,\r
-                               "PARSE ERROR: line %d: "\r
-                               "bad partition flags\n", lineno);\r
-                       fprintf(stderr, "\nPARSE ERROR: line %d: "\r
-                               "bad partition flags\n", lineno);\r
-                       return -1;\r
-               }\r
-               p += ret;\r
-               len += ret;\r
-               partition_add_flag(lineno, conf, flag, flval);\r
-       }\r
-\r
-       if (p != str || (partition_create(lineno, conf,\r
-                                         name, id, flag, flval) < 0)) {\r
-               OSM_LOG(conf->p_log, OSM_LOG_ERROR, "PARSE ERROR: line %d: "\r
-                       "bad partition definition\n", lineno);\r
-               fprintf(stderr, "\nPARSE ERROR: line %d: "\r
-                       "bad partition definition\n", lineno);\r
-               return -1;\r
-       }\r
-\r
-skip_header:\r
-       do {\r
-               name = flag = NULL;\r
-               q = strchr(p, ',');\r
-               if (q)\r
-                       *q++ = '\0';\r
-               ret = parse_name_token(p, &name, &flag);\r
-               if (partition_add_port(lineno, conf, name, flag) < 0) {\r
-                       OSM_LOG(conf->p_log, OSM_LOG_ERROR,\r
-                               "PARSE ERROR: line %d: "\r
-                               "bad PortGUID\n", lineno);\r
-                       fprintf(stderr, "PARSE ERROR: line %d: "\r
-                               "bad PortGUID\n", lineno);\r
-                       return -1;\r
-               }\r
-               p += ret;\r
-               len += ret;\r
-       } while (q);\r
-\r
-       return len;\r
-}\r
-\r
-int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,\r
-                              const char *file_name)\r
-{\r
-       char line[1024];\r
-       struct part_conf *conf = NULL;\r
-       FILE *file;\r
-       int lineno;\r
-\r
-       file = fopen(file_name, "r");\r
-       if (!file) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "Cannot open config file \'%s\': %s\n",\r
-                       file_name, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       lineno = 0;\r
-\r
-       while (fgets(line, sizeof(line) - 1, file) != NULL) {\r
-               char *q, *p = line;\r
-\r
-               lineno++;\r
-\r
-               p = line;\r
-\r
-               q = strchr(p, '#');\r
-               if (q)\r
-                       *q = '\0';\r
-\r
-               do {\r
-                       int len;\r
-                       while (*p == ' ' || *p == '\t' || *p == '\n')\r
-                               p++;\r
-                       if (*p == '\0')\r
-                               break;\r
-\r
-                       if (!conf && !(conf = new_part_conf(p_log, p_subn))) {\r
-                               OSM_LOG(conf->p_log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: line %d: "\r
-                                       "internal: cannot create config\n",\r
-                                       lineno);\r
-                               fprintf(stderr,\r
-                                       "PARSE ERROR: line %d: "\r
-                                       "internal: cannot create config\n",\r
-                                       lineno);\r
-                               break;\r
-                       }\r
-\r
-                       q = strchr(p, ';');\r
-                       if (q)\r
-                               *q = '\0';\r
-\r
-                       len = parse_part_conf(conf, p, lineno);\r
-                       if (len < 0) {\r
-                               break;\r
-                       }\r
-\r
-                       p += len;\r
-\r
-                       if (q) {\r
-                               flush_part_conf(conf);\r
-                               conf = NULL;\r
-                       }\r
-               } while (q);\r
-       }\r
-\r
-       fclose(file);\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_qos.c b/branches/opensm_3/user/opensm/osm_qos.c
deleted file mode 100644 (file)
index 45991b4..0000000
+++ /dev/null
@@ -1,393 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of OpenSM QoS infrastructure primitives\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_qos_policy.h>\r
-\r
-struct qos_config {\r
-       uint8_t max_vls;\r
-       uint8_t vl_high_limit;\r
-       ib_vl_arb_table_t vlarb_high[2];\r
-       ib_vl_arb_table_t vlarb_low[2];\r
-       ib_slvl_table_t sl2vl;\r
-};\r
-\r
-static void qos_build_config(struct qos_config *cfg, osm_qos_options_t * opt,\r
-                            osm_qos_options_t * dflt);\r
-\r
-/*\r
- * QoS primitives\r
- */\r
-static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,\r
-                                               osm_physp_t * p,\r
-                                               uint8_t port_num,\r
-                                               unsigned force_update,\r
-                                               const ib_vl_arb_table_t *\r
-                                               table_block,\r
-                                               unsigned block_length,\r
-                                               unsigned block_num)\r
-{\r
-       ib_vl_arb_table_t block;\r
-       osm_madw_context_t context;\r
-       uint32_t attr_mod;\r
-       unsigned vl_mask, i;\r
-       ib_api_status_t status;\r
-\r
-       vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;\r
-\r
-       memset(&block, 0, sizeof(block));\r
-       memcpy(&block, table_block, block_length * sizeof(block.vl_entry[0]));\r
-       for (i = 0; i < block_length; i++)\r
-               block.vl_entry[i].vl &= vl_mask;\r
-\r
-       if (!force_update &&\r
-           !memcmp(&p->vl_arb[block_num], &block,\r
-                   block_length * sizeof(block.vl_entry[0])))\r
-               return IB_SUCCESS;\r
-\r
-       context.vla_context.node_guid =\r
-           osm_node_get_node_guid(osm_physp_get_node_ptr(p));\r
-       context.vla_context.port_guid = osm_physp_get_port_guid(p);\r
-       context.vla_context.set_method = TRUE;\r
-       attr_mod = ((block_num + 1) << 16) | port_num;\r
-\r
-       status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p),\r
-                            (uint8_t *) & block, sizeof(block),\r
-                            IB_MAD_ATTR_VL_ARBITRATION, cl_hton32(attr_mod),\r
-                            CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 6202 : "\r
-                       "failed to update VLArbitration tables "\r
-                       "for port %" PRIx64 " block %u\n",\r
-                       cl_ntoh64(p->port_guid), block_num);\r
-\r
-       return status;\r
-}\r
-\r
-static ib_api_status_t vlarb_update(osm_sm_t * sm, osm_physp_t * p,\r
-                                   uint8_t port_num, unsigned force_update,\r
-                                   const struct qos_config *qcfg)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_port_info_t *p_pi = &p->port_info;\r
-       unsigned len;\r
-\r
-       if (p_pi->vl_arb_low_cap > 0) {\r
-               len = p_pi->vl_arb_low_cap < IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK ?\r
-                   p_pi->vl_arb_low_cap : IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK;\r
-               if ((status = vlarb_update_table_block(sm, p, port_num,\r
-                                                      force_update,\r
-                                                      &qcfg->vlarb_low[0],\r
-                                                      len, 0)) != IB_SUCCESS)\r
-                       return status;\r
-       }\r
-       if (p_pi->vl_arb_low_cap > IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {\r
-               len = p_pi->vl_arb_low_cap % IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK;\r
-               if ((status = vlarb_update_table_block(sm, p, port_num,\r
-                                                      force_update,\r
-                                                      &qcfg->vlarb_low[1],\r
-                                                      len, 1)) != IB_SUCCESS)\r
-                       return status;\r
-       }\r
-       if (p_pi->vl_arb_high_cap > 0) {\r
-               len = p_pi->vl_arb_high_cap < IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK ?\r
-                   p_pi->vl_arb_high_cap : IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK;\r
-               if ((status = vlarb_update_table_block(sm, p, port_num,\r
-                                                      force_update,\r
-                                                      &qcfg->vlarb_high[0],\r
-                                                      len, 2)) != IB_SUCCESS)\r
-                       return status;\r
-       }\r
-       if (p_pi->vl_arb_high_cap > IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {\r
-               len = p_pi->vl_arb_high_cap % IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK;\r
-               if ((status = vlarb_update_table_block(sm, p, port_num,\r
-                                                      force_update,\r
-                                                      &qcfg->vlarb_high[1],\r
-                                                      len, 3)) != IB_SUCCESS)\r
-                       return status;\r
-       }\r
-\r
-       return status;\r
-}\r
-\r
-static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p,\r
-                                         uint8_t in_port, uint32_t attr_mod,\r
-                                         unsigned force_update,\r
-                                         const ib_slvl_table_t * sl2vl_table)\r
-{\r
-       osm_madw_context_t context;\r
-       ib_slvl_table_t tbl, *p_tbl;\r
-       osm_node_t *p_node = osm_physp_get_node_ptr(p);\r
-       ib_api_status_t status;\r
-       unsigned vl_mask;\r
-       uint8_t vl1, vl2;\r
-       int i;\r
-\r
-       vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;\r
-\r
-       for (i = 0; i < IB_MAX_NUM_VLS / 2; i++) {\r
-               vl1 = sl2vl_table->raw_vl_by_sl[i] >> 4;\r
-               vl2 = sl2vl_table->raw_vl_by_sl[i] & 0xf;\r
-               if (vl1 != 15)\r
-                       vl1 &= vl_mask;\r
-               if (vl2 != 15)\r
-                       vl2 &= vl_mask;\r
-               tbl.raw_vl_by_sl[i] = (vl1 << 4) | vl2;\r
-       }\r
-\r
-       if (!force_update && (p_tbl = osm_physp_get_slvl_tbl(p, in_port)) &&\r
-           !memcmp(p_tbl, &tbl, sizeof(tbl)))\r
-               return IB_SUCCESS;\r
-\r
-       context.slvl_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.slvl_context.port_guid = osm_physp_get_port_guid(p);\r
-       context.slvl_context.set_method = TRUE;\r
-       status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p),\r
-                            (uint8_t *) & tbl, sizeof(tbl),\r
-                            IB_MAD_ATTR_SLVL_TABLE, cl_hton32(attr_mod),\r
-                            CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 6203 : "\r
-                       "failed to update SL2VLMapping tables "\r
-                       "for port %" PRIx64 ", attr_mod 0x%x\n",\r
-                       cl_ntoh64(p->port_guid), attr_mod);\r
-       return status;\r
-}\r
-\r
-static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node,\r
-                             const struct qos_config *qcfg)\r
-{\r
-       osm_physp_t *p0, *p;\r
-       unsigned force_update;\r
-       unsigned num_ports = osm_node_get_num_physp(node);\r
-       int ret = 0;\r
-       unsigned i, j;\r
-\r
-       for (i = 1; i < num_ports; i++) {\r
-               p = osm_node_get_physp_ptr(node, i);\r
-               force_update = p->need_update || sm->p_subn->need_update;\r
-               p->vl_high_limit = qcfg->vl_high_limit;\r
-               if (vlarb_update(sm, p, p->port_num, force_update, qcfg))\r
-                       ret = -1;\r
-       }\r
-\r
-       p0 = osm_node_get_physp_ptr(node, 0);\r
-       if (!(p0->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))\r
-               return ret;\r
-\r
-       if (ib_switch_info_get_opt_sl2vlmapping(&node->sw->switch_info) &&\r
-           sm->p_subn->opt.use_optimized_slvl) {\r
-               p = osm_node_get_physp_ptr(node, 1);\r
-               force_update = p->need_update || sm->p_subn->need_update;\r
-               return sl2vl_update_table(sm, p, 1, 0x30000, force_update,\r
-                                         &qcfg->sl2vl);\r
-       }\r
-\r
-       for (i = 1; i < num_ports; i++) {\r
-               p = osm_node_get_physp_ptr(node, i);\r
-               force_update = p->need_update || sm->p_subn->need_update;\r
-               for (j = 0; j < num_ports; j++)\r
-                       if (sl2vl_update_table(sm, p, i, i << 8 | j,\r
-                                              force_update, &qcfg->sl2vl))\r
-                               ret = -1;\r
-       }\r
-\r
-       return ret;\r
-}\r
-\r
-static int qos_endport_setup(osm_sm_t * sm, osm_physp_t * p,\r
-                            const struct qos_config *qcfg)\r
-{\r
-       unsigned force_update = p->need_update || sm->p_subn->need_update;\r
-\r
-       p->vl_high_limit = qcfg->vl_high_limit;\r
-       if (vlarb_update(sm, p, 0, force_update, qcfg))\r
-               return -1;\r
-\r
-       if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))\r
-               return 0;\r
-\r
-       if (sl2vl_update_table(sm, p, 0, 0, force_update, &qcfg->sl2vl))\r
-               return -1;\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_qos_setup(osm_opensm_t * p_osm)\r
-{\r
-       struct qos_config ca_config, sw0_config, swe_config, rtr_config;\r
-       struct qos_config *cfg;\r
-       cl_qmap_t *p_tbl;\r
-       cl_map_item_t *p_next;\r
-       osm_port_t *p_port;\r
-       osm_node_t *p_node;\r
-       int ret = 0;\r
-\r
-       if (!p_osm->subn.opt.qos)\r
-               return 0;\r
-\r
-       OSM_LOG_ENTER(&p_osm->log);\r
-\r
-       qos_build_config(&ca_config, &p_osm->subn.opt.qos_ca_options,\r
-                        &p_osm->subn.opt.qos_options);\r
-       qos_build_config(&sw0_config, &p_osm->subn.opt.qos_sw0_options,\r
-                        &p_osm->subn.opt.qos_options);\r
-       qos_build_config(&swe_config, &p_osm->subn.opt.qos_swe_options,\r
-                        &p_osm->subn.opt.qos_options);\r
-       qos_build_config(&rtr_config, &p_osm->subn.opt.qos_rtr_options,\r
-                        &p_osm->subn.opt.qos_options);\r
-\r
-       cl_plock_excl_acquire(&p_osm->lock);\r
-\r
-       /* read QoS policy config file */\r
-       osm_qos_parse_policy_file(&p_osm->subn);\r
-\r
-       p_tbl = &p_osm->subn.port_guid_tbl;\r
-       p_next = cl_qmap_head(p_tbl);\r
-       while (p_next != cl_qmap_end(p_tbl)) {\r
-               p_port = (osm_port_t *) p_next;\r
-               p_next = cl_qmap_next(p_next);\r
-\r
-               p_node = p_port->p_node;\r
-               if (p_node->sw) {\r
-                       if (qos_extports_setup(&p_osm->sm, p_node, &swe_config))\r
-                               ret = -1;\r
-\r
-                       /* skip base port 0 */\r
-                       if (!ib_switch_info_is_enhanced_port0\r
-                           (&p_node->sw->switch_info))\r
-                               continue;\r
-\r
-                       cfg = &sw0_config;\r
-               } else if (osm_node_get_type(p_node) == IB_NODE_TYPE_ROUTER)\r
-                       cfg = &rtr_config;\r
-               else\r
-                       cfg = &ca_config;\r
-\r
-               if (qos_endport_setup(&p_osm->sm, p_port->p_physp, cfg))\r
-                       ret = -1;\r
-       }\r
-\r
-       cl_plock_release(&p_osm->lock);\r
-       OSM_LOG_EXIT(&p_osm->log);\r
-\r
-       return ret;\r
-}\r
-\r
-/*\r
- *  QoS config stuff\r
- */\r
-static int parse_one_unsigned(char *str, char delim, unsigned *val)\r
-{\r
-       char *end;\r
-       *val = strtoul(str, &end, 0);\r
-       if (*end)\r
-               end++;\r
-       return (int)(end - str);\r
-}\r
-\r
-static int parse_vlarb_entry(char *str, ib_vl_arb_element_t * e)\r
-{\r
-       unsigned val;\r
-       char *p = str;\r
-       p += parse_one_unsigned(p, ':', &val);\r
-       e->vl = val % 15;\r
-       p += parse_one_unsigned(p, ',', &val);\r
-       e->weight = (uint8_t) val;\r
-       return (int)(p - str);\r
-}\r
-\r
-static int parse_sl2vl_entry(char *str, uint8_t * raw)\r
-{\r
-       unsigned val1, val2;\r
-       char *p = str;\r
-       p += parse_one_unsigned(p, ',', &val1);\r
-       p += parse_one_unsigned(p, ',', &val2);\r
-       *raw = (val1 << 4) | (val2 & 0xf);\r
-       return (int)(p - str);\r
-}\r
-\r
-static void qos_build_config(struct qos_config *cfg, osm_qos_options_t * opt,\r
-                            osm_qos_options_t * dflt)\r
-{\r
-       int i;\r
-       char *p;\r
-\r
-       memset(cfg, 0, sizeof(*cfg));\r
-\r
-       cfg->max_vls = opt->max_vls > 0 ? opt->max_vls : dflt->max_vls;\r
-\r
-       if (opt->high_limit >= 0)\r
-               cfg->vl_high_limit = (uint8_t) opt->high_limit;\r
-       else\r
-               cfg->vl_high_limit = (uint8_t) dflt->high_limit;\r
-\r
-       p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;\r
-       for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {\r
-               p += parse_vlarb_entry(p,\r
-                                      &cfg->vlarb_high[i /\r
-                                                       IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].\r
-                                      vl_entry[i %\r
-                                               IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);\r
-       }\r
-\r
-       p = opt->vlarb_low ? opt->vlarb_low : dflt->vlarb_low;\r
-       for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {\r
-               p += parse_vlarb_entry(p,\r
-                                      &cfg->vlarb_low[i /\r
-                                                      IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK].\r
-                                      vl_entry[i %\r
-                                               IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]);\r
-       }\r
-\r
-       p = opt->sl2vl ? opt->sl2vl : dflt->sl2vl;\r
-       for (i = 0; i < IB_MAX_NUM_VLS / 2; i++)\r
-               p += parse_sl2vl_entry(p, &cfg->sl2vl.raw_vl_by_sl[i]);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_l.c b/branches/opensm_3/user/opensm/osm_qos_parser_l.c
deleted file mode 100644 (file)
index e752661..0000000
+++ /dev/null
@@ -1,2679 +0,0 @@
-\r
-#line 3 "osm_qos_parser_l.c"\r
-\r
-#define  YY_INT_ALIGNED short int\r
-\r
-/* A lexical scanner generated by flex */\r
-\r
-#define FLEX_SCANNER\r
-#define YY_FLEX_MAJOR_VERSION 2\r
-#define YY_FLEX_MINOR_VERSION 5\r
-#define YY_FLEX_SUBMINOR_VERSION 35\r
-#if YY_FLEX_SUBMINOR_VERSION > 0\r
-#define FLEX_BETA\r
-#endif\r
-\r
-/* First, we deal with  platform-specific or compiler-specific issues. */\r
-\r
-/* begin standard C headers. */\r
-#ifdef __WIN__\r
-#include <stddef.h>\r
-#include <io.h>\r
-#define isatty _isatty\r
-#endif\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-\r
-/* end standard C headers. */\r
-\r
-/* flex integer type definitions */\r
-\r
-#ifndef FLEXINT_H\r
-#define FLEXINT_H\r
-\r
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */\r
-\r
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\r
-\r
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,\r
- * if you want the limit (max/min) macros for int types. \r
- */\r
-#ifndef __STDC_LIMIT_MACROS\r
-#define __STDC_LIMIT_MACROS 1\r
-#endif\r
-\r
-#include <inttypes.h>\r
-typedef int8_t flex_int8_t;\r
-typedef uint8_t flex_uint8_t;\r
-typedef int16_t flex_int16_t;\r
-typedef uint16_t flex_uint16_t;\r
-typedef int32_t flex_int32_t;\r
-typedef uint32_t flex_uint32_t;\r
-#else\r
-typedef signed char flex_int8_t;\r
-typedef short int flex_int16_t;\r
-typedef int flex_int32_t;\r
-typedef unsigned char flex_uint8_t; \r
-typedef unsigned short int flex_uint16_t;\r
-typedef unsigned int flex_uint32_t;\r
-#endif /* ! C99 */\r
-\r
-/* Limits of integral types. */\r
-#ifndef INT8_MIN\r
-#define INT8_MIN               (-128)\r
-#endif\r
-#ifndef INT16_MIN\r
-#define INT16_MIN              (-32767-1)\r
-#endif\r
-#ifndef INT32_MIN\r
-#define INT32_MIN              (-2147483647-1)\r
-#endif\r
-#ifndef INT8_MAX\r
-#define INT8_MAX               (127)\r
-#endif\r
-#ifndef INT16_MAX\r
-#define INT16_MAX              (32767)\r
-#endif\r
-#ifndef INT32_MAX\r
-#define INT32_MAX              (2147483647)\r
-#endif\r
-#ifndef UINT8_MAX\r
-#define UINT8_MAX              (255U)\r
-#endif\r
-#ifndef UINT16_MAX\r
-#define UINT16_MAX             (65535U)\r
-#endif\r
-#ifndef UINT32_MAX\r
-#define UINT32_MAX             (4294967295U)\r
-#endif\r
-\r
-#endif /* ! FLEXINT_H */\r
-\r
-#ifdef __cplusplus\r
-\r
-/* The "const" storage-class-modifier is valid. */\r
-#define YY_USE_CONST\r
-\r
-#else  /* ! __cplusplus */\r
-\r
-/* C99 requires __STDC__ to be defined as 1. */\r
-#if defined (__STDC__)\r
-\r
-#define YY_USE_CONST\r
-\r
-#endif /* defined (__STDC__) */\r
-#endif /* ! __cplusplus */\r
-\r
-#ifdef YY_USE_CONST\r
-#define yyconst const\r
-#else\r
-#define yyconst\r
-#endif\r
-\r
-/* Returned upon end-of-file. */\r
-#define YY_NULL 0\r
-\r
-/* Promotes a possibly negative, possibly signed char to an unsigned\r
- * integer for use as an array index.  If the signed char is negative,\r
- * we want to instead treat it as an 8-bit unsigned char, hence the\r
- * double cast.\r
- */\r
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)\r
-\r
-/* Enter a start condition.  This macro really ought to take a parameter,\r
- * but we do it the disgusting crufty way forced on us by the ()-less\r
- * definition of BEGIN.\r
- */\r
-#define BEGIN (yy_start) = 1 + 2 *\r
-\r
-/* Translate the current start state into a value that can be later handed\r
- * to BEGIN to return to the state.  The YYSTATE alias is for lex\r
- * compatibility.\r
- */\r
-#define YY_START (((yy_start) - 1) / 2)\r
-#define YYSTATE YY_START\r
-\r
-/* Action number for EOF rule of a given start state. */\r
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)\r
-\r
-/* Special action meaning "start processing a new file". */\r
-#define YY_NEW_FILE yyrestart(yyin  )\r
-\r
-#define YY_END_OF_BUFFER_CHAR 0\r
-\r
-/* Size of default input buffer. */\r
-#ifndef YY_BUF_SIZE\r
-#define YY_BUF_SIZE 16384\r
-#endif\r
-\r
-/* The state buf must be large enough to hold one state per character in the main buffer.\r
- */\r
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))\r
-\r
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE\r
-#define YY_TYPEDEF_YY_BUFFER_STATE\r
-typedef struct yy_buffer_state *YY_BUFFER_STATE;\r
-#endif\r
-\r
-extern int yyleng;\r
-\r
-extern FILE *yyin, *yyout;\r
-\r
-#define EOB_ACT_CONTINUE_SCAN 0\r
-#define EOB_ACT_END_OF_FILE 1\r
-#define EOB_ACT_LAST_MATCH 2\r
-\r
-    #define YY_LESS_LINENO(n)\r
-    \r
-/* Return all but the first "n" matched characters back to the input stream. */\r
-#define yyless(n) \\r
-       do \\r
-               { \\r
-               /* Undo effects of setting up yytext. */ \\r
-        int yyless_macro_arg = (n); \\r
-        YY_LESS_LINENO(yyless_macro_arg);\\r
-               *yy_cp = (yy_hold_char); \\r
-               YY_RESTORE_YY_MORE_OFFSET \\r
-               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \\r
-               YY_DO_BEFORE_ACTION; /* set up yytext again */ \\r
-               } \\r
-       while ( 0 )\r
-\r
-#define unput(c) yyunput( c, (yytext_ptr)  )\r
-\r
-#ifndef YY_TYPEDEF_YY_SIZE_T\r
-#define YY_TYPEDEF_YY_SIZE_T\r
-typedef size_t yy_size_t;\r
-#endif\r
-\r
-#ifndef YY_STRUCT_YY_BUFFER_STATE\r
-#define YY_STRUCT_YY_BUFFER_STATE\r
-struct yy_buffer_state\r
-       {\r
-       FILE *yy_input_file;\r
-\r
-       char *yy_ch_buf;                /* input buffer */\r
-       char *yy_buf_pos;               /* current position in input buffer */\r
-\r
-       /* Size of input buffer in bytes, not including room for EOB\r
-        * characters.\r
-        */\r
-       yy_size_t yy_buf_size;\r
-\r
-       /* Number of characters read into yy_ch_buf, not including EOB\r
-        * characters.\r
-        */\r
-       int yy_n_chars;\r
-\r
-       /* Whether we "own" the buffer - i.e., we know we created it,\r
-        * and can realloc() it to grow it, and should free() it to\r
-        * delete it.\r
-        */\r
-       int yy_is_our_buffer;\r
-\r
-       /* Whether this is an "interactive" input source; if so, and\r
-        * if we're using stdio for input, then we want to use getc()\r
-        * instead of fread(), to make sure we stop fetching input after\r
-        * each newline.\r
-        */\r
-       int yy_is_interactive;\r
-\r
-       /* Whether we're considered to be at the beginning of a line.\r
-        * If so, '^' rules will be active on the next match, otherwise\r
-        * not.\r
-        */\r
-       int yy_at_bol;\r
-\r
-    int yy_bs_lineno; /**< The line count. */\r
-    int yy_bs_column; /**< The column count. */\r
-    \r
-       /* Whether to try to fill the input buffer when we reach the\r
-        * end of it.\r
-        */\r
-       int yy_fill_buffer;\r
-\r
-       int yy_buffer_status;\r
-\r
-#define YY_BUFFER_NEW 0\r
-#define YY_BUFFER_NORMAL 1\r
-       /* When an EOF's been seen but there's still some text to process\r
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we\r
-        * shouldn't try reading from the input source any more.  We might\r
-        * still have a bunch of tokens to match, though, because of\r
-        * possible backing-up.\r
-        *\r
-        * When we actually see the EOF, we change the status to "new"\r
-        * (via yyrestart()), so that the user can continue scanning by\r
-        * just pointing yyin at a new input file.\r
-        */\r
-#define YY_BUFFER_EOF_PENDING 2\r
-\r
-       };\r
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */\r
-\r
-/* Stack of input buffers. */\r
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */\r
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */\r
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */\r
-\r
-/* We provide macros for accessing buffer states in case in the\r
- * future we want to put the buffer states in a more general\r
- * "scanner state".\r
- *\r
- * Returns the top of the stack, or NULL.\r
- */\r
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \\r
-                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \\r
-                          : NULL)\r
-\r
-/* Same as previous macro, but useful when we know that the buffer stack is not\r
- * NULL or when we need an lvalue. For internal use only.\r
- */\r
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]\r
-\r
-/* yy_hold_char holds the character lost when yytext is formed. */\r
-static char yy_hold_char;\r
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */\r
-int yyleng;\r
-\r
-/* Points to current character in buffer. */\r
-static char *yy_c_buf_p = (char *) 0;\r
-static int yy_init = 0;                /* whether we need to initialize */\r
-static int yy_start = 0;       /* start state number */\r
-\r
-/* Flag which is used to allow yywrap()'s to do buffer switches\r
- * instead of setting up a fresh yyin.  A bit of a hack ...\r
- */\r
-static int yy_did_buffer_switch_on_eof;\r
-\r
-void yyrestart (FILE *input_file  );\r
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );\r
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );\r
-void yy_delete_buffer (YY_BUFFER_STATE b  );\r
-void yy_flush_buffer (YY_BUFFER_STATE b  );\r
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );\r
-void yypop_buffer_state (void );\r
-\r
-static void yyensure_buffer_stack (void );\r
-static void yy_load_buffer_state (void );\r
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );\r
-\r
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )\r
-\r
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );\r
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );\r
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );\r
-\r
-void *yyalloc (yy_size_t  );\r
-void *yyrealloc (void *,yy_size_t  );\r
-void yyfree (void *  );\r
-\r
-#define yy_new_buffer yy_create_buffer\r
-\r
-#define yy_set_interactive(is_interactive) \\r
-       { \\r
-       if ( ! YY_CURRENT_BUFFER ){ \\r
-        yyensure_buffer_stack (); \\r
-               YY_CURRENT_BUFFER_LVALUE =    \\r
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \\r
-       } \\r
-       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \\r
-       }\r
-\r
-#define yy_set_bol(at_bol) \\r
-       { \\r
-       if ( ! YY_CURRENT_BUFFER ){\\r
-        yyensure_buffer_stack (); \\r
-               YY_CURRENT_BUFFER_LVALUE =    \\r
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \\r
-       } \\r
-       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \\r
-       }\r
-\r
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)\r
-\r
-/* Begin user sect3 */\r
-\r
-typedef unsigned char YY_CHAR;\r
-\r
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;\r
-\r
-typedef int yy_state_type;\r
-\r
-extern int yylineno;\r
-\r
-int yylineno = 1;\r
-\r
-extern char *yytext;\r
-#define yytext_ptr yytext\r
-\r
-static yy_state_type yy_get_previous_state (void );\r
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );\r
-static int yy_get_next_buffer (void );\r
-static void yy_fatal_error (yyconst char msg[]  );\r
-\r
-/* Done after the current pattern has been matched and before the\r
- * corresponding action - sets up yytext.\r
- */\r
-#define YY_DO_BEFORE_ACTION \\r
-       (yytext_ptr) = yy_bp; \\r
-       yyleng = (size_t) (yy_cp - yy_bp); \\r
-       (yy_hold_char) = *yy_cp; \\r
-       *yy_cp = '\0'; \\r
-       (yy_c_buf_p) = yy_cp;\r
-\r
-#define YY_NUM_RULES 82\r
-#define YY_END_OF_BUFFER 83\r
-/* This struct is not used in this scanner,\r
-   but its presence is necessary. */\r
-struct yy_trans_info\r
-       {\r
-       flex_int32_t yy_verify;\r
-       flex_int32_t yy_nxt;\r
-       };\r
-static yyconst flex_int16_t yy_accept[551] =\r
-    {   0,\r
-        0,    0,   83,   81,    3,    4,   81,   81,   79,   78,\r
-       76,   75,   75,   77,   81,   81,   81,   81,   81,   81,\r
-       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,\r
-       81,   81,   81,   81,    3,    2,    0,   80,    0,    1,\r
-       75,    0,    0,    0,   57,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,   74,   60,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-\r
-        0,    0,    0,   45,    0,    0,   39,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,   67,    0,    0,\r
-        0,   65,   59,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,   45,    0,   39,    0,   34,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,   69,    0,\r
-        0,   67,    0,    0,    0,   65,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,   40,    0,    0,    0,\r
-       33,    0,    0,    0,    0,    0,   54,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,   34,    0,    0,\r
-\r
-        0,    0,    0,    0,    0,    0,   72,    0,    0,   69,\r
-        0,   56,    0,    0,   58,    0,    0,    0,    0,    0,\r
-        0,   40,    0,   35,    0,   33,    0,    0,    0,    0,\r
-       54,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-       72,    0,    0,    0,    0,    0,    0,   43,    0,    0,\r
-        0,    0,    0,   35,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,   51,    0,    0,    0,    0,    0,   63,    0,\r
-        0,    0,   61,    0,    0,    0,    0,    0,    0,    0,\r
-\r
-       43,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    5,    0,\r
-        0,    0,    0,   51,    0,    0,    0,    0,    0,    0,\r
-        0,   61,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,    0,    0,    0,   23,    0,   11,    0,\r
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,\r
-       73,    0,    0,    0,    0,    0,    0,   41,    0,    0,\r
-        0,    0,    0,    0,    0,    0,    0,   46,    0,   32,\r
-        0,    0,   31,    0,   49,    9,    0,   29,    0,   30,\r
-\r
-        0,   50,    0,   21,    0,    0,    0,    0,    0,    0,\r
-        0,    0,   37,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,   41,    0,    0,    0,    0,    0,    0,    0,\r
-        0,    0,    0,   46,   32,    0,   31,   49,    7,   29,\r
-       30,   50,    0,    0,    0,   47,    0,   53,   19,    0,\r
-        0,    0,   36,   37,   15,    0,    0,    0,    0,   68,\r
-       66,    0,    0,   42,    0,   52,    0,    0,    0,    0,\r
-        6,    0,    0,    0,    0,    0,   48,    0,    0,   47,\r
-       53,    0,   44,   17,    0,   36,   13,    0,    0,   70,\r
-        0,   42,   52,    0,   24,    0,   12,    0,    0,    0,\r
-\r
-        0,   48,    0,    0,   44,    0,   62,    0,    0,   10,\r
-       22,    0,    0,    0,    0,    0,    0,   27,    0,   38,\r
-        0,    0,    8,    0,   20,    0,   16,    0,    0,   55,\r
-       25,   38,    0,    0,    0,   18,   14,   55,    0,    0,\r
-        0,    0,    0,   28,    0,    0,   26,   64,   71,    0\r
-    } ;\r
-\r
-static yyconst flex_int32_t yy_ec[256] =\r
-    {   0,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    2,    1,    4,    5,    1,    1,    1,    1,    1,\r
-        1,    6,    1,    7,    8,    1,    1,    9,   10,   11,\r
-       10,   10,   10,   10,   10,   10,   10,   12,    1,    1,\r
-        1,    1,    1,    1,   13,   14,   15,   16,   17,   18,\r
-        1,   19,   20,    1,    1,   21,    1,   22,   23,   24,\r
-        1,   25,   26,   27,   28,    1,   29,   30,   31,    1,\r
-        1,    1,    1,    1,    1,    1,   32,   33,   34,   35,\r
-\r
-       36,   37,   38,   39,   40,    1,   41,   42,   43,   44,\r
-       45,   46,   47,   48,   49,   50,   51,   52,   53,   30,\r
-       54,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1\r
-    } ;\r
-\r
-static yyconst flex_int32_t yy_meta[55] =\r
-    {   0,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    2,\r
-        2,    1,    2,    2,    2,    2,    2,    2,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    2,    2,    2,    2,    2,    2,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1\r
-    } ;\r
-\r
-static yyconst flex_int16_t yy_base[554] =\r
-    {   0,\r
-        0,    0,  759,  760,   53,  760,  754,  754,  760,  760,\r
-      760,   48,   51,  760,   42,   53,   51,   43,   56,   77,\r
-       54,   54,  712,  707,  706,  703,   38,   63,  707,   84,\r
-      115,  706,  701,  707,   71,  760,  744,  760,  744,  760,\r
-       71,    0,   76,   68,  760,   87,   88,   92,   77,   86,\r
-       93,   94,   96,  101,  698,  109,  710,  699,  698,  691,\r
-      698,  705,  104,  703,  690,  688,  686,  113,  154,  684,\r
-      133,  698,  115,    0,  760,  141,  140,  129,  134,  168,\r
-      135,  169,  146,  171,  140,  688,  682,  723,  687,  678,\r
-      720,  691,  690,  684,  674,  684,  668,  671,  712,  683,\r
-\r
-      666,  172,  665,  714,  667,  175,  712,  177,  674,  664,\r
-      184,  186,  164,  179,  192,  193,  194,  709,  180,  196,\r
-      199,  708,  760,  200,  204,  194,  660,  668,  171,  209,\r
-      661,  664,  212,  697,  668,  663,  694,  217,  693,  188,\r
-      692,  659,  656,  695,  662,  693,  231,  692,  653,  659,\r
-      211,  650,  654,  657,  204,  240,  246,  224,  686,  225,\r
-      642,  684,  216,  232,  640,  682,  236,  651,  230,  633,\r
-      637,  635,  634,  636,  635,  253,  674,  254,  635,  260,\r
-      672,  623,  622,  621,  637,  261,  667,  206,  626,  631,\r
-      634,  629,  622,  621,  628,  653,  624,  657,  620,  649,\r
-\r
-      620,  607,  606,  224,  273,  257,  651,  265,  607,  649,\r
-      602,  760,  601,  600,  760,  275,  615,  598,  596,  633,\r
-      611,  640,  277,  639,  597,  637,  584,  629,  596,  595,\r
-      632,  233,  601,  600,  579,  580,  579,  582,  587,  590,\r
-      241,  280,  586,  255,  570,  571,  584,  286,  266,  580,\r
-      618,  571,  568,  567,  578,  294,  258,  613,  564,  563,\r
-      604,  559,  562,  607,  568,  561,  564,  560,  554,  558,\r
-      562,  558,  551,  563,  564,  546,  547,  552,  586,  559,\r
-      560,  297,  589,  582,  549,  543,  553,  554,  760,  545,\r
-      548,  298,  581,  546,  531,  572,  571,  542,  529,  531,\r
-\r
-      573,  534,  565,  271,  530,  538,  520,  533,  528,  523,\r
-      517,  514,  529,  527,  513,  519,  521,  513,  760,  518,\r
-      517,  511,  522,  552,  511,  514,  498,  505,  516,  514,\r
-      497,  544,  491,  536,  499,  498,  491,  495,  305,  494,\r
-      500,  501,  504,  499,  492,  525,  524,  313,  314,  494,\r
-      316,  317,  484,  319,  321,  322,  293,  521,  760,  478,\r
-      492,  480,  483,  484,  484,  325,  476,  479,  484,  511,\r
-      760,  474,  466,  465,  507,  471,  328,  511,  468,  463,\r
-      458,  459,  458,  461,  286,  289,  339,  504,  341,  503,\r
-      468,  342,  501,  343,  500,  452,  344,  498,  345,  497,\r
-\r
-      346,  496,  453,  760,  448,  347,  348,  459,  458,  450,\r
-      350,  359,  490,  455,  454,  481,  442,  436,  443,  442,\r
-      438,  361,  481,  362,  437,  445,  446,  428,  429,  443,\r
-      444,  441,  442,  471,  470,  363,  469,  468,  760,  467,\r
-      466,  465,  434,  414,  364,  462,  365,  461,  760,  366,\r
-      422,  367,  459,  458,  760,  410,  418,  412,  413,  760,\r
-      760,  410,  368,  452,  370,  451,  401,  409,  411,  403,\r
-      760,  403,  414,  401,  412,  379,  442,  400,  400,  439,\r
-      438,  381,  437,  760,  388,  435,  760,  401,  387,  760,\r
-      386,  431,  430,  385,  381,  421,  760,  382,  385,  380,\r
-\r
-      383,  422,  387,  386,  419,  382,  760,  370,  364,  364,\r
-      760,  364,  375,  374,  373,  372,  383,  358,  384,  404,\r
-      397,  396,  760,  352,  760,  353,  760,  352,  385,  398,\r
-      760,  397,  360,  354,  348,  760,  760,  387,  337,  281,\r
-      266,  253,  236,  161,   75,   42,  760,  760,  760,  760,\r
-      415,  417,   63\r
-    } ;\r
-\r
-static yyconst flex_int16_t yy_def[554] =\r
-    {   0,\r
-      550,    1,  550,  550,  550,  550,  551,  552,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  551,  550,  552,  550,\r
-      550,  553,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  553,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,    0,\r
-      550,  550,  550\r
-    } ;\r
-\r
-static yyconst flex_int16_t yy_nxt[815] =\r
-    {   0,\r
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,\r
-       13,   14,   15,    4,   16,   17,    4,    4,    4,   18,\r
-        4,    4,    4,    4,   19,   20,    4,    4,    4,    4,\r
-        4,   21,    4,   16,   22,   23,   24,   25,    4,   18,\r
-        4,    4,   26,   27,    4,   28,   29,   30,   31,   32,\r
-       33,   34,    4,    4,   35,   36,   41,   41,   41,   41,\r
-       41,   41,   43,   44,   74,   45,   47,   46,   48,   61,\r
-       46,   49,   35,   36,   43,   44,  549,   42,   50,   41,\r
-       41,   41,   62,   43,   45,   44,   46,   55,   47,   56,\r
-       49,   48,   51,   52,   63,   43,   75,   44,   76,   49,\r
-\r
-       50,   53,   80,   64,   77,   54,   50,   65,   79,  548,\r
-       78,   51,   52,   81,   83,   67,   82,   75,   49,   84,\r
-       85,   76,  109,   77,   53,   80,   77,   79,   50,   54,\r
-       51,   52,   78,   83,  106,   83,   81,   94,   82,   53,\r
-       85,   84,  111,   54,  107,   77,  110,  112,  114,   51,\r
-       68,   95,  113,   96,   83,  102,   69,   87,  115,   70,\r
-      101,  119,   53,  123,  103,  104,  126,   54,  114,  116,\r
-      120,  113,  124,  102,  117,  121,  106,  125,  147,  118,\r
-      122,  115,  123,  104,  119,  111,  107,  151,  148,  126,\r
-      112,  155,  156,  157,  116,  160,  163,  120,  158,  117,\r
-\r
-      164,  124,  121,  159,  118,  167,  125,  122,  169,  547,\r
-      176,  156,  151,  180,  155,  163,  172,  173,  186,  174,\r
-      177,  189,  175,  181,  204,  208,  160,  169,  187,  190,\r
-      191,  152,  147,  164,  153,  154,  192,  167,  193,  161,\r
-      212,  205,  148,  232,  165,  204,  206,  157,  215,  233,\r
-      248,  207,  158,  168,  176,  223,  152,  159,  249,  153,\r
-      154,  180,  186,  212,  177,  224,  208,  249,  215,  209,\r
-      161,  181,  187,  248,  205,  546,  256,  165,  223,  206,\r
-      270,  282,  257,  271,  207,  168,  258,  292,  224,  280,\r
-      281,  283,  545,  285,  299,  256,  286,  293,  282,  292,\r
-\r
-      403,  544,  250,  287,  288,  258,  377,  300,  283,  293,\r
-      209,  250,  342,  343,  387,  389,  378,  392,  394,  344,\r
-      397,  345,  399,  401,  388,  390,  412,  393,  395,  377,\r
-      398,  543,  400,  402,  430,  431,  413,  432,  433,  378,\r
-      387,  404,  389,  392,  394,  397,  399,  401,  445,  447,\r
-      388,  452,  390,  393,  395,  398,  400,  402,  446,  448,\r
-      412,  453,  463,  465,  476,  445,  447,  482,  452,  463,\r
-      413,  465,  464,  466,  477,  446,  448,  483,  453,  464,\r
-      476,  466,  482,  519,  529,  519,  529,  542,  538,  541,\r
-      477,  540,  483,  520,  530,  520,  530,  539,  532,  538,\r
-\r
-      537,  536,  535,  534,  533,  532,  531,  528,  527,  526,\r
-      525,  524,  523,  522,  484,   37,   37,   39,   39,  521,\r
-      505,  518,  517,  502,  516,  515,  514,  513,  512,  511,\r
-      510,  493,  492,  509,  508,  507,  486,  506,  505,  481,\r
-      480,  504,  503,  502,  501,  500,  499,  498,  497,  496,\r
-      495,  494,  493,  492,  491,  490,  489,  488,  487,  454,\r
-      486,  485,  481,  480,  479,  478,  442,  441,  440,  438,\r
-      437,  435,  434,  475,  474,  473,  472,  471,  470,  469,\r
-      468,  467,  423,  462,  461,  460,  459,  458,  457,  456,\r
-      455,  454,  451,  450,  449,  444,  443,  442,  441,  440,\r
-\r
-      439,  438,  437,  436,  435,  434,  429,  428,  427,  426,\r
-      425,  424,  423,  422,  421,  420,  419,  418,  417,  416,\r
-      415,  414,  411,  410,  409,  408,  407,  406,  405,  396,\r
-      391,  386,  385,  384,  383,  382,  381,  380,  379,  376,\r
-      375,  374,  373,  372,  371,  332,  370,  369,  368,  367,\r
-      366,  365,  364,  324,  363,  362,  361,  360,  359,  358,\r
-      357,  356,  355,  354,  353,  352,  351,  350,  349,  348,\r
-      347,  346,  341,  340,  301,  339,  338,  337,  336,  335,\r
-      334,  333,  332,  331,  330,  329,  328,  327,  326,  325,\r
-      324,  323,  322,  321,  320,  319,  318,  317,  316,  315,\r
-\r
-      314,  313,  312,  311,  310,  309,  308,  307,  264,  306,\r
-      305,  304,  303,  302,  301,  298,  297,  296,  295,  251,\r
-      294,  291,  290,  289,  284,  279,  278,  277,  276,  275,\r
-      274,  273,  272,  231,  269,  268,  267,  266,  226,  265,\r
-      264,  222,  263,  262,  261,  260,  259,  255,  254,  253,\r
-      210,  252,  251,  247,  246,  245,  244,  243,  198,  242,\r
-      241,  240,  239,  238,  237,  236,  235,  234,  231,  230,\r
-      229,  228,  227,  226,  225,  222,  221,  220,  219,  218,\r
-      217,  216,  214,  166,  213,  162,  211,  210,  203,  202,\r
-      201,  200,  199,  198,  146,  197,  144,  196,  195,  194,\r
-\r
-      188,  185,  184,  183,  182,  179,  178,  171,  170,  166,\r
-      162,  150,  149,  146,  145,  144,  143,  142,  141,  140,\r
-      139,  138,  137,  136,  135,  134,  133,  132,  131,  130,\r
-      129,  128,  127,  108,  105,  100,   99,   98,   97,   93,\r
-       92,   91,   90,   89,   88,   86,   40,   38,   73,   72,\r
-       71,   66,   60,   59,   58,   57,   40,   38,  550,    3,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550\r
-    } ;\r
-\r
-static yyconst flex_int16_t yy_chk[815] =\r
-    {   0,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,\r
-        1,    1,    1,    1,    5,    5,   12,   12,   12,   13,\r
-       13,   13,   15,   15,  553,   16,   18,   17,   18,   27,\r
-       22,   19,   35,   35,   21,   21,  546,   12,   19,   41,\r
-       41,   41,   27,   15,   16,   15,   17,   21,   18,   22,\r
-       19,   18,   20,   20,   28,   21,   43,   21,   44,   30,\r
-\r
-       19,   20,   49,   28,   46,   20,   30,   28,   48,  545,\r
-       47,   20,   20,   50,   52,   30,   51,   43,   30,   53,\r
-       54,   44,   73,   46,   20,   49,   56,   48,   30,   20,\r
-       31,   31,   47,   68,   71,   52,   50,   63,   51,   31,\r
-       54,   53,   76,   31,   71,   56,   73,   76,   78,   31,\r
-       31,   63,   77,   63,   68,   69,   31,   56,   79,   31,\r
-       68,   81,   31,   83,   69,   69,   85,   31,   78,   80,\r
-       82,   77,   84,  102,   80,   82,  106,   84,  108,   80,\r
-       82,   79,   83,  102,   81,  111,  106,  112,  108,   85,\r
-      111,  113,  114,  115,  116,  117,  119,  120,  115,  116,\r
-\r
-      121,  124,  120,  115,  116,  125,  124,  120,  126,  544,\r
-      130,  114,  151,  133,  113,  119,  129,  129,  138,  129,\r
-      130,  140,  129,  133,  155,  158,  160,  126,  138,  140,\r
-      140,  112,  147,  164,  112,  112,  140,  167,  140,  117,\r
-      163,  156,  147,  188,  121,  155,  156,  157,  169,  188,\r
-      204,  156,  157,  125,  176,  178,  151,  157,  206,  151,\r
-      151,  180,  186,  163,  176,  178,  208,  249,  169,  158,\r
-      160,  180,  186,  204,  205,  543,  216,  164,  223,  205,\r
-      232,  242,  216,  232,  205,  167,  216,  248,  223,  241,\r
-      241,  242,  542,  244,  257,  256,  244,  248,  282,  292,\r
-\r
-      357,  541,  206,  244,  244,  256,  339,  257,  282,  292,\r
-      208,  249,  304,  304,  348,  349,  339,  351,  352,  304,\r
-      354,  304,  355,  356,  348,  349,  366,  351,  352,  377,\r
-      354,  540,  355,  356,  385,  385,  366,  386,  386,  377,\r
-      387,  357,  389,  392,  394,  397,  399,  401,  406,  407,\r
-      387,  411,  389,  392,  394,  397,  399,  401,  406,  407,\r
-      412,  411,  422,  424,  436,  445,  447,  450,  452,  463,\r
-      412,  465,  422,  424,  436,  445,  447,  450,  452,  463,\r
-      476,  465,  482,  506,  517,  519,  529,  539,  538,  535,\r
-      476,  534,  482,  506,  517,  519,  529,  533,  532,  530,\r
-\r
-      528,  526,  524,  522,  521,  520,  518,  516,  515,  514,\r
-      513,  512,  510,  509,  450,  551,  551,  552,  552,  508,\r
-      505,  504,  503,  502,  501,  500,  499,  498,  496,  495,\r
-      494,  493,  492,  491,  489,  488,  486,  485,  483,  481,\r
-      480,  479,  478,  477,  475,  474,  473,  472,  470,  469,\r
-      468,  467,  466,  464,  462,  459,  458,  457,  456,  454,\r
-      453,  451,  448,  446,  444,  443,  442,  441,  440,  438,\r
-      437,  435,  434,  433,  432,  431,  430,  429,  428,  427,\r
-      426,  425,  423,  421,  420,  419,  418,  417,  416,  415,\r
-      414,  413,  410,  409,  408,  405,  403,  402,  400,  398,\r
-\r
-      396,  395,  393,  391,  390,  388,  384,  383,  382,  381,\r
-      380,  379,  378,  376,  375,  374,  373,  372,  370,  369,\r
-      368,  367,  365,  364,  363,  362,  361,  360,  358,  353,\r
-      350,  347,  346,  345,  344,  343,  342,  341,  340,  338,\r
-      337,  336,  335,  334,  333,  332,  331,  330,  329,  328,\r
-      327,  326,  325,  324,  323,  322,  321,  320,  318,  317,\r
-      316,  315,  314,  313,  312,  311,  310,  309,  308,  307,\r
-      306,  305,  303,  302,  301,  300,  299,  298,  297,  296,\r
-      295,  294,  293,  291,  290,  288,  287,  286,  285,  284,\r
-      283,  281,  280,  279,  278,  277,  276,  275,  274,  273,\r
-\r
-      272,  271,  270,  269,  268,  267,  266,  265,  264,  263,\r
-      262,  261,  260,  259,  258,  255,  254,  253,  252,  251,\r
-      250,  247,  246,  245,  243,  240,  239,  238,  237,  236,\r
-      235,  234,  233,  231,  230,  229,  228,  227,  226,  225,\r
-      224,  222,  221,  220,  219,  218,  217,  214,  213,  211,\r
-      210,  209,  207,  203,  202,  201,  200,  199,  198,  197,\r
-      196,  195,  194,  193,  192,  191,  190,  189,  187,  185,\r
-      184,  183,  182,  181,  179,  177,  175,  174,  173,  172,\r
-      171,  170,  168,  166,  165,  162,  161,  159,  154,  153,\r
-      152,  150,  149,  148,  146,  145,  144,  143,  142,  141,\r
-\r
-      139,  137,  136,  135,  134,  132,  131,  128,  127,  122,\r
-      118,  110,  109,  107,  105,  104,  103,  101,  100,   99,\r
-       98,   97,   96,   95,   94,   93,   92,   91,   90,   89,\r
-       88,   87,   86,   72,   70,   67,   66,   65,   64,   62,\r
-       61,   60,   59,   58,   57,   55,   39,   37,   34,   33,\r
-       32,   29,   26,   25,   24,   23,    8,    7,    3,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-\r
-      550,  550,  550,  550,  550,  550,  550,  550,  550,  550,\r
-      550,  550,  550,  550\r
-    } ;\r
-\r
-static yy_state_type yy_last_accepting_state;\r
-static char *yy_last_accepting_cpos;\r
-\r
-extern int yy_flex_debug;\r
-int yy_flex_debug = 0;\r
-\r
-/* The intent behind this definition is that it'll catch\r
- * any uses of REJECT which flex missed.\r
- */\r
-#define REJECT reject_used_but_not_detected\r
-#define yymore() yymore_used_but_not_detected\r
-#define YY_MORE_ADJ 0\r
-#define YY_RESTORE_YY_MORE_OFFSET\r
-char *yytext;\r
-#line 1 "osm_qos_parser_l.l"\r
-#line 2 "osm_qos_parser_l.l"\r
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Lexer of OSM QoS parser.\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-\r
-#include <opensm/osm_qos_policy.h>\r
-#include "osm_qos_parser_y.h"\r
-\r
-#define HANDLE_IF_IN_DESCRIPTION   if (in_description) { yylval = strdup(yytext); return TK_TEXT; }\r
-\r
-#define SAVE_POS save_pos()\r
-static void save_pos();\r
-\r
-extern int column_num;\r
-extern int line_num;\r
-extern FILE * yyin;\r
-extern YYSTYPE yylval;\r
-\r
-boolean_t in_description = FALSE;\r
-boolean_t in_list_of_hex_num_ranges = FALSE;\r
-boolean_t in_node_type = FALSE;\r
-boolean_t in_list_of_numbers = FALSE;\r
-boolean_t in_list_of_strings = FALSE;\r
-boolean_t in_list_of_num_pairs = FALSE;\r
-boolean_t in_asterisk_or_list_of_numbers = FALSE;\r
-boolean_t in_list_of_num_ranges = FALSE;\r
-boolean_t in_single_string = FALSE;\r
-boolean_t in_single_number = FALSE;\r
-\r
-static void reset_new_line_flags();\r
-#define RESET_NEW_LINE_FLAGS reset_new_line_flags()\r
-\r
-#define START_USE            {in_description = TRUE;}     /* list of strings including whitespace (description) */\r
-#define START_PORT_GUID      {in_list_of_hex_num_ranges = TRUE;} /* comma-separated list of hex num ranges */\r
-#define START_PORT_NAME      {in_list_of_strings = TRUE;} /* comma-separated list of following strings: ../../.. */\r
-#define START_PARTITION      {in_single_string = TRUE;}   /* single string w/o whitespaces (partition name) */\r
-#define START_NAME           {in_single_string = TRUE;}   /* single string w/o whitespaces (port group name) */\r
-#define START_QOS_LEVEL_NAME {in_single_string = TRUE;}   /* single string w/o whitespaces (qos level name in match rule) */\r
-\r
-#define START_NODE_TYPE     {in_node_type = TRUE;}       /* comma-separated list of node types (ROUTER,CA,...) */\r
-#define START_SL2VL_TABLE   {in_list_of_numbers = TRUE;} /* comma-separated list of hex or dec numbers */\r
-\r
-#define START_GROUP         {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS        {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS_TO     {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS_FROM   {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_SOURCE        {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_DESTINATION   {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-\r
-#define START_VLARB_HIGH    {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */\r
-#define START_VLARB_LOW     {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */\r
-\r
-#define START_TO            {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */\r
-#define START_FROM          {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */\r
-\r
-#define START_PATH_BITS     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_QOS_CLASS     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_SERVICE_ID    {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_PKEY          {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-\r
-#define START_SL               {in_single_number = TRUE;}   /* single number */\r
-#define START_VLARB_HIGH_LIMIT {in_single_number = TRUE;}   /* single number */\r
-#define START_MTU_LIMIT        {in_single_number = TRUE;}   /* single number */\r
-#define START_RATE_LIMIT       {in_single_number = TRUE;}   /* single number */\r
-#define START_PACKET_LIFE      {in_single_number = TRUE;}   /* single number */\r
-\r
-#define START_ULP_DEFAULT       {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_ANY           {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_SDP_DEFAULT   {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_SDP_PORT      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_RDS_DEFAULT   {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_RDS_PORT      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_ISER_DEFAULT  {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_ISER_PORT     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_SRP_GUID      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_IPOIB_DEFAULT {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_IPOIB_PKEY    {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-\r
-\r
-#define YY_NO_INPUT 1\r
-#line 933 "osm_qos_parser_l.c"\r
-\r
-#define INITIAL 0\r
-\r
-#ifndef YY_NO_UNISTD_H\r
-/* Special case for "unistd.h", since it is non-ANSI. We include it way\r
- * down here because we want the user's section 1 to have been scanned first.\r
- * The user has a chance to override it with an option.\r
- */\r
-#include <unistd.h>\r
-#endif\r
-\r
-#ifndef YY_EXTRA_TYPE\r
-#define YY_EXTRA_TYPE void *\r
-#endif\r
-\r
-static int yy_init_globals (void );\r
-\r
-/* Accessor methods to globals.\r
-   These are made visible to non-reentrant scanners for convenience. */\r
-\r
-int yylex_destroy (void );\r
-\r
-int yyget_debug (void );\r
-\r
-void yyset_debug (int debug_flag  );\r
-\r
-YY_EXTRA_TYPE yyget_extra (void );\r
-\r
-void yyset_extra (YY_EXTRA_TYPE user_defined  );\r
-\r
-FILE *yyget_in (void );\r
-\r
-void yyset_in  (FILE * in_str  );\r
-\r
-FILE *yyget_out (void );\r
-\r
-void yyset_out  (FILE * out_str  );\r
-\r
-int yyget_leng (void );\r
-\r
-char *yyget_text (void );\r
-\r
-int yyget_lineno (void );\r
-\r
-void yyset_lineno (int line_number  );\r
-\r
-/* Macros after this point can all be overridden by user definitions in\r
- * section 1.\r
- */\r
-\r
-#ifndef YY_SKIP_YYWRAP\r
-#ifdef __cplusplus\r
-extern "C" int yywrap (void );\r
-#else\r
-extern int yywrap (void );\r
-#endif\r
-#endif\r
-\r
-#ifndef yytext_ptr\r
-static void yy_flex_strncpy (char *,yyconst char *,int );\r
-#endif\r
-\r
-#ifdef YY_NEED_STRLEN\r
-static int yy_flex_strlen (yyconst char * );\r
-#endif\r
-\r
-#ifndef YY_NO_INPUT\r
-\r
-#ifdef __cplusplus\r
-static int yyinput (void );\r
-#else\r
-static int input (void );\r
-#endif\r
-\r
-#endif\r
-\r
-/* Amount of stuff to slurp up with each read. */\r
-#ifndef YY_READ_BUF_SIZE\r
-#define YY_READ_BUF_SIZE 8192\r
-#endif\r
-\r
-/* Copy whatever the last rule matched to the standard output. */\r
-#ifndef ECHO\r
-/* This used to be an fputs(), but since the string might contain NUL's,\r
- * we now use fwrite().\r
- */\r
-#define ECHO fwrite( yytext, yyleng, 1, yyout )\r
-#endif\r
-\r
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,\r
- * is returned in "result".\r
- */\r
-#ifndef YY_INPUT\r
-#define YY_INPUT(buf,result,max_size) \\r
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\r
-               { \\r
-               int c = '*'; \\r
-               int n; \\r
-               for ( n = 0; n < max_size && \\r
-                            (c = getc( yyin )) != EOF && c != '\n'; ++n ) \\r
-                       buf[n] = (char) c; \\r
-               if ( c == '\n' ) \\r
-                       buf[n++] = (char) c; \\r
-               if ( c == EOF && ferror( yyin ) ) \\r
-                       YY_FATAL_ERROR( "input in flex scanner failed" ); \\r
-               result = n; \\r
-               } \\r
-       else \\r
-               { \\r
-               errno=0; \\r
-               while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\r
-                       { \\r
-                       if( errno != EINTR) \\r
-                               { \\r
-                               YY_FATAL_ERROR( "input in flex scanner failed" ); \\r
-                               break; \\r
-                               } \\r
-                       errno=0; \\r
-                       clearerr(yyin); \\r
-                       } \\r
-               }\\r
-\\r
-\r
-#endif\r
-\r
-/* No semi-colon after return; correct usage is to write "yyterminate();" -\r
- * we don't want an extra ';' after the "return" because that will cause\r
- * some compilers to complain about unreachable statements.\r
- */\r
-#ifndef yyterminate\r
-#define yyterminate() return YY_NULL\r
-#endif\r
-\r
-/* Number of entries by which start-condition stack grows. */\r
-#ifndef YY_START_STACK_INCR\r
-#define YY_START_STACK_INCR 25\r
-#endif\r
-\r
-/* Report a fatal error. */\r
-#ifndef YY_FATAL_ERROR\r
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )\r
-#endif\r
-\r
-/* end tables serialization structures and prototypes */\r
-\r
-/* Default declaration of generated scanner - a define so the user can\r
- * easily add parameters.\r
- */\r
-#ifndef YY_DECL\r
-#define YY_DECL_IS_OURS 1\r
-\r
-extern int yylex (void);\r
-\r
-#define YY_DECL int yylex (void)\r
-#endif /* !YY_DECL */\r
-\r
-/* Code executed at the beginning of each rule, after yytext and yyleng\r
- * have been set up.\r
- */\r
-#ifndef YY_USER_ACTION\r
-#define YY_USER_ACTION\r
-#endif\r
-\r
-/* Code executed at the end of each rule. */\r
-#ifndef YY_BREAK\r
-#define YY_BREAK break;\r
-#endif\r
-\r
-#define YY_RULE_SETUP \\r
-       YY_USER_ACTION\r
-\r
-/** The main scanner function which does all the work.\r
- */\r
-YY_DECL\r
-{\r
-       register yy_state_type yy_current_state;\r
-       register char *yy_cp, *yy_bp;\r
-       register int yy_act;\r
-    \r
-#line 201 "osm_qos_parser_l.l"\r
-\r
-\r
-\r
-#line 1117 "osm_qos_parser_l.c"\r
-\r
-       if ( !(yy_init) )\r
-               {\r
-               (yy_init) = 1;\r
-\r
-#ifdef YY_USER_INIT\r
-               YY_USER_INIT;\r
-#endif\r
-\r
-               if ( ! (yy_start) )\r
-                       (yy_start) = 1; /* first start state */\r
-\r
-               if ( ! yyin )\r
-                       yyin = stdin;\r
-\r
-               if ( ! yyout )\r
-                       yyout = stdout;\r
-\r
-               if ( ! YY_CURRENT_BUFFER ) {\r
-                       yyensure_buffer_stack ();\r
-                       YY_CURRENT_BUFFER_LVALUE =\r
-                               yy_create_buffer(yyin,YY_BUF_SIZE );\r
-               }\r
-\r
-               yy_load_buffer_state( );\r
-               }\r
-\r
-       while ( 1 )             /* loops until end-of-file is reached */\r
-               {\r
-               yy_cp = (yy_c_buf_p);\r
-\r
-               /* Support of yytext. */\r
-               *yy_cp = (yy_hold_char);\r
-\r
-               /* yy_bp points to the position in yy_ch_buf of the start of\r
-                * the current run.\r
-                */\r
-               yy_bp = yy_cp;\r
-\r
-               yy_current_state = (yy_start);\r
-yy_match:\r
-               do\r
-                       {\r
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];\r
-                       if ( yy_accept[yy_current_state] )\r
-                               {\r
-                               (yy_last_accepting_state) = yy_current_state;\r
-                               (yy_last_accepting_cpos) = yy_cp;\r
-                               }\r
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
-                               {\r
-                               yy_current_state = (int) yy_def[yy_current_state];\r
-                               if ( yy_current_state >= 551 )\r
-                                       yy_c = yy_meta[(unsigned int) yy_c];\r
-                               }\r
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
-                       ++yy_cp;\r
-                       }\r
-               while ( yy_base[yy_current_state] != 760 );\r
-\r
-yy_find_action:\r
-               yy_act = yy_accept[yy_current_state];\r
-               if ( yy_act == 0 )\r
-                       { /* have to back up */\r
-                       yy_cp = (yy_last_accepting_cpos);\r
-                       yy_current_state = (yy_last_accepting_state);\r
-                       yy_act = yy_accept[yy_current_state];\r
-                       }\r
-\r
-               YY_DO_BEFORE_ACTION;\r
-\r
-do_action:     /* This label is used only to access EOF actions. */\r
-\r
-               switch ( yy_act )\r
-       { /* beginning of action switch */\r
-                       case 0: /* must back up */\r
-                       /* undo the effects of YY_DO_BEFORE_ACTION */\r
-                       *yy_cp = (yy_hold_char);\r
-                       yy_cp = (yy_last_accepting_cpos);\r
-                       yy_current_state = (yy_last_accepting_state);\r
-                       goto yy_find_action;\r
-\r
-case 1:\r
-/* rule 1 can match eol */\r
-YY_RULE_SETUP\r
-#line 204 "osm_qos_parser_l.l"\r
-{ SAVE_POS; RESET_NEW_LINE_FLAGS; } /* swallow comment */\r
-       YY_BREAK\r
-case 2:\r
-/* rule 2 can match eol */\r
-YY_RULE_SETUP\r
-#line 205 "osm_qos_parser_l.l"\r
-{ SAVE_POS; RESET_NEW_LINE_FLAGS; } /* trailing blanks with new line */\r
-       YY_BREAK\r
-case 3:\r
-YY_RULE_SETUP\r
-#line 206 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; }\r
-       YY_BREAK\r
-case 4:\r
-/* rule 4 can match eol */\r
-YY_RULE_SETUP\r
-#line 207 "osm_qos_parser_l.l"\r
-{ SAVE_POS; RESET_NEW_LINE_FLAGS; }\r
-       YY_BREAK\r
-case 5:\r
-YY_RULE_SETUP\r
-#line 209 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_START; }\r
-       YY_BREAK\r
-case 6:\r
-YY_RULE_SETUP\r
-#line 210 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_END; }\r
-       YY_BREAK\r
-case 7:\r
-YY_RULE_SETUP\r
-#line 212 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_START; }\r
-       YY_BREAK\r
-case 8:\r
-YY_RULE_SETUP\r
-#line 213 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_END; }\r
-       YY_BREAK\r
-case 9:\r
-YY_RULE_SETUP\r
-#line 214 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_START; }\r
-       YY_BREAK\r
-case 10:\r
-YY_RULE_SETUP\r
-#line 215 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_END; }\r
-       YY_BREAK\r
-case 11:\r
-YY_RULE_SETUP\r
-#line 217 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_START; }\r
-       YY_BREAK\r
-case 12:\r
-YY_RULE_SETUP\r
-#line 218 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_END; }\r
-       YY_BREAK\r
-case 13:\r
-YY_RULE_SETUP\r
-#line 219 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_START; }\r
-       YY_BREAK\r
-case 14:\r
-YY_RULE_SETUP\r
-#line 220 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_END; }\r
-       YY_BREAK\r
-case 15:\r
-YY_RULE_SETUP\r
-#line 221 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_START; }\r
-       YY_BREAK\r
-case 16:\r
-YY_RULE_SETUP\r
-#line 222 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_END; }\r
-       YY_BREAK\r
-case 17:\r
-YY_RULE_SETUP\r
-#line 224 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_START; }\r
-       YY_BREAK\r
-case 18:\r
-YY_RULE_SETUP\r
-#line 225 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_END; }\r
-       YY_BREAK\r
-case 19:\r
-YY_RULE_SETUP\r
-#line 226 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_START; }\r
-       YY_BREAK\r
-case 20:\r
-YY_RULE_SETUP\r
-#line 227 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_END; }\r
-       YY_BREAK\r
-case 21:\r
-YY_RULE_SETUP\r
-#line 229 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_START; }\r
-       YY_BREAK\r
-case 22:\r
-YY_RULE_SETUP\r
-#line 230 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_END; }\r
-       YY_BREAK\r
-case 23:\r
-YY_RULE_SETUP\r
-#line 231 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_START; }\r
-       YY_BREAK\r
-case 24:\r
-YY_RULE_SETUP\r
-#line 232 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_END; }\r
-       YY_BREAK\r
-case 25:\r
-YY_RULE_SETUP\r
-#line 234 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_START; }\r
-       YY_BREAK\r
-case 26:\r
-YY_RULE_SETUP\r
-#line 235 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_END; }\r
-       YY_BREAK\r
-case 27:\r
-YY_RULE_SETUP\r
-#line 236 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_START; }\r
-       YY_BREAK\r
-case 28:\r
-YY_RULE_SETUP\r
-#line 237 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_END; }\r
-       YY_BREAK\r
-case 29:\r
-YY_RULE_SETUP\r
-#line 239 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_GUID;    return TK_PORT_GUID;  }\r
-       YY_BREAK\r
-case 30:\r
-YY_RULE_SETUP\r
-#line 240 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_NAME;    return TK_PORT_NAME;  }\r
-       YY_BREAK\r
-case 31:\r
-YY_RULE_SETUP\r
-#line 241 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PARTITION;    return TK_PARTITION;  }\r
-       YY_BREAK\r
-case 32:\r
-YY_RULE_SETUP\r
-#line 242 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NODE_TYPE;    return TK_NODE_TYPE;  }\r
-       YY_BREAK\r
-case 33:\r
-YY_RULE_SETUP\r
-#line 243 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NAME;         return TK_NAME;       }\r
-       YY_BREAK\r
-case 34:\r
-YY_RULE_SETUP\r
-#line 244 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_USE;          return TK_USE;        }\r
-       YY_BREAK\r
-case 35:\r
-YY_RULE_SETUP\r
-#line 245 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_GROUP;        return TK_GROUP;      }\r
-       YY_BREAK\r
-case 36:\r
-YY_RULE_SETUP\r
-#line 246 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH;   return TK_VLARB_HIGH; }\r
-       YY_BREAK\r
-case 37:\r
-YY_RULE_SETUP\r
-#line 247 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_LOW;    return TK_VLARB_LOW;  }\r
-       YY_BREAK\r
-case 38:\r
-YY_RULE_SETUP\r
-#line 248 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH_LIMIT; return TK_VLARB_HIGH_LIMIT;}\r
-       YY_BREAK\r
-case 39:\r
-YY_RULE_SETUP\r
-#line 249 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_TO;           return TK_TO;         }\r
-       YY_BREAK\r
-case 40:\r
-YY_RULE_SETUP\r
-#line 250 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_FROM;         return TK_FROM;       }\r
-       YY_BREAK\r
-case 41:\r
-YY_RULE_SETUP\r
-#line 251 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_TO;    return TK_ACROSS_TO;  }\r
-       YY_BREAK\r
-case 42:\r
-YY_RULE_SETUP\r
-#line 252 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_FROM;  return TK_ACROSS_FROM;}\r
-       YY_BREAK\r
-case 43:\r
-YY_RULE_SETUP\r
-#line 253 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS;       return TK_ACROSS;     }\r
-       YY_BREAK\r
-case 44:\r
-YY_RULE_SETUP\r
-#line 254 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL2VL_TABLE;  return TK_SL2VL_TABLE;}\r
-       YY_BREAK\r
-case 45:\r
-YY_RULE_SETUP\r
-#line 255 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL;           return TK_SL;         }\r
-       YY_BREAK\r
-case 46:\r
-YY_RULE_SETUP\r
-#line 256 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_MTU_LIMIT;    return TK_MTU_LIMIT;  }\r
-       YY_BREAK\r
-case 47:\r
-YY_RULE_SETUP\r
-#line 257 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_RATE_LIMIT;   return TK_RATE_LIMIT; }\r
-       YY_BREAK\r
-case 48:\r
-YY_RULE_SETUP\r
-#line 258 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PACKET_LIFE;  return TK_PACKET_LIFE;}\r
-       YY_BREAK\r
-case 49:\r
-YY_RULE_SETUP\r
-#line 259 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PATH_BITS;    return TK_PATH_BITS;  }\r
-       YY_BREAK\r
-case 50:\r
-YY_RULE_SETUP\r
-#line 260 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_CLASS;    return TK_QOS_CLASS;  }\r
-       YY_BREAK\r
-case 51:\r
-YY_RULE_SETUP\r
-#line 261 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SOURCE;       return TK_SOURCE;     }\r
-       YY_BREAK\r
-case 52:\r
-YY_RULE_SETUP\r
-#line 262 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_DESTINATION;  return TK_DESTINATION;}\r
-       YY_BREAK\r
-case 53:\r
-YY_RULE_SETUP\r
-#line 263 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SERVICE_ID;   return TK_SERVICE_ID; }\r
-       YY_BREAK\r
-case 54:\r
-YY_RULE_SETUP\r
-#line 264 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PKEY;         return TK_PKEY;       }\r
-       YY_BREAK\r
-case 55:\r
-YY_RULE_SETUP\r
-#line 265 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_LEVEL_NAME; return TK_QOS_LEVEL_NAME;}\r
-       YY_BREAK\r
-case 56:\r
-YY_RULE_SETUP\r
-#line 267 "osm_qos_parser_l.l"\r
-{ SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ROUTER; yylval = strdup(yytext); return TK_TEXT; }\r
-       YY_BREAK\r
-case 57:\r
-YY_RULE_SETUP\r
-#line 268 "osm_qos_parser_l.l"\r
-{ SAVE_POS; if (in_node_type) return TK_NODE_TYPE_CA;     yylval = strdup(yytext); return TK_TEXT; }\r
-       YY_BREAK\r
-case 58:\r
-YY_RULE_SETUP\r
-#line 269 "osm_qos_parser_l.l"\r
-{ SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SWITCH; yylval = strdup(yytext); return TK_TEXT; }\r
-       YY_BREAK\r
-case 59:\r
-YY_RULE_SETUP\r
-#line 270 "osm_qos_parser_l.l"\r
-{ SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SELF;   yylval = strdup(yytext); return TK_TEXT; }\r
-       YY_BREAK\r
-case 60:\r
-YY_RULE_SETUP\r
-#line 271 "osm_qos_parser_l.l"\r
-{ SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ALL;    yylval = strdup(yytext); return TK_TEXT; }\r
-       YY_BREAK\r
-case 61:\r
-YY_RULE_SETUP\r
-#line 273 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_DEFAULT; return TK_ULP_DEFAULT; }\r
-       YY_BREAK\r
-case 62:\r
-YY_RULE_SETUP\r
-#line 274 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SERVICE_ID; }\r
-       YY_BREAK\r
-case 63:\r
-YY_RULE_SETUP\r
-#line 275 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_PKEY; }\r
-       YY_BREAK\r
-case 64:\r
-YY_RULE_SETUP\r
-#line 276 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_TARGET_PORT_GUID; }\r
-       YY_BREAK\r
-case 65:\r
-YY_RULE_SETUP\r
-#line 278 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; }\r
-       YY_BREAK\r
-case 66:\r
-YY_RULE_SETUP\r
-#line 279 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; }\r
-       YY_BREAK\r
-case 67:\r
-YY_RULE_SETUP\r
-#line 281 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_DEFAULT; return TK_ULP_RDS_DEFAULT; }\r
-       YY_BREAK\r
-case 68:\r
-YY_RULE_SETUP\r
-#line 282 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_PORT; return TK_ULP_RDS_PORT; }\r
-       YY_BREAK\r
-case 69:\r
-YY_RULE_SETUP\r
-#line 284 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_ISER_DEFAULT; }\r
-       YY_BREAK\r
-case 70:\r
-YY_RULE_SETUP\r
-#line 285 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_ISER_PORT; }\r
-       YY_BREAK\r
-case 71:\r
-YY_RULE_SETUP\r
-#line 287 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SRP_GUID; return TK_ULP_SRP_GUID; }\r
-       YY_BREAK\r
-case 72:\r
-YY_RULE_SETUP\r
-#line 289 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_DEFAULT; return TK_ULP_IPOIB_DEFAULT; }\r
-       YY_BREAK\r
-case 73:\r
-YY_RULE_SETUP\r
-#line 290 "osm_qos_parser_l.l"\r
-{ SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_PKEY; return TK_ULP_IPOIB_PKEY; }\r
-       YY_BREAK\r
-case 74:\r
-YY_RULE_SETUP\r
-#line 292 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        yylval = strdup(yytext);\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                            return TK_TEXT;\r
-                        return TK_NUMBER;\r
-                    }\r
-       YY_BREAK\r
-case 75:\r
-YY_RULE_SETUP\r
-#line 300 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        yylval = strdup(yytext);\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                            return TK_TEXT;\r
-                        return TK_NUMBER;\r
-                    }\r
-       YY_BREAK\r
-case 76:\r
-YY_RULE_SETUP\r
-#line 309 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_DASH;\r
-                    }\r
-       YY_BREAK\r
-case 77:\r
-YY_RULE_SETUP\r
-#line 319 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_DOTDOT;\r
-                    }\r
-       YY_BREAK\r
-case 78:\r
-YY_RULE_SETUP\r
-#line 329 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        if (in_description)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_COMMA;\r
-                    }\r
-       YY_BREAK\r
-case 79:\r
-YY_RULE_SETUP\r
-#line 339 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_ASTERISK;\r
-                    }\r
-       YY_BREAK\r
-case 80:\r
-/* rule 80 can match eol */\r
-YY_RULE_SETUP\r
-#line 349 "osm_qos_parser_l.l"\r
-{\r
-                        SAVE_POS;\r
-                        yylval = strdup(&yytext[1]);\r
-                        yylval[strlen(yylval)-1] = '\0';\r
-                        return TK_TEXT;\r
-                    }\r
-       YY_BREAK\r
-case 81:\r
-YY_RULE_SETUP\r
-#line 356 "osm_qos_parser_l.l"\r
-{ SAVE_POS; yylval = strdup(yytext); return TK_TEXT;}\r
-       YY_BREAK\r
-case 82:\r
-YY_RULE_SETUP\r
-#line 358 "osm_qos_parser_l.l"\r
-ECHO;\r
-       YY_BREAK\r
-#line 1663 "osm_qos_parser_l.c"\r
-case YY_STATE_EOF(INITIAL):\r
-       yyterminate();\r
-\r
-       case YY_END_OF_BUFFER:\r
-               {\r
-               /* Amount of text matched not including the EOB char. */\r
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;\r
-\r
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */\r
-               *yy_cp = (yy_hold_char);\r
-               YY_RESTORE_YY_MORE_OFFSET\r
-\r
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )\r
-                       {\r
-                       /* We're scanning a new file or input source.  It's\r
-                        * possible that this happened because the user\r
-                        * just pointed yyin at a new source and called\r
-                        * yylex().  If so, then we have to assure\r
-                        * consistency between YY_CURRENT_BUFFER and our\r
-                        * globals.  Here is the right place to do so, because\r
-                        * this is the first action (other than possibly a\r
-                        * back-up) that will match for the new input source.\r
-                        */\r
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\r
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;\r
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;\r
-                       }\r
-\r
-               /* Note that here we test for yy_c_buf_p "<=" to the position\r
-                * of the first EOB in the buffer, since yy_c_buf_p will\r
-                * already have been incremented past the NUL character\r
-                * (since all states make transitions on EOB to the\r
-                * end-of-buffer state).  Contrast this with the test\r
-                * in input().\r
-                */\r
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\r
-                       { /* This was really a NUL. */\r
-                       yy_state_type yy_next_state;\r
-\r
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;\r
-\r
-                       yy_current_state = yy_get_previous_state(  );\r
-\r
-                       /* Okay, we're now positioned to make the NUL\r
-                        * transition.  We couldn't have\r
-                        * yy_get_previous_state() go ahead and do it\r
-                        * for us because it doesn't know how to deal\r
-                        * with the possibility of jamming (and we don't\r
-                        * want to build jamming into it because then it\r
-                        * will run more slowly).\r
-                        */\r
-\r
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );\r
-\r
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;\r
-\r
-                       if ( yy_next_state )\r
-                               {\r
-                               /* Consume the NUL. */\r
-                               yy_cp = ++(yy_c_buf_p);\r
-                               yy_current_state = yy_next_state;\r
-                               goto yy_match;\r
-                               }\r
-\r
-                       else\r
-                               {\r
-                               yy_cp = (yy_c_buf_p);\r
-                               goto yy_find_action;\r
-                               }\r
-                       }\r
-\r
-               else switch ( yy_get_next_buffer(  ) )\r
-                       {\r
-                       case EOB_ACT_END_OF_FILE:\r
-                               {\r
-                               (yy_did_buffer_switch_on_eof) = 0;\r
-\r
-                               if ( yywrap( ) )\r
-                                       {\r
-                                       /* Note: because we've taken care in\r
-                                        * yy_get_next_buffer() to have set up\r
-                                        * yytext, we can now set up\r
-                                        * yy_c_buf_p so that if some total\r
-                                        * hoser (like flex itself) wants to\r
-                                        * call the scanner after we return the\r
-                                        * YY_NULL, it'll still work - another\r
-                                        * YY_NULL will get returned.\r
-                                        */\r
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;\r
-\r
-                                       yy_act = YY_STATE_EOF(YY_START);\r
-                                       goto do_action;\r
-                                       }\r
-\r
-                               else\r
-                                       {\r
-                                       if ( ! (yy_did_buffer_switch_on_eof) )\r
-                                               YY_NEW_FILE;\r
-                                       }\r
-                               break;\r
-                               }\r
-\r
-                       case EOB_ACT_CONTINUE_SCAN:\r
-                               (yy_c_buf_p) =\r
-                                       (yytext_ptr) + yy_amount_of_matched_text;\r
-\r
-                               yy_current_state = yy_get_previous_state(  );\r
-\r
-                               yy_cp = (yy_c_buf_p);\r
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;\r
-                               goto yy_match;\r
-\r
-                       case EOB_ACT_LAST_MATCH:\r
-                               (yy_c_buf_p) =\r
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];\r
-\r
-                               yy_current_state = yy_get_previous_state(  );\r
-\r
-                               yy_cp = (yy_c_buf_p);\r
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;\r
-                               goto yy_find_action;\r
-                       }\r
-               break;\r
-               }\r
-\r
-       default:\r
-               YY_FATAL_ERROR(\r
-                       "fatal flex scanner internal error--no action found" );\r
-       } /* end of action switch */\r
-               } /* end of scanning one token */\r
-} /* end of yylex */\r
-\r
-/* yy_get_next_buffer - try to read in a new buffer\r
- *\r
- * Returns a code representing an action:\r
- *     EOB_ACT_LAST_MATCH -\r
- *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position\r
- *     EOB_ACT_END_OF_FILE - end of file\r
- */\r
-static int yy_get_next_buffer (void)\r
-{\r
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;\r
-       register char *source = (yytext_ptr);\r
-       register int number_to_move, i;\r
-       int ret_val;\r
-\r
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )\r
-               YY_FATAL_ERROR(\r
-               "fatal flex scanner internal error--end of buffer missed" );\r
-\r
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )\r
-               { /* Don't try to fill the buffer, so this is an EOF. */\r
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )\r
-                       {\r
-                       /* We matched a single character, the EOB, so\r
-                        * treat this as a final EOF.\r
-                        */\r
-                       return EOB_ACT_END_OF_FILE;\r
-                       }\r
-\r
-               else\r
-                       {\r
-                       /* We matched some text prior to the EOB, first\r
-                        * process it.\r
-                        */\r
-                       return EOB_ACT_LAST_MATCH;\r
-                       }\r
-               }\r
-\r
-       /* Try to read more data. */\r
-\r
-       /* First move last chars to start of buffer. */\r
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;\r
-\r
-       for ( i = 0; i < number_to_move; ++i )\r
-               *(dest++) = *(source++);\r
-\r
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )\r
-               /* don't do the read, it's not guaranteed to return an EOF,\r
-                * just force an EOF\r
-                */\r
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;\r
-\r
-       else\r
-               {\r
-                       int num_to_read =\r
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;\r
-\r
-               while ( num_to_read <= 0 )\r
-                       { /* Not enough room in the buffer - grow it. */\r
-\r
-                       /* just a shorter name for the current buffer */\r
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;\r
-\r
-                       int yy_c_buf_p_offset =\r
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);\r
-\r
-                       if ( b->yy_is_our_buffer )\r
-                               {\r
-                               int new_size = b->yy_buf_size * 2;\r
-\r
-                               if ( new_size <= 0 )\r
-                                       b->yy_buf_size += b->yy_buf_size / 8;\r
-                               else\r
-                                       b->yy_buf_size *= 2;\r
-\r
-                               b->yy_ch_buf = (char *)\r
-                                       /* Include room in for 2 EOB chars. */\r
-                                       yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );\r
-                               }\r
-                       else\r
-                               /* Can't grow it, we don't own it. */\r
-                               b->yy_ch_buf = 0;\r
-\r
-                       if ( ! b->yy_ch_buf )\r
-                               YY_FATAL_ERROR(\r
-                               "fatal error - scanner input buffer overflow" );\r
-\r
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];\r
-\r
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -\r
-                                               number_to_move - 1;\r
-\r
-                       }\r
-\r
-               if ( num_to_read > YY_READ_BUF_SIZE )\r
-                       num_to_read = YY_READ_BUF_SIZE;\r
-\r
-               /* Read in more data. */\r
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),\r
-                       (yy_n_chars), (size_t) num_to_read );\r
-\r
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\r
-               }\r
-\r
-       if ( (yy_n_chars) == 0 )\r
-               {\r
-               if ( number_to_move == YY_MORE_ADJ )\r
-                       {\r
-                       ret_val = EOB_ACT_END_OF_FILE;\r
-                       yyrestart(yyin  );\r
-                       }\r
-\r
-               else\r
-                       {\r
-                       ret_val = EOB_ACT_LAST_MATCH;\r
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =\r
-                               YY_BUFFER_EOF_PENDING;\r
-                       }\r
-               }\r
-\r
-       else\r
-               ret_val = EOB_ACT_CONTINUE_SCAN;\r
-\r
-       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {\r
-               /* Extend the array by 50%, plus the number we really need. */\r
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);\r
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );\r
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )\r
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );\r
-       }\r
-\r
-       (yy_n_chars) += number_to_move;\r
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;\r
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;\r
-\r
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];\r
-\r
-       return ret_val;\r
-}\r
-\r
-/* yy_get_previous_state - get the state just before the EOB char was reached */\r
-\r
-    static yy_state_type yy_get_previous_state (void)\r
-{\r
-       register yy_state_type yy_current_state;\r
-       register char *yy_cp;\r
-    \r
-       yy_current_state = (yy_start);\r
-\r
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )\r
-               {\r
-               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);\r
-               if ( yy_accept[yy_current_state] )\r
-                       {\r
-                       (yy_last_accepting_state) = yy_current_state;\r
-                       (yy_last_accepting_cpos) = yy_cp;\r
-                       }\r
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
-                       {\r
-                       yy_current_state = (int) yy_def[yy_current_state];\r
-                       if ( yy_current_state >= 551 )\r
-                               yy_c = yy_meta[(unsigned int) yy_c];\r
-                       }\r
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
-               }\r
-\r
-       return yy_current_state;\r
-}\r
-\r
-/* yy_try_NUL_trans - try to make a transition on the NUL character\r
- *\r
- * synopsis\r
- *     next_state = yy_try_NUL_trans( current_state );\r
- */\r
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )\r
-{\r
-       register int yy_is_jam;\r
-       register char *yy_cp = (yy_c_buf_p);\r
-\r
-       register YY_CHAR yy_c = 1;\r
-       if ( yy_accept[yy_current_state] )\r
-               {\r
-               (yy_last_accepting_state) = yy_current_state;\r
-               (yy_last_accepting_cpos) = yy_cp;\r
-               }\r
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )\r
-               {\r
-               yy_current_state = (int) yy_def[yy_current_state];\r
-               if ( yy_current_state >= 551 )\r
-                       yy_c = yy_meta[(unsigned int) yy_c];\r
-               }\r
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];\r
-       yy_is_jam = (yy_current_state == 550);\r
-\r
-       return yy_is_jam ? 0 : yy_current_state;\r
-}\r
-\r
-#ifndef YY_NO_INPUT\r
-#ifdef __cplusplus\r
-    static int yyinput (void)\r
-#else\r
-    static int input  (void)\r
-#endif\r
-\r
-{\r
-       int c;\r
-    \r
-       *(yy_c_buf_p) = (yy_hold_char);\r
-\r
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )\r
-               {\r
-               /* yy_c_buf_p now points to the character we want to return.\r
-                * If this occurs *before* the EOB characters, then it's a\r
-                * valid NUL; if not, then we've hit the end of the buffer.\r
-                */\r
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )\r
-                       /* This was really a NUL. */\r
-                       *(yy_c_buf_p) = '\0';\r
-\r
-               else\r
-                       { /* need more input */\r
-                       int offset = (yy_c_buf_p) - (yytext_ptr);\r
-                       ++(yy_c_buf_p);\r
-\r
-                       switch ( yy_get_next_buffer(  ) )\r
-                               {\r
-                               case EOB_ACT_LAST_MATCH:\r
-                                       /* This happens because yy_g_n_b()\r
-                                        * sees that we've accumulated a\r
-                                        * token and flags that we need to\r
-                                        * try matching the token before\r
-                                        * proceeding.  But for input(),\r
-                                        * there's no matching to consider.\r
-                                        * So convert the EOB_ACT_LAST_MATCH\r
-                                        * to EOB_ACT_END_OF_FILE.\r
-                                        */\r
-\r
-                                       /* Reset buffer status. */\r
-                                       yyrestart(yyin );\r
-\r
-                                       /*FALLTHROUGH*/\r
-\r
-                               case EOB_ACT_END_OF_FILE:\r
-                                       {\r
-                                       if ( yywrap( ) )\r
-                                               return EOF;\r
-\r
-                                       if ( ! (yy_did_buffer_switch_on_eof) )\r
-                                               YY_NEW_FILE;\r
-#ifdef __cplusplus\r
-                                       return yyinput();\r
-#else\r
-                                       return input();\r
-#endif\r
-                                       }\r
-\r
-                               case EOB_ACT_CONTINUE_SCAN:\r
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;\r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-\r
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */\r
-       *(yy_c_buf_p) = '\0';   /* preserve yytext */\r
-       (yy_hold_char) = *++(yy_c_buf_p);\r
-\r
-       return c;\r
-}\r
-#endif /* ifndef YY_NO_INPUT */\r
-\r
-/** Immediately switch to a different input stream.\r
- * @param input_file A readable stream.\r
- * \r
- * @note This function does not reset the start condition to @c INITIAL .\r
- */\r
-    void yyrestart  (FILE * input_file )\r
-{\r
-    \r
-       if ( ! YY_CURRENT_BUFFER ){\r
-        yyensure_buffer_stack ();\r
-               YY_CURRENT_BUFFER_LVALUE =\r
-            yy_create_buffer(yyin,YY_BUF_SIZE );\r
-       }\r
-\r
-       yy_init_buffer(YY_CURRENT_BUFFER,input_file );\r
-       yy_load_buffer_state( );\r
-}\r
-\r
-/** Switch to a different input buffer.\r
- * @param new_buffer The new input buffer.\r
- * \r
- */\r
-    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )\r
-{\r
-    \r
-       /* TODO. We should be able to replace this entire function body\r
-        * with\r
-        *              yypop_buffer_state();\r
-        *              yypush_buffer_state(new_buffer);\r
-     */\r
-       yyensure_buffer_stack ();\r
-       if ( YY_CURRENT_BUFFER == new_buffer )\r
-               return;\r
-\r
-       if ( YY_CURRENT_BUFFER )\r
-               {\r
-               /* Flush out information for old buffer. */\r
-               *(yy_c_buf_p) = (yy_hold_char);\r
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\r
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\r
-               }\r
-\r
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;\r
-       yy_load_buffer_state( );\r
-\r
-       /* We don't actually know whether we did this switch during\r
-        * EOF (yywrap()) processing, but the only time this flag\r
-        * is looked at is after yywrap() is called, so it's safe\r
-        * to go ahead and always set it.\r
-        */\r
-       (yy_did_buffer_switch_on_eof) = 1;\r
-}\r
-\r
-static void yy_load_buffer_state  (void)\r
-{\r
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;\r
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;\r
-       yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;\r
-       (yy_hold_char) = *(yy_c_buf_p);\r
-}\r
-\r
-/** Allocate and initialize an input buffer state.\r
- * @param file A readable stream.\r
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.\r
- * \r
- * @return the allocated buffer state.\r
- */\r
-    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )\r
-{\r
-       YY_BUFFER_STATE b;\r
-    \r
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );\r
-       if ( ! b )\r
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );\r
-\r
-       b->yy_buf_size = size;\r
-\r
-       /* yy_ch_buf has to be 2 characters longer than the size given because\r
-        * we need to put in 2 end-of-buffer characters.\r
-        */\r
-       b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );\r
-       if ( ! b->yy_ch_buf )\r
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );\r
-\r
-       b->yy_is_our_buffer = 1;\r
-\r
-       yy_init_buffer(b,file );\r
-\r
-       return b;\r
-}\r
-\r
-/** Destroy the buffer.\r
- * @param b a buffer created with yy_create_buffer()\r
- * \r
- */\r
-    void yy_delete_buffer (YY_BUFFER_STATE  b )\r
-{\r
-    \r
-       if ( ! b )\r
-               return;\r
-\r
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */\r
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;\r
-\r
-       if ( b->yy_is_our_buffer )\r
-               yyfree((void *) b->yy_ch_buf  );\r
-\r
-       yyfree((void *) b  );\r
-}\r
-\r
-#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-#ifndef __WIN__\r
-#ifdef __THROW /* this is a gnuism */\r
-extern int isatty (int ) __THROW;\r
-#else\r
-extern int isatty (int );\r
-#endif\r
-#endif\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif\r
-    \r
-/* Initializes or reinitializes a buffer.\r
- * This function is sometimes called more than once on the same buffer,\r
- * such as during a yyrestart() or at EOF.\r
- */\r
-    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )\r
-\r
-{\r
-       int oerrno = errno;\r
-    \r
-       yy_flush_buffer(b );\r
-\r
-       b->yy_input_file = file;\r
-       b->yy_fill_buffer = 1;\r
-\r
-    /* If b is the current buffer, then yy_init_buffer was _probably_\r
-     * called from yyrestart() or through yy_get_next_buffer.\r
-     * In that case, we don't want to reset the lineno or column.\r
-     */\r
-    if (b != YY_CURRENT_BUFFER){\r
-        b->yy_bs_lineno = 1;\r
-        b->yy_bs_column = 0;\r
-    }\r
-\r
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;\r
-    \r
-       errno = oerrno;\r
-}\r
-\r
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.\r
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.\r
- * \r
- */\r
-    void yy_flush_buffer (YY_BUFFER_STATE  b )\r
-{\r
-       if ( ! b )\r
-               return;\r
-\r
-       b->yy_n_chars = 0;\r
-\r
-       /* We always need two end-of-buffer characters.  The first causes\r
-        * a transition to the end-of-buffer state.  The second causes\r
-        * a jam in that state.\r
-        */\r
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;\r
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;\r
-\r
-       b->yy_buf_pos = &b->yy_ch_buf[0];\r
-\r
-       b->yy_at_bol = 1;\r
-       b->yy_buffer_status = YY_BUFFER_NEW;\r
-\r
-       if ( b == YY_CURRENT_BUFFER )\r
-               yy_load_buffer_state( );\r
-}\r
-\r
-/** Pushes the new state onto the stack. The new state becomes\r
- *  the current state. This function will allocate the stack\r
- *  if necessary.\r
- *  @param new_buffer The new state.\r
- *  \r
- */\r
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer )\r
-{\r
-       if (new_buffer == NULL)\r
-               return;\r
-\r
-       yyensure_buffer_stack();\r
-\r
-       /* This block is copied from yy_switch_to_buffer. */\r
-       if ( YY_CURRENT_BUFFER )\r
-               {\r
-               /* Flush out information for old buffer. */\r
-               *(yy_c_buf_p) = (yy_hold_char);\r
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);\r
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);\r
-               }\r
-\r
-       /* Only push if top exists. Otherwise, replace top. */\r
-       if (YY_CURRENT_BUFFER)\r
-               (yy_buffer_stack_top)++;\r
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;\r
-\r
-       /* copied from yy_switch_to_buffer. */\r
-       yy_load_buffer_state( );\r
-       (yy_did_buffer_switch_on_eof) = 1;\r
-}\r
-\r
-/** Removes and deletes the top of the stack, if present.\r
- *  The next element becomes the new top.\r
- *  \r
- */\r
-void yypop_buffer_state (void)\r
-{\r
-       if (!YY_CURRENT_BUFFER)\r
-               return;\r
-\r
-       yy_delete_buffer(YY_CURRENT_BUFFER );\r
-       YY_CURRENT_BUFFER_LVALUE = NULL;\r
-       if ((yy_buffer_stack_top) > 0)\r
-               --(yy_buffer_stack_top);\r
-\r
-       if (YY_CURRENT_BUFFER) {\r
-               yy_load_buffer_state( );\r
-               (yy_did_buffer_switch_on_eof) = 1;\r
-       }\r
-}\r
-\r
-/* Allocates the stack if it does not exist.\r
- *  Guarantees space for at least one push.\r
- */\r
-static void yyensure_buffer_stack (void)\r
-{\r
-       int num_to_alloc;\r
-    \r
-       if (!(yy_buffer_stack)) {\r
-\r
-               /* First allocation is just for 2 elements, since we don't know if this\r
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an\r
-                * immediate realloc on the next call.\r
-         */\r
-               num_to_alloc = 1;\r
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc\r
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)\r
-                                                               );\r
-               if ( ! (yy_buffer_stack) )\r
-                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );\r
-                                                                 \r
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));\r
-                               \r
-               (yy_buffer_stack_max) = num_to_alloc;\r
-               (yy_buffer_stack_top) = 0;\r
-               return;\r
-       }\r
-\r
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){\r
-\r
-               /* Increase the buffer to prepare for a possible push. */\r
-               int grow_size = 8 /* arbitrary grow size */;\r
-\r
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;\r
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc\r
-                                                               ((yy_buffer_stack),\r
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)\r
-                                                               );\r
-               if ( ! (yy_buffer_stack) )\r
-                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );\r
-\r
-               /* zero only the new slots.*/\r
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));\r
-               (yy_buffer_stack_max) = num_to_alloc;\r
-       }\r
-}\r
-\r
-/** Setup the input buffer state to scan directly from a user-specified character buffer.\r
- * @param base the character buffer\r
- * @param size the size in bytes of the character buffer\r
- * \r
- * @return the newly allocated buffer state object. \r
- */\r
-YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )\r
-{\r
-       YY_BUFFER_STATE b;\r
-    \r
-       if ( size < 2 ||\r
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||\r
-            base[size-1] != YY_END_OF_BUFFER_CHAR )\r
-               /* They forgot to leave room for the EOB's. */\r
-               return 0;\r
-\r
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );\r
-       if ( ! b )\r
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );\r
-\r
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */\r
-       b->yy_buf_pos = b->yy_ch_buf = base;\r
-       b->yy_is_our_buffer = 0;\r
-       b->yy_input_file = 0;\r
-       b->yy_n_chars = b->yy_buf_size;\r
-       b->yy_is_interactive = 0;\r
-       b->yy_at_bol = 1;\r
-       b->yy_fill_buffer = 0;\r
-       b->yy_buffer_status = YY_BUFFER_NEW;\r
-\r
-       yy_switch_to_buffer(b  );\r
-\r
-       return b;\r
-}\r
-\r
-/** Setup the input buffer state to scan a string. The next call to yylex() will\r
- * scan from a @e copy of @a str.\r
- * @param yystr a NUL-terminated string to scan\r
- * \r
- * @return the newly allocated buffer state object.\r
- * @note If you want to scan bytes that may contain NUL values, then use\r
- *       yy_scan_bytes() instead.\r
- */\r
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )\r
-{\r
-    \r
-       return yy_scan_bytes(yystr,strlen(yystr) );\r
-}\r
-\r
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will\r
- * scan from a @e copy of @a bytes.\r
- * @param bytes the byte buffer to scan\r
- * @param len the number of bytes in the buffer pointed to by @a bytes.\r
- * \r
- * @return the newly allocated buffer state object.\r
- */\r
-YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )\r
-{\r
-       YY_BUFFER_STATE b;\r
-       char *buf;\r
-       yy_size_t n;\r
-       int i;\r
-    \r
-       /* Get memory for full buffer, including space for trailing EOB's. */\r
-       n = _yybytes_len + 2;\r
-       buf = (char *) yyalloc(n  );\r
-       if ( ! buf )\r
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );\r
-\r
-       for ( i = 0; i < _yybytes_len; ++i )\r
-               buf[i] = yybytes[i];\r
-\r
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;\r
-\r
-       b = yy_scan_buffer(buf,n );\r
-       if ( ! b )\r
-               YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );\r
-\r
-       /* It's okay to grow etc. this buffer, and we should throw it\r
-        * away when we're done.\r
-        */\r
-       b->yy_is_our_buffer = 1;\r
-\r
-       return b;\r
-}\r
-\r
-#ifndef YY_EXIT_FAILURE\r
-#define YY_EXIT_FAILURE 2\r
-#endif\r
-\r
-static void yy_fatal_error (yyconst char* msg )\r
-{\r
-       (void) fprintf( stderr, "%s\n", msg );\r
-       exit( YY_EXIT_FAILURE );\r
-}\r
-\r
-/* Redefine yyless() so it works in section 3 code. */\r
-\r
-#undef yyless\r
-#define yyless(n) \\r
-       do \\r
-               { \\r
-               /* Undo effects of setting up yytext. */ \\r
-        int yyless_macro_arg = (n); \\r
-        YY_LESS_LINENO(yyless_macro_arg);\\r
-               yytext[yyleng] = (yy_hold_char); \\r
-               (yy_c_buf_p) = yytext + yyless_macro_arg; \\r
-               (yy_hold_char) = *(yy_c_buf_p); \\r
-               *(yy_c_buf_p) = '\0'; \\r
-               yyleng = yyless_macro_arg; \\r
-               } \\r
-       while ( 0 )\r
-\r
-/* Accessor  methods (get/set functions) to struct members. */\r
-\r
-/** Get the current line number.\r
- * \r
- */\r
-int yyget_lineno  (void)\r
-{\r
-        \r
-    return yylineno;\r
-}\r
-\r
-/** Get the input stream.\r
- * \r
- */\r
-FILE *yyget_in  (void)\r
-{\r
-        return yyin;\r
-}\r
-\r
-/** Get the output stream.\r
- * \r
- */\r
-FILE *yyget_out  (void)\r
-{\r
-        return yyout;\r
-}\r
-\r
-/** Get the length of the current token.\r
- * \r
- */\r
-int yyget_leng  (void)\r
-{\r
-        return yyleng;\r
-}\r
-\r
-/** Get the current token.\r
- * \r
- */\r
-\r
-char *yyget_text  (void)\r
-{\r
-        return yytext;\r
-}\r
-\r
-/** Set the current line number.\r
- * @param line_number\r
- * \r
- */\r
-void yyset_lineno (int  line_number )\r
-{\r
-    \r
-    yylineno = line_number;\r
-}\r
-\r
-/** Set the input stream. This does not discard the current\r
- * input buffer.\r
- * @param in_str A readable stream.\r
- * \r
- * @see yy_switch_to_buffer\r
- */\r
-void yyset_in (FILE *  in_str )\r
-{\r
-        yyin = in_str ;\r
-}\r
-\r
-void yyset_out (FILE *  out_str )\r
-{\r
-        yyout = out_str ;\r
-}\r
-\r
-int yyget_debug  (void)\r
-{\r
-        return yy_flex_debug;\r
-}\r
-\r
-void yyset_debug (int  bdebug )\r
-{\r
-        yy_flex_debug = bdebug ;\r
-}\r
-\r
-static int yy_init_globals (void)\r
-{\r
-        /* Initialization is the same as for the non-reentrant scanner.\r
-     * This function is called from yylex_destroy(), so don't allocate here.\r
-     */\r
-\r
-    (yy_buffer_stack) = 0;\r
-    (yy_buffer_stack_top) = 0;\r
-    (yy_buffer_stack_max) = 0;\r
-    (yy_c_buf_p) = (char *) 0;\r
-    (yy_init) = 0;\r
-    (yy_start) = 0;\r
-\r
-/* Defined in main.c */\r
-#ifdef YY_STDINIT\r
-    yyin = stdin;\r
-    yyout = stdout;\r
-#else\r
-    yyin = (FILE *) 0;\r
-    yyout = (FILE *) 0;\r
-#endif\r
-\r
-    /* For future reference: Set errno on error, since we are called by\r
-     * yylex_init()\r
-     */\r
-    return 0;\r
-}\r
-\r
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */\r
-int yylex_destroy  (void)\r
-{\r
-    \r
-    /* Pop the buffer stack, destroying each element. */\r
-       while(YY_CURRENT_BUFFER){\r
-               yy_delete_buffer(YY_CURRENT_BUFFER  );\r
-               YY_CURRENT_BUFFER_LVALUE = NULL;\r
-               yypop_buffer_state();\r
-       }\r
-\r
-       /* Destroy the stack itself. */\r
-       yyfree((yy_buffer_stack) );\r
-       (yy_buffer_stack) = NULL;\r
-\r
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time\r
-     * yylex() is called, initialization will occur. */\r
-    yy_init_globals( );\r
-\r
-    return 0;\r
-}\r
-\r
-/*\r
- * Internal utility routines.\r
- */\r
-\r
-#ifndef yytext_ptr\r
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )\r
-{\r
-       register int i;\r
-       for ( i = 0; i < n; ++i )\r
-               s1[i] = s2[i];\r
-}\r
-#endif\r
-\r
-#ifdef YY_NEED_STRLEN\r
-static int yy_flex_strlen (yyconst char * s )\r
-{\r
-       register int n;\r
-       for ( n = 0; s[n]; ++n )\r
-               ;\r
-\r
-       return n;\r
-}\r
-#endif\r
-\r
-void *yyalloc (yy_size_t  size )\r
-{\r
-       return (void *) malloc( size );\r
-}\r
-\r
-void *yyrealloc  (void * ptr, yy_size_t  size )\r
-{\r
-       /* The cast to (char *) in the following accommodates both\r
-        * implementations that use char* generic pointers, and those\r
-        * that use void* generic pointers.  It works with the latter\r
-        * because both ANSI C and C++ allow castless assignment from\r
-        * any pointer type to void*, and deal with argument conversions\r
-        * as though doing an assignment.\r
-        */\r
-       return (void *) realloc( (char *) ptr, size );\r
-}\r
-\r
-void yyfree (void * ptr )\r
-{\r
-       free( (char *) ptr );   /* see yyrealloc() for (char *) cast */\r
-}\r
-\r
-#define YYTABLES_NAME "yytables"\r
-\r
-#line 358 "osm_qos_parser_l.l"\r
-\r
-\r
-\r
-\r
-/*********************************************\r
- *********************************************/\r
-\r
-static void save_pos()\r
-{\r
-    int i;\r
-    for (i = 0; i < yyleng; i++)\r
-    {\r
-        if (yytext[i] == '\n')\r
-        {\r
-            line_num ++;\r
-            column_num = 1;\r
-        }\r
-        else\r
-            column_num ++;\r
-    }\r
-}\r
-\r
-/*********************************************\r
- *********************************************/\r
-\r
-static void reset_new_line_flags()\r
-{\r
-    in_description = FALSE;\r
-    in_list_of_hex_num_ranges = FALSE;\r
-    in_node_type = FALSE;\r
-    in_list_of_numbers = FALSE;\r
-    in_list_of_strings = FALSE;\r
-    in_list_of_num_pairs = FALSE;\r
-    in_asterisk_or_list_of_numbers = FALSE;\r
-    in_list_of_num_ranges = FALSE;\r
-    in_single_string = FALSE;\r
-    in_single_number = FALSE;\r
-}\r
-\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_l.l b/branches/opensm_3/user/opensm/osm_qos_parser_l.l
deleted file mode 100644 (file)
index a31c79e..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-%{\r
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Lexer of OSM QoS parser.\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-\r
-#include <opensm/osm_qos_policy.h>\r
-#include "osm_qos_parser_y.h"\r
-\r
-#define HANDLE_IF_IN_DESCRIPTION   if (in_description) { yylval = strdup(yytext); return TK_TEXT; }\r
-\r
-#define SAVE_POS save_pos()\r
-static void save_pos();\r
-\r
-extern int column_num;\r
-extern int line_num;\r
-extern FILE * yyin;\r
-extern YYSTYPE yylval;\r
-\r
-boolean_t in_description = FALSE;\r
-boolean_t in_list_of_hex_num_ranges = FALSE;\r
-boolean_t in_node_type = FALSE;\r
-boolean_t in_list_of_numbers = FALSE;\r
-boolean_t in_list_of_strings = FALSE;\r
-boolean_t in_list_of_num_pairs = FALSE;\r
-boolean_t in_asterisk_or_list_of_numbers = FALSE;\r
-boolean_t in_list_of_num_ranges = FALSE;\r
-boolean_t in_single_string = FALSE;\r
-boolean_t in_single_number = FALSE;\r
-\r
-static void reset_new_line_flags();\r
-#define RESET_NEW_LINE_FLAGS reset_new_line_flags()\r
-\r
-#define START_USE            {in_description = TRUE;}     /* list of strings including whitespace (description) */\r
-#define START_PORT_GUID      {in_list_of_hex_num_ranges = TRUE;} /* comma-separated list of hex num ranges */\r
-#define START_PORT_NAME      {in_list_of_strings = TRUE;} /* comma-separated list of following strings: ../../.. */\r
-#define START_PARTITION      {in_single_string = TRUE;}   /* single string w/o whitespaces (partition name) */\r
-#define START_NAME           {in_single_string = TRUE;}   /* single string w/o whitespaces (port group name) */\r
-#define START_QOS_LEVEL_NAME {in_single_string = TRUE;}   /* single string w/o whitespaces (qos level name in match rule) */\r
-\r
-#define START_NODE_TYPE     {in_node_type = TRUE;}       /* comma-separated list of node types (ROUTER,CA,...) */\r
-#define START_SL2VL_TABLE   {in_list_of_numbers = TRUE;} /* comma-separated list of hex or dec numbers */\r
-\r
-#define START_GROUP         {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS        {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS_TO     {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_ACROSS_FROM   {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_SOURCE        {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-#define START_DESTINATION   {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */\r
-\r
-#define START_VLARB_HIGH    {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */\r
-#define START_VLARB_LOW     {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */\r
-\r
-#define START_TO            {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */\r
-#define START_FROM          {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */\r
-\r
-#define START_PATH_BITS     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_QOS_CLASS     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_SERVICE_ID    {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_PKEY          {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-\r
-#define START_SL               {in_single_number = TRUE;}   /* single number */\r
-#define START_VLARB_HIGH_LIMIT {in_single_number = TRUE;}   /* single number */\r
-#define START_MTU_LIMIT        {in_single_number = TRUE;}   /* single number */\r
-#define START_RATE_LIMIT       {in_single_number = TRUE;}   /* single number */\r
-#define START_PACKET_LIFE      {in_single_number = TRUE;}   /* single number */\r
-\r
-#define START_ULP_DEFAULT       {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_ANY           {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_SDP_DEFAULT   {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_SDP_PORT      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_RDS_DEFAULT   {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_RDS_PORT      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_ISER_DEFAULT  {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_ISER_PORT     {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_SRP_GUID      {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-#define START_ULP_IPOIB_DEFAULT {in_single_number = TRUE;}      /* single number */\r
-#define START_ULP_IPOIB_PKEY    {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */\r
-\r
-\r
-%}\r
-\r
-%option nounput noinput\r
-\r
-QOS_ULPS_START          qos\-ulps\r
-QOS_ULPS_END            end\-qos\-ulps\r
-PORT_GROUPS_START       port\-groups\r
-PORT_GROUPS_END         end\-port\-groups\r
-PORT_GROUP_START        port\-group\r
-PORT_GROUP_END          end\-port\-group\r
-PORT_NUM                port\-num\r
-NAME                    name\r
-USE                     use\r
-PORT_GUID               port\-guid\r
-TARGET_PORT_GUID        target\-port\-guid\r
-PORT_NAME               port\-name\r
-PARTITION               partition\r
-NODE_TYPE               node\-type\r
-QOS_SETUP_START         qos\-setup\r
-QOS_SETUP_END           end\-qos\-setup\r
-VLARB_TABLES_START      vlarb\-tables\r
-VLARB_TABLES_END        end\-vlarb\-tables\r
-VLARB_SCOPE_START       vlarb\-scope\r
-VLARB_SCOPE_END         end\-vlarb\-scope\r
-GROUP                   group\r
-ACROSS                  across\r
-VLARB_HIGH              vlarb\-high\r
-VLARB_LOW               vlarb\-low\r
-VLARB_HIGH_LIMIT        vl\-high\-limit\r
-SL2VL_TABLES_START      sl2vl\-tables\r
-SL2VL_TABLES_END        end\-sl2vl\-tables\r
-SL2VL_SCOPE_START       sl2vl\-scope\r
-SL2VL_SCOPE_END         end\-sl2vl\-scope\r
-TO                      to\r
-FROM                    from\r
-ACROSS_TO               across\-to\r
-ACROSS_FROM             across\-from\r
-SL2VL_TABLE             sl2vl\-table\r
-QOS_LEVELS_START        qos\-levels\r
-QOS_LEVELS_END          end\-qos\-levels\r
-QOS_LEVEL_START         qos\-level\r
-QOS_LEVEL_END           end\-qos\-level\r
-SL                      sl\r
-MTU_LIMIT               mtu\-limit\r
-RATE_LIMIT              rate\-limit\r
-PACKET_LIFE             packet\-life\r
-PATH_BITS               path\-bits\r
-QOS_MATCH_RULES_START   qos\-match\-rules\r
-QOS_MATCH_RULES_END     end\-qos\-match\-rules\r
-QOS_MATCH_RULE_START    qos\-match\-rule\r
-QOS_MATCH_RULE_END      end\-qos\-match\-rule\r
-QOS_CLASS               qos\-class\r
-SOURCE                  source\r
-DESTINATION             destination\r
-SERVICE_ID              service\-id\r
-PKEY                    pkey\r
-QOS_LEVEL_NAME          qos\-level\-name\r
-\r
-ROUTER                  [Rr][Oo][Uu][Tt][Ee][Rr]\r
-CA                      [Cc][Aa]\r
-SWITCH                  [Ss][Ww][Ii][Tt][Cc][Hh]\r
-SELF                    [Ss][Ee][Ll][Ff]\r
-ALL                     [Aa][Ll][Ll]\r
-\r
-ULP_SDP                 [Ss][Dd][Pp]\r
-ULP_SRP                 [Ss][Rr][Pp]\r
-ULP_RDS                 [Rr][Dd][Ss]\r
-ULP_IPOIB               [Ii][Pp][Oo][Ii][Bb]\r
-ULP_ISER                [Ii][Ss][Ee][Rr]\r
-ULP_ANY                 [Aa][Nn][Yy]\r
-ULP_DEFAULT             [Dd][Ee][Ff][Aa][Uu][Ll][Tt]\r
-\r
-WHITE                   [ \t]+\r
-NEW_LINE                \n\r
-COMMENT                            \#.*\n\r
-WHITE_DOTDOT_WHITE      [ \t]*:[ \t]*\r
-WHITE_COMMA_WHITE       [ \t]*,[ \t]*\r
-QUOTED_TEXT             \"[^\"]*\"\r
-\r
-%%\r
-\r
-\r
-{COMMENT}               { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* swallow comment */\r
-{WHITE}{NEW_LINE}       { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* trailing blanks with new line */\r
-{WHITE}                 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; }\r
-{NEW_LINE}              { SAVE_POS; RESET_NEW_LINE_FLAGS; }\r
-\r
-{QOS_ULPS_START}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_START; }\r
-{QOS_ULPS_END}          { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_END; }\r
-\r
-{PORT_GROUPS_START}     { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_START; }\r
-{PORT_GROUPS_END}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_END; }\r
-{PORT_GROUP_START}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_START; }\r
-{PORT_GROUP_END}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_END; }\r
-\r
-{QOS_SETUP_START}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_START; }\r
-{QOS_SETUP_END}         { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_END; }\r
-{VLARB_TABLES_START}    { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_START; }\r
-{VLARB_TABLES_END}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_END; }\r
-{VLARB_SCOPE_START}     { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_START; }\r
-{VLARB_SCOPE_END}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_END; }\r
-\r
-{SL2VL_TABLES_START}    { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_START; }\r
-{SL2VL_TABLES_END}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_END; }\r
-{SL2VL_SCOPE_START}     { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_START; }\r
-{SL2VL_SCOPE_END}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_END; }\r
-\r
-{QOS_LEVELS_START}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_START; }\r
-{QOS_LEVELS_END}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_END; }\r
-{QOS_LEVEL_START}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_START; }\r
-{QOS_LEVEL_END}         { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_END; }\r
-\r
-{QOS_MATCH_RULES_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_START; }\r
-{QOS_MATCH_RULES_END}   { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_END; }\r
-{QOS_MATCH_RULE_START}  { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_START; }\r
-{QOS_MATCH_RULE_END}    { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_END; }\r
-\r
-{PORT_GUID}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_GUID;    return TK_PORT_GUID;  }\r
-{PORT_NAME}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_NAME;    return TK_PORT_NAME;  }\r
-{PARTITION}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PARTITION;    return TK_PARTITION;  }\r
-{NODE_TYPE}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NODE_TYPE;    return TK_NODE_TYPE;  }\r
-{NAME}{WHITE_DOTDOT_WHITE}             { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NAME;         return TK_NAME;       }\r
-{USE}{WHITE_DOTDOT_WHITE}              { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_USE;          return TK_USE;        }\r
-{GROUP}{WHITE_DOTDOT_WHITE}            { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_GROUP;        return TK_GROUP;      }\r
-{VLARB_HIGH}{WHITE_DOTDOT_WHITE}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH;   return TK_VLARB_HIGH; }\r
-{VLARB_LOW}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_LOW;    return TK_VLARB_LOW;  }\r
-{VLARB_HIGH_LIMIT}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH_LIMIT; return TK_VLARB_HIGH_LIMIT;}\r
-{TO}{WHITE_DOTDOT_WHITE}               { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_TO;           return TK_TO;         }\r
-{FROM}{WHITE_DOTDOT_WHITE}             { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_FROM;         return TK_FROM;       }\r
-{ACROSS_TO}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_TO;    return TK_ACROSS_TO;  }\r
-{ACROSS_FROM}{WHITE_DOTDOT_WHITE}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_FROM;  return TK_ACROSS_FROM;}\r
-{ACROSS}{WHITE_DOTDOT_WHITE}           { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS;       return TK_ACROSS;     }\r
-{SL2VL_TABLE}{WHITE_DOTDOT_WHITE}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL2VL_TABLE;  return TK_SL2VL_TABLE;}\r
-{SL}{WHITE_DOTDOT_WHITE}               { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL;           return TK_SL;         }\r
-{MTU_LIMIT}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_MTU_LIMIT;    return TK_MTU_LIMIT;  }\r
-{RATE_LIMIT}{WHITE_DOTDOT_WHITE}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_RATE_LIMIT;   return TK_RATE_LIMIT; }\r
-{PACKET_LIFE}{WHITE_DOTDOT_WHITE}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PACKET_LIFE;  return TK_PACKET_LIFE;}\r
-{PATH_BITS}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PATH_BITS;    return TK_PATH_BITS;  }\r
-{QOS_CLASS}{WHITE_DOTDOT_WHITE}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_CLASS;    return TK_QOS_CLASS;  }\r
-{SOURCE}{WHITE_DOTDOT_WHITE}           { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SOURCE;       return TK_SOURCE;     }\r
-{DESTINATION}{WHITE_DOTDOT_WHITE}      { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_DESTINATION;  return TK_DESTINATION;}\r
-{SERVICE_ID}{WHITE_DOTDOT_WHITE}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SERVICE_ID;   return TK_SERVICE_ID; }\r
-{PKEY}{WHITE_DOTDOT_WHITE}             { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PKEY;         return TK_PKEY;       }\r
-{QOS_LEVEL_NAME}{WHITE_DOTDOT_WHITE}   { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_LEVEL_NAME; return TK_QOS_LEVEL_NAME;}\r
-\r
-{ROUTER}                  { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ROUTER; yylval = strdup(yytext); return TK_TEXT; }\r
-{CA}                      { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_CA;     yylval = strdup(yytext); return TK_TEXT; }\r
-{SWITCH}                  { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SWITCH; yylval = strdup(yytext); return TK_TEXT; }\r
-{SELF}                    { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SELF;   yylval = strdup(yytext); return TK_TEXT; }\r
-{ALL}                     { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ALL;    yylval = strdup(yytext); return TK_TEXT; }\r
-\r
-{ULP_DEFAULT}{WHITE_DOTDOT_WHITE}              { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_DEFAULT; return TK_ULP_DEFAULT; }\r
-{ULP_ANY}{WHITE_COMMA_WHITE}{SERVICE_ID}       { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SERVICE_ID; }\r
-{ULP_ANY}{WHITE_COMMA_WHITE}{PKEY}             { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_PKEY; }\r
-{ULP_ANY}{WHITE_COMMA_WHITE}{TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_TARGET_PORT_GUID; }\r
-\r
-{ULP_SDP}{WHITE_DOTDOT_WHITE}                  { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; }\r
-{ULP_SDP}{WHITE_COMMA_WHITE}{PORT_NUM}         { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; }\r
-\r
-{ULP_RDS}{WHITE_DOTDOT_WHITE}                  { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_DEFAULT; return TK_ULP_RDS_DEFAULT; }\r
-{ULP_RDS}{WHITE_COMMA_WHITE}{PORT_NUM}         { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_PORT; return TK_ULP_RDS_PORT; }\r
-\r
-{ULP_ISER}{WHITE_DOTDOT_WHITE}                 { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_ISER_DEFAULT; }\r
-{ULP_ISER}{WHITE_COMMA_WHITE}{PORT_NUM}        { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_ISER_PORT; }\r
-\r
-{ULP_SRP}{WHITE_COMMA_WHITE}{TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SRP_GUID; return TK_ULP_SRP_GUID; }\r
-\r
-{ULP_IPOIB}{WHITE_DOTDOT_WHITE}                { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_DEFAULT; return TK_ULP_IPOIB_DEFAULT; }\r
-{ULP_IPOIB}{WHITE_COMMA_WHITE}{PKEY}           { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_PKEY; return TK_ULP_IPOIB_PKEY; }\r
-\r
-0[xX][0-9a-fA-F]+  {\r
-                        SAVE_POS;\r
-                        yylval = strdup(yytext);\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                            return TK_TEXT;\r
-                        return TK_NUMBER;\r
-                    }\r
-\r
-[0-9]+              {\r
-                        SAVE_POS;\r
-                        yylval = strdup(yytext);\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                            return TK_TEXT;\r
-                        return TK_NUMBER;\r
-                    }\r
-\r
-\r
--                   {\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_DASH;\r
-                    }\r
-\r
-:                   {\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_DOTDOT;\r
-                    }\r
-\r
-,                   {\r
-                        SAVE_POS;\r
-                        if (in_description)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_COMMA;\r
-                    }\r
-\r
-\*                  {\r
-                        SAVE_POS;\r
-                        if (in_description || in_list_of_strings || in_single_string)\r
-                        {\r
-                            yylval = strdup(yytext);\r
-                            return TK_TEXT;\r
-                        }\r
-                        return TK_ASTERISK;\r
-                    }\r
-\r
-{QUOTED_TEXT}       {\r
-                        SAVE_POS;\r
-                        yylval = strdup(&yytext[1]);\r
-                        yylval[strlen(yylval)-1] = '\0';\r
-                        return TK_TEXT;\r
-                    }\r
-\r
-.                   { SAVE_POS; yylval = strdup(yytext); return TK_TEXT;}\r
-\r
-%%\r
-\r
-\r
-/*********************************************\r
- *********************************************/\r
-\r
-static void save_pos()\r
-{\r
-    int i;\r
-    for (i = 0; i < yyleng; i++)\r
-    {\r
-        if (yytext[i] == '\n')\r
-        {\r
-            line_num ++;\r
-            column_num = 1;\r
-        }\r
-        else\r
-            column_num ++;\r
-    }\r
-}\r
-\r
-/*********************************************\r
- *********************************************/\r
-\r
-static void reset_new_line_flags()\r
-{\r
-    in_description = FALSE;\r
-    in_list_of_hex_num_ranges = FALSE;\r
-    in_node_type = FALSE;\r
-    in_list_of_numbers = FALSE;\r
-    in_list_of_strings = FALSE;\r
-    in_list_of_num_pairs = FALSE;\r
-    in_asterisk_or_list_of_numbers = FALSE;\r
-    in_list_of_num_ranges = FALSE;\r
-    in_single_string = FALSE;\r
-    in_single_number = FALSE;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_y.c b/branches/opensm_3/user/opensm/osm_qos_parser_y.c
deleted file mode 100644 (file)
index 68c3255..0000000
+++ /dev/null
@@ -1,5181 +0,0 @@
-\r
-/* A Bison parser, made by GNU Bison 2.4.1.  */\r
-\r
-/* Skeleton implementation for Bison's Yacc-like parsers in C\r
-   \r
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006\r
-   Free Software Foundation, Inc.\r
-   \r
-   This program is free software: you can redistribute it and/or modify\r
-   it under the terms of the GNU General Public License as published by\r
-   the Free Software Foundation, either version 3 of the License, or\r
-   (at your option) any later version.\r
-   \r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-   \r
-   You should have received a copy of the GNU General Public License\r
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
-\r
-/* As a special exception, you may create a larger work that contains\r
-   part or all of the Bison parser skeleton and distribute that work\r
-   under terms of your choice, so long as that work isn't itself a\r
-   parser generator using the skeleton or a modified version thereof\r
-   as a parser skeleton.  Alternatively, if you modify or redistribute\r
-   the parser skeleton itself, you may (at your option) remove this\r
-   special exception, which will cause the skeleton and the resulting\r
-   Bison output files to be licensed under the GNU General Public\r
-   License without this special exception.\r
-   \r
-   This special exception was added by the Free Software Foundation in\r
-   version 2.2 of Bison.  */\r
-\r
-/* C LALR(1) parser skeleton written by Richard Stallman, by\r
-   simplifying the original so-called "semantic" parser.  */\r
-\r
-/* All symbols defined below should begin with yy or YY, to avoid\r
-   infringing on user name space.  This should be done even for local\r
-   variables, as they might otherwise be expanded by user macros.\r
-   There are some unavoidable exceptions within include files to\r
-   define necessary library symbols; they are noted "INFRINGES ON\r
-   USER NAME SPACE" below.  */\r
-\r
-/* Identify Bison output.  */\r
-#define YYBISON 1\r
-\r
-/* Bison version.  */\r
-#define YYBISON_VERSION "2.4.1"\r
-\r
-/* Skeleton name.  */\r
-#define YYSKELETON_NAME "yacc.c"\r
-\r
-/* Pure parsers.  */\r
-#define YYPURE 0\r
-\r
-/* Push parsers.  */\r
-#define YYPUSH 0\r
-\r
-/* Pull parsers.  */\r
-#define YYPULL 1\r
-\r
-/* Using locations.  */\r
-#define YYLSP_NEEDED 0\r
-\r
-\r
-\r
-/* Copy the first part of user declarations.  */\r
-\r
-/* Line 189 of yacc.c  */\r
-#line 1 "osm_qos_parser_y.y"\r
-\r
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Grammar of OSM QoS parser.\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-\r
-#ifdef __WIN__\r
-#include <stddef.h>\r
-#endif\r
-#include <stdio.h>\r
-#include <assert.h>\r
-#include <stdarg.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_qos_policy.h>\r
-#ifdef __WIN__\r
-#define malloc\r
-#define free\r
-#define fopen Fopen\r
-#endif\r
-\r
-#define OSM_QOS_POLICY_MAX_LINE_LEN         1024*10\r
-#define OSM_QOS_POLICY_SL2VL_TABLE_LEN      IB_MAX_NUM_VLS\r
-#define OSM_QOS_POLICY_MAX_VL_NUM           IB_MAX_NUM_VLS\r
-\r
-typedef struct tmp_parser_struct_t_ {\r
-    char       str[OSM_QOS_POLICY_MAX_LINE_LEN];\r
-    uint64_t   num_pair[2];\r
-    cl_list_t  str_list;\r
-    cl_list_t  num_list;\r
-    cl_list_t  num_pair_list;\r
-} tmp_parser_struct_t;\r
-\r
-static void __parser_tmp_struct_init();\r
-static void __parser_tmp_struct_reset();\r
-static void __parser_tmp_struct_destroy();\r
-\r
-static char * __parser_strip_white(char * str);\r
-\r
-static void __parser_str2uint64(uint64_t * p_val, char * str);\r
-\r
-static void __parser_port_group_start();\r
-static int __parser_port_group_end();\r
-\r
-static void __parser_sl2vl_scope_start();\r
-static int __parser_sl2vl_scope_end();\r
-\r
-static void __parser_vlarb_scope_start();\r
-static int __parser_vlarb_scope_end();\r
-\r
-static void __parser_qos_level_start();\r
-static int __parser_qos_level_end();\r
-\r
-static void __parser_match_rule_start();\r
-static int __parser_match_rule_end();\r
-\r
-static void __parser_ulp_match_rule_start();\r
-static int __parser_ulp_match_rule_end();\r
-\r
-static void __pkey_rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len);\r
-\r
-static void __rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len);\r
-\r
-static void __merge_rangearr(\r
-    uint64_t  **   range_arr_1,\r
-    unsigned       range_len_1,\r
-    uint64_t  **   range_arr_2,\r
-    unsigned       range_len_2,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len );\r
-\r
-static void __parser_add_port_to_port_map(\r
-    cl_qmap_t   * p_map,\r
-    osm_physp_t * p_physp);\r
-\r
-static void __parser_add_guid_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len);\r
-\r
-static void __parser_add_pkey_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len);\r
-\r
-static void __parser_add_partition_list_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    cl_list_t  * p_list);\r
-\r
-static void __parser_add_map_to_port_map(\r
-    cl_qmap_t * p_dmap,\r
-    cl_map_t  * p_smap);\r
-\r
-static int __validate_pkeys(\r
-    uint64_t ** range_arr,\r
-    unsigned    range_len,\r
-    boolean_t   is_ipoib);\r
-\r
-static void __setup_simple_qos_levels();\r
-static void __clear_simple_qos_levels();\r
-static void __setup_ulp_match_rules();\r
-static void __process_ulp_match_rules();\r
-static void yyerror(const char *format, ...);\r
-\r
-extern char * yytext;\r
-extern int yylex (void);\r
-extern FILE * yyin;\r
-#ifndef __WIN__\r
-extern int errno;\r
-#endif\r
-int yyparse();\r
-\r
-#define RESET_BUFFER  __parser_tmp_struct_reset()\r
-\r
-tmp_parser_struct_t tmp_parser_struct;\r
-\r
-int column_num;\r
-int line_num;\r
-\r
-osm_qos_policy_t       * p_qos_policy = NULL;\r
-osm_qos_port_group_t   * p_current_port_group = NULL;\r
-osm_qos_sl2vl_scope_t  * p_current_sl2vl_scope = NULL;\r
-osm_qos_vlarb_scope_t  * p_current_vlarb_scope = NULL;\r
-osm_qos_level_t        * p_current_qos_level = NULL;\r
-osm_qos_match_rule_t   * p_current_qos_match_rule = NULL;\r
-osm_log_t              * p_qos_parser_osm_log;\r
-\r
-/* 16 Simple QoS Levels - one for each SL */\r
-static osm_qos_level_t osm_qos_policy_simple_qos_levels[16];\r
-\r
-/* Default Simple QoS Level */\r
-osm_qos_level_t __default_simple_qos_level;\r
-\r
-/*\r
- * List of match rules that will be generated by the\r
- * qos-ulp section. These rules are concatenated to\r
- * the end of the usual matching rules list at the\r
- * end of parsing.\r
- */\r
-static cl_list_t __ulp_match_rules;\r
-\r
-/***************************************************/\r
-\r
-\r
-\r
-/* Line 189 of yacc.c  */\r
-#line 260 "osm_qos_parser_y.c"\r
-\r
-/* Enabling traces.  */\r
-#ifndef YYDEBUG\r
-# define YYDEBUG 0\r
-#endif\r
-\r
-/* Enabling verbose error messages.  */\r
-#ifdef YYERROR_VERBOSE\r
-# undef YYERROR_VERBOSE\r
-# define YYERROR_VERBOSE 1\r
-#else\r
-# define YYERROR_VERBOSE 0\r
-#endif\r
-\r
-/* Enabling the token table.  */\r
-#ifndef YYTOKEN_TABLE\r
-# define YYTOKEN_TABLE 0\r
-#endif\r
-\r
-\r
-/* Tokens.  */\r
-#ifndef YYTOKENTYPE\r
-# define YYTOKENTYPE\r
-   /* Put the tokens into the symbol table, so that GDB and other debuggers\r
-      know about them.  */\r
-   enum yytokentype {\r
-     TK_NUMBER = 258,\r
-     TK_DASH = 259,\r
-     TK_DOTDOT = 260,\r
-     TK_COMMA = 261,\r
-     TK_ASTERISK = 262,\r
-     TK_TEXT = 263,\r
-     TK_QOS_ULPS_START = 264,\r
-     TK_QOS_ULPS_END = 265,\r
-     TK_PORT_GROUPS_START = 266,\r
-     TK_PORT_GROUPS_END = 267,\r
-     TK_PORT_GROUP_START = 268,\r
-     TK_PORT_GROUP_END = 269,\r
-     TK_QOS_SETUP_START = 270,\r
-     TK_QOS_SETUP_END = 271,\r
-     TK_VLARB_TABLES_START = 272,\r
-     TK_VLARB_TABLES_END = 273,\r
-     TK_VLARB_SCOPE_START = 274,\r
-     TK_VLARB_SCOPE_END = 275,\r
-     TK_SL2VL_TABLES_START = 276,\r
-     TK_SL2VL_TABLES_END = 277,\r
-     TK_SL2VL_SCOPE_START = 278,\r
-     TK_SL2VL_SCOPE_END = 279,\r
-     TK_QOS_LEVELS_START = 280,\r
-     TK_QOS_LEVELS_END = 281,\r
-     TK_QOS_LEVEL_START = 282,\r
-     TK_QOS_LEVEL_END = 283,\r
-     TK_QOS_MATCH_RULES_START = 284,\r
-     TK_QOS_MATCH_RULES_END = 285,\r
-     TK_QOS_MATCH_RULE_START = 286,\r
-     TK_QOS_MATCH_RULE_END = 287,\r
-     TK_NAME = 288,\r
-     TK_USE = 289,\r
-     TK_PORT_GUID = 290,\r
-     TK_PORT_NAME = 291,\r
-     TK_PARTITION = 292,\r
-     TK_NODE_TYPE = 293,\r
-     TK_GROUP = 294,\r
-     TK_ACROSS = 295,\r
-     TK_VLARB_HIGH = 296,\r
-     TK_VLARB_LOW = 297,\r
-     TK_VLARB_HIGH_LIMIT = 298,\r
-     TK_TO = 299,\r
-     TK_FROM = 300,\r
-     TK_ACROSS_TO = 301,\r
-     TK_ACROSS_FROM = 302,\r
-     TK_SL2VL_TABLE = 303,\r
-     TK_SL = 304,\r
-     TK_MTU_LIMIT = 305,\r
-     TK_RATE_LIMIT = 306,\r
-     TK_PACKET_LIFE = 307,\r
-     TK_PATH_BITS = 308,\r
-     TK_QOS_CLASS = 309,\r
-     TK_SOURCE = 310,\r
-     TK_DESTINATION = 311,\r
-     TK_SERVICE_ID = 312,\r
-     TK_QOS_LEVEL_NAME = 313,\r
-     TK_PKEY = 314,\r
-     TK_NODE_TYPE_ROUTER = 315,\r
-     TK_NODE_TYPE_CA = 316,\r
-     TK_NODE_TYPE_SWITCH = 317,\r
-     TK_NODE_TYPE_SELF = 318,\r
-     TK_NODE_TYPE_ALL = 319,\r
-     TK_ULP_DEFAULT = 320,\r
-     TK_ULP_ANY_SERVICE_ID = 321,\r
-     TK_ULP_ANY_PKEY = 322,\r
-     TK_ULP_ANY_TARGET_PORT_GUID = 323,\r
-     TK_ULP_SDP_DEFAULT = 324,\r
-     TK_ULP_SDP_PORT = 325,\r
-     TK_ULP_RDS_DEFAULT = 326,\r
-     TK_ULP_RDS_PORT = 327,\r
-     TK_ULP_ISER_DEFAULT = 328,\r
-     TK_ULP_ISER_PORT = 329,\r
-     TK_ULP_SRP_GUID = 330,\r
-     TK_ULP_IPOIB_DEFAULT = 331,\r
-     TK_ULP_IPOIB_PKEY = 332\r
-   };\r
-#endif\r
-/* Tokens.  */\r
-#define TK_NUMBER 258\r
-#define TK_DASH 259\r
-#define TK_DOTDOT 260\r
-#define TK_COMMA 261\r
-#define TK_ASTERISK 262\r
-#define TK_TEXT 263\r
-#define TK_QOS_ULPS_START 264\r
-#define TK_QOS_ULPS_END 265\r
-#define TK_PORT_GROUPS_START 266\r
-#define TK_PORT_GROUPS_END 267\r
-#define TK_PORT_GROUP_START 268\r
-#define TK_PORT_GROUP_END 269\r
-#define TK_QOS_SETUP_START 270\r
-#define TK_QOS_SETUP_END 271\r
-#define TK_VLARB_TABLES_START 272\r
-#define TK_VLARB_TABLES_END 273\r
-#define TK_VLARB_SCOPE_START 274\r
-#define TK_VLARB_SCOPE_END 275\r
-#define TK_SL2VL_TABLES_START 276\r
-#define TK_SL2VL_TABLES_END 277\r
-#define TK_SL2VL_SCOPE_START 278\r
-#define TK_SL2VL_SCOPE_END 279\r
-#define TK_QOS_LEVELS_START 280\r
-#define TK_QOS_LEVELS_END 281\r
-#define TK_QOS_LEVEL_START 282\r
-#define TK_QOS_LEVEL_END 283\r
-#define TK_QOS_MATCH_RULES_START 284\r
-#define TK_QOS_MATCH_RULES_END 285\r
-#define TK_QOS_MATCH_RULE_START 286\r
-#define TK_QOS_MATCH_RULE_END 287\r
-#define TK_NAME 288\r
-#define TK_USE 289\r
-#define TK_PORT_GUID 290\r
-#define TK_PORT_NAME 291\r
-#define TK_PARTITION 292\r
-#define TK_NODE_TYPE 293\r
-#define TK_GROUP 294\r
-#define TK_ACROSS 295\r
-#define TK_VLARB_HIGH 296\r
-#define TK_VLARB_LOW 297\r
-#define TK_VLARB_HIGH_LIMIT 298\r
-#define TK_TO 299\r
-#define TK_FROM 300\r
-#define TK_ACROSS_TO 301\r
-#define TK_ACROSS_FROM 302\r
-#define TK_SL2VL_TABLE 303\r
-#define TK_SL 304\r
-#define TK_MTU_LIMIT 305\r
-#define TK_RATE_LIMIT 306\r
-#define TK_PACKET_LIFE 307\r
-#define TK_PATH_BITS 308\r
-#define TK_QOS_CLASS 309\r
-#define TK_SOURCE 310\r
-#define TK_DESTINATION 311\r
-#define TK_SERVICE_ID 312\r
-#define TK_QOS_LEVEL_NAME 313\r
-#define TK_PKEY 314\r
-#define TK_NODE_TYPE_ROUTER 315\r
-#define TK_NODE_TYPE_CA 316\r
-#define TK_NODE_TYPE_SWITCH 317\r
-#define TK_NODE_TYPE_SELF 318\r
-#define TK_NODE_TYPE_ALL 319\r
-#define TK_ULP_DEFAULT 320\r
-#define TK_ULP_ANY_SERVICE_ID 321\r
-#define TK_ULP_ANY_PKEY 322\r
-#define TK_ULP_ANY_TARGET_PORT_GUID 323\r
-#define TK_ULP_SDP_DEFAULT 324\r
-#define TK_ULP_SDP_PORT 325\r
-#define TK_ULP_RDS_DEFAULT 326\r
-#define TK_ULP_RDS_PORT 327\r
-#define TK_ULP_ISER_DEFAULT 328\r
-#define TK_ULP_ISER_PORT 329\r
-#define TK_ULP_SRP_GUID 330\r
-#define TK_ULP_IPOIB_DEFAULT 331\r
-#define TK_ULP_IPOIB_PKEY 332\r
-\r
-\r
-\r
-\r
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED\r
-typedef int YYSTYPE;\r
-# define YYSTYPE_IS_TRIVIAL 1\r
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */\r
-# define YYSTYPE_IS_DECLARED 1\r
-#endif\r
-\r
-\r
-/* Copy the second part of user declarations.  */\r
-\r
-\r
-/* Line 264 of yacc.c  */\r
-#line 456 "osm_qos_parser_y.c"\r
-\r
-#ifdef short\r
-# undef short\r
-#endif\r
-\r
-#ifdef YYTYPE_UINT8\r
-typedef YYTYPE_UINT8 yytype_uint8;\r
-#else\r
-typedef unsigned char yytype_uint8;\r
-#endif\r
-\r
-#ifdef YYTYPE_INT8\r
-typedef YYTYPE_INT8 yytype_int8;\r
-#elif (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-typedef signed char yytype_int8;\r
-#else\r
-typedef short int yytype_int8;\r
-#endif\r
-\r
-#ifdef YYTYPE_UINT16\r
-typedef YYTYPE_UINT16 yytype_uint16;\r
-#else\r
-typedef unsigned short int yytype_uint16;\r
-#endif\r
-\r
-#ifdef YYTYPE_INT16\r
-typedef YYTYPE_INT16 yytype_int16;\r
-#else\r
-typedef short int yytype_int16;\r
-#endif\r
-\r
-#ifndef YYSIZE_T\r
-# ifdef __SIZE_TYPE__\r
-#  define YYSIZE_T __SIZE_TYPE__\r
-# elif defined size_t\r
-#  define YYSIZE_T size_t\r
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */\r
-#  define YYSIZE_T size_t\r
-# else\r
-#  define YYSIZE_T unsigned int\r
-# endif\r
-#endif\r
-\r
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)\r
-\r
-#ifndef YY_\r
-# if YYENABLE_NLS\r
-#  if ENABLE_NLS\r
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */\r
-#   define YY_(msgid) dgettext ("bison-runtime", msgid)\r
-#  endif\r
-# endif\r
-# ifndef YY_\r
-#  define YY_(msgid) msgid\r
-# endif\r
-#endif\r
-\r
-/* Suppress unused-variable warnings by "using" E.  */\r
-#if ! defined lint || defined __GNUC__\r
-# define YYUSE(e) ((void) (e))\r
-#else\r
-# define YYUSE(e) /* empty */\r
-#endif\r
-\r
-/* Identity function, used to suppress warnings about constant conditions.  */\r
-#ifndef lint\r
-# define YYID(n) (n)\r
-#else\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static int\r
-YYID (int yyi)\r
-#else\r
-static int\r
-YYID (yyi)\r
-    int yyi;\r
-#endif\r
-{\r
-  return yyi;\r
-}\r
-#endif\r
-\r
-#if ! defined yyoverflow || YYERROR_VERBOSE\r
-\r
-/* The parser invokes alloca or malloc; define the necessary symbols.  */\r
-\r
-# ifdef YYSTACK_USE_ALLOCA\r
-#  if YYSTACK_USE_ALLOCA\r
-#   ifdef __GNUC__\r
-#    define YYSTACK_ALLOC __builtin_alloca\r
-#   elif defined __BUILTIN_VA_ARG_INCR\r
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */\r
-#   elif defined _AIX\r
-#    define YYSTACK_ALLOC __alloca\r
-#   elif defined _MSC_VER\r
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */\r
-#    define alloca _alloca\r
-#   else\r
-#    define YYSTACK_ALLOC alloca\r
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\r
-#     ifndef _STDLIB_H\r
-#      define _STDLIB_H 1\r
-#     endif\r
-#    endif\r
-#   endif\r
-#  endif\r
-# endif\r
-\r
-# ifdef YYSTACK_ALLOC\r
-   /* Pacify GCC's `empty if-body' warning.  */\r
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))\r
-#  ifndef YYSTACK_ALLOC_MAXIMUM\r
-    /* The OS might guarantee only one guard page at the bottom of the stack,\r
-       and a page size can be as small as 4096 bytes.  So we cannot safely\r
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number\r
-       to allow for a few compiler-allocated temporary stack slots.  */\r
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */\r
-#  endif\r
-# else\r
-#  define YYSTACK_ALLOC YYMALLOC\r
-#  define YYSTACK_FREE YYFREE\r
-#  ifndef YYSTACK_ALLOC_MAXIMUM\r
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM\r
-#  endif\r
-#  if (defined __cplusplus && ! defined _STDLIB_H \\r
-       && ! ((defined YYMALLOC || defined malloc) \\r
-            && (defined YYFREE || defined free)))\r
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */\r
-#   ifndef _STDLIB_H\r
-#    define _STDLIB_H 1\r
-#   endif\r
-#  endif\r
-#  ifndef YYMALLOC\r
-#   define YYMALLOC malloc\r
-#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */\r
-#   endif\r
-#  endif\r
-#  ifndef YYFREE\r
-#   define YYFREE free\r
-#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-void free (void *); /* INFRINGES ON USER NAME SPACE */\r
-#   endif\r
-#  endif\r
-# endif\r
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */\r
-\r
-\r
-#if (! defined yyoverflow \\r
-     && (! defined __cplusplus \\r
-        || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))\r
-\r
-/* A type that is properly aligned for any stack member.  */\r
-union yyalloc\r
-{\r
-  yytype_int16 yyss_alloc;\r
-  YYSTYPE yyvs_alloc;\r
-};\r
-\r
-/* The size of the maximum gap between one aligned stack and the next.  */\r
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)\r
-\r
-/* The size of an array large to enough to hold all stacks, each with\r
-   N elements.  */\r
-# define YYSTACK_BYTES(N) \\r
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \\r
-      + YYSTACK_GAP_MAXIMUM)\r
-\r
-/* Copy COUNT objects from FROM to TO.  The source and destination do\r
-   not overlap.  */\r
-# ifndef YYCOPY\r
-#  if defined __GNUC__ && 1 < __GNUC__\r
-#   define YYCOPY(To, From, Count) \\r
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))\r
-#  else\r
-#   define YYCOPY(To, From, Count)             \\r
-      do                                       \\r
-       {                                       \\r
-         YYSIZE_T yyi;                         \\r
-         for (yyi = 0; yyi < (Count); yyi++)   \\r
-           (To)[yyi] = (From)[yyi];            \\r
-       }                                       \\r
-      while (YYID (0))\r
-#  endif\r
-# endif\r
-\r
-/* Relocate STACK from its old location to the new one.  The\r
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of\r
-   elements in the stack, and YYPTR gives the new location of the\r
-   stack.  Advance YYPTR to a properly aligned location for the next\r
-   stack.  */\r
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \\r
-    do                                                                 \\r
-      {                                                                        \\r
-       YYSIZE_T yynewbytes;                                            \\r
-       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \\r
-       Stack = &yyptr->Stack_alloc;                                    \\r
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \\r
-       yyptr += yynewbytes / sizeof (*yyptr);                          \\r
-      }                                                                        \\r
-    while (YYID (0))\r
-\r
-#endif\r
-\r
-/* YYFINAL -- State number of the termination state.  */\r
-#define YYFINAL  3\r
-/* YYLAST -- Last index in YYTABLE.  */\r
-#define YYLAST   262\r
-\r
-/* YYNTOKENS -- Number of terminals.  */\r
-#define YYNTOKENS  78\r
-/* YYNNTS -- Number of nonterminals.  */\r
-#define YYNNTS  165\r
-/* YYNRULES -- Number of rules.  */\r
-#define YYNRULES  238\r
-/* YYNRULES -- Number of states.  */\r
-#define YYNSTATES  328\r
-\r
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */\r
-#define YYUNDEFTOK  2\r
-#define YYMAXUTOK   332\r
-\r
-#define YYTRANSLATE(YYX)                                               \\r
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)\r
-\r
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */\r
-static const yytype_uint8 yytranslate[] =\r
-{\r
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,\r
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,\r
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,\r
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,\r
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,\r
-      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,\r
-      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,\r
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,\r
-      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,\r
-      75,    76,    77\r
-};\r
-\r
-#if YYDEBUG\r
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in\r
-   YYRHS.  */\r
-static const yytype_uint16 yyprhs[] =\r
-{\r
-       0,     0,     3,     5,     6,     9,    11,    13,    15,    17,\r
-      19,    23,    25,    28,    32,    34,    37,    41,    43,    45,\r
-      46,    49,    51,    53,    55,    57,    59,    61,    63,    67,\r
-      68,    71,    74,    78,    79,    82,    86,    88,    90,    91,\r
-      94,    96,    98,   100,   102,   104,   108,   109,   112,   116,\r
-     118,   120,   121,   124,   126,   128,   130,   132,   134,   136,\r
-     138,   142,   143,   146,   150,   152,   154,   155,   158,   160,\r
-     162,   164,   166,   168,   170,   172,   174,   178,   179,   182,\r
-     186,   188,   190,   191,   194,   196,   198,   200,   202,   204,\r
-     206,   208,   211,   212,   218,   219,   225,   226,   232,   233,\r
-     237,   238,   244,   245,   249,   250,   256,   257,   261,   262,\r
-     268,   269,   275,   276,   280,   281,   287,   289,   291,   293,\r
-     295,   297,   299,   301,   303,   305,   307,   309,   311,   313,\r
-     316,   318,   321,   323,   326,   328,   331,   333,   336,   338,\r
-     341,   343,   346,   348,   350,   354,   356,   358,   360,   362,\r
-     364,   366,   368,   370,   372,   374,   377,   379,   382,   384,\r
-     387,   389,   392,   394,   397,   399,   402,   404,   407,   409,\r
-     412,   414,   417,   419,   422,   424,   427,   429,   431,   433,\r
-     435,   437,   439,   441,   443,   445,   448,   450,   453,   455,\r
-     458,   460,   463,   465,   468,   470,   473,   475,   478,   480,\r
-     483,   485,   488,   490,   493,   495,   498,   500,   503,   505,\r
-     508,   510,   513,   515,   518,   520,   523,   525,   527,   529,\r
-     532,   534,   536,   540,   542,   544,   548,   550,   554,   560,\r
-     562,   564,   566,   568,   572,   578,   582,   584,   586\r
-};\r
-\r
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */\r
-static const yytype_int16 yyrhs[] =\r
-{\r
-      79,     0,    -1,    80,    -1,    -1,    80,    81,    -1,    82,\r
-      -1,    84,    -1,    91,    -1,   107,    -1,   114,    -1,     9,\r
-      83,    10,    -1,   121,    -1,    83,   121,    -1,    11,    85,\r
-      12,    -1,    86,    -1,    85,    86,    -1,    87,    89,    88,\r
-      -1,    13,    -1,    14,    -1,    -1,    89,    90,    -1,   147,\r
-      -1,   149,    -1,   153,    -1,   151,    -1,   155,    -1,   157,\r
-      -1,   159,    -1,    15,    92,    16,    -1,    -1,    92,    93,\r
-      -1,    92,   100,    -1,    17,    94,    18,    -1,    -1,    94,\r
-      95,    -1,    96,    98,    97,    -1,    19,    -1,    20,    -1,\r
-      -1,    98,    99,    -1,   168,    -1,   170,    -1,   174,    -1,\r
-     176,    -1,   172,    -1,    21,   101,    22,    -1,    -1,   101,\r
-     102,    -1,   103,   105,   104,    -1,    23,    -1,    24,    -1,\r
-      -1,   105,   106,    -1,   178,    -1,   180,    -1,   182,    -1,\r
-     184,    -1,   186,    -1,   188,    -1,   196,    -1,    25,   108,\r
-      26,    -1,    -1,   108,   109,    -1,   110,   112,   111,    -1,\r
-      27,    -1,    28,    -1,    -1,   112,   113,    -1,   198,    -1,\r
-     200,    -1,   202,    -1,   204,    -1,   206,    -1,   208,    -1,\r
-     210,    -1,   212,    -1,    29,   115,    30,    -1,    -1,   115,\r
-     116,    -1,   117,   119,   118,    -1,    31,    -1,    32,    -1,\r
-      -1,   119,   120,    -1,   214,    -1,   216,    -1,   222,    -1,\r
-     218,    -1,   220,    -1,   224,    -1,   226,    -1,    65,   232,\r
-      -1,    -1,   134,   238,     5,   122,   146,    -1,    -1,   135,\r
-     238,     5,   123,   146,    -1,    -1,   136,   238,     5,   124,\r
-     146,    -1,    -1,   137,   125,   146,    -1,    -1,   138,   238,\r
-       5,   126,   146,    -1,    -1,   139,   127,   146,    -1,    -1,\r
-     140,   238,     5,   128,   146,    -1,    -1,   141,   129,   146,\r
-      -1,    -1,   142,   238,     5,   130,   146,    -1,    -1,   143,\r
-     238,     5,   131,   146,    -1,    -1,   144,   132,   146,    -1,\r
-      -1,   145,   238,     5,   133,   146,    -1,    66,    -1,    67,\r
-      -1,    68,    -1,    69,    -1,    70,    -1,    71,    -1,    72,\r
-      -1,    73,    -1,    74,    -1,    75,    -1,    76,    -1,    77,\r
-      -1,   232,    -1,   148,   228,    -1,    33,    -1,   150,   228,\r
-      -1,    34,    -1,   152,   231,    -1,    36,    -1,   154,   238,\r
-      -1,    35,    -1,   156,   238,    -1,    59,    -1,   158,   231,\r
-      -1,    37,    -1,   160,   161,    -1,    38,    -1,   162,    -1,\r
-     161,     6,   162,    -1,   163,    -1,   164,    -1,   165,    -1,\r
-     166,    -1,   167,    -1,    61,    -1,    62,    -1,    60,    -1,\r
-      64,    -1,    63,    -1,   169,   231,    -1,    39,    -1,   171,\r
-     231,    -1,    40,    -1,   173,   232,    -1,    43,    -1,   175,\r
-     235,    -1,    41,    -1,   177,   235,    -1,    42,    -1,   179,\r
-     231,    -1,    39,    -1,   181,   231,    -1,    40,    -1,   183,\r
-     231,    -1,    47,    -1,   185,   231,    -1,    46,    -1,   187,\r
-     190,    -1,    45,    -1,   189,   192,    -1,    44,    -1,   191,\r
-      -1,   194,    -1,     7,    -1,   193,    -1,   195,    -1,     7,\r
-      -1,   238,    -1,   238,    -1,   197,   233,    -1,    48,    -1,\r
-     199,   228,    -1,    33,    -1,   201,   228,    -1,    34,    -1,\r
-     203,   232,    -1,    49,    -1,   205,   232,    -1,    50,    -1,\r
-     207,   232,    -1,    51,    -1,   209,   232,    -1,    52,    -1,\r
-     211,   238,    -1,    53,    -1,   213,   238,    -1,    59,    -1,\r
-     215,   228,    -1,    34,    -1,   217,   238,    -1,    54,    -1,\r
-     219,   231,    -1,    55,    -1,   221,   231,    -1,    56,    -1,\r
-     223,   228,    -1,    58,    -1,   225,   238,    -1,    57,    -1,\r
-     227,   238,    -1,    59,    -1,   229,    -1,   230,    -1,   229,\r
-     230,    -1,     8,    -1,   228,    -1,   231,     6,   228,    -1,\r
-     234,    -1,   234,    -1,   233,     6,   234,    -1,     3,    -1,\r
-     236,     5,   237,    -1,   235,     6,   236,     5,   237,    -1,\r
-       3,    -1,     3,    -1,   239,    -1,   240,    -1,   241,     4,\r
-     242,    -1,   239,     6,   241,     4,   242,    -1,   239,     6,\r
-     240,    -1,     3,    -1,     3,    -1,     3,    -1\r
-};\r
-\r
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */\r
-static const yytype_uint16 yyrline[] =\r
-{\r
-       0,   276,   276,   279,   280,   283,   284,   285,   286,   287,\r
-     311,   314,   315,   344,   347,   348,   351,   354,   359,   365,\r
-     366,   369,   370,   371,   372,   373,   374,   375,   402,   405,\r
-     406,   407,   412,   415,   416,   419,   422,   427,   433,   434,\r
-     449,   450,   451,   452,   453,   458,   461,   462,   465,   468,\r
-     473,   479,   480,   499,   500,   501,   502,   503,   504,   505,\r
-     529,   532,   533,   536,   539,   544,   550,   551,   554,   555,\r
-     556,   557,   558,   559,   560,   561,   583,   586,   587,   590,\r
-     593,   598,   604,   605,   608,   609,   610,   611,   612,   613,\r
-     614,   636,   654,   654,   675,   675,   696,   696,   731,   731,\r
-     744,   744,   777,   777,   790,   790,   823,   823,   836,   836,\r
-     869,   869,   905,   905,   925,   925,   956,   959,   962,   965,\r
-     968,   971,   974,   977,   980,   983,   986,   989,   993,  1032,\r
-    1055,  1060,  1083,  1088,  1154,  1159,  1179,  1184,  1204,  1209,\r
-    1217,  1222,  1227,  1232,  1233,  1236,  1237,  1238,  1239,  1240,\r
-    1243,  1249,  1255,  1261,  1269,  1291,  1308,  1313,  1330,  1335,\r
-    1353,  1358,  1375,  1380,  1397,  1413,  1430,  1435,  1454,  1459,\r
-    1476,  1481,  1499,  1504,  1509,  1514,  1519,  1524,  1525,  1528,\r
-    1535,  1536,  1539,  1546,  1578,  1611,  1654,  1671,  1694,  1699,\r
-    1722,  1727,  1747,  1752,  1772,  1778,  1798,  1804,  1824,  1830,\r
-    1865,  1870,  1903,  1920,  1943,  1948,  1982,  1987,  2004,  2009,\r
-    2026,  2031,  2054,  2059,  2092,  2097,  2130,  2141,  2148,  2149,\r
-    2152,  2159,  2160,  2165,  2168,  2169,  2172,  2180,  2186,  2194,\r
-    2200,  2206,  2209,  2215,  2227,  2239,  2247,  2254,  2260\r
-};\r
-#endif\r
-\r
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE\r
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.\r
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */\r
-static const char *const yytname[] =\r
-{\r
-  "$end", "error", "$undefined", "TK_NUMBER", "TK_DASH", "TK_DOTDOT",\r
-  "TK_COMMA", "TK_ASTERISK", "TK_TEXT", "TK_QOS_ULPS_START",\r
-  "TK_QOS_ULPS_END", "TK_PORT_GROUPS_START", "TK_PORT_GROUPS_END",\r
-  "TK_PORT_GROUP_START", "TK_PORT_GROUP_END", "TK_QOS_SETUP_START",\r
-  "TK_QOS_SETUP_END", "TK_VLARB_TABLES_START", "TK_VLARB_TABLES_END",\r
-  "TK_VLARB_SCOPE_START", "TK_VLARB_SCOPE_END", "TK_SL2VL_TABLES_START",\r
-  "TK_SL2VL_TABLES_END", "TK_SL2VL_SCOPE_START", "TK_SL2VL_SCOPE_END",\r
-  "TK_QOS_LEVELS_START", "TK_QOS_LEVELS_END", "TK_QOS_LEVEL_START",\r
-  "TK_QOS_LEVEL_END", "TK_QOS_MATCH_RULES_START", "TK_QOS_MATCH_RULES_END",\r
-  "TK_QOS_MATCH_RULE_START", "TK_QOS_MATCH_RULE_END", "TK_NAME", "TK_USE",\r
-  "TK_PORT_GUID", "TK_PORT_NAME", "TK_PARTITION", "TK_NODE_TYPE",\r
-  "TK_GROUP", "TK_ACROSS", "TK_VLARB_HIGH", "TK_VLARB_LOW",\r
-  "TK_VLARB_HIGH_LIMIT", "TK_TO", "TK_FROM", "TK_ACROSS_TO",\r
-  "TK_ACROSS_FROM", "TK_SL2VL_TABLE", "TK_SL", "TK_MTU_LIMIT",\r
-  "TK_RATE_LIMIT", "TK_PACKET_LIFE", "TK_PATH_BITS", "TK_QOS_CLASS",\r
-  "TK_SOURCE", "TK_DESTINATION", "TK_SERVICE_ID", "TK_QOS_LEVEL_NAME",\r
-  "TK_PKEY", "TK_NODE_TYPE_ROUTER", "TK_NODE_TYPE_CA",\r
-  "TK_NODE_TYPE_SWITCH", "TK_NODE_TYPE_SELF", "TK_NODE_TYPE_ALL",\r
-  "TK_ULP_DEFAULT", "TK_ULP_ANY_SERVICE_ID", "TK_ULP_ANY_PKEY",\r
-  "TK_ULP_ANY_TARGET_PORT_GUID", "TK_ULP_SDP_DEFAULT", "TK_ULP_SDP_PORT",\r
-  "TK_ULP_RDS_DEFAULT", "TK_ULP_RDS_PORT", "TK_ULP_ISER_DEFAULT",\r
-  "TK_ULP_ISER_PORT", "TK_ULP_SRP_GUID", "TK_ULP_IPOIB_DEFAULT",\r
-  "TK_ULP_IPOIB_PKEY", "$accept", "head", "qos_policy_entries",\r
-  "qos_policy_entry", "qos_ulps_section", "qos_ulps",\r
-  "port_groups_section", "port_groups", "port_group", "port_group_start",\r
-  "port_group_end", "port_group_entries", "port_group_entry",\r
-  "qos_setup_section", "qos_setup_items", "vlarb_tables",\r
-  "vlarb_scope_items", "vlarb_scope", "vlarb_scope_start",\r
-  "vlarb_scope_end", "vlarb_scope_entries", "vlarb_scope_entry",\r
-  "sl2vl_tables", "sl2vl_scope_items", "sl2vl_scope", "sl2vl_scope_start",\r
-  "sl2vl_scope_end", "sl2vl_scope_entries", "sl2vl_scope_entry",\r
-  "qos_levels_section", "qos_levels", "qos_level", "qos_level_start",\r
-  "qos_level_end", "qos_level_entries", "qos_level_entry",\r
-  "qos_match_rules_section", "qos_match_rules", "qos_match_rule",\r
-  "qos_match_rule_start", "qos_match_rule_end", "qos_match_rule_entries",\r
-  "qos_match_rule_entry", "qos_ulp", "$@1", "$@2", "$@3", "$@4", "$@5",\r
-  "$@6", "$@7", "$@8", "$@9", "$@10", "$@11", "$@12",\r
-  "qos_ulp_type_any_service", "qos_ulp_type_any_pkey",\r
-  "qos_ulp_type_any_target_port_guid", "qos_ulp_type_sdp_default",\r
-  "qos_ulp_type_sdp_port", "qos_ulp_type_rds_default",\r
-  "qos_ulp_type_rds_port", "qos_ulp_type_iser_default",\r
-  "qos_ulp_type_iser_port", "qos_ulp_type_srp_guid",\r
-  "qos_ulp_type_ipoib_default", "qos_ulp_type_ipoib_pkey", "qos_ulp_sl",\r
-  "port_group_name", "port_group_name_start", "port_group_use",\r
-  "port_group_use_start", "port_group_port_name",\r
-  "port_group_port_name_start", "port_group_port_guid",\r
-  "port_group_port_guid_start", "port_group_pkey", "port_group_pkey_start",\r
-  "port_group_partition", "port_group_partition_start",\r
-  "port_group_node_type", "port_group_node_type_start",\r
-  "port_group_node_type_list", "node_type_item", "node_type_ca",\r
-  "node_type_switch", "node_type_router", "node_type_all",\r
-  "node_type_self", "vlarb_scope_group", "vlarb_scope_group_start",\r
-  "vlarb_scope_across", "vlarb_scope_across_start",\r
-  "vlarb_scope_vlarb_high_limit", "vlarb_scope_vlarb_high_limit_start",\r
-  "vlarb_scope_vlarb_high", "vlarb_scope_vlarb_high_start",\r
-  "vlarb_scope_vlarb_low", "vlarb_scope_vlarb_low_start",\r
-  "sl2vl_scope_group", "sl2vl_scope_group_start", "sl2vl_scope_across",\r
-  "sl2vl_scope_across_start", "sl2vl_scope_across_from",\r
-  "sl2vl_scope_across_from_start", "sl2vl_scope_across_to",\r
-  "sl2vl_scope_across_to_start", "sl2vl_scope_from",\r
-  "sl2vl_scope_from_start", "sl2vl_scope_to", "sl2vl_scope_to_start",\r
-  "sl2vl_scope_from_list_or_asterisk", "sl2vl_scope_from_asterisk",\r
-  "sl2vl_scope_to_list_or_asterisk", "sl2vl_scope_to_asterisk",\r
-  "sl2vl_scope_from_list_of_ranges", "sl2vl_scope_to_list_of_ranges",\r
-  "sl2vl_scope_sl2vl_table", "sl2vl_scope_sl2vl_table_start",\r
-  "qos_level_name", "qos_level_name_start", "qos_level_use",\r
-  "qos_level_use_start", "qos_level_sl", "qos_level_sl_start",\r
-  "qos_level_mtu_limit", "qos_level_mtu_limit_start",\r
-  "qos_level_rate_limit", "qos_level_rate_limit_start",\r
-  "qos_level_packet_life", "qos_level_packet_life_start",\r
-  "qos_level_path_bits", "qos_level_path_bits_start", "qos_level_pkey",\r
-  "qos_level_pkey_start", "qos_match_rule_use", "qos_match_rule_use_start",\r
-  "qos_match_rule_qos_class", "qos_match_rule_qos_class_start",\r
-  "qos_match_rule_source", "qos_match_rule_source_start",\r
-  "qos_match_rule_destination", "qos_match_rule_destination_start",\r
-  "qos_match_rule_qos_level_name", "qos_match_rule_qos_level_name_start",\r
-  "qos_match_rule_service_id", "qos_match_rule_service_id_start",\r
-  "qos_match_rule_pkey", "qos_match_rule_pkey_start", "single_string",\r
-  "single_string_elems", "single_string_element", "string_list",\r
-  "single_number", "num_list", "number", "num_list_with_dotdot",\r
-  "number_from_pair_1", "number_from_pair_2", "list_of_ranges",\r
-  "num_list_with_dash", "single_number_from_range", "number_from_range_1",\r
-  "number_from_range_2", 0\r
-};\r
-#endif\r
-\r
-# ifdef YYPRINT\r
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to\r
-   token YYLEX-NUM.  */\r
-static const yytype_uint16 yytoknum[] =\r
-{\r
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,\r
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,\r
-     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,\r
-     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,\r
-     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,\r
-     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,\r
-     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,\r
-     325,   326,   327,   328,   329,   330,   331,   332\r
-};\r
-# endif\r
-\r
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */\r
-static const yytype_uint8 yyr1[] =\r
-{\r
-       0,    78,    79,    80,    80,    81,    81,    81,    81,    81,\r
-      82,    83,    83,    84,    85,    85,    86,    87,    88,    89,\r
-      89,    90,    90,    90,    90,    90,    90,    90,    91,    92,\r
-      92,    92,    93,    94,    94,    95,    96,    97,    98,    98,\r
-      99,    99,    99,    99,    99,   100,   101,   101,   102,   103,\r
-     104,   105,   105,   106,   106,   106,   106,   106,   106,   106,\r
-     107,   108,   108,   109,   110,   111,   112,   112,   113,   113,\r
-     113,   113,   113,   113,   113,   113,   114,   115,   115,   116,\r
-     117,   118,   119,   119,   120,   120,   120,   120,   120,   120,\r
-     120,   121,   122,   121,   123,   121,   124,   121,   125,   121,\r
-     126,   121,   127,   121,   128,   121,   129,   121,   130,   121,\r
-     131,   121,   132,   121,   133,   121,   134,   135,   136,   137,\r
-     138,   139,   140,   141,   142,   143,   144,   145,   146,   147,\r
-     148,   149,   150,   151,   152,   153,   154,   155,   156,   157,\r
-     158,   159,   160,   161,   161,   162,   162,   162,   162,   162,\r
-     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,\r
-     173,   174,   175,   176,   177,   178,   179,   180,   181,   182,\r
-     183,   184,   185,   186,   187,   188,   189,   190,   190,   191,\r
-     192,   192,   193,   194,   195,   196,   197,   198,   199,   200,\r
-     201,   202,   203,   204,   205,   206,   207,   208,   209,   210,\r
-     211,   212,   213,   214,   215,   216,   217,   218,   219,   220,\r
-     221,   222,   223,   224,   225,   226,   227,   228,   229,   229,\r
-     230,   231,   231,   232,   233,   233,   234,   235,   235,   236,\r
-     237,   238,   239,   239,   239,   239,   240,   241,   242\r
-};\r
-\r
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */\r
-static const yytype_uint8 yyr2[] =\r
-{\r
-       0,     2,     1,     0,     2,     1,     1,     1,     1,     1,\r
-       3,     1,     2,     3,     1,     2,     3,     1,     1,     0,\r
-       2,     1,     1,     1,     1,     1,     1,     1,     3,     0,\r
-       2,     2,     3,     0,     2,     3,     1,     1,     0,     2,\r
-       1,     1,     1,     1,     1,     3,     0,     2,     3,     1,\r
-       1,     0,     2,     1,     1,     1,     1,     1,     1,     1,\r
-       3,     0,     2,     3,     1,     1,     0,     2,     1,     1,\r
-       1,     1,     1,     1,     1,     1,     3,     0,     2,     3,\r
-       1,     1,     0,     2,     1,     1,     1,     1,     1,     1,\r
-       1,     2,     0,     5,     0,     5,     0,     5,     0,     3,\r
-       0,     5,     0,     3,     0,     5,     0,     3,     0,     5,\r
-       0,     5,     0,     3,     0,     5,     1,     1,     1,     1,\r
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     1,     3,     1,     1,     1,     1,     1,\r
-       1,     1,     1,     1,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     1,     1,     1,\r
-       1,     1,     1,     1,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     2,     1,     2,\r
-       1,     2,     1,     2,     1,     2,     1,     1,     1,     2,\r
-       1,     1,     3,     1,     1,     3,     1,     3,     5,     1,\r
-       1,     1,     1,     3,     5,     3,     1,     1,     1\r
-};\r
-\r
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state\r
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero\r
-   means the default is an error.  */\r
-static const yytype_uint8 yydefact[] =\r
-{\r
-       3,     0,     2,     1,     0,     0,    29,    61,    77,     4,\r
-       5,     6,     7,     8,     9,     0,   116,   117,   118,   119,\r
-     120,   121,   122,   123,   124,   125,   126,   127,     0,    11,\r
-       0,     0,     0,    98,     0,   102,     0,   106,     0,     0,\r
-     112,     0,    17,     0,    14,    19,     0,     0,     0,   226,\r
-      91,   223,    10,    12,   236,     0,   231,   232,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-      13,    15,     0,    28,    33,    46,    30,    31,    60,    64,\r
-      62,    66,    76,    80,    78,    82,    92,     0,     0,    94,\r
-      96,    99,   128,   100,   103,   104,   107,   108,   110,   113,\r
-     114,    18,   130,   132,   136,   134,   140,   142,   138,    16,\r
-      20,    21,     0,    22,     0,    24,     0,    23,     0,    25,\r
-       0,    26,     0,    27,     0,     0,     0,     0,     0,     0,\r
-     235,     0,   238,   233,     0,     0,     0,     0,     0,     0,\r
-       0,   220,   129,   217,   218,   131,   221,   133,   135,   137,\r
-     139,   152,   150,   151,   154,   153,   141,   143,   145,   146,\r
-     147,   148,   149,    32,    36,    34,    38,    45,    49,    47,\r
-      51,    65,   188,   190,   192,   194,   196,   198,   200,   202,\r
-      63,    67,    68,     0,    69,     0,    70,     0,    71,     0,\r
-      72,     0,    73,     0,    74,     0,    75,     0,    81,   204,\r
-     206,   208,   210,   214,   212,   216,    79,    83,    84,     0,\r
-      85,     0,    87,     0,    88,     0,    86,     0,    89,     0,\r
-      90,     0,    93,     0,    95,    97,   101,   105,   109,   111,\r
-     115,   219,     0,     0,     0,     0,   187,   189,   191,   193,\r
-     195,   197,   199,   201,   203,   205,   207,   209,   211,   213,\r
-     215,   234,   222,   144,    37,   156,   158,   162,   164,   160,\r
-      35,    39,    40,     0,    41,     0,    44,     0,    42,     0,\r
-      43,     0,    50,   166,   168,   176,   174,   172,   170,   186,\r
-      48,    52,    53,     0,    54,     0,    55,     0,    56,     0,\r
-      57,     0,    58,     0,    59,     0,   155,   157,   159,   229,\r
-     161,     0,   163,   165,   167,   169,   171,   179,   173,   177,\r
-     178,   183,   182,   175,   180,   181,   184,   185,   224,     0,\r
-       0,     0,     0,   230,   227,   225,     0,   228\r
-};\r
-\r
-/* YYDEFGOTO[NTERM-NUM].  */\r
-static const yytype_int16 yydefgoto[] =\r
-{\r
-      -1,     1,     2,     9,    10,    28,    11,    43,    44,    45,\r
-     109,    72,   110,    12,    46,    76,   125,   165,   166,   260,\r
-     234,   261,    77,   126,   169,   170,   280,   235,   281,    13,\r
-      47,    80,    81,   180,   127,   181,    14,    48,    84,    85,\r
-     206,   128,   207,    29,   129,   134,   135,    61,   136,    63,\r
-     137,    65,   138,   139,    68,   140,    30,    31,    32,    33,\r
-      34,    35,    36,    37,    38,    39,    40,    41,    91,   111,\r
-     112,   113,   114,   115,   116,   117,   118,   119,   120,   121,\r
-     122,   123,   124,   156,   157,   158,   159,   160,   161,   162,\r
-     262,   263,   264,   265,   266,   267,   268,   269,   270,   271,\r
-     282,   283,   284,   285,   286,   287,   288,   289,   290,   291,\r
-     292,   293,   308,   309,   313,   314,   310,   315,   294,   295,\r
-     182,   183,   184,   185,   186,   187,   188,   189,   190,   191,\r
-     192,   193,   194,   195,   196,   197,   208,   209,   210,   211,\r
-     212,   213,   214,   215,   216,   217,   218,   219,   220,   221,\r
-     146,   143,   144,   147,    92,   317,    51,   300,   301,   324,\r
-      55,    56,    57,    58,   133\r
-};\r
-\r
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing\r
-   STATE-NUM.  */\r
-#define YYPACT_NINF -279\r
-static const yytype_int16 yypact[] =\r
-{\r
-    -279,    19,     5,  -279,    63,     9,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,    21,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    45,  -279,\r
-      29,    29,    29,  -279,    29,  -279,    29,  -279,    29,    29,\r
-    -279,    29,  -279,     0,  -279,  -279,    36,    33,    -4,  -279,\r
-    -279,  -279,  -279,  -279,    31,    61,    62,  -279,    70,    71,\r
-      79,    21,    80,    21,    81,    21,    83,    85,    21,    86,\r
-    -279,  -279,     4,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,    29,    64,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,    84,  -279,    84,  -279,    84,  -279,    29,  -279,\r
-      29,  -279,    84,  -279,    91,    32,    39,    -5,    24,    21,\r
-    -279,    90,  -279,  -279,    21,    21,    21,    21,    21,    21,\r
-      21,  -279,  -279,    84,  -279,  -279,  -279,    92,  -279,  -279,\r
-      92,  -279,  -279,  -279,  -279,  -279,    93,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,    84,  -279,    84,  -279,    21,  -279,    21,\r
-    -279,    21,  -279,    21,  -279,    29,  -279,    29,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    84,\r
-    -279,    29,  -279,    84,  -279,    84,  -279,    84,  -279,    29,\r
-    -279,    29,  -279,    64,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,    84,    91,   107,    25,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,    92,    92,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,    84,  -279,    84,  -279,    21,  -279,    97,\r
-    -279,    97,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,    84,  -279,    84,  -279,    84,  -279,    84,\r
-    -279,     8,  -279,    18,  -279,    21,    92,    92,  -279,  -279,\r
-     117,   120,   117,    92,    92,    92,    92,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,   135,  -279,    97,\r
-     123,    21,   137,  -279,  -279,  -279,   123,  -279\r
-};\r
-\r
-/* YYPGOTO[NTERM-NUM].  */\r
-static const yytype_int16 yypgoto[] =\r
-{\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,    53,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,   116,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,   -32,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,   -77,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,  -279,\r
-    -108,  -279,    14,  -120,    -6,  -279,  -278,  -113,  -160,  -166,\r
-     -31,  -279,    74,    75,   -55\r
-};\r
-\r
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If\r
-   positive, shift that token.  If negative, reduce the rule which\r
-   number is the opposite.  If zero, do what YYDEFACT says.\r
-   If YYTABLE_NINF, syntax error.  */\r
-#define YYTABLE_NINF -238\r
-static const yytype_int16 yytable[] =\r
-{\r
-      59,    60,   150,    62,   142,    64,   145,    66,    67,    50,\r
-      69,    54,    70,    42,     4,   307,     5,   318,   101,     3,\r
-       6,    54,    42,   171,    49,   312,    82,    83,   172,   173,\r
-       7,    94,    54,    96,     8,  -237,    99,   102,   103,   104,\r
-     105,   106,   107,   325,   174,   175,   176,   177,   178,   272,\r
-     163,   164,    73,    74,   179,    52,   198,    75,   199,    78,\r
-      79,   167,   168,   108,   273,   274,    86,   132,    87,   275,\r
-     276,   277,   278,   279,    88,   236,    89,   237,   200,   201,\r
-     202,   203,   204,   205,    90,    93,    95,   148,    97,   149,\r
-      98,   100,   141,   246,   223,   247,    71,   222,   232,   233,\r
-     299,   244,   224,   225,   226,   227,   228,   229,   230,   248,\r
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,\r
-      25,    26,    27,   319,   252,   320,   323,   254,    15,    16,\r
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,\r
-      27,   321,   326,   296,    53,   297,   255,   256,   257,   258,\r
-     259,   151,   152,   153,   154,   155,   253,   231,   302,   322,\r
-     327,   130,   131,   303,   242,   304,   243,   305,   251,   306,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-     245,   238,     0,   239,     0,   240,     0,   241,   249,     0,\r
-     250,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,\r
-     311,   298,   316\r
-};\r
-\r
-static const yytype_int16 yycheck[] =\r
-{\r
-      31,    32,   122,    34,   112,    36,   114,    38,    39,    15,\r
-      41,     3,    12,    13,     9,     7,    11,   295,    14,     0,\r
-      15,     3,    13,    28,     3,     7,    30,    31,    33,    34,\r
-      25,    63,     3,    65,    29,     4,    68,    33,    34,    35,\r
-      36,    37,    38,   321,    49,    50,    51,    52,    53,    24,\r
-      18,    19,    16,    17,    59,    10,    32,    21,    34,    26,\r
-      27,    22,    23,    59,    39,    40,     5,     3,     6,    44,\r
-      45,    46,    47,    48,     4,   183,     5,   185,    54,    55,\r
-      56,    57,    58,    59,     5,     5,     5,   118,     5,   120,\r
-       5,     5,     8,   213,     4,   215,    43,   129,     6,     6,\r
-       3,   209,   134,   135,   136,   137,   138,   139,   140,   217,\r
-      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,\r
-      75,    76,    77,     6,   232,     5,     3,    20,    65,    66,\r
-      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,\r
-      77,     6,     5,   263,    28,   265,    39,    40,    41,    42,\r
-      43,    60,    61,    62,    63,    64,   233,   143,   271,   319,\r
-     326,    87,    87,   283,   195,   285,   197,   287,   223,   289,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-     211,   187,    -1,   189,    -1,   191,    -1,   193,   219,    -1,\r
-     221,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,\r
-     291,   267,   293\r
-};\r
-\r
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing\r
-   symbol of state STATE-NUM.  */\r
-static const yytype_uint8 yystos[] =\r
-{\r
-       0,    79,    80,     0,     9,    11,    15,    25,    29,    81,\r
-      82,    84,    91,   107,   114,    65,    66,    67,    68,    69,\r
-      70,    71,    72,    73,    74,    75,    76,    77,    83,   121,\r
-     134,   135,   136,   137,   138,   139,   140,   141,   142,   143,\r
-     144,   145,    13,    85,    86,    87,    92,   108,   115,     3,\r
-     232,   234,    10,   121,     3,   238,   239,   240,   241,   238,\r
-     238,   125,   238,   127,   238,   129,   238,   238,   132,   238,\r
-      12,    86,    89,    16,    17,    21,    93,   100,    26,    27,\r
-     109,   110,    30,    31,   116,   117,     5,     6,     4,     5,\r
-       5,   146,   232,     5,   146,     5,   146,     5,     5,   146,\r
-       5,    14,    33,    34,    35,    36,    37,    38,    59,    88,\r
-      90,   147,   148,   149,   150,   151,   152,   153,   154,   155,\r
-     156,   157,   158,   159,   160,    94,   101,   112,   119,   122,\r
-     240,   241,     3,   242,   123,   124,   126,   128,   130,   131,\r
-     133,     8,   228,   229,   230,   228,   228,   231,   238,   238,\r
-     231,    60,    61,    62,    63,    64,   161,   162,   163,   164,\r
-     165,   166,   167,    18,    19,    95,    96,    22,    23,   102,\r
-     103,    28,    33,    34,    49,    50,    51,    52,    53,    59,\r
-     111,   113,   198,   199,   200,   201,   202,   203,   204,   205,\r
-     206,   207,   208,   209,   210,   211,   212,   213,    32,    34,\r
-      54,    55,    56,    57,    58,    59,   118,   120,   214,   215,\r
-     216,   217,   218,   219,   220,   221,   222,   223,   224,   225,\r
-     226,   227,   146,     4,   146,   146,   146,   146,   146,   146,\r
-     146,   230,     6,     6,    98,   105,   228,   228,   232,   232,\r
-     232,   232,   238,   238,   228,   238,   231,   231,   228,   238,\r
-     238,   242,   228,   162,    20,    39,    40,    41,    42,    43,\r
-      97,    99,   168,   169,   170,   171,   172,   173,   174,   175,\r
-     176,   177,    24,    39,    40,    44,    45,    46,    47,    48,\r
-     104,   106,   178,   179,   180,   181,   182,   183,   184,   185,\r
-     186,   187,   188,   189,   196,   197,   231,   231,   232,     3,\r
-     235,   236,   235,   231,   231,   231,   231,     7,   190,   191,\r
-     194,   238,     7,   192,   193,   195,   238,   233,   234,     6,\r
-       5,     6,   236,     3,   237,   234,     5,   237\r
-};\r
-\r
-#define yyerrok                (yyerrstatus = 0)\r
-#define yyclearin      (yychar = YYEMPTY)\r
-#define YYEMPTY                (-2)\r
-#define YYEOF          0\r
-\r
-#define YYACCEPT       goto yyacceptlab\r
-#define YYABORT                goto yyabortlab\r
-#define YYERROR                goto yyerrorlab\r
-\r
-\r
-/* Like YYERROR except do call yyerror.  This remains here temporarily\r
-   to ease the transition to the new meaning of YYERROR, for GCC.\r
-   Once GCC version 2 has supplanted version 1, this can go.  */\r
-\r
-#define YYFAIL         goto yyerrlab\r
-\r
-#define YYRECOVERING()  (!!yyerrstatus)\r
-\r
-#define YYBACKUP(Token, Value)                                 \\r
-do                                                             \\r
-  if (yychar == YYEMPTY && yylen == 1)                         \\r
-    {                                                          \\r
-      yychar = (Token);                                                \\r
-      yylval = (Value);                                                \\r
-      yytoken = YYTRANSLATE (yychar);                          \\r
-      YYPOPSTACK (1);                                          \\r
-      goto yybackup;                                           \\r
-    }                                                          \\r
-  else                                                         \\r
-    {                                                          \\r
-      yyerror (YY_("syntax error: cannot back up")); \\r
-      YYERROR;                                                 \\r
-    }                                                          \\r
-while (YYID (0))\r
-\r
-\r
-#define YYTERROR       1\r
-#define YYERRCODE      256\r
-\r
-\r
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].\r
-   If N is 0, then set CURRENT to the empty location which ends\r
-   the previous symbol: RHS[0] (always defined).  */\r
-\r
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])\r
-#ifndef YYLLOC_DEFAULT\r
-# define YYLLOC_DEFAULT(Current, Rhs, N)                               \\r
-    do                                                                 \\r
-      if (YYID (N))                                                    \\r
-       {                                                               \\r
-         (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \\r
-         (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \\r
-         (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \\r
-         (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \\r
-       }                                                               \\r
-      else                                                             \\r
-       {                                                               \\r
-         (Current).first_line   = (Current).last_line   =              \\r
-           YYRHSLOC (Rhs, 0).last_line;                                \\r
-         (Current).first_column = (Current).last_column =              \\r
-           YYRHSLOC (Rhs, 0).last_column;                              \\r
-       }                                                               \\r
-    while (YYID (0))\r
-#endif\r
-\r
-\r
-/* YY_LOCATION_PRINT -- Print the location on the stream.\r
-   This macro was not mandated originally: define only if we know\r
-   we won't break user code: when these are the locations we know.  */\r
-\r
-#ifndef YY_LOCATION_PRINT\r
-# if YYLTYPE_IS_TRIVIAL\r
-#  define YY_LOCATION_PRINT(File, Loc)                 \\r
-     fprintf (File, "%d.%d-%d.%d",                     \\r
-             (Loc).first_line, (Loc).first_column,     \\r
-             (Loc).last_line,  (Loc).last_column)\r
-# else\r
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)\r
-# endif\r
-#endif\r
-\r
-\r
-/* YYLEX -- calling `yylex' with the right arguments.  */\r
-\r
-#ifdef YYLEX_PARAM\r
-# define YYLEX yylex (YYLEX_PARAM)\r
-#else\r
-# define YYLEX yylex ()\r
-#endif\r
-\r
-/* Enable debugging if requested.  */\r
-#if YYDEBUG\r
-\r
-# ifndef YYFPRINTF\r
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */\r
-#  define YYFPRINTF fprintf\r
-# endif\r
-\r
-# define YYDPRINTF(Args)                       \\r
-do {                                           \\r
-  if (yydebug)                                 \\r
-    YYFPRINTF Args;                            \\r
-} while (YYID (0))\r
-\r
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                   \\r
-do {                                                                     \\r
-  if (yydebug)                                                           \\r
-    {                                                                    \\r
-      YYFPRINTF (stderr, "%s ", Title);                                          \\r
-      yy_symbol_print (stderr,                                           \\r
-                 Type, Value); \\r
-      YYFPRINTF (stderr, "\n");                                                  \\r
-    }                                                                    \\r
-} while (YYID (0))\r
-\r
-\r
-/*--------------------------------.\r
-| Print this symbol on YYOUTPUT.  |\r
-`--------------------------------*/\r
-\r
-/*ARGSUSED*/\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static void\r
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)\r
-#else\r
-static void\r
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)\r
-    FILE *yyoutput;\r
-    int yytype;\r
-    YYSTYPE const * const yyvaluep;\r
-#endif\r
-{\r
-  if (!yyvaluep)\r
-    return;\r
-# ifdef YYPRINT\r
-  if (yytype < YYNTOKENS)\r
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);\r
-# else\r
-  YYUSE (yyoutput);\r
-# endif\r
-  switch (yytype)\r
-    {\r
-      default:\r
-       break;\r
-    }\r
-}\r
-\r
-\r
-/*--------------------------------.\r
-| Print this symbol on YYOUTPUT.  |\r
-`--------------------------------*/\r
-\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static void\r
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)\r
-#else\r
-static void\r
-yy_symbol_print (yyoutput, yytype, yyvaluep)\r
-    FILE *yyoutput;\r
-    int yytype;\r
-    YYSTYPE const * const yyvaluep;\r
-#endif\r
-{\r
-  if (yytype < YYNTOKENS)\r
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);\r
-  else\r
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);\r
-\r
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep);\r
-  YYFPRINTF (yyoutput, ")");\r
-}\r
-\r
-/*------------------------------------------------------------------.\r
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |\r
-| TOP (included).                                                   |\r
-`------------------------------------------------------------------*/\r
-\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static void\r
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)\r
-#else\r
-static void\r
-yy_stack_print (yybottom, yytop)\r
-    yytype_int16 *yybottom;\r
-    yytype_int16 *yytop;\r
-#endif\r
-{\r
-  YYFPRINTF (stderr, "Stack now");\r
-  for (; yybottom <= yytop; yybottom++)\r
-    {\r
-      int yybot = *yybottom;\r
-      YYFPRINTF (stderr, " %d", yybot);\r
-    }\r
-  YYFPRINTF (stderr, "\n");\r
-}\r
-\r
-# define YY_STACK_PRINT(Bottom, Top)                           \\r
-do {                                                           \\r
-  if (yydebug)                                                 \\r
-    yy_stack_print ((Bottom), (Top));                          \\r
-} while (YYID (0))\r
-\r
-\r
-/*------------------------------------------------.\r
-| Report that the YYRULE is going to be reduced.  |\r
-`------------------------------------------------*/\r
-\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static void\r
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)\r
-#else\r
-static void\r
-yy_reduce_print (yyvsp, yyrule)\r
-    YYSTYPE *yyvsp;\r
-    int yyrule;\r
-#endif\r
-{\r
-  int yynrhs = yyr2[yyrule];\r
-  int yyi;\r
-  unsigned long int yylno = yyrline[yyrule];\r
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",\r
-            yyrule - 1, yylno);\r
-  /* The symbols being reduced.  */\r
-  for (yyi = 0; yyi < yynrhs; yyi++)\r
-    {\r
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);\r
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],\r
-                      &(yyvsp[(yyi + 1) - (yynrhs)])\r
-                                      );\r
-      YYFPRINTF (stderr, "\n");\r
-    }\r
-}\r
-\r
-# define YY_REDUCE_PRINT(Rule)         \\r
-do {                                   \\r
-  if (yydebug)                         \\r
-    yy_reduce_print (yyvsp, Rule); \\r
-} while (YYID (0))\r
-\r
-/* Nonzero means print parse trace.  It is left uninitialized so that\r
-   multiple parsers can coexist.  */\r
-int yydebug;\r
-#else /* !YYDEBUG */\r
-# define YYDPRINTF(Args)\r
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)\r
-# define YY_STACK_PRINT(Bottom, Top)\r
-# define YY_REDUCE_PRINT(Rule)\r
-#endif /* !YYDEBUG */\r
-\r
-\r
-/* YYINITDEPTH -- initial size of the parser's stacks.  */\r
-#ifndef        YYINITDEPTH\r
-# define YYINITDEPTH 200\r
-#endif\r
-\r
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only\r
-   if the built-in stack extension method is used).\r
-\r
-   Do not make this value too large; the results are undefined if\r
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)\r
-   evaluated with infinite-precision integer arithmetic.  */\r
-\r
-#ifndef YYMAXDEPTH\r
-# define YYMAXDEPTH 10000\r
-#endif\r
-\r
-\f\r
-\r
-#if YYERROR_VERBOSE\r
-\r
-# ifndef yystrlen\r
-#  if defined __GLIBC__ && defined _STRING_H\r
-#   define yystrlen strlen\r
-#  else\r
-/* Return the length of YYSTR.  */\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static YYSIZE_T\r
-yystrlen (const char *yystr)\r
-#else\r
-static YYSIZE_T\r
-yystrlen (yystr)\r
-    const char *yystr;\r
-#endif\r
-{\r
-  YYSIZE_T yylen;\r
-  for (yylen = 0; yystr[yylen]; yylen++)\r
-    continue;\r
-  return yylen;\r
-}\r
-#  endif\r
-# endif\r
-\r
-# ifndef yystpcpy\r
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE\r
-#   define yystpcpy stpcpy\r
-#  else\r
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in\r
-   YYDEST.  */\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static char *\r
-yystpcpy (char *yydest, const char *yysrc)\r
-#else\r
-static char *\r
-yystpcpy (yydest, yysrc)\r
-    char *yydest;\r
-    const char *yysrc;\r
-#endif\r
-{\r
-  char *yyd = yydest;\r
-  const char *yys = yysrc;\r
-\r
-  while ((*yyd++ = *yys++) != '\0')\r
-    continue;\r
-\r
-  return yyd - 1;\r
-}\r
-#  endif\r
-# endif\r
-\r
-# ifndef yytnamerr\r
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary\r
-   quotes and backslashes, so that it's suitable for yyerror.  The\r
-   heuristic is that double-quoting is unnecessary unless the string\r
-   contains an apostrophe, a comma, or backslash (other than\r
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is\r
-   null, do not copy; instead, return the length of what the result\r
-   would have been.  */\r
-static YYSIZE_T\r
-yytnamerr (char *yyres, const char *yystr)\r
-{\r
-  if (*yystr == '"')\r
-    {\r
-      YYSIZE_T yyn = 0;\r
-      char const *yyp = yystr;\r
-\r
-      for (;;)\r
-       switch (*++yyp)\r
-         {\r
-         case '\'':\r
-         case ',':\r
-           goto do_not_strip_quotes;\r
-\r
-         case '\\':\r
-           if (*++yyp != '\\')\r
-             goto do_not_strip_quotes;\r
-           /* Fall through.  */\r
-         default:\r
-           if (yyres)\r
-             yyres[yyn] = *yyp;\r
-           yyn++;\r
-           break;\r
-\r
-         case '"':\r
-           if (yyres)\r
-             yyres[yyn] = '\0';\r
-           return yyn;\r
-         }\r
-    do_not_strip_quotes: ;\r
-    }\r
-\r
-  if (! yyres)\r
-    return yystrlen (yystr);\r
-\r
-  return yystpcpy (yyres, yystr) - yyres;\r
-}\r
-# endif\r
-\r
-/* Copy into YYRESULT an error message about the unexpected token\r
-   YYCHAR while in state YYSTATE.  Return the number of bytes copied,\r
-   including the terminating null byte.  If YYRESULT is null, do not\r
-   copy anything; just return the number of bytes that would be\r
-   copied.  As a special case, return 0 if an ordinary "syntax error"\r
-   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during\r
-   size calculation.  */\r
-static YYSIZE_T\r
-yysyntax_error (char *yyresult, int yystate, int yychar)\r
-{\r
-  int yyn = yypact[yystate];\r
-\r
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))\r
-    return 0;\r
-  else\r
-    {\r
-      int yytype = YYTRANSLATE (yychar);\r
-      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);\r
-      YYSIZE_T yysize = yysize0;\r
-      YYSIZE_T yysize1;\r
-      int yysize_overflow = 0;\r
-      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };\r
-      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];\r
-      int yyx;\r
-\r
-# if 0\r
-      /* This is so xgettext sees the translatable formats that are\r
-        constructed on the fly.  */\r
-      YY_("syntax error, unexpected %s");\r
-      YY_("syntax error, unexpected %s, expecting %s");\r
-      YY_("syntax error, unexpected %s, expecting %s or %s");\r
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s");\r
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");\r
-# endif\r
-      char *yyfmt;\r
-      char const *yyf;\r
-      static char const yyunexpected[] = "syntax error, unexpected %s";\r
-      static char const yyexpecting[] = ", expecting %s";\r
-      static char const yyor[] = " or %s";\r
-      char yyformat[sizeof yyunexpected\r
-                   + sizeof yyexpecting - 1\r
-                   + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)\r
-                      * (sizeof yyor - 1))];\r
-      char const *yyprefix = yyexpecting;\r
-\r
-      /* Start YYX at -YYN if negative to avoid negative indexes in\r
-        YYCHECK.  */\r
-      int yyxbegin = yyn < 0 ? -yyn : 0;\r
-\r
-      /* Stay within bounds of both yycheck and yytname.  */\r
-      int yychecklim = YYLAST - yyn + 1;\r
-      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;\r
-      int yycount = 1;\r
-\r
-      yyarg[0] = yytname[yytype];\r
-      yyfmt = yystpcpy (yyformat, yyunexpected);\r
-\r
-      for (yyx = yyxbegin; yyx < yyxend; ++yyx)\r
-       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)\r
-         {\r
-           if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)\r
-             {\r
-               yycount = 1;\r
-               yysize = yysize0;\r
-               yyformat[sizeof yyunexpected - 1] = '\0';\r
-               break;\r
-             }\r
-           yyarg[yycount++] = yytname[yyx];\r
-           yysize1 = yysize + yytnamerr (0, yytname[yyx]);\r
-           yysize_overflow |= (yysize1 < yysize);\r
-           yysize = yysize1;\r
-           yyfmt = yystpcpy (yyfmt, yyprefix);\r
-           yyprefix = yyor;\r
-         }\r
-\r
-      yyf = YY_(yyformat);\r
-      yysize1 = yysize + yystrlen (yyf);\r
-      yysize_overflow |= (yysize1 < yysize);\r
-      yysize = yysize1;\r
-\r
-      if (yysize_overflow)\r
-       return YYSIZE_MAXIMUM;\r
-\r
-      if (yyresult)\r
-       {\r
-         /* Avoid sprintf, as that infringes on the user's name space.\r
-            Don't have undefined behavior even if the translation\r
-            produced a string with the wrong number of "%s"s.  */\r
-         char *yyp = yyresult;\r
-         int yyi = 0;\r
-         while ((*yyp = *yyf) != '\0')\r
-           {\r
-             if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)\r
-               {\r
-                 yyp += yytnamerr (yyp, yyarg[yyi++]);\r
-                 yyf += 2;\r
-               }\r
-             else\r
-               {\r
-                 yyp++;\r
-                 yyf++;\r
-               }\r
-           }\r
-       }\r
-      return yysize;\r
-    }\r
-}\r
-#endif /* YYERROR_VERBOSE */\r
-\f\r
-\r
-/*-----------------------------------------------.\r
-| Release the memory associated to this symbol.  |\r
-`-----------------------------------------------*/\r
-\r
-/*ARGSUSED*/\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-static void\r
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)\r
-#else\r
-static void\r
-yydestruct (yymsg, yytype, yyvaluep)\r
-    const char *yymsg;\r
-    int yytype;\r
-    YYSTYPE *yyvaluep;\r
-#endif\r
-{\r
-  YYUSE (yyvaluep);\r
-\r
-  if (!yymsg)\r
-    yymsg = "Deleting";\r
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);\r
-\r
-  switch (yytype)\r
-    {\r
-\r
-      default:\r
-       break;\r
-    }\r
-}\r
-\r
-/* Prevent warnings from -Wmissing-prototypes.  */\r
-#ifdef YYPARSE_PARAM\r
-#if defined __STDC__ || defined __cplusplus\r
-int yyparse (void *YYPARSE_PARAM);\r
-#else\r
-int yyparse ();\r
-#endif\r
-#else /* ! YYPARSE_PARAM */\r
-#if defined __STDC__ || defined __cplusplus\r
-int yyparse (void);\r
-#else\r
-int yyparse ();\r
-#endif\r
-#endif /* ! YYPARSE_PARAM */\r
-\r
-\r
-/* The lookahead symbol.  */\r
-int yychar;\r
-\r
-/* The semantic value of the lookahead symbol.  */\r
-YYSTYPE yylval;\r
-\r
-/* Number of syntax errors so far.  */\r
-int yynerrs;\r
-\r
-\r
-\r
-/*-------------------------.\r
-| yyparse or yypush_parse.  |\r
-`-------------------------*/\r
-\r
-#ifdef YYPARSE_PARAM\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-int\r
-yyparse (void *YYPARSE_PARAM)\r
-#else\r
-int\r
-yyparse (YYPARSE_PARAM)\r
-    void *YYPARSE_PARAM;\r
-#endif\r
-#else /* ! YYPARSE_PARAM */\r
-#if (defined __STDC__ || defined __C99__FUNC__ \\r
-     || defined __cplusplus || defined _MSC_VER)\r
-int\r
-yyparse (void)\r
-#else\r
-int\r
-yyparse ()\r
-\r
-#endif\r
-#endif\r
-{\r
-\r
-\r
-    int yystate;\r
-    /* Number of tokens to shift before error messages enabled.  */\r
-    int yyerrstatus;\r
-\r
-    /* The stacks and their tools:\r
-       `yyss': related to states.\r
-       `yyvs': related to semantic values.\r
-\r
-       Refer to the stacks thru separate pointers, to allow yyoverflow\r
-       to reallocate them elsewhere.  */\r
-\r
-    /* The state stack.  */\r
-    yytype_int16 yyssa[YYINITDEPTH];\r
-    yytype_int16 *yyss;\r
-    yytype_int16 *yyssp;\r
-\r
-    /* The semantic value stack.  */\r
-    YYSTYPE yyvsa[YYINITDEPTH];\r
-    YYSTYPE *yyvs;\r
-    YYSTYPE *yyvsp;\r
-\r
-    YYSIZE_T yystacksize;\r
-\r
-  int yyn;\r
-  int yyresult;\r
-  /* Lookahead token as an internal (translated) token number.  */\r
-  int yytoken;\r
-  /* The variables used to return semantic value and location from the\r
-     action routines.  */\r
-  YYSTYPE yyval;\r
-\r
-#if YYERROR_VERBOSE\r
-  /* Buffer for error messages, and its allocated size.  */\r
-  char yymsgbuf[128];\r
-  char *yymsg = yymsgbuf;\r
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;\r
-#endif\r
-\r
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))\r
-\r
-  /* The number of symbols on the RHS of the reduced rule.\r
-     Keep to zero when no symbol should be popped.  */\r
-  int yylen = 0;\r
-\r
-  yytoken = 0;\r
-  yyss = yyssa;\r
-  yyvs = yyvsa;\r
-  yystacksize = YYINITDEPTH;\r
-\r
-  YYDPRINTF ((stderr, "Starting parse\n"));\r
-\r
-  yystate = 0;\r
-  yyerrstatus = 0;\r
-  yynerrs = 0;\r
-  yychar = YYEMPTY; /* Cause a token to be read.  */\r
-\r
-  /* Initialize stack pointers.\r
-     Waste one element of value and location stack\r
-     so that they stay on the same level as the state stack.\r
-     The wasted elements are never initialized.  */\r
-  yyssp = yyss;\r
-  yyvsp = yyvs;\r
-\r
-  goto yysetstate;\r
-\r
-/*------------------------------------------------------------.\r
-| yynewstate -- Push a new state, which is found in yystate.  |\r
-`------------------------------------------------------------*/\r
- yynewstate:\r
-  /* In all cases, when you get here, the value and location stacks\r
-     have just been pushed.  So pushing a state here evens the stacks.  */\r
-  yyssp++;\r
-\r
- yysetstate:\r
-  *yyssp = yystate;\r
-\r
-  if (yyss + yystacksize - 1 <= yyssp)\r
-    {\r
-      /* Get the current used size of the three stacks, in elements.  */\r
-      YYSIZE_T yysize = yyssp - yyss + 1;\r
-\r
-#ifdef yyoverflow\r
-      {\r
-       /* Give user a chance to reallocate the stack.  Use copies of\r
-          these so that the &'s don't force the real ones into\r
-          memory.  */\r
-       YYSTYPE *yyvs1 = yyvs;\r
-       yytype_int16 *yyss1 = yyss;\r
-\r
-       /* Each stack pointer address is followed by the size of the\r
-          data in use in that stack, in bytes.  This used to be a\r
-          conditional around just the two extra args, but that might\r
-          be undefined if yyoverflow is a macro.  */\r
-       yyoverflow (YY_("memory exhausted"),\r
-                   &yyss1, yysize * sizeof (*yyssp),\r
-                   &yyvs1, yysize * sizeof (*yyvsp),\r
-                   &yystacksize);\r
-\r
-       yyss = yyss1;\r
-       yyvs = yyvs1;\r
-      }\r
-#else /* no yyoverflow */\r
-# ifndef YYSTACK_RELOCATE\r
-      goto yyexhaustedlab;\r
-# else\r
-      /* Extend the stack our own way.  */\r
-      if (YYMAXDEPTH <= yystacksize)\r
-       goto yyexhaustedlab;\r
-      yystacksize *= 2;\r
-      if (YYMAXDEPTH < yystacksize)\r
-       yystacksize = YYMAXDEPTH;\r
-\r
-      {\r
-       yytype_int16 *yyss1 = yyss;\r
-       union yyalloc *yyptr =\r
-         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));\r
-       if (! yyptr)\r
-         goto yyexhaustedlab;\r
-       YYSTACK_RELOCATE (yyss_alloc, yyss);\r
-       YYSTACK_RELOCATE (yyvs_alloc, yyvs);\r
-#  undef YYSTACK_RELOCATE\r
-       if (yyss1 != yyssa)\r
-         YYSTACK_FREE (yyss1);\r
-      }\r
-# endif\r
-#endif /* no yyoverflow */\r
-\r
-      yyssp = yyss + yysize - 1;\r
-      yyvsp = yyvs + yysize - 1;\r
-\r
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",\r
-                 (unsigned long int) yystacksize));\r
-\r
-      if (yyss + yystacksize - 1 <= yyssp)\r
-       YYABORT;\r
-    }\r
-\r
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));\r
-\r
-  if (yystate == YYFINAL)\r
-    YYACCEPT;\r
-\r
-  goto yybackup;\r
-\r
-/*-----------.\r
-| yybackup.  |\r
-`-----------*/\r
-yybackup:\r
-\r
-  /* Do appropriate processing given the current state.  Read a\r
-     lookahead token if we need one and don't already have one.  */\r
-\r
-  /* First try to decide what to do without reference to lookahead token.  */\r
-  yyn = yypact[yystate];\r
-  if (yyn == YYPACT_NINF)\r
-    goto yydefault;\r
-\r
-  /* Not known => get a lookahead token if don't already have one.  */\r
-\r
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */\r
-  if (yychar == YYEMPTY)\r
-    {\r
-      YYDPRINTF ((stderr, "Reading a token: "));\r
-      yychar = YYLEX;\r
-    }\r
-\r
-  if (yychar <= YYEOF)\r
-    {\r
-      yychar = yytoken = YYEOF;\r
-      YYDPRINTF ((stderr, "Now at end of input.\n"));\r
-    }\r
-  else\r
-    {\r
-      yytoken = YYTRANSLATE (yychar);\r
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);\r
-    }\r
-\r
-  /* If the proper action on seeing token YYTOKEN is to reduce or to\r
-     detect an error, take that action.  */\r
-  yyn += yytoken;\r
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)\r
-    goto yydefault;\r
-  yyn = yytable[yyn];\r
-  if (yyn <= 0)\r
-    {\r
-      if (yyn == 0 || yyn == YYTABLE_NINF)\r
-       goto yyerrlab;\r
-      yyn = -yyn;\r
-      goto yyreduce;\r
-    }\r
-\r
-  /* Count tokens shifted since error; after three, turn off error\r
-     status.  */\r
-  if (yyerrstatus)\r
-    yyerrstatus--;\r
-\r
-  /* Shift the lookahead token.  */\r
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);\r
-\r
-  /* Discard the shifted token.  */\r
-  yychar = YYEMPTY;\r
-\r
-  yystate = yyn;\r
-  *++yyvsp = yylval;\r
-\r
-  goto yynewstate;\r
-\r
-\r
-/*-----------------------------------------------------------.\r
-| yydefault -- do the default action for the current state.  |\r
-`-----------------------------------------------------------*/\r
-yydefault:\r
-  yyn = yydefact[yystate];\r
-  if (yyn == 0)\r
-    goto yyerrlab;\r
-  goto yyreduce;\r
-\r
-\r
-/*-----------------------------.\r
-| yyreduce -- Do a reduction.  |\r
-`-----------------------------*/\r
-yyreduce:\r
-  /* yyn is the number of a rule to reduce with.  */\r
-  yylen = yyr2[yyn];\r
-\r
-  /* If YYLEN is nonzero, implement the default value of the action:\r
-     `$$ = $1'.\r
-\r
-     Otherwise, the following line sets YYVAL to garbage.\r
-     This behavior is undocumented and Bison\r
-     users should not rely upon it.  Assigning to YYVAL\r
-     unconditionally makes the parser a bit smaller, and it avoids a\r
-     GCC warning that YYVAL may be used uninitialized.  */\r
-  yyval = yyvsp[1-yylen];\r
-\r
-\r
-  YY_REDUCE_PRINT (yyn);\r
-  switch (yyn)\r
-    {\r
-        case 17:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 354 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_port_group_start();\r
-                    }\r
-    break;\r
-\r
-  case 18:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 359 "osm_qos_parser_y.y"\r
-    {\r
-                        if ( __parser_port_group_end() )\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 36:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 422 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_vlarb_scope_start();\r
-                    }\r
-    break;\r
-\r
-  case 37:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 427 "osm_qos_parser_y.y"\r
-    {\r
-                        if ( __parser_vlarb_scope_end() )\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 49:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 468 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_sl2vl_scope_start();\r
-                    }\r
-    break;\r
-\r
-  case 50:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 473 "osm_qos_parser_y.y"\r
-    {\r
-                        if ( __parser_sl2vl_scope_end() )\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 64:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 539 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_qos_level_start();\r
-                    }\r
-    break;\r
-\r
-  case 65:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 544 "osm_qos_parser_y.y"\r
-    {\r
-                        if ( __parser_qos_level_end() )\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 80:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 593 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_match_rule_start();\r
-                    }\r
-    break;\r
-\r
-  case 81:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 598 "osm_qos_parser_y.y"\r
-    {\r
-                        if ( __parser_match_rule_end() )\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 91:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 636 "osm_qos_parser_y.y"\r
-    {\r
-                        /* parsing default ulp rule: "default: num" */\r
-                        cl_list_iterator_t    list_iterator;\r
-                        uint64_t            * p_tmp_num;\r
-\r
-                        list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                        p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                        if (*p_tmp_num > 15)\r
-                        {\r
-                            yyerror("illegal SL value");\r
-                            return 1;\r
-                        }\r
-                        __default_simple_qos_level.sl = (uint8_t)(*p_tmp_num);\r
-                        __default_simple_qos_level.sl_set = TRUE;\r
-                        free(p_tmp_num);\r
-                        cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                    }\r
-    break;\r
-\r
-  case 92:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 654 "osm_qos_parser_y.y"\r
-    {\r
-                        /* "any, service-id ... : sl" - one instance of list of ranges */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have service ids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the service id ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 94:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 675 "osm_qos_parser_y.y"\r
-    {\r
-                        /* "any, pkey ... : sl" - one instance of list of ranges */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have pkeys");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the pkey ranges */\r
-                        __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 96:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 696 "osm_qos_parser_y.y"\r
-    {\r
-                        /* any, target-port-guid ... : sl */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have port guids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* create a new port group with these ports */\r
-                        __parser_port_group_start();\r
-\r
-                        p_current_port_group->name = strdup("_ULP_Targets_");\r
-                        p_current_port_group->use = strdup("Generated from ULP rules");\r
-\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        __parser_add_guid_range_to_port_map(\r
-                                              &p_current_port_group->port_map,\r
-                                              range_arr,\r
-                                              range_len);\r
-\r
-                        /* add this port group to the destination\r
-                           groups of the current match rule */\r
-                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,\r
-                                            p_current_port_group);\r
-\r
-                        __parser_port_group_end();\r
-\r
-                    }\r
-    break;\r
-\r
-  case 98:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 731 "osm_qos_parser_y.y"\r
-    {\r
-                        /* "sdp : sl" - default SL for SDP */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                        range_arr[0][1] = OSM_QOS_POLICY_ULP_SDP_SERVICE_ID + 0xFFFF;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 100:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 744 "osm_qos_parser_y.y"\r
-    {\r
-                        /* sdp with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("SDP ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 102:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 777 "osm_qos_parser_y.y"\r
-    {\r
-                        /* "rds : sl" - default SL for RDS */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] =\r
-                           OSM_QOS_POLICY_ULP_RDS_SERVICE_ID + OSM_QOS_POLICY_ULP_RDS_PORT;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 104:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 790 "osm_qos_parser_y.y"\r
-    {\r
-                        /* rds with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("RDS ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 106:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 823 "osm_qos_parser_y.y"\r
-    {\r
-                        /* "iSER : sl" - default SL for iSER */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] =\r
-                           OSM_QOS_POLICY_ULP_ISER_SERVICE_ID + OSM_QOS_POLICY_ULP_ISER_PORT;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 108:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 836 "osm_qos_parser_y.y"\r
-    {\r
-                        /* iser with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("iSER ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 110:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 869 "osm_qos_parser_y.y"\r
-    {\r
-                        /* srp with target guids - this rule is similar\r
-                           to writing 'any' ulp with target port guids */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("SRP ULP rule doesn't have port guids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* create a new port group with these ports */\r
-                        __parser_port_group_start();\r
-\r
-                        p_current_port_group->name = strdup("_SRP_Targets_");\r
-                        p_current_port_group->use = strdup("Generated from ULP rules");\r
-\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        __parser_add_guid_range_to_port_map(\r
-                                              &p_current_port_group->port_map,\r
-                                              range_arr,\r
-                                              range_len);\r
-\r
-                        /* add this port group to the destination\r
-                           groups of the current match rule */\r
-                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,\r
-                                            p_current_port_group);\r
-\r
-                        __parser_port_group_end();\r
-\r
-                    }\r
-    break;\r
-\r
-  case 112:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 905 "osm_qos_parser_y.y"\r
-    {\r
-                        /* ipoib w/o any pkeys (default pkey) */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] = 0x7fff;\r
-\r
-                        /*\r
-                         * Although we know that the default partition exists,\r
-                         * we still need to validate it by checking that it has\r
-                         * at least two full members. Otherwise IPoIB won't work.\r
-                         */\r
-                        if (__validate_pkeys(range_arr, 1, TRUE))\r
-                            return 1;\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = 1;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 114:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 925 "osm_qos_parser_y.y"\r
-    {\r
-                        /* ipoib with pkeys */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("IPoIB ULP rule doesn't have pkeys");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the pkey ranges */\r
-                        __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        /*\r
-                         * Validate pkeys.\r
-                         * For IPoIB pkeys the validation is strict.\r
-                         * If some problem would be found, parsing will\r
-                         * be aborted with a proper error messages.\r
-                         */\r
-                        if (__validate_pkeys(range_arr, range_len, TRUE))\r
-                            return 1;\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = range_len;\r
-\r
-                    }\r
-    break;\r
-\r
-  case 116:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 957 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 117:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 960 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 118:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 963 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 119:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 966 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 120:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 969 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 121:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 972 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 122:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 975 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 123:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 978 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 124:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 981 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 125:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 984 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 126:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 987 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 127:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 990 "osm_qos_parser_y.y"\r
-    { __parser_ulp_match_rule_start(); }\r
-    break;\r
-\r
-  case 128:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 993 "osm_qos_parser_y.y"\r
-    {\r
-                        /* get the SL for ULP rules */\r
-                        cl_list_iterator_t  list_iterator;\r
-                        uint64_t          * p_tmp_num;\r
-                        uint8_t             sl;\r
-\r
-                        list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                        p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                        if (*p_tmp_num > 15)\r
-                        {\r
-                            yyerror("illegal SL value");\r
-                            return 1;\r
-                        }\r
-\r
-                        sl = (uint8_t)(*p_tmp_num);\r
-                        free(p_tmp_num);\r
-                        cl_list_remove_all(&tmp_parser_struct.num_list);\r
-\r
-                        p_current_qos_match_rule->p_qos_level =\r
-                                 &osm_qos_policy_simple_qos_levels[sl];\r
-                        p_current_qos_match_rule->qos_level_name =\r
-                                 strdup(osm_qos_policy_simple_qos_levels[sl].name);\r
-\r
-                        if (__parser_ulp_match_rule_end())\r
-                            return 1;\r
-                    }\r
-    break;\r
-\r
-  case 129:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1032 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'name' of 'port-group' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_port_group->name)\r
-                            {\r
-                                yyerror("port-group has multiple 'name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_port_group->name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 130:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1055 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 131:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1060 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'use' of 'port-group' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_port_group->use)\r
-                            {\r
-                                yyerror("port-group has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_port_group->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 132:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1083 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 133:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1088 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'port-name' in 'port-group' - any num of instances */\r
-                            cl_list_iterator_t list_iterator;\r
-                            osm_node_t * p_node;\r
-                            osm_physp_t * p_physp;\r
-                            unsigned port_num;\r
-                            char * tmp_str;\r
-                            char * port_str;\r
-\r
-                            /* parsing port name strings */\r
-                            for (list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                                 list_iterator != cl_list_end(&tmp_parser_struct.str_list);\r
-                                 list_iterator = cl_list_next(list_iterator))\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                {\r
-                                    /* last slash in port name string is a separator\r
-                                       between node name and port number */\r
-                                    port_str = strrchr(tmp_str, '/');\r
-                                    if (!port_str || (strlen(port_str) < 3) ||\r
-                                        (port_str[1] != 'p' && port_str[1] != 'P')) {\r
-                                        yyerror("'%s' - illegal port name",\r
-                                                           tmp_str);\r
-                                        free(tmp_str);\r
-                                        cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                        return 1;\r
-                                    }\r
-\r
-                                    if (!(port_num = strtoul(&port_str[2],NULL,0))) {\r
-                                        yyerror(\r
-                                               "'%s' - illegal port number in port name",\r
-                                               tmp_str);\r
-                                        free(tmp_str);\r
-                                        cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                        return 1;\r
-                                    }\r
-\r
-                                    /* separate node name from port number */\r
-                                    port_str[0] = '\0';\r
-\r
-                                    if (st_lookup(p_qos_policy->p_node_hash,\r
-                                                  (st_data_t)tmp_str,\r
-                                                  (void *)&p_node))\r
-                                    {\r
-                                        /* we found the node, now get the right port */\r
-                                        p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                                        if (!p_physp) {\r
-                                            yyerror(\r
-                                                   "'%s' - port number out of range in port name",\r
-                                                   tmp_str);\r
-                                            free(tmp_str);\r
-                                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                            return 1;\r
-                                        }\r
-                                        /* we found the port, now add it to guid table */\r
-                                        __parser_add_port_to_port_map(&p_current_port_group->port_map,\r
-                                                                      p_physp);\r
-                                    }\r
-                                    free(tmp_str);\r
-                                }\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 134:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1154 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 135:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1159 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'port-guid' in 'port-group' - any num of instances */\r
-                            /* list of guid ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                __parser_add_guid_range_to_port_map(\r
-                                                      &p_current_port_group->port_map,\r
-                                                      range_arr,\r
-                                                      range_len);\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 136:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1179 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 137:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1184 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'pkey' in 'port-group' - any num of instances */\r
-                            /* list of pkey ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                __parser_add_pkey_range_to_port_map(\r
-                                                      &p_current_port_group->port_map,\r
-                                                      range_arr,\r
-                                                      range_len);\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 138:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1204 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 139:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1209 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'partition' in 'port-group' - any num of instances */\r
-                            __parser_add_partition_list_to_port_map(\r
-                                               &p_current_port_group->port_map,\r
-                                               &tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 140:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1217 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 141:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1222 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'node-type' in 'port-group' - any num of instances */\r
-                        }\r
-    break;\r
-\r
-  case 142:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1227 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 150:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1243 "osm_qos_parser_y.y"\r
-    {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_CA;\r
-                        }\r
-    break;\r
-\r
-  case 151:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1249 "osm_qos_parser_y.y"\r
-    {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_SWITCH;\r
-                        }\r
-    break;\r
-\r
-  case 152:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1255 "osm_qos_parser_y.y"\r
-    {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_ROUTER;\r
-                        }\r
-    break;\r
-\r
-  case 153:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1261 "osm_qos_parser_y.y"\r
-    {\r
-                            p_current_port_group->node_types |=\r
-                               (OSM_QOS_POLICY_NODE_TYPE_CA |\r
-                                OSM_QOS_POLICY_NODE_TYPE_SWITCH |\r
-                                OSM_QOS_POLICY_NODE_TYPE_ROUTER);\r
-                        }\r
-    break;\r
-\r
-  case 154:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1269 "osm_qos_parser_y.y"\r
-    {\r
-                            osm_port_t * p_osm_port =\r
-                                osm_get_port_by_guid(p_qos_policy->p_subn,\r
-                                     p_qos_policy->p_subn->sm_port_guid);\r
-                            if (p_osm_port)\r
-                                __parser_add_port_to_port_map(\r
-                                   &p_current_port_group->port_map,\r
-                                   p_osm_port->p_physp);\r
-                        }\r
-    break;\r
-\r
-  case 155:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1291 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'group' in 'vlarb-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->group_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 156:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1308 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 157:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1313 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'across' in 'vlarb-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->across_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 158:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1330 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 159:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1335 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'vl-high-limit' in 'vlarb-scope' - one instance of one number */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * p_tmp_num;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            if (p_tmp_num)\r
-                            {\r
-                                p_current_vlarb_scope->vl_high_limit = (uint32_t)(*p_tmp_num);\r
-                                p_current_vlarb_scope->vl_high_limit_set = TRUE;\r
-                                free(p_tmp_num);\r
-                            }\r
-\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 160:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1353 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 161:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1358 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'vlarb-high' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->vlarb_high_list,num_pair);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-    break;\r
-\r
-  case 162:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1375 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 163:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1380 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'vlarb-low' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->vlarb_low_list,num_pair);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-    break;\r
-\r
-  case 164:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1397 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 165:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1413 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'group' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->group_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 166:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1430 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 167:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1435 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'across' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str) {\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_from_list,tmp_str);\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_to_list,strdup(tmp_str));\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 168:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1454 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 169:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1459 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'across-from' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_from_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 170:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1476 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 171:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1481 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'across-to' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str) {\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_to_list,tmp_str);\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 172:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1499 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 173:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1504 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'from' in 'sl2vl-scope' - any num of instances */\r
-                        }\r
-    break;\r
-\r
-  case 174:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1509 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 175:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1514 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'to' in 'sl2vl-scope' - any num of instances */\r
-                        }\r
-    break;\r
-\r
-  case 176:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1519 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 179:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1528 "osm_qos_parser_y.y"\r
-    {\r
-                            int i;\r
-                            for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)\r
-                                p_current_sl2vl_scope->from[i] = TRUE;\r
-                        }\r
-    break;\r
-\r
-  case 182:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1539 "osm_qos_parser_y.y"\r
-    {\r
-                            int i;\r
-                            for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)\r
-                                p_current_sl2vl_scope->to[i] = TRUE;\r
-                        }\r
-    break;\r
-\r
-  case 183:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1546 "osm_qos_parser_y.y"\r
-    {\r
-                            int i;\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-                            uint8_t               num1, num2;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                {\r
-                                    if ( (int64_t)num_pair[0] < 0 ||\r
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )\r
-                                    {\r
-                                        yyerror("port number out of range 'from' list");\r
-                                        free(num_pair);\r
-                                        cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                                        return 1;\r
-                                    }\r
-                                    num1 = (uint8_t)num_pair[0];\r
-                                    num2 = (uint8_t)num_pair[1];\r
-                                    free(num_pair);\r
-                                    for (i = num1; i <= num2; i++)\r
-                                        p_current_sl2vl_scope->from[i] = TRUE;\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-    break;\r
-\r
-  case 184:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1578 "osm_qos_parser_y.y"\r
-    {\r
-                            int i;\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-                            uint8_t               num1, num2;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                {\r
-                                    if ( (int64_t)num_pair[0] < 0 ||\r
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )\r
-                                    {\r
-                                        yyerror("port number out of range 'to' list");\r
-                                        free(num_pair);\r
-                                        cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                                        return 1;\r
-                                    }\r
-                                    num1 = (uint8_t)num_pair[0];\r
-                                    num2 = (uint8_t)num_pair[1];\r
-                                    free(num_pair);\r
-                                    for (i = num1; i <= num2; i++)\r
-                                        p_current_sl2vl_scope->to[i] = TRUE;\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-    break;\r
-\r
-  case 185:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1611 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'sl2vl-table' - one instance of exactly\r
-                               OSM_QOS_POLICY_SL2VL_TABLE_LEN numbers */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t              num;\r
-                            uint64_t            * p_num;\r
-                            int                   i = 0;\r
-\r
-                            if (p_current_sl2vl_scope->sl2vl_table_set)\r
-                            {\r
-                                yyerror("sl2vl-scope has more than one sl2vl-table");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            if (cl_list_count(&tmp_parser_struct.num_list) != OSM_QOS_POLICY_SL2VL_TABLE_LEN)\r
-                            {\r
-                                yyerror("wrong number of values in 'sl2vl-table' (should be 16)");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_list) )\r
-                            {\r
-                                p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                                num = *p_num;\r
-                                free(p_num);\r
-                                if (num >= OSM_QOS_POLICY_MAX_VL_NUM)\r
-                                {\r
-                                    yyerror("wrong VL value in 'sl2vl-table' (should be 0 to 15)");\r
-                                    cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                    return 1;\r
-                                }\r
-\r
-                                p_current_sl2vl_scope->sl2vl_table[i++] = (uint8_t)num;\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            p_current_sl2vl_scope->sl2vl_table_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 186:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1654 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 187:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1671 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'name' of 'qos-level' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_level->name)\r
-                            {\r
-                                yyerror("qos-level has multiple 'name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_level->name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 188:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1694 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 189:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1699 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'use' of 'qos-level' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_level->use)\r
-                            {\r
-                                yyerror("qos-level has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_level->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 190:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1722 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 191:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1727 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'sl' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->sl_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'sl' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->sl = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->sl_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 192:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1747 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 193:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1752 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'mtu-limit' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->mtu_limit_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'mtu-limit' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->mtu_limit = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->mtu_limit_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 194:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1772 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'mtu-limit' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 195:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1778 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'rate-limit' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->rate_limit_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'rate-limit' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->rate_limit = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->rate_limit_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 196:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1798 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'rate-limit' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 197:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1804 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'packet-life' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->pkt_life_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'packet-life' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->pkt_life = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->pkt_life_set= TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-    break;\r
-\r
-  case 198:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1824 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'packet-life' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 199:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1830 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'path-bits' in 'qos-level' - any num of instances */\r
-                            /* list of path bit ranges */\r
-\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_level->path_bits_range_len )\r
-                                {\r
-                                    p_current_qos_level->path_bits_range_arr = range_arr;\r
-                                    p_current_qos_level->path_bits_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_level->path_bits_range_arr,\r
-                                                      p_current_qos_level->path_bits_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_level->path_bits_range_arr = new_range_arr;\r
-                                    p_current_qos_level->path_bits_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 200:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1865 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 201:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1870 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'pkey' in 'qos-level' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_level->pkey_range_len )\r
-                                {\r
-                                    p_current_qos_level->pkey_range_arr = range_arr;\r
-                                    p_current_qos_level->pkey_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_level->pkey_range_arr,\r
-                                                      p_current_qos_level->pkey_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_level->pkey_range_arr = new_range_arr;\r
-                                    p_current_qos_level->pkey_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 202:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1903 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 203:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1920 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'use' of 'qos-match-rule' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_match_rule->use)\r
-                            {\r
-                                yyerror("'qos-match-rule' has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_match_rule->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 204:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1943 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 205:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1948 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'qos-class' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            /* list of class ranges (QoS Class is 12-bit value) */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->qos_class_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->qos_class_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->qos_class_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->qos_class_range_arr,\r
-                                                      p_current_qos_match_rule->qos_class_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->qos_class_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->qos_class_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 206:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1982 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 207:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 1987 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'source' in 'qos-match-rule' - text */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_qos_match_rule->source_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 208:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2004 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 209:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2009 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'destination' in 'qos-match-rule' - text */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_qos_match_rule->destination_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 210:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2026 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 211:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2031 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'qos-level-name' in 'qos-match-rule' - single string */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            char               * tmp_str;\r
-\r
-                            if (p_current_qos_match_rule->qos_level_name)\r
-                            {\r
-                                yyerror("qos-match-rule has multiple 'qos-level-name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_match_rule->qos_level_name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-    break;\r
-\r
-  case 212:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2054 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 213:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2059 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'service-id' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->service_id_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->service_id_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->service_id_range_arr,\r
-                                                      p_current_qos_match_rule->service_id_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->service_id_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->service_id_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 214:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2092 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 215:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2097 "osm_qos_parser_y.y"\r
-    {\r
-                            /* 'pkey' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->pkey_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->pkey_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->pkey_range_arr,\r
-                                                      p_current_qos_match_rule->pkey_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->pkey_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->pkey_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-    break;\r
-\r
-  case 216:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2130 "osm_qos_parser_y.y"\r
-    {\r
-                            RESET_BUFFER;\r
-                        }\r
-    break;\r
-\r
-  case 217:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2141 "osm_qos_parser_y.y"\r
-    {\r
-                        cl_list_insert_tail(&tmp_parser_struct.str_list,\r
-                                            strdup(__parser_strip_white(tmp_parser_struct.str)));\r
-                        tmp_parser_struct.str[0] = '\0';\r
-                    }\r
-    break;\r
-\r
-  case 220:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2152 "osm_qos_parser_y.y"\r
-    {\r
-                        strcat(tmp_parser_struct.str,(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-  case 226:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2172 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * p_num = (uint64_t*)malloc(sizeof(uint64_t));\r
-                        __parser_str2uint64(p_num,(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_list, p_num);\r
-                    }\r
-    break;\r
-\r
-  case 227:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2180 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 228:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2186 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 229:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2194 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-  case 230:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2200 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-  case 232:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2209 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 233:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2215 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {\r
-                            num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        else {\r
-                            num_pair[1] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[0] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 234:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2227 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {\r
-                            num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        else {\r
-                            num_pair[1] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[0] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 235:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2239 "osm_qos_parser_y.y"\r
-    {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-    break;\r
-\r
-  case 236:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2247 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-  case 237:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2254 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-  case 238:\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 2260 "osm_qos_parser_y.y"\r
-    {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));\r
-                        free((yyvsp[(1) - (1)]));\r
-                    }\r
-    break;\r
-\r
-\r
-\r
-/* Line 1455 of yacc.c  */\r
-#line 4167 "osm_qos_parser_y.c"\r
-      default: break;\r
-    }\r
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);\r
-\r
-  YYPOPSTACK (yylen);\r
-  yylen = 0;\r
-  YY_STACK_PRINT (yyss, yyssp);\r
-\r
-  *++yyvsp = yyval;\r
-\r
-  /* Now `shift' the result of the reduction.  Determine what state\r
-     that goes to, based on the state we popped back to and the rule\r
-     number reduced by.  */\r
-\r
-  yyn = yyr1[yyn];\r
-\r
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;\r
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)\r
-    yystate = yytable[yystate];\r
-  else\r
-    yystate = yydefgoto[yyn - YYNTOKENS];\r
-\r
-  goto yynewstate;\r
-\r
-\r
-/*------------------------------------.\r
-| yyerrlab -- here on detecting error |\r
-`------------------------------------*/\r
-yyerrlab:\r
-  /* If not already recovering from an error, report this error.  */\r
-  if (!yyerrstatus)\r
-    {\r
-      ++yynerrs;\r
-#if ! YYERROR_VERBOSE\r
-      yyerror (YY_("syntax error"));\r
-#else\r
-      {\r
-       YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);\r
-       if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)\r
-         {\r
-           YYSIZE_T yyalloc = 2 * yysize;\r
-           if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))\r
-             yyalloc = YYSTACK_ALLOC_MAXIMUM;\r
-           if (yymsg != yymsgbuf)\r
-             YYSTACK_FREE (yymsg);\r
-           yymsg = (char *) YYSTACK_ALLOC (yyalloc);\r
-           if (yymsg)\r
-             yymsg_alloc = yyalloc;\r
-           else\r
-             {\r
-               yymsg = yymsgbuf;\r
-               yymsg_alloc = sizeof yymsgbuf;\r
-             }\r
-         }\r
-\r
-       if (0 < yysize && yysize <= yymsg_alloc)\r
-         {\r
-           (void) yysyntax_error (yymsg, yystate, yychar);\r
-           yyerror (yymsg);\r
-         }\r
-       else\r
-         {\r
-           yyerror (YY_("syntax error"));\r
-           if (yysize != 0)\r
-             goto yyexhaustedlab;\r
-         }\r
-      }\r
-#endif\r
-    }\r
-\r
-\r
-\r
-  if (yyerrstatus == 3)\r
-    {\r
-      /* If just tried and failed to reuse lookahead token after an\r
-        error, discard it.  */\r
-\r
-      if (yychar <= YYEOF)\r
-       {\r
-         /* Return failure if at end of input.  */\r
-         if (yychar == YYEOF)\r
-           YYABORT;\r
-       }\r
-      else\r
-       {\r
-         yydestruct ("Error: discarding",\r
-                     yytoken, &yylval);\r
-         yychar = YYEMPTY;\r
-       }\r
-    }\r
-\r
-  /* Else will try to reuse lookahead token after shifting the error\r
-     token.  */\r
-  goto yyerrlab1;\r
-\r
-\r
-/*---------------------------------------------------.\r
-| yyerrorlab -- error raised explicitly by YYERROR.  |\r
-`---------------------------------------------------*/\r
-yyerrorlab:\r
-\r
-  /* Pacify compilers like GCC when the user code never invokes\r
-     YYERROR and the label yyerrorlab therefore never appears in user\r
-     code.  */\r
-  if (/*CONSTCOND*/ 0)\r
-     goto yyerrorlab;\r
-\r
-  /* Do not reclaim the symbols of the rule which action triggered\r
-     this YYERROR.  */\r
-  YYPOPSTACK (yylen);\r
-  yylen = 0;\r
-  YY_STACK_PRINT (yyss, yyssp);\r
-  yystate = *yyssp;\r
-  goto yyerrlab1;\r
-\r
-\r
-/*-------------------------------------------------------------.\r
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |\r
-`-------------------------------------------------------------*/\r
-yyerrlab1:\r
-  yyerrstatus = 3;     /* Each real token shifted decrements this.  */\r
-\r
-  for (;;)\r
-    {\r
-      yyn = yypact[yystate];\r
-      if (yyn != YYPACT_NINF)\r
-       {\r
-         yyn += YYTERROR;\r
-         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)\r
-           {\r
-             yyn = yytable[yyn];\r
-             if (0 < yyn)\r
-               break;\r
-           }\r
-       }\r
-\r
-      /* Pop the current state because it cannot handle the error token.  */\r
-      if (yyssp == yyss)\r
-       YYABORT;\r
-\r
-\r
-      yydestruct ("Error: popping",\r
-                 yystos[yystate], yyvsp);\r
-      YYPOPSTACK (1);\r
-      yystate = *yyssp;\r
-      YY_STACK_PRINT (yyss, yyssp);\r
-    }\r
-\r
-  *++yyvsp = yylval;\r
-\r
-\r
-  /* Shift the error token.  */\r
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);\r
-\r
-  yystate = yyn;\r
-  goto yynewstate;\r
-\r
-\r
-/*-------------------------------------.\r
-| yyacceptlab -- YYACCEPT comes here.  |\r
-`-------------------------------------*/\r
-yyacceptlab:\r
-  yyresult = 0;\r
-  goto yyreturn;\r
-\r
-/*-----------------------------------.\r
-| yyabortlab -- YYABORT comes here.  |\r
-`-----------------------------------*/\r
-yyabortlab:\r
-  yyresult = 1;\r
-  goto yyreturn;\r
-\r
-#if !defined(yyoverflow) || YYERROR_VERBOSE\r
-/*-------------------------------------------------.\r
-| yyexhaustedlab -- memory exhaustion comes here.  |\r
-`-------------------------------------------------*/\r
-yyexhaustedlab:\r
-  yyerror (YY_("memory exhausted"));\r
-  yyresult = 2;\r
-  /* Fall through.  */\r
-#endif\r
-\r
-yyreturn:\r
-  if (yychar != YYEMPTY)\r
-     yydestruct ("Cleanup: discarding lookahead",\r
-                yytoken, &yylval);\r
-  /* Do not reclaim the symbols of the rule which action triggered\r
-     this YYABORT or YYACCEPT.  */\r
-  YYPOPSTACK (yylen);\r
-  YY_STACK_PRINT (yyss, yyssp);\r
-  while (yyssp != yyss)\r
-    {\r
-      yydestruct ("Cleanup: popping",\r
-                 yystos[*yyssp], yyvsp);\r
-      YYPOPSTACK (1);\r
-    }\r
-#ifndef yyoverflow\r
-  if (yyss != yyssa)\r
-    YYSTACK_FREE (yyss);\r
-#endif\r
-#if YYERROR_VERBOSE\r
-  if (yymsg != yymsgbuf)\r
-    YYSTACK_FREE (yymsg);\r
-#endif\r
-  /* Make sure YYID is used.  */\r
-  return YYID (yyresult);\r
-}\r
-\r
-\r
-\r
-/* Line 1675 of yacc.c  */\r
-#line 2266 "osm_qos_parser_y.y"\r
-\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int osm_qos_parse_policy_file(IN osm_subn_t * p_subn)\r
-{\r
-    int res = 0;\r
-    static boolean_t first_time = TRUE;\r
-    p_qos_parser_osm_log = &p_subn->p_osm->log;\r
-\r
-    OSM_LOG_ENTER(p_qos_parser_osm_log);\r
-\r
-    osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-    p_subn->p_qos_policy = NULL;\r
-\r
-    yyin = fopen (p_subn->opt.qos_policy_file, "r");\r
-    if (!yyin)\r
-    {\r
-        if (strcmp(p_subn->opt.qos_policy_file,OSM_DEFAULT_QOS_POLICY_FILE)) {\r
-            OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC01: "\r
-                    "Failed opening QoS policy file %s - %s\n",\r
-                    p_subn->opt.qos_policy_file, strerror(errno));\r
-            res = 1;\r
-        }\r
-        else\r
-            OSM_LOG(p_qos_parser_osm_log, OSM_LOG_VERBOSE,\r
-                    "QoS policy file not found (%s)\n",\r
-                    p_subn->opt.qos_policy_file);\r
-\r
-        goto Exit;\r
-    }\r
-\r
-    if (first_time)\r
-    {\r
-        first_time = FALSE;\r
-        __setup_simple_qos_levels();\r
-        __setup_ulp_match_rules();\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_INFO,\r
-               "Loading QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-    }\r
-    else\r
-        /*\r
-         * ULP match rules list was emptied at the end of\r
-         * previous parsing iteration.\r
-         * What's left is to clear simple QoS levels.\r
-         */\r
-        __clear_simple_qos_levels();\r
-\r
-    column_num = 1;\r
-    line_num = 1;\r
-\r
-    p_subn->p_qos_policy = osm_qos_policy_create(p_subn);\r
-\r
-    __parser_tmp_struct_init();\r
-    p_qos_policy = p_subn->p_qos_policy;\r
-\r
-    res = yyparse();\r
-\r
-    __parser_tmp_struct_destroy();\r
-\r
-    if (res != 0)\r
-    {\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC03: "\r
-                "Failed parsing QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-        p_subn->p_qos_policy = NULL;\r
-        res = 1;\r
-        goto Exit;\r
-    }\r
-\r
-    /* add generated ULP match rules to the usual match rules */\r
-    __process_ulp_match_rules();\r
-\r
-    if (osm_qos_policy_validate(p_subn->p_qos_policy,p_qos_parser_osm_log))\r
-    {\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC04: "\r
-                "Error(s) in QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        fprintf(stderr, "Error(s) in QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-        p_subn->p_qos_policy = NULL;\r
-        res = 1;\r
-        goto Exit;\r
-    }\r
-\r
-  Exit:\r
-    if (yyin)\r
-        fclose(yyin);\r
-    OSM_LOG_EXIT(p_qos_parser_osm_log);\r
-    return res;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int yywrap()\r
-{\r
-    return(1);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void yyerror(const char *format, ...)\r
-{\r
-    char s[256];\r
-    va_list pvar;\r
-\r
-    OSM_LOG_ENTER(p_qos_parser_osm_log);\r
-\r
-    va_start(pvar, format);\r
-    vsnprintf(s, sizeof(s), format, pvar);\r
-    va_end(pvar);\r
-\r
-    OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC05: "\r
-            "Syntax error (line %d:%d): %s\n",\r
-            line_num, column_num, s);\r
-    fprintf(stderr, "Error in QoS Policy File (line %d:%d): %s.\n",\r
-            line_num, column_num, s);\r
-    OSM_LOG_EXIT(p_qos_parser_osm_log);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static char * __parser_strip_white(char * str)\r
-{\r
-       char *p;\r
-\r
-       while (isspace(*str))\r
-               str++;\r
-       if (!*str)\r
-               return str;\r
-       p = str + strlen(str) - 1;\r
-       while (isspace(*p))\r
-               *p-- = '\0';\r
-\r
-       return str;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_str2uint64(uint64_t * p_val, char * str)\r
-{\r
-   *p_val = strtoull(str, NULL, 0);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_port_group_start()\r
-{\r
-    p_current_port_group = osm_qos_policy_port_group_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_port_group_end()\r
-{\r
-    if(!p_current_port_group->name)\r
-    {\r
-        yyerror("port-group validation failed - no port group name specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->port_groups,\r
-                        p_current_port_group);\r
-    p_current_port_group = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_vlarb_scope_start()\r
-{\r
-    p_current_vlarb_scope = osm_qos_policy_vlarb_scope_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_vlarb_scope_end()\r
-{\r
-    if ( !cl_list_count(&p_current_vlarb_scope->group_list) &&\r
-         !cl_list_count(&p_current_vlarb_scope->across_list) )\r
-    {\r
-        yyerror("vlarb-scope validation failed - no port groups specified by 'group' or by 'across'");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->vlarb_tables,\r
-                        p_current_vlarb_scope);\r
-    p_current_vlarb_scope = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_sl2vl_scope_start()\r
-{\r
-    p_current_sl2vl_scope = osm_qos_policy_sl2vl_scope_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_sl2vl_scope_end()\r
-{\r
-    if (!p_current_sl2vl_scope->sl2vl_table_set)\r
-    {\r
-        yyerror("sl2vl-scope validation failed - no sl2vl table specified");\r
-        return -1;\r
-    }\r
-    if ( !cl_list_count(&p_current_sl2vl_scope->group_list) &&\r
-         !cl_list_count(&p_current_sl2vl_scope->across_to_list) &&\r
-         !cl_list_count(&p_current_sl2vl_scope->across_from_list) )\r
-    {\r
-        yyerror("sl2vl-scope validation failed - no port groups specified by 'group', 'across-to' or 'across-from'");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->sl2vl_tables,\r
-                        p_current_sl2vl_scope);\r
-    p_current_sl2vl_scope = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_qos_level_start()\r
-{\r
-    p_current_qos_level = osm_qos_policy_qos_level_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_qos_level_end()\r
-{\r
-    if (!p_current_qos_level->sl_set)\r
-    {\r
-        yyerror("qos-level validation failed - no 'sl' specified");\r
-        return -1;\r
-    }\r
-    if (!p_current_qos_level->name)\r
-    {\r
-        yyerror("qos-level validation failed - no 'name' specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->qos_levels,\r
-                        p_current_qos_level);\r
-    p_current_qos_level = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_match_rule_start()\r
-{\r
-    p_current_qos_match_rule = osm_qos_policy_match_rule_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_match_rule_end()\r
-{\r
-    if (!p_current_qos_match_rule->qos_level_name)\r
-    {\r
-        yyerror("match-rule validation failed - no 'qos-level-name' specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->qos_match_rules,\r
-                        p_current_qos_match_rule);\r
-    p_current_qos_match_rule = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_ulp_match_rule_start()\r
-{\r
-    p_current_qos_match_rule = osm_qos_policy_match_rule_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_ulp_match_rule_end()\r
-{\r
-    CL_ASSERT(p_current_qos_match_rule->p_qos_level);\r
-    cl_list_insert_tail(&__ulp_match_rules,\r
-                        p_current_qos_match_rule);\r
-    p_current_qos_match_rule = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_tmp_struct_init()\r
-{\r
-    tmp_parser_struct.str[0] = '\0';\r
-    cl_list_construct(&tmp_parser_struct.str_list);\r
-    cl_list_init(&tmp_parser_struct.str_list, 10);\r
-    cl_list_construct(&tmp_parser_struct.num_list);\r
-    cl_list_init(&tmp_parser_struct.num_list, 10);\r
-    cl_list_construct(&tmp_parser_struct.num_pair_list);\r
-    cl_list_init(&tmp_parser_struct.num_pair_list, 10);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-/*\r
- * Do NOT free objects from the temp struct.\r
- * Either they are inserted into the parse tree data\r
- * structure, or they are already freed when copying\r
- * their values to the parse tree data structure.\r
- */\r
-static void __parser_tmp_struct_reset()\r
-{\r
-    tmp_parser_struct.str[0] = '\0';\r
-    cl_list_remove_all(&tmp_parser_struct.str_list);\r
-    cl_list_remove_all(&tmp_parser_struct.num_list);\r
-    cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_tmp_struct_destroy()\r
-{\r
-    __parser_tmp_struct_reset();\r
-    cl_list_destroy(&tmp_parser_struct.str_list);\r
-    cl_list_destroy(&tmp_parser_struct.num_list);\r
-    cl_list_destroy(&tmp_parser_struct.num_pair_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-#define __SIMPLE_QOS_LEVEL_NAME "SimpleQoSLevel_SL"\r
-#define __SIMPLE_QOS_LEVEL_DEFAULT_NAME "SimpleQoSLevel_DEFAULT"\r
-\r
-static void __setup_simple_qos_levels()\r
-{\r
-    uint8_t i;\r
-    char tmp_buf[30];\r
-    memset(osm_qos_policy_simple_qos_levels, 0,\r
-           sizeof(osm_qos_policy_simple_qos_levels));\r
-    for (i = 0; i < 16; i++)\r
-    {\r
-        osm_qos_policy_simple_qos_levels[i].sl = i;\r
-        osm_qos_policy_simple_qos_levels[i].sl_set = TRUE;\r
-        sprintf(tmp_buf, "%s%u", __SIMPLE_QOS_LEVEL_NAME, i);\r
-        osm_qos_policy_simple_qos_levels[i].name = strdup(tmp_buf);\r
-    }\r
-\r
-    memset(&__default_simple_qos_level, 0,\r
-           sizeof(__default_simple_qos_level));\r
-    __default_simple_qos_level.name =\r
-           strdup(__SIMPLE_QOS_LEVEL_DEFAULT_NAME);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __clear_simple_qos_levels()\r
-{\r
-    /*\r
-     * Simple QoS levels are static.\r
-     * What's left is to invalidate default simple QoS level.\r
-     */\r
-    __default_simple_qos_level.sl_set = FALSE;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __setup_ulp_match_rules()\r
-{\r
-    cl_list_construct(&__ulp_match_rules);\r
-    cl_list_init(&__ulp_match_rules, 10);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __process_ulp_match_rules()\r
-{\r
-    cl_list_iterator_t list_iterator;\r
-    osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-\r
-    list_iterator = cl_list_head(&__ulp_match_rules);\r
-    while (list_iterator != cl_list_end(&__ulp_match_rules))\r
-    {\r
-        p_qos_match_rule = (osm_qos_match_rule_t *) cl_list_obj(list_iterator);\r
-        if (p_qos_match_rule)\r
-            cl_list_insert_tail(&p_qos_policy->qos_match_rules,\r
-                                p_qos_match_rule);\r
-        list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(&__ulp_match_rules);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __cdecl __cmp_num_range(const void * p1, const void * p2)\r
-{\r
-    uint64_t * pair1 = *((uint64_t **)p1);\r
-    uint64_t * pair2 = *((uint64_t **)p2);\r
-\r
-    if (pair1[0] < pair2[0])\r
-        return -1;\r
-    if (pair1[0] > pair2[0])\r
-        return 1;\r
-\r
-    if (pair1[1] < pair2[1])\r
-        return -1;\r
-    if (pair1[1] > pair2[1])\r
-        return 1;\r
-\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __sort_reduce_rangearr(\r
-    uint64_t  **   arr,\r
-    unsigned       arr_len,\r
-    uint64_t  ** * p_res_arr,\r
-    unsigned     * p_res_arr_len )\r
-{\r
-    unsigned i = 0;\r
-    unsigned j = 0;\r
-    unsigned last_valid_ind = 0;\r
-    unsigned valid_cnt = 0;\r
-    uint64_t ** res_arr;\r
-    boolean_t * is_valid_arr;\r
-\r
-    *p_res_arr = NULL;\r
-    *p_res_arr_len = 0;\r
-\r
-    qsort(arr, arr_len, sizeof(uint64_t*), __cmp_num_range);\r
-\r
-    is_valid_arr = (boolean_t *)malloc(arr_len * sizeof(boolean_t));\r
-    is_valid_arr[last_valid_ind] = TRUE;\r
-    valid_cnt++;\r
-    for (i = 1; i < arr_len; i++)\r
-    {\r
-        if (arr[i][0] <= arr[last_valid_ind][1])\r
-        {\r
-            if (arr[i][1] > arr[last_valid_ind][1])\r
-                arr[last_valid_ind][1] = arr[i][1];\r
-            free(arr[i]);\r
-            arr[i] = NULL;\r
-            is_valid_arr[i] = FALSE;\r
-        }\r
-        else if ((arr[i][0] - 1) == arr[last_valid_ind][1])\r
-        {\r
-            arr[last_valid_ind][1] = arr[i][1];\r
-            free(arr[i]);\r
-            arr[i] = NULL;\r
-            is_valid_arr[i] = FALSE;\r
-        }\r
-        else\r
-        {\r
-            is_valid_arr[i] = TRUE;\r
-            last_valid_ind = i;\r
-            valid_cnt++;\r
-        }\r
-    }\r
-\r
-    res_arr = (uint64_t **)malloc(valid_cnt * sizeof(uint64_t *));\r
-    for (i = 0; i < arr_len; i++)\r
-    {\r
-        if (is_valid_arr[i])\r
-            res_arr[j++] = arr[i];\r
-    }\r
-    free(is_valid_arr);\r
-    free(arr);\r
-\r
-    *p_res_arr = res_arr;\r
-    *p_res_arr_len = valid_cnt;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __pkey_rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len)\r
-{\r
-    uint64_t   tmp_pkey;\r
-    uint64_t * p_pkeys;\r
-    cl_list_iterator_t list_iterator;\r
-\r
-    list_iterator= cl_list_head(p_list);\r
-    while( list_iterator != cl_list_end(p_list) )\r
-    {\r
-       p_pkeys = (uint64_t *)cl_list_obj(list_iterator);\r
-       p_pkeys[0] &= 0x7fff;\r
-       p_pkeys[1] &= 0x7fff;\r
-       if (p_pkeys[0] > p_pkeys[1])\r
-       {\r
-           tmp_pkey = p_pkeys[1];\r
-           p_pkeys[1] = p_pkeys[0];\r
-           p_pkeys[0] = tmp_pkey;\r
-       }\r
-       list_iterator = cl_list_next(list_iterator);\r
-    }\r
-\r
-    __rangelist2rangearr(p_list, p_arr, p_arr_len);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len)\r
-{\r
-    cl_list_iterator_t list_iterator;\r
-    unsigned len = cl_list_count(p_list);\r
-    unsigned i = 0;\r
-    uint64_t ** tmp_arr;\r
-    uint64_t ** res_arr = NULL;\r
-    unsigned res_arr_len = 0;\r
-\r
-    tmp_arr = (uint64_t **)malloc(len * sizeof(uint64_t *));\r
-\r
-    list_iterator = cl_list_head(p_list);\r
-    while( list_iterator != cl_list_end(p_list) )\r
-    {\r
-       tmp_arr[i++] = (uint64_t *)cl_list_obj(list_iterator);\r
-       list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(p_list);\r
-\r
-    __sort_reduce_rangearr( tmp_arr,\r
-                            len,\r
-                            &res_arr,\r
-                            &res_arr_len );\r
-    *p_arr = res_arr;\r
-    *p_arr_len = res_arr_len;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __merge_rangearr(\r
-    uint64_t  **   range_arr_1,\r
-    unsigned       range_len_1,\r
-    uint64_t  **   range_arr_2,\r
-    unsigned       range_len_2,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len )\r
-{\r
-    unsigned i = 0;\r
-    unsigned j = 0;\r
-    unsigned len = range_len_1 + range_len_2;\r
-    uint64_t ** tmp_arr;\r
-    uint64_t ** res_arr = NULL;\r
-    unsigned res_arr_len = 0;\r
-\r
-    *p_arr = NULL;\r
-    *p_arr_len = 0;\r
-\r
-    tmp_arr = (uint64_t **)malloc(len * sizeof(uint64_t *));\r
-\r
-    for (i = 0; i < range_len_1; i++)\r
-       tmp_arr[j++] = range_arr_1[i];\r
-    for (i = 0; i < range_len_2; i++)\r
-       tmp_arr[j++] = range_arr_2[i];\r
-    free(range_arr_1);\r
-    free(range_arr_2);\r
-\r
-    __sort_reduce_rangearr( tmp_arr,\r
-                            len,\r
-                            &res_arr,\r
-                            &res_arr_len );\r
-    *p_arr = res_arr;\r
-    *p_arr_len = res_arr_len;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_port_to_port_map(\r
-    cl_qmap_t   * p_map,\r
-    osm_physp_t * p_physp)\r
-{\r
-    if (cl_qmap_get(p_map, cl_ntoh64(osm_physp_get_port_guid(p_physp))) ==\r
-        cl_qmap_end(p_map))\r
-    {\r
-        osm_qos_port_t * p_port = osm_qos_policy_port_create(p_physp);\r
-        if (p_port)\r
-            cl_qmap_insert(p_map,\r
-                           cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                           &p_port->map_item);\r
-    }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_guid_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len)\r
-{\r
-    unsigned i;\r
-    uint64_t guid_ho;\r
-    osm_port_t * p_osm_port;\r
-\r
-    if (!range_arr || !range_len)\r
-        return;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-         for (guid_ho = range_arr[i][0]; guid_ho <= range_arr[i][1]; guid_ho++) {\r
-             p_osm_port =\r
-                osm_get_port_by_guid(p_qos_policy->p_subn, cl_hton64(guid_ho));\r
-             if (p_osm_port)\r
-                 __parser_add_port_to_port_map(p_map, p_osm_port->p_physp);\r
-         }\r
-         free(range_arr[i]);\r
-    }\r
-    free(range_arr);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_pkey_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len)\r
-{\r
-    unsigned i;\r
-    uint64_t pkey_64;\r
-    ib_net16_t pkey;\r
-    osm_prtn_t * p_prtn;\r
-\r
-    if (!range_arr || !range_len)\r
-        return;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-         for (pkey_64 = range_arr[i][0]; pkey_64 <= range_arr[i][1]; pkey_64++) {\r
-             pkey = cl_hton16((uint16_t)(pkey_64 & 0x7fff));\r
-             p_prtn = (osm_prtn_t *)\r
-                 cl_qmap_get(&p_qos_policy->p_subn->prtn_pkey_tbl, pkey);\r
-             if (p_prtn != (osm_prtn_t *)cl_qmap_end(\r
-                   &p_qos_policy->p_subn->prtn_pkey_tbl)) {\r
-                 __parser_add_map_to_port_map(p_map, &p_prtn->part_guid_tbl);\r
-                 __parser_add_map_to_port_map(p_map, &p_prtn->full_guid_tbl);\r
-             }\r
-         }\r
-         free(range_arr[i]);\r
-    }\r
-    free(range_arr);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_partition_list_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    cl_list_t  * p_list)\r
-{\r
-    cl_list_iterator_t    list_iterator;\r
-    char                * tmp_str;\r
-    osm_prtn_t          * p_prtn;\r
-\r
-    /* extract all the ports from the partition\r
-       to the port map of this port group */\r
-    list_iterator = cl_list_head(p_list);\r
-    while(list_iterator != cl_list_end(p_list)) {\r
-        tmp_str = (char*)cl_list_obj(list_iterator);\r
-        if (tmp_str) {\r
-            p_prtn = osm_prtn_find_by_name(p_qos_policy->p_subn, tmp_str);\r
-            if (p_prtn) {\r
-                __parser_add_map_to_port_map(p_map, &p_prtn->part_guid_tbl);\r
-                __parser_add_map_to_port_map(p_map, &p_prtn->full_guid_tbl);\r
-            }\r
-            free(tmp_str);\r
-        }\r
-        list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(p_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_map_to_port_map(\r
-    cl_qmap_t * p_dmap,\r
-    cl_map_t  * p_smap)\r
-{\r
-    cl_map_iterator_t map_iterator;\r
-    osm_physp_t * p_physp;\r
-\r
-    if (!p_dmap || !p_smap)\r
-        return;\r
-\r
-    map_iterator = cl_map_head(p_smap);\r
-    while (map_iterator != cl_map_end(p_smap)) {\r
-        p_physp = (osm_physp_t*)cl_map_obj(map_iterator);\r
-        __parser_add_port_to_port_map(p_dmap, p_physp);\r
-        map_iterator = cl_map_next(map_iterator);\r
-    }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __validate_pkeys( uint64_t ** range_arr,\r
-                             unsigned    range_len,\r
-                             boolean_t   is_ipoib)\r
-{\r
-    unsigned i;\r
-    uint64_t pkey_64;\r
-    ib_net16_t pkey;\r
-    osm_prtn_t * p_prtn;\r
-\r
-    if (!range_arr || !range_len)\r
-        return 0;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-        for (pkey_64 = range_arr[i][0]; pkey_64 <= range_arr[i][1]; pkey_64++) {\r
-            pkey = cl_hton16((uint16_t)(pkey_64 & 0x7fff));\r
-            p_prtn = (osm_prtn_t *)\r
-                cl_qmap_get(&p_qos_policy->p_subn->prtn_pkey_tbl, pkey);\r
-\r
-            if (p_prtn == (osm_prtn_t *)cl_qmap_end(\r
-                  &p_qos_policy->p_subn->prtn_pkey_tbl))\r
-                p_prtn = NULL;\r
-\r
-            if (is_ipoib) {\r
-                /*\r
-                 * Be very strict for IPoIB partition:\r
-                 *  - the partition for the pkey have to exist\r
-                 *  - it has to have at least 2 full members\r
-                 */\r
-                if (!p_prtn) {\r
-                    yyerror("IPoIB partition, pkey 0x%04X - "\r
-                                       "partition doesn't exist",\r
-                                       cl_ntoh16(pkey));\r
-                    return 1;\r
-                }\r
-                else if (cl_map_count(&p_prtn->full_guid_tbl) < 2) {\r
-                    yyerror("IPoIB partition, pkey 0x%04X - "\r
-                                       "partition has less than two full members",\r
-                                       cl_ntoh16(pkey));\r
-                    return 1;\r
-                }\r
-            }\r
-            else if (!p_prtn) {\r
-                /*\r
-                 * For non-IPoIB pkey we just want to check that\r
-                 * the relevant partition exists.\r
-                 * And even if it doesn't, don't exit - just print\r
-                 * error message and continue.\r
-                 */\r
-                 OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC02: "\r
-                        "pkey 0x%04X - partition doesn't exist",\r
-                         cl_ntoh16(pkey));\r
-            }\r
-        }\r
-    }\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_y.h b/branches/opensm_3/user/opensm/osm_qos_parser_y.h
deleted file mode 100644 (file)
index ed19e9a..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-\r
-/* A Bison parser, made by GNU Bison 2.4.1.  */\r
-\r
-/* Skeleton interface for Bison's Yacc-like parsers in C\r
-   \r
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006\r
-   Free Software Foundation, Inc.\r
-   \r
-   This program is free software: you can redistribute it and/or modify\r
-   it under the terms of the GNU General Public License as published by\r
-   the Free Software Foundation, either version 3 of the License, or\r
-   (at your option) any later version.\r
-   \r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-   \r
-   You should have received a copy of the GNU General Public License\r
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
-\r
-/* As a special exception, you may create a larger work that contains\r
-   part or all of the Bison parser skeleton and distribute that work\r
-   under terms of your choice, so long as that work isn't itself a\r
-   parser generator using the skeleton or a modified version thereof\r
-   as a parser skeleton.  Alternatively, if you modify or redistribute\r
-   the parser skeleton itself, you may (at your option) remove this\r
-   special exception, which will cause the skeleton and the resulting\r
-   Bison output files to be licensed under the GNU General Public\r
-   License without this special exception.\r
-   \r
-   This special exception was added by the Free Software Foundation in\r
-   version 2.2 of Bison.  */\r
-\r
-\r
-/* Tokens.  */\r
-#ifndef YYTOKENTYPE\r
-# define YYTOKENTYPE\r
-   /* Put the tokens into the symbol table, so that GDB and other debuggers\r
-      know about them.  */\r
-   enum yytokentype {\r
-     TK_NUMBER = 258,\r
-     TK_DASH = 259,\r
-     TK_DOTDOT = 260,\r
-     TK_COMMA = 261,\r
-     TK_ASTERISK = 262,\r
-     TK_TEXT = 263,\r
-     TK_QOS_ULPS_START = 264,\r
-     TK_QOS_ULPS_END = 265,\r
-     TK_PORT_GROUPS_START = 266,\r
-     TK_PORT_GROUPS_END = 267,\r
-     TK_PORT_GROUP_START = 268,\r
-     TK_PORT_GROUP_END = 269,\r
-     TK_QOS_SETUP_START = 270,\r
-     TK_QOS_SETUP_END = 271,\r
-     TK_VLARB_TABLES_START = 272,\r
-     TK_VLARB_TABLES_END = 273,\r
-     TK_VLARB_SCOPE_START = 274,\r
-     TK_VLARB_SCOPE_END = 275,\r
-     TK_SL2VL_TABLES_START = 276,\r
-     TK_SL2VL_TABLES_END = 277,\r
-     TK_SL2VL_SCOPE_START = 278,\r
-     TK_SL2VL_SCOPE_END = 279,\r
-     TK_QOS_LEVELS_START = 280,\r
-     TK_QOS_LEVELS_END = 281,\r
-     TK_QOS_LEVEL_START = 282,\r
-     TK_QOS_LEVEL_END = 283,\r
-     TK_QOS_MATCH_RULES_START = 284,\r
-     TK_QOS_MATCH_RULES_END = 285,\r
-     TK_QOS_MATCH_RULE_START = 286,\r
-     TK_QOS_MATCH_RULE_END = 287,\r
-     TK_NAME = 288,\r
-     TK_USE = 289,\r
-     TK_PORT_GUID = 290,\r
-     TK_PORT_NAME = 291,\r
-     TK_PARTITION = 292,\r
-     TK_NODE_TYPE = 293,\r
-     TK_GROUP = 294,\r
-     TK_ACROSS = 295,\r
-     TK_VLARB_HIGH = 296,\r
-     TK_VLARB_LOW = 297,\r
-     TK_VLARB_HIGH_LIMIT = 298,\r
-     TK_TO = 299,\r
-     TK_FROM = 300,\r
-     TK_ACROSS_TO = 301,\r
-     TK_ACROSS_FROM = 302,\r
-     TK_SL2VL_TABLE = 303,\r
-     TK_SL = 304,\r
-     TK_MTU_LIMIT = 305,\r
-     TK_RATE_LIMIT = 306,\r
-     TK_PACKET_LIFE = 307,\r
-     TK_PATH_BITS = 308,\r
-     TK_QOS_CLASS = 309,\r
-     TK_SOURCE = 310,\r
-     TK_DESTINATION = 311,\r
-     TK_SERVICE_ID = 312,\r
-     TK_QOS_LEVEL_NAME = 313,\r
-     TK_PKEY = 314,\r
-     TK_NODE_TYPE_ROUTER = 315,\r
-     TK_NODE_TYPE_CA = 316,\r
-     TK_NODE_TYPE_SWITCH = 317,\r
-     TK_NODE_TYPE_SELF = 318,\r
-     TK_NODE_TYPE_ALL = 319,\r
-     TK_ULP_DEFAULT = 320,\r
-     TK_ULP_ANY_SERVICE_ID = 321,\r
-     TK_ULP_ANY_PKEY = 322,\r
-     TK_ULP_ANY_TARGET_PORT_GUID = 323,\r
-     TK_ULP_SDP_DEFAULT = 324,\r
-     TK_ULP_SDP_PORT = 325,\r
-     TK_ULP_RDS_DEFAULT = 326,\r
-     TK_ULP_RDS_PORT = 327,\r
-     TK_ULP_ISER_DEFAULT = 328,\r
-     TK_ULP_ISER_PORT = 329,\r
-     TK_ULP_SRP_GUID = 330,\r
-     TK_ULP_IPOIB_DEFAULT = 331,\r
-     TK_ULP_IPOIB_PKEY = 332\r
-   };\r
-#endif\r
-/* Tokens.  */\r
-#define TK_NUMBER 258\r
-#define TK_DASH 259\r
-#define TK_DOTDOT 260\r
-#define TK_COMMA 261\r
-#define TK_ASTERISK 262\r
-#define TK_TEXT 263\r
-#define TK_QOS_ULPS_START 264\r
-#define TK_QOS_ULPS_END 265\r
-#define TK_PORT_GROUPS_START 266\r
-#define TK_PORT_GROUPS_END 267\r
-#define TK_PORT_GROUP_START 268\r
-#define TK_PORT_GROUP_END 269\r
-#define TK_QOS_SETUP_START 270\r
-#define TK_QOS_SETUP_END 271\r
-#define TK_VLARB_TABLES_START 272\r
-#define TK_VLARB_TABLES_END 273\r
-#define TK_VLARB_SCOPE_START 274\r
-#define TK_VLARB_SCOPE_END 275\r
-#define TK_SL2VL_TABLES_START 276\r
-#define TK_SL2VL_TABLES_END 277\r
-#define TK_SL2VL_SCOPE_START 278\r
-#define TK_SL2VL_SCOPE_END 279\r
-#define TK_QOS_LEVELS_START 280\r
-#define TK_QOS_LEVELS_END 281\r
-#define TK_QOS_LEVEL_START 282\r
-#define TK_QOS_LEVEL_END 283\r
-#define TK_QOS_MATCH_RULES_START 284\r
-#define TK_QOS_MATCH_RULES_END 285\r
-#define TK_QOS_MATCH_RULE_START 286\r
-#define TK_QOS_MATCH_RULE_END 287\r
-#define TK_NAME 288\r
-#define TK_USE 289\r
-#define TK_PORT_GUID 290\r
-#define TK_PORT_NAME 291\r
-#define TK_PARTITION 292\r
-#define TK_NODE_TYPE 293\r
-#define TK_GROUP 294\r
-#define TK_ACROSS 295\r
-#define TK_VLARB_HIGH 296\r
-#define TK_VLARB_LOW 297\r
-#define TK_VLARB_HIGH_LIMIT 298\r
-#define TK_TO 299\r
-#define TK_FROM 300\r
-#define TK_ACROSS_TO 301\r
-#define TK_ACROSS_FROM 302\r
-#define TK_SL2VL_TABLE 303\r
-#define TK_SL 304\r
-#define TK_MTU_LIMIT 305\r
-#define TK_RATE_LIMIT 306\r
-#define TK_PACKET_LIFE 307\r
-#define TK_PATH_BITS 308\r
-#define TK_QOS_CLASS 309\r
-#define TK_SOURCE 310\r
-#define TK_DESTINATION 311\r
-#define TK_SERVICE_ID 312\r
-#define TK_QOS_LEVEL_NAME 313\r
-#define TK_PKEY 314\r
-#define TK_NODE_TYPE_ROUTER 315\r
-#define TK_NODE_TYPE_CA 316\r
-#define TK_NODE_TYPE_SWITCH 317\r
-#define TK_NODE_TYPE_SELF 318\r
-#define TK_NODE_TYPE_ALL 319\r
-#define TK_ULP_DEFAULT 320\r
-#define TK_ULP_ANY_SERVICE_ID 321\r
-#define TK_ULP_ANY_PKEY 322\r
-#define TK_ULP_ANY_TARGET_PORT_GUID 323\r
-#define TK_ULP_SDP_DEFAULT 324\r
-#define TK_ULP_SDP_PORT 325\r
-#define TK_ULP_RDS_DEFAULT 326\r
-#define TK_ULP_RDS_PORT 327\r
-#define TK_ULP_ISER_DEFAULT 328\r
-#define TK_ULP_ISER_PORT 329\r
-#define TK_ULP_SRP_GUID 330\r
-#define TK_ULP_IPOIB_DEFAULT 331\r
-#define TK_ULP_IPOIB_PKEY 332\r
-\r
-\r
-\r
-\r
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED\r
-typedef int YYSTYPE;\r
-# define YYSTYPE_IS_TRIVIAL 1\r
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */\r
-# define YYSTYPE_IS_DECLARED 1\r
-#endif\r
-\r
-extern YYSTYPE yylval;\r
-\r
-\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_y.y b/branches/opensm_3/user/opensm/osm_qos_parser_y.y
deleted file mode 100644 (file)
index f5c9ba0..0000000
+++ /dev/null
@@ -1,3066 +0,0 @@
-%{\r
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Grammar of OSM QoS parser.\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-#ifdef __WIN__\r
-#include <stddef.h>\r
-#endif\r
-#include <stdio.h>\r
-#include <assert.h>\r
-#include <stdarg.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_qos_policy.h>\r
-#ifdef __WIN__\r
-/* prevent redefinition in windows header files */\r
-#define malloc\r
-#define free\r
-#endif\r
-\r
-#define OSM_QOS_POLICY_MAX_LINE_LEN         1024*10\r
-#define OSM_QOS_POLICY_SL2VL_TABLE_LEN      IB_MAX_NUM_VLS\r
-#define OSM_QOS_POLICY_MAX_VL_NUM           IB_MAX_NUM_VLS\r
-\r
-typedef struct tmp_parser_struct_t_ {\r
-    char       str[OSM_QOS_POLICY_MAX_LINE_LEN];\r
-    uint64_t   num_pair[2];\r
-    cl_list_t  str_list;\r
-    cl_list_t  num_list;\r
-    cl_list_t  num_pair_list;\r
-} tmp_parser_struct_t;\r
-\r
-static void __parser_tmp_struct_init();\r
-static void __parser_tmp_struct_reset();\r
-static void __parser_tmp_struct_destroy();\r
-\r
-static char * __parser_strip_white(char * str);\r
-\r
-static void __parser_str2uint64(uint64_t * p_val, char * str);\r
-\r
-static void __parser_port_group_start();\r
-static int __parser_port_group_end();\r
-\r
-static void __parser_sl2vl_scope_start();\r
-static int __parser_sl2vl_scope_end();\r
-\r
-static void __parser_vlarb_scope_start();\r
-static int __parser_vlarb_scope_end();\r
-\r
-static void __parser_qos_level_start();\r
-static int __parser_qos_level_end();\r
-\r
-static void __parser_match_rule_start();\r
-static int __parser_match_rule_end();\r
-\r
-static void __parser_ulp_match_rule_start();\r
-static int __parser_ulp_match_rule_end();\r
-\r
-static void __pkey_rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len);\r
-\r
-static void __rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len);\r
-\r
-static void __merge_rangearr(\r
-    uint64_t  **   range_arr_1,\r
-    unsigned       range_len_1,\r
-    uint64_t  **   range_arr_2,\r
-    unsigned       range_len_2,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len );\r
-\r
-static void __parser_add_port_to_port_map(\r
-    cl_qmap_t   * p_map,\r
-    osm_physp_t * p_physp);\r
-\r
-static void __parser_add_guid_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len);\r
-\r
-static void __parser_add_pkey_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len);\r
-\r
-static void __parser_add_partition_list_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    cl_list_t  * p_list);\r
-\r
-static void __parser_add_map_to_port_map(\r
-    cl_qmap_t * p_dmap,\r
-    cl_map_t  * p_smap);\r
-\r
-static int __validate_pkeys(\r
-    uint64_t ** range_arr,\r
-    unsigned    range_len,\r
-    boolean_t   is_ipoib);\r
-\r
-static void __setup_simple_qos_levels();\r
-static void __clear_simple_qos_levels();\r
-static void __setup_ulp_match_rules();\r
-static void __process_ulp_match_rules();\r
-static void yyerror(const char *format, ...);\r
-\r
-extern char * yytext;\r
-extern int yylex (void);\r
-extern FILE * yyin;\r
-#ifndef __WIN__\r
-extern int errno;\r
-#endif\r
-int yyparse();\r
-\r
-#define RESET_BUFFER  __parser_tmp_struct_reset()\r
-\r
-tmp_parser_struct_t tmp_parser_struct;\r
-\r
-int column_num;\r
-int line_num;\r
-\r
-osm_qos_policy_t       * p_qos_policy = NULL;\r
-osm_qos_port_group_t   * p_current_port_group = NULL;\r
-osm_qos_sl2vl_scope_t  * p_current_sl2vl_scope = NULL;\r
-osm_qos_vlarb_scope_t  * p_current_vlarb_scope = NULL;\r
-osm_qos_level_t        * p_current_qos_level = NULL;\r
-osm_qos_match_rule_t   * p_current_qos_match_rule = NULL;\r
-osm_log_t              * p_qos_parser_osm_log;\r
-\r
-/* 16 Simple QoS Levels - one for each SL */\r
-static osm_qos_level_t osm_qos_policy_simple_qos_levels[16];\r
-\r
-/* Default Simple QoS Level */\r
-osm_qos_level_t __default_simple_qos_level;\r
-\r
-/*\r
- * List of match rules that will be generated by the\r
- * qos-ulp section. These rules are concatenated to\r
- * the end of the usual matching rules list at the\r
- * end of parsing.\r
- */\r
-static cl_list_t __ulp_match_rules;\r
-\r
-/***************************************************/\r
-\r
-%}\r
-\r
-%token TK_NUMBER\r
-%token TK_DASH\r
-%token TK_DOTDOT\r
-%token TK_COMMA\r
-%token TK_ASTERISK\r
-%token TK_TEXT\r
-\r
-%token TK_QOS_ULPS_START\r
-%token TK_QOS_ULPS_END\r
-\r
-%token TK_PORT_GROUPS_START\r
-%token TK_PORT_GROUPS_END\r
-%token TK_PORT_GROUP_START\r
-%token TK_PORT_GROUP_END\r
-\r
-%token TK_QOS_SETUP_START\r
-%token TK_QOS_SETUP_END\r
-%token TK_VLARB_TABLES_START\r
-%token TK_VLARB_TABLES_END\r
-%token TK_VLARB_SCOPE_START\r
-%token TK_VLARB_SCOPE_END\r
-\r
-%token TK_SL2VL_TABLES_START\r
-%token TK_SL2VL_TABLES_END\r
-%token TK_SL2VL_SCOPE_START\r
-%token TK_SL2VL_SCOPE_END\r
-\r
-%token TK_QOS_LEVELS_START\r
-%token TK_QOS_LEVELS_END\r
-%token TK_QOS_LEVEL_START\r
-%token TK_QOS_LEVEL_END\r
-\r
-%token TK_QOS_MATCH_RULES_START\r
-%token TK_QOS_MATCH_RULES_END\r
-%token TK_QOS_MATCH_RULE_START\r
-%token TK_QOS_MATCH_RULE_END\r
-\r
-%token TK_NAME\r
-%token TK_USE\r
-%token TK_PORT_GUID\r
-%token TK_PORT_NAME\r
-%token TK_PARTITION\r
-%token TK_NODE_TYPE\r
-%token TK_GROUP\r
-%token TK_ACROSS\r
-%token TK_VLARB_HIGH\r
-%token TK_VLARB_LOW\r
-%token TK_VLARB_HIGH_LIMIT\r
-%token TK_TO\r
-%token TK_FROM\r
-%token TK_ACROSS_TO\r
-%token TK_ACROSS_FROM\r
-%token TK_SL2VL_TABLE\r
-%token TK_SL\r
-%token TK_MTU_LIMIT\r
-%token TK_RATE_LIMIT\r
-%token TK_PACKET_LIFE\r
-%token TK_PATH_BITS\r
-%token TK_QOS_CLASS\r
-%token TK_SOURCE\r
-%token TK_DESTINATION\r
-%token TK_SERVICE_ID\r
-%token TK_QOS_LEVEL_NAME\r
-%token TK_PKEY\r
-\r
-%token TK_NODE_TYPE_ROUTER\r
-%token TK_NODE_TYPE_CA\r
-%token TK_NODE_TYPE_SWITCH\r
-%token TK_NODE_TYPE_SELF\r
-%token TK_NODE_TYPE_ALL\r
-\r
-%token TK_ULP_DEFAULT\r
-%token TK_ULP_ANY_SERVICE_ID\r
-%token TK_ULP_ANY_PKEY\r
-%token TK_ULP_ANY_TARGET_PORT_GUID\r
-%token TK_ULP_SDP_DEFAULT\r
-%token TK_ULP_SDP_PORT\r
-%token TK_ULP_RDS_DEFAULT\r
-%token TK_ULP_RDS_PORT\r
-%token TK_ULP_ISER_DEFAULT\r
-%token TK_ULP_ISER_PORT\r
-%token TK_ULP_SRP_GUID\r
-%token TK_ULP_IPOIB_DEFAULT\r
-%token TK_ULP_IPOIB_PKEY\r
-\r
-%start head\r
-\r
-%%\r
-\r
-head:               qos_policy_entries\r
-                    ;\r
-\r
-qos_policy_entries: /* empty */\r
-                    | qos_policy_entries qos_policy_entry\r
-                    ;\r
-\r
-qos_policy_entry:     qos_ulps_section\r
-                    | port_groups_section\r
-                    | qos_setup_section\r
-                    | qos_levels_section\r
-                    | qos_match_rules_section\r
-                    ;\r
-\r
-    /*\r
-     * Parsing qos-ulps:\r
-     * -------------------\r
-     *  qos-ulps\r
-     *      default                       : 0 #default SL\r
-     *      sdp, port-num 30000           : 1 #SL for SDP when destination port is 30000\r
-     *      sdp, port-num 10000-20000     : 2\r
-     *      sdp                           : 0 #default SL for SDP\r
-     *      srp, target-port-guid 0x1234  : 2\r
-     *      rds, port-num 25000           : 2 #SL for RDS when destination port is 25000\r
-     *      rds,                          : 0 #default SL for RDS\r
-     *      iser, port-num 900            : 5 #SL for iSER where target port is 900\r
-     *      iser                          : 4 #default SL for iSER\r
-     *      ipoib, pkey 0x0001            : 5 #SL for IPoIB on partition with pkey 0x0001\r
-     *      ipoib                         : 6 #default IPoIB partition - pkey=0x7FFF\r
-     *      any, service-id 0x6234        : 2\r
-     *      any, pkey 0x0ABC              : 3\r
-     *      any, target-port-guid 0x0ABC-0xFFFFF : 6\r
-     *  end-qos-ulps\r
-     */\r
-\r
-qos_ulps_section: TK_QOS_ULPS_START qos_ulps TK_QOS_ULPS_END\r
-                     ;\r
-\r
-qos_ulps:             qos_ulp\r
-                    | qos_ulps qos_ulp\r
-                    ;\r
-\r
-    /*\r
-     * Parsing port groups:\r
-     * -------------------\r
-     *  port-groups\r
-     *       port-group\r
-     *          name: Storage\r
-     *          use: our SRP storage targets\r
-     *          port-guid: 0x1000000000000001,0x1000000000000002\r
-     *          ...\r
-     *          port-name: vs1 HCA-1/P1\r
-     *          port-name: node_description/P2\r
-     *          ...\r
-     *          pkey: 0x00FF-0x0FFF\r
-     *          ...\r
-     *          partition: Part1\r
-     *          ...\r
-     *          node-type: ROUTER,CA,SWITCH,SELF,ALL\r
-     *          ...\r
-     *      end-port-group\r
-     *      port-group\r
-     *          ...\r
-     *      end-port-group\r
-     *  end-port-groups\r
-     */\r
-\r
-\r
-port_groups_section: TK_PORT_GROUPS_START port_groups TK_PORT_GROUPS_END\r
-                     ;\r
-\r
-port_groups:        port_group\r
-                    | port_groups port_group\r
-                    ;\r
-\r
-port_group:         port_group_start port_group_entries port_group_end\r
-                    ;\r
-\r
-port_group_start:   TK_PORT_GROUP_START {\r
-                        __parser_port_group_start();\r
-                    }\r
-                    ;\r
-\r
-port_group_end:     TK_PORT_GROUP_END {\r
-                        if ( __parser_port_group_end() )\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-port_group_entries: /* empty */\r
-                    | port_group_entries port_group_entry\r
-                    ;\r
-\r
-port_group_entry:     port_group_name\r
-                    | port_group_use\r
-                    | port_group_port_guid\r
-                    | port_group_port_name\r
-                    | port_group_pkey\r
-                    | port_group_partition\r
-                    | port_group_node_type\r
-                    ;\r
-\r
-\r
-    /*\r
-     * Parsing qos setup:\r
-     * -----------------\r
-     *  qos-setup\r
-     *      vlarb-tables\r
-     *          vlarb-scope\r
-     *              ...\r
-     *          end-vlarb-scope\r
-     *          vlarb-scope\r
-     *              ...\r
-     *          end-vlarb-scope\r
-     *     end-vlarb-tables\r
-     *     sl2vl-tables\r
-     *          sl2vl-scope\r
-     *              ...\r
-     *         end-sl2vl-scope\r
-     *         sl2vl-scope\r
-     *              ...\r
-     *          end-sl2vl-scope\r
-     *     end-sl2vl-tables\r
-     *  end-qos-setup\r
-     */\r
-\r
-qos_setup_section:  TK_QOS_SETUP_START qos_setup_items TK_QOS_SETUP_END\r
-                    ;\r
-\r
-qos_setup_items:    /* empty */\r
-                    | qos_setup_items vlarb_tables\r
-                    | qos_setup_items sl2vl_tables\r
-                    ;\r
-\r
-    /* Parsing vlarb-tables */\r
-\r
-vlarb_tables:       TK_VLARB_TABLES_START vlarb_scope_items TK_VLARB_TABLES_END\r
-                    ;\r
-\r
-vlarb_scope_items:  /* empty */\r
-                    | vlarb_scope_items vlarb_scope\r
-                    ;\r
-\r
-vlarb_scope:        vlarb_scope_start vlarb_scope_entries vlarb_scope_end\r
-                    ;\r
-\r
-vlarb_scope_start:  TK_VLARB_SCOPE_START {\r
-                        __parser_vlarb_scope_start();\r
-                    }\r
-                    ;\r
-\r
-vlarb_scope_end:    TK_VLARB_SCOPE_END {\r
-                        if ( __parser_vlarb_scope_end() )\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-vlarb_scope_entries:/* empty */\r
-                    | vlarb_scope_entries vlarb_scope_entry\r
-                    ;\r
-\r
-    /*\r
-     *          vlarb-scope\r
-     *              group: Storage\r
-     *              ...\r
-     *              across: Storage\r
-     *              ...\r
-     *              vlarb-high: 0:255,1:127,2:63,3:31,4:15,5:7,6:3,7:1\r
-     *              vlarb-low: 8:255,9:127,10:63,11:31,12:15,13:7,14:3\r
-     *              vl-high-limit: 10\r
-     *          end-vlarb-scope\r
-     */\r
-\r
-vlarb_scope_entry:    vlarb_scope_group\r
-                    | vlarb_scope_across\r
-                    | vlarb_scope_vlarb_high\r
-                    | vlarb_scope_vlarb_low\r
-                    | vlarb_scope_vlarb_high_limit\r
-                    ;\r
-\r
-    /* Parsing sl2vl-tables */\r
-\r
-sl2vl_tables:       TK_SL2VL_TABLES_START sl2vl_scope_items TK_SL2VL_TABLES_END\r
-                    ;\r
-\r
-sl2vl_scope_items:  /* empty */\r
-                    | sl2vl_scope_items sl2vl_scope\r
-                    ;\r
-\r
-sl2vl_scope:        sl2vl_scope_start sl2vl_scope_entries sl2vl_scope_end\r
-                    ;\r
-\r
-sl2vl_scope_start:  TK_SL2VL_SCOPE_START {\r
-                        __parser_sl2vl_scope_start();\r
-                    }\r
-                    ;\r
-\r
-sl2vl_scope_end:    TK_SL2VL_SCOPE_END {\r
-                        if ( __parser_sl2vl_scope_end() )\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-sl2vl_scope_entries:/* empty */\r
-                    | sl2vl_scope_entries sl2vl_scope_entry\r
-                    ;\r
-\r
-    /*\r
-     *          sl2vl-scope\r
-     *              group: Part1\r
-     *              ...\r
-     *              from: *\r
-     *              ...\r
-     *              to: *\r
-     *              ...\r
-     *              across-to: Storage2\r
-     *              ...\r
-     *              across-from: Storage1\r
-     *              ...\r
-     *              sl2vl-table: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7\r
-     *          end-sl2vl-scope\r
-     */\r
-\r
-sl2vl_scope_entry:    sl2vl_scope_group\r
-                    | sl2vl_scope_across\r
-                    | sl2vl_scope_across_from\r
-                    | sl2vl_scope_across_to\r
-                    | sl2vl_scope_from\r
-                    | sl2vl_scope_to\r
-                    | sl2vl_scope_sl2vl_table\r
-                    ;\r
-\r
-    /*\r
-     * Parsing qos-levels:\r
-     * ------------------\r
-     *  qos-levels\r
-     *      qos-level\r
-     *          name: qos_level_1\r
-     *          use: for the lowest priority communication\r
-     *          sl: 15\r
-     *          mtu-limit: 1\r
-     *          rate-limit: 1\r
-     *          packet-life: 12\r
-     *          path-bits: 2,4,8-32\r
-     *          pkey: 0x00FF-0x0FFF\r
-     *      end-qos-level\r
-     *          ...\r
-     *      qos-level\r
-     *    end-qos-level\r
-     *  end-qos-levels\r
-     */\r
-\r
-\r
-qos_levels_section: TK_QOS_LEVELS_START qos_levels TK_QOS_LEVELS_END\r
-                    ;\r
-\r
-qos_levels:         /* empty */\r
-                    | qos_levels qos_level\r
-                    ;\r
-\r
-qos_level:          qos_level_start qos_level_entries qos_level_end\r
-                    ;\r
-\r
-qos_level_start:    TK_QOS_LEVEL_START {\r
-                        __parser_qos_level_start();\r
-                    }\r
-                    ;\r
-\r
-qos_level_end:      TK_QOS_LEVEL_END {\r
-                        if ( __parser_qos_level_end() )\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-qos_level_entries:  /* empty */\r
-                    | qos_level_entries qos_level_entry\r
-                    ;\r
-\r
-qos_level_entry:      qos_level_name\r
-                    | qos_level_use\r
-                    | qos_level_sl\r
-                    | qos_level_mtu_limit\r
-                    | qos_level_rate_limit\r
-                    | qos_level_packet_life\r
-                    | qos_level_path_bits\r
-                    | qos_level_pkey\r
-                    ;\r
-\r
-    /*\r
-     * Parsing qos-match-rules:\r
-     * -----------------------\r
-     *  qos-match-rules\r
-     *      qos-match-rule\r
-     *          use: low latency by class 7-9 or 11 and bla bla\r
-     *          qos-class: 7-9,11\r
-     *          qos-level-name: default\r
-     *          source: Storage\r
-     *          destination: Storage\r
-     *          service-id: 22,4719-5000\r
-     *          pkey: 0x00FF-0x0FFF\r
-     *      end-qos-match-rule\r
-     *      qos-match-rule\r
-     *          ...\r
-     *      end-qos-match-rule\r
-     *  end-qos-match-rules\r
-     */\r
-\r
-qos_match_rules_section: TK_QOS_MATCH_RULES_START qos_match_rules TK_QOS_MATCH_RULES_END\r
-                    ;\r
-\r
-qos_match_rules:    /* empty */\r
-                    | qos_match_rules qos_match_rule\r
-                    ;\r
-\r
-qos_match_rule:     qos_match_rule_start qos_match_rule_entries qos_match_rule_end\r
-                    ;\r
-\r
-qos_match_rule_start: TK_QOS_MATCH_RULE_START {\r
-                        __parser_match_rule_start();\r
-                    }\r
-                    ;\r
-\r
-qos_match_rule_end: TK_QOS_MATCH_RULE_END {\r
-                        if ( __parser_match_rule_end() )\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-qos_match_rule_entries: /* empty */\r
-                    | qos_match_rule_entries qos_match_rule_entry\r
-                    ;\r
-\r
-qos_match_rule_entry: qos_match_rule_use\r
-                    | qos_match_rule_qos_class\r
-                    | qos_match_rule_qos_level_name\r
-                    | qos_match_rule_source\r
-                    | qos_match_rule_destination\r
-                    | qos_match_rule_service_id\r
-                    | qos_match_rule_pkey\r
-                    ;\r
-\r
-\r
-    /*\r
-     * Parsing qos-ulps:\r
-     * -----------------\r
-     *   default\r
-     *   sdp\r
-     *   sdp with port-num\r
-     *   rds\r
-     *   rds with port-num\r
-     *   srp with port-guid\r
-     *   iser\r
-     *   iser with port-num\r
-     *   ipoib\r
-     *   ipoib with pkey\r
-     *   any with service-id\r
-     *   any with pkey\r
-     *   any with target-port-guid\r
-     */\r
-\r
-qos_ulp:            TK_ULP_DEFAULT single_number {\r
-                        /* parsing default ulp rule: "default: num" */\r
-                        cl_list_iterator_t    list_iterator;\r
-                        uint64_t            * p_tmp_num;\r
-\r
-                        list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                        p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                        if (*p_tmp_num > 15)\r
-                        {\r
-                            yyerror("illegal SL value");\r
-                            return 1;\r
-                        }\r
-                        __default_simple_qos_level.sl = (uint8_t)(*p_tmp_num);\r
-                        __default_simple_qos_level.sl_set = TRUE;\r
-                        free(p_tmp_num);\r
-                        cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                    }\r
-\r
-                    | qos_ulp_type_any_service list_of_ranges TK_DOTDOT {\r
-                        /* "any, service-id ... : sl" - one instance of list of ranges */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have service ids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the service id ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_any_pkey list_of_ranges TK_DOTDOT {\r
-                        /* "any, pkey ... : sl" - one instance of list of ranges */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have pkeys");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the pkey ranges */\r
-                        __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_any_target_port_guid list_of_ranges TK_DOTDOT {\r
-                        /* any, target-port-guid ... : sl */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("ULP rule doesn't have port guids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* create a new port group with these ports */\r
-                        __parser_port_group_start();\r
-\r
-                        p_current_port_group->name = strdup("_ULP_Targets_");\r
-                        p_current_port_group->use = strdup("Generated from ULP rules");\r
-\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        __parser_add_guid_range_to_port_map(\r
-                                              &p_current_port_group->port_map,\r
-                                              range_arr,\r
-                                              range_len);\r
-\r
-                        /* add this port group to the destination\r
-                           groups of the current match rule */\r
-                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,\r
-                                            p_current_port_group);\r
-\r
-                        __parser_port_group_end();\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_sdp_default {\r
-                        /* "sdp : sl" - default SL for SDP */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                        range_arr[0][1] = OSM_QOS_POLICY_ULP_SDP_SERVICE_ID + 0xFFFF;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_sdp_port list_of_ranges TK_DOTDOT {\r
-                        /* sdp with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("SDP ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_rds_default {\r
-                        /* "rds : sl" - default SL for RDS */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] =\r
-                           OSM_QOS_POLICY_ULP_RDS_SERVICE_ID + OSM_QOS_POLICY_ULP_RDS_PORT;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_rds_port list_of_ranges TK_DOTDOT {\r
-                        /* rds with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("RDS ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_iser_default {\r
-                        /* "iSER : sl" - default SL for iSER */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] =\r
-                           OSM_QOS_POLICY_ULP_ISER_SERVICE_ID + OSM_QOS_POLICY_ULP_ISER_PORT;\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = 1;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_iser_port list_of_ranges TK_DOTDOT {\r
-                        /* iser with port numbers */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-                        unsigned    i;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("iSER ULP rule doesn't have port numbers");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the port ranges */\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-                        /* now translate these port numbers into service ids */\r
-                        for (i = 0; i < range_len; i++)\r
-                        {\r
-                            if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)\r
-                            {\r
-                                yyerror("SDP port number out of range");\r
-                                return 1;\r
-                            }\r
-                            range_arr[i][0] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;\r
-                            range_arr[i][1] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;\r
-                        }\r
-\r
-                        p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                        p_current_qos_match_rule->service_id_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_srp_guid list_of_ranges TK_DOTDOT {\r
-                        /* srp with target guids - this rule is similar\r
-                           to writing 'any' ulp with target port guids */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("SRP ULP rule doesn't have port guids");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* create a new port group with these ports */\r
-                        __parser_port_group_start();\r
-\r
-                        p_current_port_group->name = strdup("_SRP_Targets_");\r
-                        p_current_port_group->use = strdup("Generated from ULP rules");\r
-\r
-                        __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        __parser_add_guid_range_to_port_map(\r
-                                              &p_current_port_group->port_map,\r
-                                              range_arr,\r
-                                              range_len);\r
-\r
-                        /* add this port group to the destination\r
-                           groups of the current match rule */\r
-                        cl_list_insert_tail(&p_current_qos_match_rule->destination_group_list,\r
-                                            p_current_port_group);\r
-\r
-                        __parser_port_group_end();\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_ipoib_default {\r
-                        /* ipoib w/o any pkeys (default pkey) */\r
-                        uint64_t ** range_arr =\r
-                               (uint64_t **)malloc(sizeof(uint64_t *));\r
-                        range_arr[0] = (uint64_t *)malloc(2*sizeof(uint64_t));\r
-                        range_arr[0][0] = range_arr[0][1] = 0x7fff;\r
-\r
-                        /*\r
-                         * Although we know that the default partition exists,\r
-                         * we still need to validate it by checking that it has\r
-                         * at least two full members. Otherwise IPoIB won't work.\r
-                         */\r
-                        if (__validate_pkeys(range_arr, 1, TRUE))\r
-                            return 1;\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = 1;\r
-\r
-                    } qos_ulp_sl\r
-\r
-                    | qos_ulp_type_ipoib_pkey list_of_ranges TK_DOTDOT {\r
-                        /* ipoib with pkeys */\r
-                        uint64_t ** range_arr;\r
-                        unsigned    range_len;\r
-\r
-                        if (!cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                        {\r
-                            yyerror("IPoIB ULP rule doesn't have pkeys");\r
-                            return 1;\r
-                        }\r
-\r
-                        /* get all the pkey ranges */\r
-                        __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                              &range_arr,\r
-                                              &range_len );\r
-\r
-                        /*\r
-                         * Validate pkeys.\r
-                         * For IPoIB pkeys the validation is strict.\r
-                         * If some problem would be found, parsing will\r
-                         * be aborted with a proper error messages.\r
-                         */\r
-                        if (__validate_pkeys(range_arr, range_len, TRUE))\r
-                            return 1;\r
-\r
-                        p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                        p_current_qos_match_rule->pkey_range_len = range_len;\r
-\r
-                    } qos_ulp_sl\r
-                    ;\r
-\r
-qos_ulp_type_any_service: TK_ULP_ANY_SERVICE_ID\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_any_pkey: TK_ULP_ANY_PKEY\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_any_target_port_guid: TK_ULP_ANY_TARGET_PORT_GUID\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_sdp_default: TK_ULP_SDP_DEFAULT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_sdp_port: TK_ULP_SDP_PORT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_rds_default: TK_ULP_RDS_DEFAULT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_rds_port: TK_ULP_RDS_PORT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_iser_default: TK_ULP_ISER_DEFAULT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_iser_port: TK_ULP_ISER_PORT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_srp_guid: TK_ULP_SRP_GUID\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_ipoib_default: TK_ULP_IPOIB_DEFAULT\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-qos_ulp_type_ipoib_pkey: TK_ULP_IPOIB_PKEY\r
-                    { __parser_ulp_match_rule_start(); };\r
-\r
-\r
-qos_ulp_sl:   single_number {\r
-                        /* get the SL for ULP rules */\r
-                        cl_list_iterator_t  list_iterator;\r
-                        uint64_t          * p_tmp_num;\r
-                        uint8_t             sl;\r
-\r
-                        list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                        p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                        if (*p_tmp_num > 15)\r
-                        {\r
-                            yyerror("illegal SL value");\r
-                            return 1;\r
-                        }\r
-\r
-                        sl = (uint8_t)(*p_tmp_num);\r
-                        free(p_tmp_num);\r
-                        cl_list_remove_all(&tmp_parser_struct.num_list);\r
-\r
-                        p_current_qos_match_rule->p_qos_level =\r
-                                 &osm_qos_policy_simple_qos_levels[sl];\r
-                        p_current_qos_match_rule->qos_level_name =\r
-                                 strdup(osm_qos_policy_simple_qos_levels[sl].name);\r
-\r
-                        if (__parser_ulp_match_rule_end())\r
-                            return 1;\r
-                    }\r
-                    ;\r
-\r
-    /*\r
-     *  port_group_entry values:\r
-     *      port_group_name\r
-     *      port_group_use\r
-     *      port_group_port_guid\r
-     *      port_group_port_name\r
-     *      port_group_pkey\r
-     *      port_group_partition\r
-     *      port_group_node_type\r
-     */\r
-\r
-port_group_name:        port_group_name_start single_string {\r
-                            /* 'name' of 'port-group' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_port_group->name)\r
-                            {\r
-                                yyerror("port-group has multiple 'name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_port_group->name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-port_group_name_start:  TK_NAME {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_use:         port_group_use_start single_string {\r
-                            /* 'use' of 'port-group' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_port_group->use)\r
-                            {\r
-                                yyerror("port-group has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_port_group->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-port_group_use_start:   TK_USE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_port_name:   port_group_port_name_start string_list {\r
-                            /* 'port-name' in 'port-group' - any num of instances */\r
-                            cl_list_iterator_t list_iterator;\r
-                            osm_node_t * p_node;\r
-                            osm_physp_t * p_physp;\r
-                            unsigned port_num;\r
-                            char * tmp_str;\r
-                            char * port_str;\r
-\r
-                            /* parsing port name strings */\r
-                            for (list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                                 list_iterator != cl_list_end(&tmp_parser_struct.str_list);\r
-                                 list_iterator = cl_list_next(list_iterator))\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                {\r
-                                    /* last slash in port name string is a separator\r
-                                       between node name and port number */\r
-                                    port_str = strrchr(tmp_str, '/');\r
-                                    if (!port_str || (strlen(port_str) < 3) ||\r
-                                        (port_str[1] != 'p' && port_str[1] != 'P')) {\r
-                                        yyerror("'%s' - illegal port name",\r
-                                                           tmp_str);\r
-                                        free(tmp_str);\r
-                                        cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                        return 1;\r
-                                    }\r
-\r
-                                    if (!(port_num = strtoul(&port_str[2],NULL,0))) {\r
-                                        yyerror(\r
-                                               "'%s' - illegal port number in port name",\r
-                                               tmp_str);\r
-                                        free(tmp_str);\r
-                                        cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                        return 1;\r
-                                    }\r
-\r
-                                    /* separate node name from port number */\r
-                                    port_str[0] = '\0';\r
-\r
-                                    if (st_lookup(p_qos_policy->p_node_hash,\r
-                                                  (st_data_t)tmp_str,\r
-                                                  (void *)&p_node))\r
-                                    {\r
-                                        /* we found the node, now get the right port */\r
-                                        p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                                        if (!p_physp) {\r
-                                            yyerror(\r
-                                                   "'%s' - port number out of range in port name",\r
-                                                   tmp_str);\r
-                                            free(tmp_str);\r
-                                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                            return 1;\r
-                                        }\r
-                                        /* we found the port, now add it to guid table */\r
-                                        __parser_add_port_to_port_map(&p_current_port_group->port_map,\r
-                                                                      p_physp);\r
-                                    }\r
-                                    free(tmp_str);\r
-                                }\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-port_group_port_name_start: TK_PORT_NAME {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_port_guid:   port_group_port_guid_start list_of_ranges {\r
-                            /* 'port-guid' in 'port-group' - any num of instances */\r
-                            /* list of guid ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                __parser_add_guid_range_to_port_map(\r
-                                                      &p_current_port_group->port_map,\r
-                                                      range_arr,\r
-                                                      range_len);\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-port_group_port_guid_start: TK_PORT_GUID {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_pkey:        port_group_pkey_start list_of_ranges {\r
-                            /* 'pkey' in 'port-group' - any num of instances */\r
-                            /* list of pkey ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                __parser_add_pkey_range_to_port_map(\r
-                                                      &p_current_port_group->port_map,\r
-                                                      range_arr,\r
-                                                      range_len);\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-port_group_pkey_start:  TK_PKEY {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_partition:  port_group_partition_start string_list {\r
-                            /* 'partition' in 'port-group' - any num of instances */\r
-                            __parser_add_partition_list_to_port_map(\r
-                                               &p_current_port_group->port_map,\r
-                                               &tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-port_group_partition_start: TK_PARTITION {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_node_type:   port_group_node_type_start port_group_node_type_list {\r
-                            /* 'node-type' in 'port-group' - any num of instances */\r
-                        }\r
-                        ;\r
-\r
-port_group_node_type_start: TK_NODE_TYPE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-port_group_node_type_list:  node_type_item\r
-                        |   port_group_node_type_list TK_COMMA node_type_item\r
-                        ;\r
-\r
-node_type_item:           node_type_ca\r
-                        | node_type_switch\r
-                        | node_type_router\r
-                        | node_type_all\r
-                        | node_type_self\r
-                        ;\r
-\r
-node_type_ca:           TK_NODE_TYPE_CA {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_CA;\r
-                        }\r
-                        ;\r
-\r
-node_type_switch:       TK_NODE_TYPE_SWITCH {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_SWITCH;\r
-                        }\r
-                        ;\r
-\r
-node_type_router:       TK_NODE_TYPE_ROUTER {\r
-                            p_current_port_group->node_types |=\r
-                               OSM_QOS_POLICY_NODE_TYPE_ROUTER;\r
-                        }\r
-                        ;\r
-\r
-node_type_all:          TK_NODE_TYPE_ALL {\r
-                            p_current_port_group->node_types |=\r
-                               (OSM_QOS_POLICY_NODE_TYPE_CA |\r
-                                OSM_QOS_POLICY_NODE_TYPE_SWITCH |\r
-                                OSM_QOS_POLICY_NODE_TYPE_ROUTER);\r
-                        }\r
-                        ;\r
-\r
-node_type_self:         TK_NODE_TYPE_SELF {\r
-                            osm_port_t * p_osm_port =\r
-                                osm_get_port_by_guid(p_qos_policy->p_subn,\r
-                                     p_qos_policy->p_subn->sm_port_guid);\r
-                            if (p_osm_port)\r
-                                __parser_add_port_to_port_map(\r
-                                   &p_current_port_group->port_map,\r
-                                   p_osm_port->p_physp);\r
-                        }\r
-                        ;\r
-\r
-    /*\r
-     *  vlarb_scope_entry values:\r
-     *      vlarb_scope_group\r
-     *      vlarb_scope_across\r
-     *      vlarb_scope_vlarb_high\r
-     *      vlarb_scope_vlarb_low\r
-     *      vlarb_scope_vlarb_high_limit\r
-     */\r
-\r
-\r
-\r
-vlarb_scope_group:      vlarb_scope_group_start string_list {\r
-                            /* 'group' in 'vlarb-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->group_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_group_start: TK_GROUP {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_across: vlarb_scope_across_start string_list {\r
-                            /* 'across' in 'vlarb-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->across_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_across_start: TK_ACROSS {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_high_limit:  vlarb_scope_vlarb_high_limit_start single_number {\r
-                            /* 'vl-high-limit' in 'vlarb-scope' - one instance of one number */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * p_tmp_num;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_tmp_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            if (p_tmp_num)\r
-                            {\r
-                                p_current_vlarb_scope->vl_high_limit = (uint32_t)(*p_tmp_num);\r
-                                p_current_vlarb_scope->vl_high_limit_set = TRUE;\r
-                                free(p_tmp_num);\r
-                            }\r
-\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_high_limit_start: TK_VLARB_HIGH_LIMIT {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_high: vlarb_scope_vlarb_high_start num_list_with_dotdot {\r
-                            /* 'vlarb-high' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->vlarb_high_list,num_pair);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_high_start: TK_VLARB_HIGH {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_low:  vlarb_scope_vlarb_low_start num_list_with_dotdot {\r
-                            /* 'vlarb-low' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                    cl_list_insert_tail(&p_current_vlarb_scope->vlarb_low_list,num_pair);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-                        ;\r
-\r
-vlarb_scope_vlarb_low_start: TK_VLARB_LOW {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-    /*\r
-     *  sl2vl_scope_entry values:\r
-     *      sl2vl_scope_group\r
-     *      sl2vl_scope_across\r
-     *      sl2vl_scope_across_from\r
-     *      sl2vl_scope_across_to\r
-     *      sl2vl_scope_from\r
-     *      sl2vl_scope_to\r
-     *      sl2vl_scope_sl2vl_table\r
-     */\r
-\r
-sl2vl_scope_group:      sl2vl_scope_group_start string_list {\r
-                            /* 'group' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->group_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_group_start: TK_GROUP {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across:     sl2vl_scope_across_start string_list {\r
-                            /* 'across' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str) {\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_from_list,tmp_str);\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_to_list,strdup(tmp_str));\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across_start: TK_ACROSS {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across_from:  sl2vl_scope_across_from_start string_list {\r
-                            /* 'across-from' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_from_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across_from_start: TK_ACROSS_FROM {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across_to:  sl2vl_scope_across_to_start string_list {\r
-                            /* 'across-to' in 'sl2vl-scope' - any num of instances */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str) {\r
-                                    cl_list_insert_tail(&p_current_sl2vl_scope->across_to_list,tmp_str);\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_across_to_start: TK_ACROSS_TO {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_from:       sl2vl_scope_from_start sl2vl_scope_from_list_or_asterisk {\r
-                            /* 'from' in 'sl2vl-scope' - any num of instances */\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_from_start: TK_FROM {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_to:         sl2vl_scope_to_start sl2vl_scope_to_list_or_asterisk {\r
-                            /* 'to' in 'sl2vl-scope' - any num of instances */\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_to_start:   TK_TO {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_from_list_or_asterisk:  sl2vl_scope_from_asterisk\r
-                                  | sl2vl_scope_from_list_of_ranges\r
-                                  ;\r
-\r
-sl2vl_scope_from_asterisk: TK_ASTERISK {\r
-                            int i;\r
-                            for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)\r
-                                p_current_sl2vl_scope->from[i] = TRUE;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_to_list_or_asterisk:  sl2vl_scope_to_asterisk\r
-                                | sl2vl_scope_to_list_of_ranges\r
-                                  ;\r
-\r
-sl2vl_scope_to_asterisk: TK_ASTERISK {\r
-                            int i;\r
-                            for (i = 0; i < OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH; i++)\r
-                                p_current_sl2vl_scope->to[i] = TRUE;\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_from_list_of_ranges: list_of_ranges {\r
-                            int i;\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-                            uint8_t               num1, num2;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                {\r
-                                    if ( (int64_t)num_pair[0] < 0 ||\r
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )\r
-                                    {\r
-                                        yyerror("port number out of range 'from' list");\r
-                                        free(num_pair);\r
-                                        cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                                        return 1;\r
-                                    }\r
-                                    num1 = (uint8_t)num_pair[0];\r
-                                    num2 = (uint8_t)num_pair[1];\r
-                                    free(num_pair);\r
-                                    for (i = num1; i <= num2; i++)\r
-                                        p_current_sl2vl_scope->from[i] = TRUE;\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_to_list_of_ranges: list_of_ranges {\r
-                            int i;\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t            * num_pair;\r
-                            uint8_t               num1, num2;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_pair_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_pair_list) )\r
-                            {\r
-                                num_pair = (uint64_t*)cl_list_obj(list_iterator);\r
-                                if (num_pair)\r
-                                {\r
-                                    if ( (uint64_t)num_pair[0] < 0 ||\r
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )\r
-                                    {\r
-                                        yyerror("port number out of range 'to' list");\r
-                                        free(num_pair);\r
-                                        cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                                        return 1;\r
-                                    }\r
-                                    num1 = (uint8_t)num_pair[0];\r
-                                    num2 = (uint8_t)num_pair[1];\r
-                                    free(num_pair);\r
-                                    for (i = num1; i <= num2; i++)\r
-                                        p_current_sl2vl_scope->to[i] = TRUE;\r
-                                }\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-                        }\r
-                        ;\r
-\r
-\r
-sl2vl_scope_sl2vl_table:  sl2vl_scope_sl2vl_table_start num_list {\r
-                            /* 'sl2vl-table' - one instance of exactly\r
-                               OSM_QOS_POLICY_SL2VL_TABLE_LEN numbers */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            uint64_t              num;\r
-                            uint64_t            * p_num;\r
-                            int                   i = 0;\r
-\r
-                            if (p_current_sl2vl_scope->sl2vl_table_set)\r
-                            {\r
-                                yyerror("sl2vl-scope has more than one sl2vl-table");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            if (cl_list_count(&tmp_parser_struct.num_list) != OSM_QOS_POLICY_SL2VL_TABLE_LEN)\r
-                            {\r
-                                yyerror("wrong number of values in 'sl2vl-table' (should be 16)");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.num_list) )\r
-                            {\r
-                                p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                                num = *p_num;\r
-                                free(p_num);\r
-                                if (num >= OSM_QOS_POLICY_MAX_VL_NUM)\r
-                                {\r
-                                    yyerror("wrong VL value in 'sl2vl-table' (should be 0 to 15)");\r
-                                    cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                    return 1;\r
-                                }\r
-\r
-                                p_current_sl2vl_scope->sl2vl_table[i++] = (uint8_t)num;\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            p_current_sl2vl_scope->sl2vl_table_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-sl2vl_scope_sl2vl_table_start: TK_SL2VL_TABLE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-    /*\r
-     *  qos_level_entry values:\r
-     *      qos_level_name\r
-     *      qos_level_use\r
-     *      qos_level_sl\r
-     *      qos_level_mtu_limit\r
-     *      qos_level_rate_limit\r
-     *      qos_level_packet_life\r
-     *      qos_level_path_bits\r
-     *      qos_level_pkey\r
-     */\r
-\r
-qos_level_name:         qos_level_name_start single_string {\r
-                            /* 'name' of 'qos-level' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_level->name)\r
-                            {\r
-                                yyerror("qos-level has multiple 'name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_level->name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_name_start:   TK_NAME {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_use:          qos_level_use_start single_string {\r
-                            /* 'use' of 'qos-level' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_level->use)\r
-                            {\r
-                                yyerror("qos-level has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_level->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_use_start:    TK_USE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_sl:           qos_level_sl_start single_number {\r
-                            /* 'sl' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->sl_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'sl' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->sl = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->sl_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_sl_start:     TK_SL {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_mtu_limit:    qos_level_mtu_limit_start single_number {\r
-                            /* 'mtu-limit' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->mtu_limit_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'mtu-limit' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->mtu_limit = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->mtu_limit_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_mtu_limit_start: TK_MTU_LIMIT {\r
-                            /* 'mtu-limit' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_rate_limit:    qos_level_rate_limit_start single_number {\r
-                            /* 'rate-limit' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->rate_limit_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'rate-limit' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->rate_limit = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->rate_limit_set = TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_rate_limit_start: TK_RATE_LIMIT {\r
-                            /* 'rate-limit' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_packet_life:  qos_level_packet_life_start single_number {\r
-                            /* 'packet-life' in 'qos-level' - one instance */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            uint64_t           * p_num;\r
-\r
-                            if (p_current_qos_level->pkt_life_set)\r
-                            {\r
-                                yyerror("'qos-level' has multiple 'packet-life' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.num_list);\r
-                            p_num = (uint64_t*)cl_list_obj(list_iterator);\r
-                            p_current_qos_level->pkt_life = (uint8_t)(*p_num);\r
-                            free(p_num);\r
-                            p_current_qos_level->pkt_life_set= TRUE;\r
-                            cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                        }\r
-                        ;\r
-\r
-qos_level_packet_life_start: TK_PACKET_LIFE {\r
-                            /* 'packet-life' in 'qos-level' - one instance */\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_path_bits:    qos_level_path_bits_start list_of_ranges {\r
-                            /* 'path-bits' in 'qos-level' - any num of instances */\r
-                            /* list of path bit ranges */\r
-\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_level->path_bits_range_len )\r
-                                {\r
-                                    p_current_qos_level->path_bits_range_arr = range_arr;\r
-                                    p_current_qos_level->path_bits_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_level->path_bits_range_arr,\r
-                                                      p_current_qos_level->path_bits_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_level->path_bits_range_arr = new_range_arr;\r
-                                    p_current_qos_level->path_bits_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-qos_level_path_bits_start: TK_PATH_BITS {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_level_pkey:         qos_level_pkey_start list_of_ranges {\r
-                            /* 'pkey' in 'qos-level' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_level->pkey_range_len )\r
-                                {\r
-                                    p_current_qos_level->pkey_range_arr = range_arr;\r
-                                    p_current_qos_level->pkey_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_level->pkey_range_arr,\r
-                                                      p_current_qos_level->pkey_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_level->pkey_range_arr = new_range_arr;\r
-                                    p_current_qos_level->pkey_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-qos_level_pkey_start:   TK_PKEY {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-    /*\r
-     *  qos_match_rule_entry values:\r
-     *      qos_match_rule_use\r
-     *      qos_match_rule_qos_class\r
-     *      qos_match_rule_qos_level_name\r
-     *      qos_match_rule_source\r
-     *      qos_match_rule_destination\r
-     *      qos_match_rule_service_id\r
-     *      qos_match_rule_pkey\r
-     */\r
-\r
-\r
-qos_match_rule_use:     qos_match_rule_use_start single_string {\r
-                            /* 'use' of 'qos-match-rule' - one instance */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            if (p_current_qos_match_rule->use)\r
-                            {\r
-                                yyerror("'qos-match-rule' has multiple 'use' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_match_rule->use = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_use_start: TK_USE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_qos_class: qos_match_rule_qos_class_start list_of_ranges {\r
-                            /* 'qos-class' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            /* list of class ranges (QoS Class is 12-bit value) */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->qos_class_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->qos_class_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->qos_class_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->qos_class_range_arr,\r
-                                                      p_current_qos_match_rule->qos_class_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->qos_class_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->qos_class_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_qos_class_start: TK_QOS_CLASS {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_source:  qos_match_rule_source_start string_list {\r
-                            /* 'source' in 'qos-match-rule' - text */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_qos_match_rule->source_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_source_start: TK_SOURCE {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_destination: qos_match_rule_destination_start string_list {\r
-                            /* 'destination' in 'qos-match-rule' - text */\r
-                            cl_list_iterator_t    list_iterator;\r
-                            char                * tmp_str;\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            while( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    cl_list_insert_tail(&p_current_qos_match_rule->destination_list,tmp_str);\r
-                                list_iterator = cl_list_next(list_iterator);\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_destination_start: TK_DESTINATION {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_qos_level_name:  qos_match_rule_qos_level_name_start single_string {\r
-                            /* 'qos-level-name' in 'qos-match-rule' - single string */\r
-                            cl_list_iterator_t   list_iterator;\r
-                            char               * tmp_str;\r
-\r
-                            if (p_current_qos_match_rule->qos_level_name)\r
-                            {\r
-                                yyerror("qos-match-rule has multiple 'qos-level-name' tags");\r
-                                cl_list_remove_all(&tmp_parser_struct.num_list);\r
-                                return 1;\r
-                            }\r
-\r
-                            list_iterator = cl_list_head(&tmp_parser_struct.str_list);\r
-                            if ( list_iterator != cl_list_end(&tmp_parser_struct.str_list) )\r
-                            {\r
-                                tmp_str = (char*)cl_list_obj(list_iterator);\r
-                                if (tmp_str)\r
-                                    p_current_qos_match_rule->qos_level_name = tmp_str;\r
-                            }\r
-                            cl_list_remove_all(&tmp_parser_struct.str_list);\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_qos_level_name_start: TK_QOS_LEVEL_NAME {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_service_id: qos_match_rule_service_id_start list_of_ranges {\r
-                            /* 'service-id' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->service_id_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->service_id_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->service_id_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->service_id_range_arr,\r
-                                                      p_current_qos_match_rule->service_id_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->service_id_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->service_id_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_service_id_start: TK_SERVICE_ID {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_pkey:    qos_match_rule_pkey_start list_of_ranges {\r
-                            /* 'pkey' in 'qos-match-rule' - num of instances of list of ranges */\r
-                            if (cl_list_count(&tmp_parser_struct.num_pair_list))\r
-                            {\r
-                                uint64_t ** range_arr;\r
-                                unsigned range_len;\r
-\r
-                                __pkey_rangelist2rangearr( &tmp_parser_struct.num_pair_list,\r
-                                                      &range_arr,\r
-                                                      &range_len );\r
-\r
-                                if ( !p_current_qos_match_rule->pkey_range_len )\r
-                                {\r
-                                    p_current_qos_match_rule->pkey_range_arr = range_arr;\r
-                                    p_current_qos_match_rule->pkey_range_len = range_len;\r
-                                }\r
-                                else\r
-                                {\r
-                                    uint64_t ** new_range_arr;\r
-                                    unsigned new_range_len;\r
-                                    __merge_rangearr( p_current_qos_match_rule->pkey_range_arr,\r
-                                                      p_current_qos_match_rule->pkey_range_len,\r
-                                                      range_arr,\r
-                                                      range_len,\r
-                                                      &new_range_arr,\r
-                                                      &new_range_len );\r
-                                    p_current_qos_match_rule->pkey_range_arr = new_range_arr;\r
-                                    p_current_qos_match_rule->pkey_range_len = new_range_len;\r
-                                }\r
-                            }\r
-                        }\r
-                        ;\r
-\r
-qos_match_rule_pkey_start: TK_PKEY {\r
-                            RESET_BUFFER;\r
-                        }\r
-                        ;\r
-\r
-\r
-    /*\r
-     * Common part\r
-     */\r
-\r
-\r
-single_string:      single_string_elems {\r
-                        cl_list_insert_tail(&tmp_parser_struct.str_list,\r
-                                            strdup(__parser_strip_white(tmp_parser_struct.str)));\r
-                        tmp_parser_struct.str[0] = '\0';\r
-                    }\r
-                    ;\r
-\r
-single_string_elems:  single_string_element\r
-                    | single_string_elems single_string_element\r
-                    ;\r
-\r
-single_string_element: TK_TEXT {\r
-                        strcat(tmp_parser_struct.str,$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-\r
-string_list:        single_string\r
-                    | string_list TK_COMMA single_string\r
-                    ;\r
-\r
-\r
-\r
-single_number:      number\r
-                    ;\r
-\r
-num_list:             number\r
-                    | num_list TK_COMMA number\r
-                    ;\r
-\r
-number:             TK_NUMBER {\r
-                        uint64_t * p_num = (uint64_t*)malloc(sizeof(uint64_t));\r
-                        __parser_str2uint64(p_num,$1);\r
-                        free($1);\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_list, p_num);\r
-                    }\r
-                    ;\r
-\r
-num_list_with_dotdot: number_from_pair_1 TK_DOTDOT number_from_pair_2 {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    | num_list_with_dotdot TK_COMMA number_from_pair_1 TK_DOTDOT number_from_pair_2 {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    ;\r
-\r
-number_from_pair_1:   TK_NUMBER {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-number_from_pair_2:   TK_NUMBER {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-list_of_ranges:     num_list_with_dash\r
-                    ;\r
-\r
-num_list_with_dash:   single_number_from_range {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    | number_from_range_1 TK_DASH number_from_range_2 {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {\r
-                            num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        else {\r
-                            num_pair[1] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[0] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    | num_list_with_dash TK_COMMA number_from_range_1 TK_DASH number_from_range_2 {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {\r
-                            num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        else {\r
-                            num_pair[1] = tmp_parser_struct.num_pair[0];\r
-                            num_pair[0] = tmp_parser_struct.num_pair[1];\r
-                        }\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    | num_list_with_dash TK_COMMA single_number_from_range {\r
-                        uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);\r
-                        num_pair[0] = tmp_parser_struct.num_pair[0];\r
-                        num_pair[1] = tmp_parser_struct.num_pair[1];\r
-                        cl_list_insert_tail(&tmp_parser_struct.num_pair_list, num_pair);\r
-                    }\r
-                    ;\r
-\r
-single_number_from_range:  TK_NUMBER {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],$1);\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-number_from_range_1:  TK_NUMBER {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[0],$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-number_from_range_2:  TK_NUMBER {\r
-                        __parser_str2uint64(&tmp_parser_struct.num_pair[1],$1);\r
-                        free($1);\r
-                    }\r
-                    ;\r
-\r
-%%\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int osm_qos_parse_policy_file(IN osm_subn_t * p_subn)\r
-{\r
-    int res = 0;\r
-    static boolean_t first_time = TRUE;\r
-    p_qos_parser_osm_log = &p_subn->p_osm->log;\r
-\r
-    OSM_LOG_ENTER(p_qos_parser_osm_log);\r
-\r
-    osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-    p_subn->p_qos_policy = NULL;\r
-\r
-    yyin = fopen (p_subn->opt.qos_policy_file, "r");\r
-    if (!yyin)\r
-    {\r
-        if (strcmp(p_subn->opt.qos_policy_file,OSM_DEFAULT_QOS_POLICY_FILE)) {\r
-            OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC01: "\r
-                    "Failed opening QoS policy file %s - %s\n",\r
-                    p_subn->opt.qos_policy_file, strerror(errno));\r
-            res = 1;\r
-        }\r
-        else\r
-            OSM_LOG(p_qos_parser_osm_log, OSM_LOG_VERBOSE,\r
-                    "QoS policy file not found (%s)\n",\r
-                    p_subn->opt.qos_policy_file);\r
-\r
-        goto Exit;\r
-    }\r
-\r
-    if (first_time)\r
-    {\r
-        first_time = FALSE;\r
-        __setup_simple_qos_levels();\r
-        __setup_ulp_match_rules();\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_INFO,\r
-               "Loading QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-    }\r
-    else\r
-        /*\r
-         * ULP match rules list was emptied at the end of\r
-         * previous parsing iteration.\r
-         * What's left is to clear simple QoS levels.\r
-         */\r
-        __clear_simple_qos_levels();\r
-\r
-    column_num = 1;\r
-    line_num = 1;\r
-\r
-    p_subn->p_qos_policy = osm_qos_policy_create(p_subn);\r
-\r
-    __parser_tmp_struct_init();\r
-    p_qos_policy = p_subn->p_qos_policy;\r
-\r
-    res = yyparse();\r
-\r
-    __parser_tmp_struct_destroy();\r
-\r
-    if (res != 0)\r
-    {\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC03: "\r
-                "Failed parsing QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-        p_subn->p_qos_policy = NULL;\r
-        res = 1;\r
-        goto Exit;\r
-    }\r
-\r
-    /* add generated ULP match rules to the usual match rules */\r
-    __process_ulp_match_rules();\r
-\r
-    if (osm_qos_policy_validate(p_subn->p_qos_policy,p_qos_parser_osm_log))\r
-    {\r
-        OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC04: "\r
-                "Error(s) in QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        fprintf(stderr, "Error(s) in QoS policy file (%s)\n",\r
-                p_subn->opt.qos_policy_file);\r
-        osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-        p_subn->p_qos_policy = NULL;\r
-        res = 1;\r
-        goto Exit;\r
-    }\r
-\r
-  Exit:\r
-    if (yyin)\r
-        fclose(yyin);\r
-    OSM_LOG_EXIT(p_qos_parser_osm_log);\r
-    return res;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int yywrap()\r
-{\r
-    return(1);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void yyerror(const char *format, ...)\r
-{\r
-    char s[256];\r
-    va_list pvar;\r
-\r
-    OSM_LOG_ENTER(p_qos_parser_osm_log);\r
-\r
-    va_start(pvar, format);\r
-    vsnprintf(s, sizeof(s), format, pvar);\r
-    va_end(pvar);\r
-\r
-    OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC05: "\r
-            "Syntax error (line %d:%d): %s\n",\r
-            line_num, column_num, s);\r
-    fprintf(stderr, "Error in QoS Policy File (line %d:%d): %s.\n",\r
-            line_num, column_num, s);\r
-    OSM_LOG_EXIT(p_qos_parser_osm_log);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static char * __parser_strip_white(char * str)\r
-{\r
-       char *p;\r
-\r
-       while (isspace(*str))\r
-               str++;\r
-       if (!*str)\r
-               return str;\r
-       p = str + strlen(str) - 1;\r
-       while (isspace(*p))\r
-               *p-- = '\0';\r
-\r
-       return str;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_str2uint64(uint64_t * p_val, char * str)\r
-{\r
-   *p_val = strtoull(str, NULL, 0);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_port_group_start()\r
-{\r
-    p_current_port_group = osm_qos_policy_port_group_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_port_group_end()\r
-{\r
-    if(!p_current_port_group->name)\r
-    {\r
-        yyerror("port-group validation failed - no port group name specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->port_groups,\r
-                        p_current_port_group);\r
-    p_current_port_group = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_vlarb_scope_start()\r
-{\r
-    p_current_vlarb_scope = osm_qos_policy_vlarb_scope_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_vlarb_scope_end()\r
-{\r
-    if ( !cl_list_count(&p_current_vlarb_scope->group_list) &&\r
-         !cl_list_count(&p_current_vlarb_scope->across_list) )\r
-    {\r
-        yyerror("vlarb-scope validation failed - no port groups specified by 'group' or by 'across'");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->vlarb_tables,\r
-                        p_current_vlarb_scope);\r
-    p_current_vlarb_scope = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_sl2vl_scope_start()\r
-{\r
-    p_current_sl2vl_scope = osm_qos_policy_sl2vl_scope_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_sl2vl_scope_end()\r
-{\r
-    if (!p_current_sl2vl_scope->sl2vl_table_set)\r
-    {\r
-        yyerror("sl2vl-scope validation failed - no sl2vl table specified");\r
-        return -1;\r
-    }\r
-    if ( !cl_list_count(&p_current_sl2vl_scope->group_list) &&\r
-         !cl_list_count(&p_current_sl2vl_scope->across_to_list) &&\r
-         !cl_list_count(&p_current_sl2vl_scope->across_from_list) )\r
-    {\r
-        yyerror("sl2vl-scope validation failed - no port groups specified by 'group', 'across-to' or 'across-from'");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->sl2vl_tables,\r
-                        p_current_sl2vl_scope);\r
-    p_current_sl2vl_scope = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_qos_level_start()\r
-{\r
-    p_current_qos_level = osm_qos_policy_qos_level_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_qos_level_end()\r
-{\r
-    if (!p_current_qos_level->sl_set)\r
-    {\r
-        yyerror("qos-level validation failed - no 'sl' specified");\r
-        return -1;\r
-    }\r
-    if (!p_current_qos_level->name)\r
-    {\r
-        yyerror("qos-level validation failed - no 'name' specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->qos_levels,\r
-                        p_current_qos_level);\r
-    p_current_qos_level = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_match_rule_start()\r
-{\r
-    p_current_qos_match_rule = osm_qos_policy_match_rule_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_match_rule_end()\r
-{\r
-    if (!p_current_qos_match_rule->qos_level_name)\r
-    {\r
-        yyerror("match-rule validation failed - no 'qos-level-name' specified");\r
-        return -1;\r
-    }\r
-\r
-    cl_list_insert_tail(&p_qos_policy->qos_match_rules,\r
-                        p_current_qos_match_rule);\r
-    p_current_qos_match_rule = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_ulp_match_rule_start()\r
-{\r
-    p_current_qos_match_rule = osm_qos_policy_match_rule_create();\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __parser_ulp_match_rule_end()\r
-{\r
-    CL_ASSERT(p_current_qos_match_rule->p_qos_level);\r
-    cl_list_insert_tail(&__ulp_match_rules,\r
-                        p_current_qos_match_rule);\r
-    p_current_qos_match_rule = NULL;\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_tmp_struct_init()\r
-{\r
-    tmp_parser_struct.str[0] = '\0';\r
-    cl_list_construct(&tmp_parser_struct.str_list);\r
-    cl_list_init(&tmp_parser_struct.str_list, 10);\r
-    cl_list_construct(&tmp_parser_struct.num_list);\r
-    cl_list_init(&tmp_parser_struct.num_list, 10);\r
-    cl_list_construct(&tmp_parser_struct.num_pair_list);\r
-    cl_list_init(&tmp_parser_struct.num_pair_list, 10);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-/*\r
- * Do NOT free objects from the temp struct.\r
- * Either they are inserted into the parse tree data\r
- * structure, or they are already freed when copying\r
- * their values to the parse tree data structure.\r
- */\r
-static void __parser_tmp_struct_reset()\r
-{\r
-    tmp_parser_struct.str[0] = '\0';\r
-    cl_list_remove_all(&tmp_parser_struct.str_list);\r
-    cl_list_remove_all(&tmp_parser_struct.num_list);\r
-    cl_list_remove_all(&tmp_parser_struct.num_pair_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_tmp_struct_destroy()\r
-{\r
-    __parser_tmp_struct_reset();\r
-    cl_list_destroy(&tmp_parser_struct.str_list);\r
-    cl_list_destroy(&tmp_parser_struct.num_list);\r
-    cl_list_destroy(&tmp_parser_struct.num_pair_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-#define __SIMPLE_QOS_LEVEL_NAME "SimpleQoSLevel_SL"\r
-#define __SIMPLE_QOS_LEVEL_DEFAULT_NAME "SimpleQoSLevel_DEFAULT"\r
-\r
-static void __setup_simple_qos_levels()\r
-{\r
-    uint8_t i;\r
-    char tmp_buf[30];\r
-    memset(osm_qos_policy_simple_qos_levels, 0,\r
-           sizeof(osm_qos_policy_simple_qos_levels));\r
-    for (i = 0; i < 16; i++)\r
-    {\r
-        osm_qos_policy_simple_qos_levels[i].sl = i;\r
-        osm_qos_policy_simple_qos_levels[i].sl_set = TRUE;\r
-        sprintf(tmp_buf, "%s%u", __SIMPLE_QOS_LEVEL_NAME, i);\r
-        osm_qos_policy_simple_qos_levels[i].name = strdup(tmp_buf);\r
-    }\r
-\r
-    memset(&__default_simple_qos_level, 0,\r
-           sizeof(__default_simple_qos_level));\r
-    __default_simple_qos_level.name =\r
-           strdup(__SIMPLE_QOS_LEVEL_DEFAULT_NAME);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __clear_simple_qos_levels()\r
-{\r
-    /*\r
-     * Simple QoS levels are static.\r
-     * What's left is to invalidate default simple QoS level.\r
-     */\r
-    __default_simple_qos_level.sl_set = FALSE;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __setup_ulp_match_rules()\r
-{\r
-    cl_list_construct(&__ulp_match_rules);\r
-    cl_list_init(&__ulp_match_rules, 10);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __process_ulp_match_rules()\r
-{\r
-    cl_list_iterator_t list_iterator;\r
-    osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-\r
-    list_iterator = cl_list_head(&__ulp_match_rules);\r
-    while (list_iterator != cl_list_end(&__ulp_match_rules))\r
-    {\r
-        p_qos_match_rule = (osm_qos_match_rule_t *) cl_list_obj(list_iterator);\r
-        if (p_qos_match_rule)\r
-            cl_list_insert_tail(&p_qos_policy->qos_match_rules,\r
-                                p_qos_match_rule);\r
-        list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(&__ulp_match_rules);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __cdecl __cmp_num_range(const void * p1, const void * p2)\r
-{\r
-    uint64_t * pair1 = *((uint64_t **)p1);\r
-    uint64_t * pair2 = *((uint64_t **)p2);\r
-\r
-    if (pair1[0] < pair2[0])\r
-        return -1;\r
-    if (pair1[0] > pair2[0])\r
-        return 1;\r
-\r
-    if (pair1[1] < pair2[1])\r
-        return -1;\r
-    if (pair1[1] > pair2[1])\r
-        return 1;\r
-\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __sort_reduce_rangearr(\r
-    uint64_t  **   arr,\r
-    unsigned       arr_len,\r
-    uint64_t  ** * p_res_arr,\r
-    unsigned     * p_res_arr_len )\r
-{\r
-    unsigned i = 0;\r
-    unsigned j = 0;\r
-    unsigned last_valid_ind = 0;\r
-    unsigned valid_cnt = 0;\r
-    uint64_t ** res_arr;\r
-    boolean_t * is_valid_arr;\r
-\r
-    *p_res_arr = NULL;\r
-    *p_res_arr_len = 0;\r
-\r
-    qsort(arr, arr_len, sizeof(uint64_t*), __cmp_num_range);\r
-\r
-    is_valid_arr = (boolean_t *)malloc(arr_len * sizeof(boolean_t));\r
-    is_valid_arr[last_valid_ind] = TRUE;\r
-    valid_cnt++;\r
-    for (i = 1; i < arr_len; i++)\r
-    {\r
-        if (arr[i][0] <= arr[last_valid_ind][1])\r
-        {\r
-            if (arr[i][1] > arr[last_valid_ind][1])\r
-                arr[last_valid_ind][1] = arr[i][1];\r
-            free(arr[i]);\r
-            arr[i] = NULL;\r
-            is_valid_arr[i] = FALSE;\r
-        }\r
-        else if ((arr[i][0] - 1) == arr[last_valid_ind][1])\r
-        {\r
-            arr[last_valid_ind][1] = arr[i][1];\r
-            free(arr[i]);\r
-            arr[i] = NULL;\r
-            is_valid_arr[i] = FALSE;\r
-        }\r
-        else\r
-        {\r
-            is_valid_arr[i] = TRUE;\r
-            last_valid_ind = i;\r
-            valid_cnt++;\r
-        }\r
-    }\r
-\r
-    res_arr = (uint64_t **)malloc(valid_cnt * sizeof(uint64_t *));\r
-    for (i = 0; i < arr_len; i++)\r
-    {\r
-        if (is_valid_arr[i])\r
-            res_arr[j++] = arr[i];\r
-    }\r
-    free(is_valid_arr);\r
-    free(arr);\r
-\r
-    *p_res_arr = res_arr;\r
-    *p_res_arr_len = valid_cnt;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __pkey_rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len)\r
-{\r
-    uint64_t   tmp_pkey;\r
-    uint64_t * p_pkeys;\r
-    cl_list_iterator_t list_iterator;\r
-\r
-    list_iterator= cl_list_head(p_list);\r
-    while( list_iterator != cl_list_end(p_list) )\r
-    {\r
-       p_pkeys = (uint64_t *)cl_list_obj(list_iterator);\r
-       p_pkeys[0] &= 0x7fff;\r
-       p_pkeys[1] &= 0x7fff;\r
-       if (p_pkeys[0] > p_pkeys[1])\r
-       {\r
-           tmp_pkey = p_pkeys[1];\r
-           p_pkeys[1] = p_pkeys[0];\r
-           p_pkeys[0] = tmp_pkey;\r
-       }\r
-       list_iterator = cl_list_next(list_iterator);\r
-    }\r
-\r
-    __rangelist2rangearr(p_list, p_arr, p_arr_len);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __rangelist2rangearr(\r
-    cl_list_t    * p_list,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len)\r
-{\r
-    cl_list_iterator_t list_iterator;\r
-    unsigned len = cl_list_count(p_list);\r
-    unsigned i = 0;\r
-    uint64_t ** tmp_arr;\r
-    uint64_t ** res_arr = NULL;\r
-    unsigned res_arr_len = 0;\r
-\r
-    tmp_arr = (uint64_t **)malloc(len * sizeof(uint64_t *));\r
-\r
-    list_iterator = cl_list_head(p_list);\r
-    while( list_iterator != cl_list_end(p_list) )\r
-    {\r
-       tmp_arr[i++] = (uint64_t *)cl_list_obj(list_iterator);\r
-       list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(p_list);\r
-\r
-    __sort_reduce_rangearr( tmp_arr,\r
-                            len,\r
-                            &res_arr,\r
-                            &res_arr_len );\r
-    *p_arr = res_arr;\r
-    *p_arr_len = res_arr_len;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __merge_rangearr(\r
-    uint64_t  **   range_arr_1,\r
-    unsigned       range_len_1,\r
-    uint64_t  **   range_arr_2,\r
-    unsigned       range_len_2,\r
-    uint64_t  ** * p_arr,\r
-    unsigned     * p_arr_len )\r
-{\r
-    unsigned i = 0;\r
-    unsigned j = 0;\r
-    unsigned len = range_len_1 + range_len_2;\r
-    uint64_t ** tmp_arr;\r
-    uint64_t ** res_arr = NULL;\r
-    unsigned res_arr_len = 0;\r
-\r
-    *p_arr = NULL;\r
-    *p_arr_len = 0;\r
-\r
-    tmp_arr = (uint64_t **)malloc(len * sizeof(uint64_t *));\r
-\r
-    for (i = 0; i < range_len_1; i++)\r
-       tmp_arr[j++] = range_arr_1[i];\r
-    for (i = 0; i < range_len_2; i++)\r
-       tmp_arr[j++] = range_arr_2[i];\r
-    free(range_arr_1);\r
-    free(range_arr_2);\r
-\r
-    __sort_reduce_rangearr( tmp_arr,\r
-                            len,\r
-                            &res_arr,\r
-                            &res_arr_len );\r
-    *p_arr = res_arr;\r
-    *p_arr_len = res_arr_len;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_port_to_port_map(\r
-    cl_qmap_t   * p_map,\r
-    osm_physp_t * p_physp)\r
-{\r
-    if (cl_qmap_get(p_map, cl_ntoh64(osm_physp_get_port_guid(p_physp))) ==\r
-        cl_qmap_end(p_map))\r
-    {\r
-        osm_qos_port_t * p_port = osm_qos_policy_port_create(p_physp);\r
-        if (p_port)\r
-            cl_qmap_insert(p_map,\r
-                           cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                           &p_port->map_item);\r
-    }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_guid_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len)\r
-{\r
-    unsigned i;\r
-    uint64_t guid_ho;\r
-    osm_port_t * p_osm_port;\r
-\r
-    if (!range_arr || !range_len)\r
-        return;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-         for (guid_ho = range_arr[i][0]; guid_ho <= range_arr[i][1]; guid_ho++) {\r
-             p_osm_port =\r
-                osm_get_port_by_guid(p_qos_policy->p_subn, cl_hton64(guid_ho));\r
-             if (p_osm_port)\r
-                 __parser_add_port_to_port_map(p_map, p_osm_port->p_physp);\r
-         }\r
-         free(range_arr[i]);\r
-    }\r
-    free(range_arr);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_pkey_range_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    uint64_t  ** range_arr,\r
-    unsigned     range_len)\r
-{\r
-    unsigned i;\r
-    uint64_t pkey_64;\r
-    ib_net16_t pkey;\r
-    osm_prtn_t * p_prtn;\r
-\r
-    if (!range_arr || !range_len)\r
-        return;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-         for (pkey_64 = range_arr[i][0]; pkey_64 <= range_arr[i][1]; pkey_64++) {\r
-             pkey = cl_hton16((uint16_t)(pkey_64 & 0x7fff));\r
-             p_prtn = (osm_prtn_t *)\r
-                 cl_qmap_get(&p_qos_policy->p_subn->prtn_pkey_tbl, pkey);\r
-             if (p_prtn != (osm_prtn_t *)cl_qmap_end(\r
-                   &p_qos_policy->p_subn->prtn_pkey_tbl)) {\r
-                 __parser_add_map_to_port_map(p_map, &p_prtn->part_guid_tbl);\r
-                 __parser_add_map_to_port_map(p_map, &p_prtn->full_guid_tbl);\r
-             }\r
-         }\r
-         free(range_arr[i]);\r
-    }\r
-    free(range_arr);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_partition_list_to_port_map(\r
-    cl_qmap_t  * p_map,\r
-    cl_list_t  * p_list)\r
-{\r
-    cl_list_iterator_t    list_iterator;\r
-    char                * tmp_str;\r
-    osm_prtn_t          * p_prtn;\r
-\r
-    /* extract all the ports from the partition\r
-       to the port map of this port group */\r
-    list_iterator = cl_list_head(p_list);\r
-    while(list_iterator != cl_list_end(p_list)) {\r
-        tmp_str = (char*)cl_list_obj(list_iterator);\r
-        if (tmp_str) {\r
-            p_prtn = osm_prtn_find_by_name(p_qos_policy->p_subn, tmp_str);\r
-            if (p_prtn) {\r
-                __parser_add_map_to_port_map(p_map, &p_prtn->part_guid_tbl);\r
-                __parser_add_map_to_port_map(p_map, &p_prtn->full_guid_tbl);\r
-            }\r
-            free(tmp_str);\r
-        }\r
-        list_iterator = cl_list_next(list_iterator);\r
-    }\r
-    cl_list_remove_all(p_list);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __parser_add_map_to_port_map(\r
-    cl_qmap_t * p_dmap,\r
-    cl_map_t  * p_smap)\r
-{\r
-    cl_map_iterator_t map_iterator;\r
-    osm_physp_t * p_physp;\r
-\r
-    if (!p_dmap || !p_smap)\r
-        return;\r
-\r
-    map_iterator = cl_map_head(p_smap);\r
-    while (map_iterator != cl_map_end(p_smap)) {\r
-        p_physp = (osm_physp_t*)cl_map_obj(map_iterator);\r
-        __parser_add_port_to_port_map(p_dmap, p_physp);\r
-        map_iterator = cl_map_next(map_iterator);\r
-    }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int __validate_pkeys( uint64_t ** range_arr,\r
-                             unsigned    range_len,\r
-                             boolean_t   is_ipoib)\r
-{\r
-    unsigned i;\r
-    uint64_t pkey_64;\r
-    ib_net16_t pkey;\r
-    osm_prtn_t * p_prtn;\r
-\r
-    if (!range_arr || !range_len)\r
-        return 0;\r
-\r
-    for (i = 0; i < range_len; i++) {\r
-        for (pkey_64 = range_arr[i][0]; pkey_64 <= range_arr[i][1]; pkey_64++) {\r
-            pkey = cl_hton16((uint16_t)(pkey_64 & 0x7fff));\r
-            p_prtn = (osm_prtn_t *)\r
-                cl_qmap_get(&p_qos_policy->p_subn->prtn_pkey_tbl, pkey);\r
-\r
-            if (p_prtn == (osm_prtn_t *)cl_qmap_end(\r
-                  &p_qos_policy->p_subn->prtn_pkey_tbl))\r
-                p_prtn = NULL;\r
-\r
-            if (is_ipoib) {\r
-                /*\r
-                 * Be very strict for IPoIB partition:\r
-                 *  - the partition for the pkey have to exist\r
-                 *  - it has to have at least 2 full members\r
-                 */\r
-                if (!p_prtn) {\r
-                    yyerror("IPoIB partition, pkey 0x%04X - "\r
-                                       "partition doesn't exist",\r
-                                       cl_ntoh16(pkey));\r
-                    return 1;\r
-                }\r
-                else if (cl_map_count(&p_prtn->full_guid_tbl) < 2) {\r
-                    yyerror("IPoIB partition, pkey 0x%04X - "\r
-                                       "partition has less than two full members",\r
-                                       cl_ntoh16(pkey));\r
-                    return 1;\r
-                }\r
-            }\r
-            else if (!p_prtn) {\r
-                /*\r
-                 * For non-IPoIB pkey we just want to check that\r
-                 * the relevant partition exists.\r
-                 * And even if it doesn't, don't exit - just print\r
-                 * error message and continue.\r
-                 */\r
-                 OSM_LOG(p_qos_parser_osm_log, OSM_LOG_ERROR, "ERR AC02: "\r
-                        "pkey 0x%04X - partition doesn't exist",\r
-                         cl_ntoh16(pkey));\r
-            }\r
-        }\r
-    }\r
-    return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
diff --git a/branches/opensm_3/user/opensm/osm_qos_policy.c b/branches/opensm_3/user/opensm/osm_qos_policy.c
deleted file mode 100644 (file)
index 8156c9d..0000000
+++ /dev/null
@@ -1,1057 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting.  All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    OSM QoS Policy functions.\r
- *\r
- * Author:\r
- *    Yevgeny Kliteynik, Mellanox\r
- */\r
-\r
-#include <stdio.h>\r
-#include <assert.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_qos_policy.h>\r
-\r
-extern osm_qos_level_t __default_simple_qos_level;\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void\r
-__build_nodebyname_hash(osm_qos_policy_t * p_qos_policy)\r
-{\r
-       osm_node_t * p_node;\r
-       cl_qmap_t  * p_node_guid_tbl = &p_qos_policy->p_subn->node_guid_tbl;\r
-\r
-       p_qos_policy->p_node_hash = st_init_strtable();\r
-       CL_ASSERT(p_qos_policy->p_node_hash);\r
-\r
-       if (!p_node_guid_tbl || !cl_qmap_count(p_node_guid_tbl))\r
-               return;\r
-\r
-       for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);\r
-            p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);\r
-            p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item)) {\r
-               if (!st_lookup(p_qos_policy->p_node_hash,\r
-                             (st_data_t)p_node->print_desc, NULL))\r
-                       st_insert(p_qos_policy->p_node_hash,\r
-                                 (st_data_t)p_node->print_desc,\r
-                                 (st_data_t)p_node);\r
-       }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static boolean_t\r
-__is_num_in_range_arr(uint64_t ** range_arr,\r
-                 unsigned range_arr_len, uint64_t num)\r
-{\r
-       unsigned ind_1 = 0;\r
-       unsigned ind_2 = range_arr_len - 1;\r
-       unsigned ind_mid;\r
-\r
-       if (!range_arr || !range_arr_len)\r
-               return FALSE;\r
-\r
-       while (ind_1 <= ind_2) {\r
-           if (num < range_arr[ind_1][0] || num > range_arr[ind_2][1])\r
-               return FALSE;\r
-           else if (num <= range_arr[ind_1][1] || num >= range_arr[ind_2][0])\r
-               return TRUE;\r
-\r
-           ind_mid = ind_1 + (ind_2 - ind_1 + 1)/2;\r
-\r
-           if (num < range_arr[ind_mid][0])\r
-               ind_2 = ind_mid;\r
-           else if (num > range_arr[ind_mid][1])\r
-               ind_1 = ind_mid;\r
-           else\r
-               return TRUE;\r
-\r
-           ind_1++;\r
-           ind_2--;\r
-       }\r
-\r
-       return FALSE;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __free_single_element(void *p_element, void *context)\r
-{\r
-       if (p_element)\r
-               free(p_element);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_port_t *osm_qos_policy_port_create(osm_physp_t *p_physp)\r
-{\r
-       osm_qos_port_t *p =\r
-           (osm_qos_port_t *) calloc(1, sizeof(osm_qos_port_t));\r
-       if (p)\r
-               p->p_physp = p_physp;\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_port_group_t *osm_qos_policy_port_group_create()\r
-{\r
-       osm_qos_port_group_t *p =\r
-           (osm_qos_port_group_t *) calloc(1, sizeof(osm_qos_port_group_t));\r
-       if (p)\r
-               cl_qmap_init(&p->port_map);\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_port_group_destroy(osm_qos_port_group_t * p)\r
-{\r
-       osm_qos_port_t * p_port;\r
-       osm_qos_port_t * p_old_port;\r
-\r
-       if (!p)\r
-               return;\r
-\r
-       if (p->name)\r
-               free(p->name);\r
-       if (p->use)\r
-               free(p->use);\r
-\r
-       p_port = (osm_qos_port_t *) cl_qmap_head(&p->port_map);\r
-       while (p_port != (osm_qos_port_t *) cl_qmap_end(&p->port_map))\r
-       {\r
-               p_old_port = p_port;\r
-               p_port = (osm_qos_port_t *) cl_qmap_next(&p_port->map_item);\r
-               free(p_old_port);\r
-       }\r
-       cl_qmap_remove_all(&p->port_map);\r
-\r
-       free(p);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_vlarb_scope_t *osm_qos_policy_vlarb_scope_create()\r
-{\r
-       osm_qos_vlarb_scope_t *p =\r
-           (osm_qos_vlarb_scope_t *) calloc(1, sizeof(osm_qos_vlarb_scope_t));\r
-       if (p) {\r
-               cl_list_init(&p->group_list, 10);\r
-               cl_list_init(&p->across_list, 10);\r
-               cl_list_init(&p->vlarb_high_list, 10);\r
-               cl_list_init(&p->vlarb_low_list, 10);\r
-       }\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_vlarb_scope_destroy(osm_qos_vlarb_scope_t * p)\r
-{\r
-       if (!p)\r
-               return;\r
-\r
-       cl_list_apply_func(&p->group_list, __free_single_element, NULL);\r
-       cl_list_apply_func(&p->across_list, __free_single_element, NULL);\r
-       cl_list_apply_func(&p->vlarb_high_list, __free_single_element, NULL);\r
-       cl_list_apply_func(&p->vlarb_low_list, __free_single_element, NULL);\r
-\r
-       cl_list_remove_all(&p->group_list);\r
-       cl_list_remove_all(&p->across_list);\r
-       cl_list_remove_all(&p->vlarb_high_list);\r
-       cl_list_remove_all(&p->vlarb_low_list);\r
-\r
-       cl_list_destroy(&p->group_list);\r
-       cl_list_destroy(&p->across_list);\r
-       cl_list_destroy(&p->vlarb_high_list);\r
-       cl_list_destroy(&p->vlarb_low_list);\r
-\r
-       free(p);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_sl2vl_scope_t *osm_qos_policy_sl2vl_scope_create()\r
-{\r
-       osm_qos_sl2vl_scope_t *p =\r
-           (osm_qos_sl2vl_scope_t *) calloc(1, sizeof(osm_qos_sl2vl_scope_t));\r
-       if (p) {\r
-               cl_list_init(&p->group_list, 10);\r
-               cl_list_init(&p->across_from_list, 10);\r
-               cl_list_init(&p->across_to_list, 10);\r
-       }\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_sl2vl_scope_destroy(osm_qos_sl2vl_scope_t * p)\r
-{\r
-       if (!p)\r
-               return;\r
-\r
-       cl_list_apply_func(&p->group_list, __free_single_element, NULL);\r
-       cl_list_apply_func(&p->across_from_list, __free_single_element, NULL);\r
-       cl_list_apply_func(&p->across_to_list, __free_single_element, NULL);\r
-\r
-       cl_list_remove_all(&p->group_list);\r
-       cl_list_remove_all(&p->across_from_list);\r
-       cl_list_remove_all(&p->across_to_list);\r
-\r
-       cl_list_destroy(&p->group_list);\r
-       cl_list_destroy(&p->across_from_list);\r
-       cl_list_destroy(&p->across_to_list);\r
-\r
-       free(p);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_level_t *osm_qos_policy_qos_level_create()\r
-{\r
-       osm_qos_level_t *p =\r
-           (osm_qos_level_t *) calloc(1, sizeof(osm_qos_level_t));\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_qos_level_destroy(osm_qos_level_t * p)\r
-{\r
-       unsigned i;\r
-\r
-       if (!p)\r
-               return;\r
-\r
-       if (p->name)\r
-               free(p->name);\r
-       if (p->use)\r
-               free(p->use);\r
-\r
-       for (i = 0; i < p->path_bits_range_len; i++)\r
-               free(p->path_bits_range_arr[i]);\r
-       if (p->path_bits_range_arr)\r
-               free(p->path_bits_range_arr);\r
-\r
-       free(p);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-boolean_t osm_qos_level_has_pkey(IN const osm_qos_level_t * p_qos_level,\r
-                                IN ib_net16_t pkey)\r
-{\r
-       if (!p_qos_level || !p_qos_level->pkey_range_len)\r
-               return FALSE;\r
-       return __is_num_in_range_arr(p_qos_level->pkey_range_arr,\r
-                                    p_qos_level->pkey_range_len,\r
-                                    cl_ntoh16(ib_pkey_get_base(pkey)));\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-ib_net16_t osm_qos_level_get_shared_pkey(IN const osm_qos_level_t * p_qos_level,\r
-                                        IN const osm_physp_t * p_src_physp,\r
-                                        IN const osm_physp_t * p_dest_physp)\r
-{\r
-       unsigned i;\r
-       uint16_t pkey_ho = 0;\r
-\r
-       if (!p_qos_level || !p_qos_level->pkey_range_len)\r
-               return 0;\r
-\r
-       /*\r
-        * ToDo: This approach is not optimal.\r
-        *       Think how to find shared pkey that also exists\r
-        *       in QoS level in less runtime.\r
-        */\r
-\r
-       for (i = 0; i < p_qos_level->pkey_range_len; i++) {\r
-               for (pkey_ho = p_qos_level->pkey_range_arr[i][0];\r
-                    pkey_ho <= p_qos_level->pkey_range_arr[i][1]; pkey_ho++) {\r
-                       if (osm_physp_share_this_pkey\r
-                           (p_src_physp, p_dest_physp, cl_hton16(pkey_ho)))\r
-                               return cl_hton16(pkey_ho);\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_match_rule_t *osm_qos_policy_match_rule_create()\r
-{\r
-       osm_qos_match_rule_t *p =\r
-           (osm_qos_match_rule_t *) calloc(1, sizeof(osm_qos_match_rule_t));\r
-       if (p) {\r
-               cl_list_init(&p->source_list, 10);\r
-               cl_list_init(&p->source_group_list, 10);\r
-               cl_list_init(&p->destination_list, 10);\r
-               cl_list_init(&p->destination_group_list, 10);\r
-       }\r
-       return p;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p)\r
-{\r
-       unsigned i;\r
-\r
-       if (!p)\r
-               return;\r
-\r
-       if (p->qos_level_name)\r
-               free(p->qos_level_name);\r
-       if (p->use)\r
-               free(p->use);\r
-\r
-       for (i = 0; i < p->service_id_range_len; i++)\r
-               free(p->service_id_range_arr[i]);\r
-       if (p->service_id_range_arr)\r
-               free(p->service_id_range_arr);\r
-\r
-       for (i = 0; i < p->qos_class_range_len; i++)\r
-               free(p->qos_class_range_arr[i]);\r
-       if (p->qos_class_range_arr)\r
-               free(p->qos_class_range_arr);\r
-\r
-       for (i = 0; i < p->pkey_range_len; i++)\r
-               free(p->pkey_range_arr[i]);\r
-       if (p->pkey_range_arr)\r
-               free(p->pkey_range_arr);\r
-\r
-       cl_list_apply_func(&p->source_list, __free_single_element, NULL);\r
-       cl_list_remove_all(&p->source_list);\r
-       cl_list_destroy(&p->source_list);\r
-\r
-       cl_list_remove_all(&p->source_group_list);\r
-       cl_list_destroy(&p->source_group_list);\r
-\r
-       cl_list_apply_func(&p->destination_list, __free_single_element, NULL);\r
-       cl_list_remove_all(&p->destination_list);\r
-       cl_list_destroy(&p->destination_list);\r
-\r
-       cl_list_remove_all(&p->destination_group_list);\r
-       cl_list_destroy(&p->destination_group_list);\r
-\r
-       free(p);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_policy_t * osm_qos_policy_create(osm_subn_t * p_subn)\r
-{\r
-       osm_qos_policy_t * p_qos_policy = (osm_qos_policy_t *)calloc(1, sizeof(osm_qos_policy_t));\r
-       if (!p_qos_policy)\r
-               return NULL;\r
-\r
-       cl_list_construct(&p_qos_policy->port_groups);\r
-       cl_list_init(&p_qos_policy->port_groups, 10);\r
-\r
-       cl_list_construct(&p_qos_policy->vlarb_tables);\r
-       cl_list_init(&p_qos_policy->vlarb_tables, 10);\r
-\r
-       cl_list_construct(&p_qos_policy->sl2vl_tables);\r
-       cl_list_init(&p_qos_policy->sl2vl_tables, 10);\r
-\r
-       cl_list_construct(&p_qos_policy->qos_levels);\r
-       cl_list_init(&p_qos_policy->qos_levels, 10);\r
-\r
-       cl_list_construct(&p_qos_policy->qos_match_rules);\r
-       cl_list_init(&p_qos_policy->qos_match_rules, 10);\r
-\r
-       p_qos_policy->p_subn = p_subn;\r
-       __build_nodebyname_hash(p_qos_policy);\r
-\r
-       return p_qos_policy;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-void osm_qos_policy_destroy(osm_qos_policy_t * p_qos_policy)\r
-{\r
-       cl_list_iterator_t list_iterator;\r
-       osm_qos_port_group_t *p_port_group = NULL;\r
-       osm_qos_vlarb_scope_t *p_vlarb_scope = NULL;\r
-       osm_qos_sl2vl_scope_t *p_sl2vl_scope = NULL;\r
-       osm_qos_level_t *p_qos_level = NULL;\r
-       osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-\r
-       if (!p_qos_policy)\r
-               return;\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->port_groups);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->port_groups)) {\r
-               p_port_group =\r
-                   (osm_qos_port_group_t *) cl_list_obj(list_iterator);\r
-               if (p_port_group)\r
-                       osm_qos_policy_port_group_destroy(p_port_group);\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       cl_list_remove_all(&p_qos_policy->port_groups);\r
-       cl_list_destroy(&p_qos_policy->port_groups);\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->vlarb_tables);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->vlarb_tables)) {\r
-               p_vlarb_scope =\r
-                   (osm_qos_vlarb_scope_t *) cl_list_obj(list_iterator);\r
-               if (p_vlarb_scope)\r
-                       osm_qos_policy_vlarb_scope_destroy(p_vlarb_scope);\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       cl_list_remove_all(&p_qos_policy->vlarb_tables);\r
-       cl_list_destroy(&p_qos_policy->vlarb_tables);\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->sl2vl_tables);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->sl2vl_tables)) {\r
-               p_sl2vl_scope =\r
-                   (osm_qos_sl2vl_scope_t *) cl_list_obj(list_iterator);\r
-               if (p_sl2vl_scope)\r
-                       osm_qos_policy_sl2vl_scope_destroy(p_sl2vl_scope);\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       cl_list_remove_all(&p_qos_policy->sl2vl_tables);\r
-       cl_list_destroy(&p_qos_policy->sl2vl_tables);\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->qos_levels);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->qos_levels)) {\r
-               p_qos_level = (osm_qos_level_t *) cl_list_obj(list_iterator);\r
-               if (p_qos_level)\r
-                       osm_qos_policy_qos_level_destroy(p_qos_level);\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       cl_list_remove_all(&p_qos_policy->qos_levels);\r
-       cl_list_destroy(&p_qos_policy->qos_levels);\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->qos_match_rules);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->qos_match_rules)) {\r
-               p_qos_match_rule =\r
-                   (osm_qos_match_rule_t *) cl_list_obj(list_iterator);\r
-               if (p_qos_match_rule)\r
-                       osm_qos_policy_match_rule_destroy(p_qos_match_rule);\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       cl_list_remove_all(&p_qos_policy->qos_match_rules);\r
-       cl_list_destroy(&p_qos_policy->qos_match_rules);\r
-\r
-       if (p_qos_policy->p_node_hash)\r
-               st_free_table(p_qos_policy->p_node_hash);\r
-\r
-       free(p_qos_policy);\r
-\r
-       p_qos_policy = NULL;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static boolean_t\r
-__qos_policy_is_port_in_group(osm_subn_t * p_subn,\r
-                             const osm_physp_t * p_physp,\r
-                             osm_qos_port_group_t * p_port_group)\r
-{\r
-       osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);\r
-       ib_net64_t port_guid = osm_physp_get_port_guid(p_physp);\r
-       uint64_t port_guid_ho = cl_ntoh64(port_guid);\r
-\r
-       /* check whether this port's type matches any of group's types */\r
-\r
-       if ( p_port_group->node_types &\r
-            (((uint8_t)1)<<osm_node_get_type(p_node)) )\r
-               return TRUE;\r
-\r
-       /* check whether this port's guid is in group's port map */\r
-\r
-       if (cl_qmap_get(&p_port_group->port_map, port_guid_ho) !=\r
-           cl_qmap_end(&p_port_group->port_map))\r
-               return TRUE;\r
-\r
-       return FALSE;\r
-}                              /* __qos_policy_is_port_in_group() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static boolean_t\r
-__qos_policy_is_port_in_group_list(const osm_qos_policy_t * p_qos_policy,\r
-                                  const osm_physp_t * p_physp,\r
-                                  cl_list_t * p_port_group_list)\r
-{\r
-       osm_qos_port_group_t *p_port_group;\r
-       cl_list_iterator_t list_iterator;\r
-\r
-       list_iterator = cl_list_head(p_port_group_list);\r
-       while (list_iterator != cl_list_end(p_port_group_list)) {\r
-               p_port_group =\r
-                   (osm_qos_port_group_t *) cl_list_obj(list_iterator);\r
-               if (p_port_group) {\r
-                       if (__qos_policy_is_port_in_group\r
-                           (p_qos_policy->p_subn, p_physp, p_port_group))\r
-                               return TRUE;\r
-               }\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-       return FALSE;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(\r
-                        const osm_qos_policy_t * p_qos_policy,\r
-                        uint64_t service_id,\r
-                        uint16_t qos_class,\r
-                        uint16_t pkey,\r
-                        const osm_physp_t * p_src_physp,\r
-                        const osm_physp_t * p_dest_physp,\r
-                        ib_net64_t comp_mask)\r
-{\r
-       osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-       cl_list_iterator_t list_iterator;\r
-       osm_log_t * p_log = &p_qos_policy->p_subn->p_osm->log;\r
-\r
-       boolean_t matched_by_sguid = FALSE,\r
-                 matched_by_dguid = FALSE,\r
-                 matched_by_class = FALSE,\r
-                 matched_by_sid = FALSE,\r
-                 matched_by_pkey = FALSE;\r
-\r
-       if (!cl_list_count(&p_qos_policy->qos_match_rules))\r
-               return NULL;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* Go over all QoS match rules and find the one that matches the request */\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->qos_match_rules);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->qos_match_rules)) {\r
-               p_qos_match_rule =\r
-                   (osm_qos_match_rule_t *) cl_list_obj(list_iterator);\r
-               if (!p_qos_match_rule) {\r
-                       list_iterator = cl_list_next(list_iterator);\r
-                       continue;\r
-               }\r
-\r
-               /* If a match rule has Source groups, PR request source has to be in this list */\r
-\r
-               if (cl_list_count(&p_qos_match_rule->source_group_list)) {\r
-                       if (!__qos_policy_is_port_in_group_list(p_qos_policy,\r
-                                                               p_src_physp,\r
-                                                               &p_qos_match_rule->\r
-                                                               source_group_list))\r
-                       {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-                       matched_by_sguid = TRUE;\r
-               }\r
-\r
-               /* If a match rule has Destination groups, PR request dest. has to be in this list */\r
-\r
-               if (cl_list_count(&p_qos_match_rule->destination_group_list)) {\r
-                       if (!__qos_policy_is_port_in_group_list(p_qos_policy,\r
-                                                               p_dest_physp,\r
-                                                               &p_qos_match_rule->\r
-                                                               destination_group_list))\r
-                       {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-                       matched_by_dguid = TRUE;\r
-               }\r
-\r
-               /* If a match rule has QoS classes, PR request HAS\r
-                  to have a matching QoS class to match the rule */\r
-\r
-               if (p_qos_match_rule->qos_class_range_len) {\r
-                       if (!(comp_mask & IB_PR_COMPMASK_QOS_CLASS)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-\r
-                       if (!__is_num_in_range_arr\r
-                           (p_qos_match_rule->qos_class_range_arr,\r
-                            p_qos_match_rule->qos_class_range_len,\r
-                            qos_class)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-                       matched_by_class = TRUE;\r
-               }\r
-\r
-               /* If a match rule has Service IDs, PR request HAS\r
-                  to have a matching Service ID to match the rule */\r
-\r
-               if (p_qos_match_rule->service_id_range_len) {\r
-                       if (!(comp_mask & IB_PR_COMPMASK_SERVICEID_MSB) ||\r
-                           !(comp_mask & IB_PR_COMPMASK_SERVICEID_LSB)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-\r
-                       if (!__is_num_in_range_arr\r
-                           (p_qos_match_rule->service_id_range_arr,\r
-                            p_qos_match_rule->service_id_range_len,\r
-                            service_id)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-                       matched_by_sid = TRUE;\r
-               }\r
-\r
-               /* If a match rule has PKeys, PR request HAS\r
-                  to have a matching PKey to match the rule */\r
-\r
-               if (p_qos_match_rule->pkey_range_len) {\r
-                       if (!(comp_mask & IB_PR_COMPMASK_PKEY)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-\r
-                       if (!__is_num_in_range_arr\r
-                           (p_qos_match_rule->pkey_range_arr,\r
-                            p_qos_match_rule->pkey_range_len,\r
-                            pkey & 0x7FFF)) {\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                               continue;\r
-                       }\r
-                       matched_by_pkey = TRUE;\r
-               }\r
-\r
-               /* if we got here, then this match-rule matched this PR request */\r
-               break;\r
-       }\r
-\r
-       if (list_iterator == cl_list_end(&p_qos_policy->qos_match_rules))\r
-               p_qos_match_rule = NULL;\r
-\r
-       if (p_qos_match_rule)\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "request matched rule (%s) by:%s%s%s%s%s\n",\r
-                       (p_qos_match_rule->use) ?\r
-                               p_qos_match_rule->use : "no description",\r
-                       (matched_by_sguid) ? " SGUID" : "",\r
-                       (matched_by_dguid) ? " DGUID" : "",\r
-                       (matched_by_class) ? " QoS_Class" : "",\r
-                       (matched_by_sid)   ? " ServiceID" : "",\r
-                       (matched_by_pkey)  ? " PKey" : "");\r
-       else\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "request not matched any rule\n");\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return p_qos_match_rule;\r
-}                              /* __qos_policy_get_match_rule_by_params() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static osm_qos_level_t *__qos_policy_get_qos_level_by_name(\r
-               const osm_qos_policy_t * p_qos_policy,\r
-               char *name)\r
-{\r
-       osm_qos_level_t *p_qos_level = NULL;\r
-       cl_list_iterator_t list_iterator;\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->qos_levels);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->qos_levels)) {\r
-               p_qos_level = (osm_qos_level_t *) cl_list_obj(list_iterator);\r
-               if (!p_qos_level)\r
-                       continue;\r
-\r
-               /* names are case INsensitive */\r
-               if (strcasecmp(name, p_qos_level->name) == 0)\r
-                       return p_qos_level;\r
-\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static osm_qos_port_group_t *__qos_policy_get_port_group_by_name(\r
-               const osm_qos_policy_t * p_qos_policy,\r
-               const char *const name)\r
-{\r
-       osm_qos_port_group_t *p_port_group = NULL;\r
-       cl_list_iterator_t list_iterator;\r
-\r
-       list_iterator = cl_list_head(&p_qos_policy->port_groups);\r
-       while (list_iterator != cl_list_end(&p_qos_policy->port_groups)) {\r
-               p_port_group =\r
-                   (osm_qos_port_group_t *) cl_list_obj(list_iterator);\r
-               if (!p_port_group)\r
-                       continue;\r
-\r
-               /* names are case INsensitive */\r
-               if (strcasecmp(name, p_port_group->name) == 0)\r
-                       return p_port_group;\r
-\r
-               list_iterator = cl_list_next(list_iterator);\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void __qos_policy_validate_pkey(\r
-                       osm_qos_policy_t * p_qos_policy,\r
-                       osm_qos_match_rule_t * p_qos_match_rule,\r
-                       osm_prtn_t * p_prtn)\r
-{\r
-       uint8_t sl;\r
-       uint32_t flow;\r
-       uint8_t hop;\r
-\r
-       if (!p_qos_policy || !p_qos_match_rule || !p_prtn)\r
-               return;\r
-\r
-       if (!p_qos_match_rule->p_qos_level->sl_set ||\r
-           p_prtn->sl == p_qos_match_rule->p_qos_level->sl)\r
-               return;\r
-\r
-       /* overriding partition's SL */\r
-       OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR,\r
-               "ERR AC15: pkey 0x%04X in match rule - "\r
-               "overriding partition SL (%u) with QoS Level SL (%u)\n",\r
-               cl_ntoh16(p_prtn->pkey), p_prtn->sl,\r
-               p_qos_match_rule->p_qos_level->sl);\r
-       p_prtn->sl = p_qos_match_rule->p_qos_level->sl;\r
-\r
-\r
-       /* If this partition is an IPoIB partition, there should\r
-          be a matching MCast group. Fix this group's SL too */\r
-       if (!p_prtn->mgrp)\r
-               return;\r
-\r
-       CL_ASSERT((cl_ntoh16(p_prtn->mgrp->mcmember_rec.pkey) & 0x7fff) ==\r
-                 (cl_ntoh16(p_prtn->pkey) & 0x7fff));\r
-\r
-       ib_member_get_sl_flow_hop(p_prtn->mgrp->mcmember_rec.sl_flow_hop,\r
-                                 &sl, &flow, &hop);\r
-       if (sl != p_prtn->sl) {\r
-               OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Updating MCGroup (MLID 0x%04x) SL to "\r
-                       "match partition SL (%u)\n",\r
-                       cl_hton16(p_prtn->mgrp->mcmember_rec.mlid),\r
-                       p_prtn->sl);\r
-               p_prtn->mgrp->mcmember_rec.sl_flow_hop =\r
-                       ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);\r
-       }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int osm_qos_policy_validate(osm_qos_policy_t * p_qos_policy,\r
-                           osm_log_t *p_log)\r
-{\r
-       cl_list_iterator_t match_rules_list_iterator;\r
-       cl_list_iterator_t list_iterator;\r
-       osm_qos_port_group_t *p_port_group = NULL;\r
-       osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-       char *str;\r
-       unsigned i, j;\r
-       int res = 0;\r
-       uint64_t pkey_64;\r
-       ib_net16_t pkey;\r
-       osm_prtn_t * p_prtn;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* set default qos level */\r
-\r
-       p_qos_policy->p_default_qos_level =\r
-           __qos_policy_get_qos_level_by_name(p_qos_policy, OSM_QOS_POLICY_DEFAULT_LEVEL_NAME);\r
-       if (!p_qos_policy->p_default_qos_level) {\r
-               /* There's no default QoS level in the usual qos-level section.\r
-                  Check whether the 'simple' default QoS level that can be\r
-                  defined in the qos-ulp section exists */\r
-               if (__default_simple_qos_level.sl_set) {\r
-                       p_qos_policy->p_default_qos_level = &__default_simple_qos_level;\r
-               }\r
-               else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AC10: "\r
-                               "Default qos-level (%s) not defined.\n",\r
-                               OSM_QOS_POLICY_DEFAULT_LEVEL_NAME);\r
-                       res = 1;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* scan all the match rules, and fill the lists of pointers to\r
-          relevant qos levels and port groups to speed up PR matching */\r
-\r
-       i = 1;\r
-       match_rules_list_iterator =\r
-           cl_list_head(&p_qos_policy->qos_match_rules);\r
-       while (match_rules_list_iterator !=\r
-              cl_list_end(&p_qos_policy->qos_match_rules)) {\r
-               p_qos_match_rule =\r
-                   (osm_qos_match_rule_t *)\r
-                   cl_list_obj(match_rules_list_iterator);\r
-               CL_ASSERT(p_qos_match_rule);\r
-\r
-               /* find the matching qos-level for each match-rule */\r
-\r
-               if (!p_qos_match_rule->p_qos_level)\r
-                       p_qos_match_rule->p_qos_level =\r
-                               __qos_policy_get_qos_level_by_name(p_qos_policy,\r
-                                              p_qos_match_rule->qos_level_name);\r
-\r
-               if (!p_qos_match_rule->p_qos_level) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AC11: "\r
-                               "qos-match-rule num %u: qos-level '%s' not found\n",\r
-                               i, p_qos_match_rule->qos_level_name);\r
-                       res = 1;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* find the matching port-group for element of source_list */\r
-\r
-               if (cl_list_count(&p_qos_match_rule->source_list)) {\r
-                       list_iterator =\r
-                           cl_list_head(&p_qos_match_rule->source_list);\r
-                       while (list_iterator !=\r
-                              cl_list_end(&p_qos_match_rule->source_list)) {\r
-                               str = (char *)cl_list_obj(list_iterator);\r
-                               CL_ASSERT(str);\r
-\r
-                               p_port_group =\r
-                                   __qos_policy_get_port_group_by_name(p_qos_policy, str);\r
-                               if (!p_port_group) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AC12: "\r
-                                               "qos-match-rule num %u: source port-group '%s' not found\n",\r
-                                               i, str);\r
-                                       res = 1;\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               cl_list_insert_tail(&p_qos_match_rule->\r
-                                                   source_group_list,\r
-                                                   p_port_group);\r
-\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                       }\r
-               }\r
-\r
-               /* find the matching port-group for element of destination_list */\r
-\r
-               if (cl_list_count(&p_qos_match_rule->destination_list)) {\r
-                       list_iterator =\r
-                           cl_list_head(&p_qos_match_rule->destination_list);\r
-                       while (list_iterator !=\r
-                              cl_list_end(&p_qos_match_rule->\r
-                                          destination_list)) {\r
-                               str = (char *)cl_list_obj(list_iterator);\r
-                               CL_ASSERT(str);\r
-\r
-                               p_port_group =\r
-                                   __qos_policy_get_port_group_by_name(p_qos_policy,str);\r
-                               if (!p_port_group) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AC13: "\r
-                                               "qos-match-rule num %u: destination port-group '%s' not found\n",\r
-                                               i, str);\r
-                                       res = 1;\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               cl_list_insert_tail(&p_qos_match_rule->\r
-                                                   destination_group_list,\r
-                                                   p_port_group);\r
-\r
-                               list_iterator = cl_list_next(list_iterator);\r
-                       }\r
-               }\r
-\r
-               /*\r
-                * Scan all the pkeys in matching rule, and if the\r
-                * partition for these pkeys exists, set the SL\r
-                * according to the QoS Level.\r
-                * Warn if there's mismatch between QoS level SL\r
-                * and Partition SL.\r
-                */\r
-\r
-               for (j = 0; j < p_qos_match_rule->pkey_range_len; j++) {\r
-                       for ( pkey_64 = p_qos_match_rule->pkey_range_arr[j][0];\r
-                             pkey_64 <= p_qos_match_rule->pkey_range_arr[j][1];\r
-                             pkey_64++) {\r
-                                pkey = cl_hton16((uint16_t)(pkey_64 & 0x7fff));\r
-                               p_prtn = (osm_prtn_t *)cl_qmap_get(\r
-                                       &p_qos_policy->p_subn->prtn_pkey_tbl, pkey);\r
-\r
-                               if (p_prtn == (osm_prtn_t *)cl_qmap_end(\r
-                                       &p_qos_policy->p_subn->prtn_pkey_tbl))\r
-                                       /* partition for this pkey not found */\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AC14: "\r
-                                               "pkey 0x%04X in match rule - "\r
-                                               "partition doesn't exist\n",\r
-                                               cl_ntoh16(pkey));\r
-                               else\r
-                                       __qos_policy_validate_pkey(p_qos_policy,\r
-                                                       p_qos_match_rule,\r
-                                                       p_prtn);\r
-                       }\r
-               }\r
-\r
-               /* done with the current match-rule */\r
-\r
-               match_rules_list_iterator =\r
-                   cl_list_next(match_rules_list_iterator);\r
-               i++;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return res;\r
-}                              /* osm_qos_policy_validate() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static osm_qos_level_t * __qos_policy_get_qos_level_by_params(\r
-       IN const osm_qos_policy_t * p_qos_policy,\r
-       IN const osm_physp_t * p_src_physp,\r
-       IN const osm_physp_t * p_dest_physp,\r
-       IN uint64_t service_id,\r
-       IN uint16_t qos_class,\r
-       IN uint16_t pkey,\r
-       IN ib_net64_t comp_mask)\r
-{\r
-       osm_qos_match_rule_t *p_qos_match_rule = NULL;\r
-\r
-       if (!p_qos_policy)\r
-               return NULL;\r
-\r
-       p_qos_match_rule = __qos_policy_get_match_rule_by_params(\r
-               p_qos_policy, service_id, qos_class, pkey,\r
-               p_src_physp, p_dest_physp, comp_mask);\r
-\r
-       return p_qos_match_rule ? p_qos_match_rule->p_qos_level :\r
-               p_qos_policy->p_default_qos_level;\r
-}                              /* __qos_policy_get_qos_level_by_params() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_level_t * osm_qos_policy_get_qos_level_by_pr(\r
-       IN const osm_qos_policy_t * p_qos_policy,\r
-       IN const ib_path_rec_t * p_pr,\r
-       IN const osm_physp_t * p_src_physp,\r
-       IN const osm_physp_t * p_dest_physp,\r
-       IN ib_net64_t comp_mask)\r
-{\r
-       return __qos_policy_get_qos_level_by_params(\r
-               p_qos_policy, p_src_physp, p_dest_physp,\r
-               cl_ntoh64(p_pr->service_id), ib_path_rec_qos_class(p_pr),\r
-               cl_ntoh16(p_pr->pkey), comp_mask);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-osm_qos_level_t * osm_qos_policy_get_qos_level_by_mpr(\r
-       IN const osm_qos_policy_t * p_qos_policy,\r
-       IN const ib_multipath_rec_t * p_mpr,\r
-       IN const osm_physp_t * p_src_physp,\r
-       IN const osm_physp_t * p_dest_physp,\r
-       IN ib_net64_t comp_mask)\r
-{\r
-       ib_net64_t pr_comp_mask = 0;\r
-\r
-       if (!p_qos_policy)\r
-               return NULL;\r
-\r
-       /*\r
-        * Converting MultiPathRecord compmask to the PathRecord\r
-        * compmask. Note that only relevant bits are set.\r
-        */\r
-       pr_comp_mask =\r
-               ((comp_mask & IB_MPR_COMPMASK_QOS_CLASS) ?\r
-                IB_PR_COMPMASK_QOS_CLASS : 0) |\r
-               ((comp_mask & IB_MPR_COMPMASK_PKEY) ?\r
-                IB_PR_COMPMASK_PKEY : 0) |\r
-               ((comp_mask & IB_MPR_COMPMASK_SERVICEID_MSB) ?\r
-                IB_PR_COMPMASK_SERVICEID_MSB : 0) |\r
-               ((comp_mask & IB_MPR_COMPMASK_SERVICEID_LSB) ?\r
-                IB_PR_COMPMASK_SERVICEID_LSB : 0);\r
-\r
-       return __qos_policy_get_qos_level_by_params(\r
-               p_qos_policy, p_src_physp, p_dest_physp,\r
-               cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),\r
-               ib_multipath_rec_qos_class(p_mpr),\r
-               cl_ntoh16(p_mpr->pkey), pr_comp_mask);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
diff --git a/branches/opensm_3/user/opensm/osm_remote_sm.c b/branches/opensm_3/user/opensm/osm_remote_sm.c
deleted file mode 100644 (file)
index 6b8bd1c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sm_t.\r
- * This object represents the remote SM object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <opensm/osm_remote_sm.h>\r
-\r
-void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm)\r
-{\r
-       memset(p_sm, 0, sizeof(*p_sm));\r
-}\r
-\r
-void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm)\r
-{\r
-       memset(p_sm, 0, sizeof(*p_sm));\r
-}\r
-\r
-void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, IN const osm_port_t * p_port,\r
-                       IN const ib_sm_info_t * p_smi)\r
-{\r
-       CL_ASSERT(p_sm);\r
-       CL_ASSERT(p_port);\r
-\r
-       osm_remote_sm_construct(p_sm);\r
-\r
-       p_sm->p_port = p_port;\r
-       p_sm->smi = *p_smi;\r
-       return;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_req.c b/branches/opensm_3/user/opensm/osm_req.c
deleted file mode 100644 (file)
index fe7d134..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_req_t.\r
- * This object represents the generic attribute requester.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_attrib_req.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_vl15intf.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-/**********************************************************************\r
-  The plock MAY or MAY NOT be held before calling this function.\r
-**********************************************************************/\r
-ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,\r
-                           IN ib_net16_t attr_id, IN ib_net32_t attr_mod,\r
-                           IN cl_disp_msgid_t err_msg,\r
-                           IN const osm_madw_context_t * p_context)\r
-{\r
-       osm_madw_t *p_madw;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net64_t tid;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_path);\r
-       CL_ASSERT(attr_id);\r
-\r
-       /* do nothing if we are exiting ... */\r
-       if (osm_exit_flag)\r
-               goto Exit;\r
-\r
-       /* p_context may be NULL. */\r
-\r
-       p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind,\r
-                                 MAD_BLOCK_SIZE, NULL);\r
-       if (p_madw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1101: Unable to acquire MAD\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",\r
-               ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),\r
-               cl_ntoh32(attr_mod), cl_ntoh64(tid));\r
-\r
-       ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_GET,\r
-                       tid, attr_id, attr_mod, p_path->hop_count,\r
-                       sm->p_subn->opt.m_key, p_path->path,\r
-                       IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);\r
-\r
-       p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;\r
-       p_madw->mad_addr.addr_type.smi.source_lid = IB_LID_PERMISSIVE;\r
-       p_madw->resp_expected = TRUE;\r
-       p_madw->fail_msg = err_msg;\r
-\r
-       /*\r
-          Fill in the mad wrapper context for the recipient.\r
-          In this case, the only thing the recipient needs is the\r
-          guid value.\r
-        */\r
-\r
-       if (p_context)\r
-               p_madw->context = *p_context;\r
-\r
-       osm_vl15_post(sm->p_vl15, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
-  The plock MAY or MAY NOT be held before calling this function.\r
-**********************************************************************/\r
-ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,\r
-                           IN const uint8_t * p_payload,\r
-                           IN size_t payload_size,\r
-                           IN ib_net16_t attr_id, IN ib_net32_t attr_mod,\r
-                           IN cl_disp_msgid_t err_msg,\r
-                           IN const osm_madw_context_t * p_context)\r
-{\r
-       osm_madw_t *p_madw;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net64_t tid;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_path);\r
-       CL_ASSERT(attr_id);\r
-       CL_ASSERT(p_payload);\r
-\r
-       /* do nothing if we are exiting ... */\r
-       if (osm_exit_flag)\r
-               goto Exit;\r
-\r
-       /* p_context may be NULL. */\r
-\r
-       p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind,\r
-                                 MAD_BLOCK_SIZE, NULL);\r
-       if (p_madw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1102: Unable to acquire MAD\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64 "\n",\r
-               ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),\r
-               cl_ntoh32(attr_mod), cl_ntoh64(tid));\r
-\r
-       ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_SET,\r
-                       tid, attr_id, attr_mod, p_path->hop_count,\r
-                       sm->p_subn->opt.m_key, p_path->path,\r
-                       IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);\r
-\r
-       p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;\r
-       p_madw->mad_addr.addr_type.smi.source_lid = IB_LID_PERMISSIVE;\r
-       p_madw->resp_expected = TRUE;\r
-       p_madw->fail_msg = err_msg;\r
-\r
-       /*\r
-          Fill in the mad wrapper context for the recipient.\r
-          In this case, the only thing the recipient needs is the\r
-          guid value.\r
-        */\r
-\r
-       if (p_context)\r
-               p_madw->context = *p_context;\r
-\r
-       memcpy(osm_madw_get_smp_ptr(p_madw)->data, p_payload, payload_size);\r
-\r
-       osm_vl15_post(sm->p_vl15, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-int osm_send_trap144(osm_sm_t * sm, ib_net16_t local)\r
-{\r
-       osm_madw_t *madw;\r
-       ib_smp_t *smp;\r
-       ib_mad_notice_attr_t *ntc;\r
-       osm_port_t *port, *smport;\r
-       ib_port_info_t *pi;\r
-\r
-       port = osm_get_port_by_guid(sm->p_subn, sm->p_subn->sm_port_guid);\r
-       if (!port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1104: cannot find SM port by guid 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(sm->p_subn->sm_port_guid));\r
-               return -1;\r
-       }\r
-\r
-       pi = &port->p_physp->port_info;\r
-\r
-       /* don't bother with sending trap when SMA supports this */\r
-       if (!local &&\r
-           pi->capability_mask&(IB_PORT_CAP_HAS_TRAP|IB_PORT_CAP_HAS_CAP_NTC))\r
-               return 0;\r
-\r
-       smport = osm_get_port_by_guid(sm->p_subn, sm->master_sm_guid);\r
-       if (!smport) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1106: cannot find master SM port by guid 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(sm->master_sm_guid));\r
-               return -1;\r
-       }\r
-\r
-       madw = osm_mad_pool_get(sm->p_mad_pool,\r
-                               osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl),\r
-                               MAD_BLOCK_SIZE, NULL);\r
-       if (madw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1105: Unable to acquire MAD\n");\r
-               return -1;\r
-       }\r
-\r
-       madw->mad_addr.dest_lid = smport->p_physp->port_info.base_lid;\r
-       madw->mad_addr.addr_type.smi.source_lid = pi->base_lid;\r
-       madw->resp_expected = TRUE;\r
-       madw->fail_msg = CL_DISP_MSGID_NONE;\r
-\r
-       smp = osm_madw_get_smp_ptr(madw);\r
-       memset(smp, 0, sizeof(*smp));\r
-\r
-       smp->base_ver = 1;\r
-       smp->mgmt_class = IB_MCLASS_SUBN_LID;\r
-       smp->class_ver = 1;\r
-       smp->method = IB_MAD_METHOD_TRAP;\r
-       smp->trans_id = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id));\r
-       smp->attr_id = IB_MAD_ATTR_NOTICE;\r
-       smp->m_key = 0;\r
-\r
-       ntc = (ib_mad_notice_attr_t *) smp->data;\r
-\r
-       ntc->generic_type = 0x80 | IB_NOTICE_TYPE_INFO;\r
-       ib_notice_set_prod_type_ho(ntc, osm_node_get_type(port->p_node));\r
-       ntc->g_or_v.generic.trap_num = cl_hton16(144);\r
-       ntc->issuer_lid = pi->base_lid;\r
-       ntc->data_details.ntc_144.lid = pi->base_lid;\r
-       ntc->data_details.ntc_144.local_changes = local ?\r
-           TRAP_144_MASK_OTHER_LOCAL_CHANGES : 0;\r
-       ntc->data_details.ntc_144.new_cap_mask = pi->capability_mask;\r
-       ntc->data_details.ntc_144.change_flgs = local;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Sending Trap 144, TID 0x%" PRIx64 " to SM lid %u\n",\r
-               cl_ntoh64(smp->trans_id), cl_ntoh16(madw->mad_addr.dest_lid));\r
-\r
-       osm_vl15_post(sm->p_vl15, madw);\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_resp.c b/branches/opensm_3/user/opensm/osm_resp.c
deleted file mode 100644 (file)
index 22d5a80..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_resp_t.\r
- * This object represents the generic attribute responder.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_attrib_req.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_vl15intf.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-static void resp_make_resp_smp(IN osm_sm_t * sm, IN const ib_smp_t * p_src_smp,\r
-                              IN ib_net16_t status,\r
-                              IN const uint8_t * p_payload,\r
-                              OUT ib_smp_t * p_dest_smp)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_dest_smp);\r
-       CL_ASSERT(p_src_smp);\r
-       CL_ASSERT(!ib_smp_is_response(p_src_smp));\r
-\r
-       *p_dest_smp = *p_src_smp;\r
-       if (p_src_smp->method == IB_MAD_METHOD_GET ||\r
-           p_src_smp->method == IB_MAD_METHOD_SET) {\r
-               p_dest_smp->method = IB_MAD_METHOD_GET_RESP;\r
-               p_dest_smp->status = status;\r
-       } else if (p_src_smp->method == IB_MAD_METHOD_TRAP) {\r
-               p_dest_smp->method = IB_MAD_METHOD_TRAP_REPRESS;\r
-               p_dest_smp->status = 0;\r
-       } else {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 1302: "\r
-                       "src smp method unsupported 0x%X\n", p_src_smp->method);\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_src_smp->mgmt_class == IB_MCLASS_SUBN_DIR)\r
-               p_dest_smp->status |= IB_SMP_DIRECTION;\r
-\r
-       p_dest_smp->dr_dlid = p_dest_smp->dr_slid;\r
-       p_dest_smp->dr_slid = p_dest_smp->dr_dlid;\r
-       memcpy(&p_dest_smp->data, p_payload, IB_SMP_DATA_SIZE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-ib_api_status_t osm_resp_send(IN osm_sm_t * sm,\r
-                             IN const osm_madw_t * p_req_madw,\r
-                             IN ib_net16_t mad_status,\r
-                             IN const uint8_t * p_payload)\r
-{\r
-       const ib_smp_t *p_req_smp;\r
-       ib_smp_t *p_smp;\r
-       osm_madw_t *p_madw;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_req_madw);\r
-       CL_ASSERT(p_payload);\r
-\r
-       /* do nothing if we are exiting ... */\r
-       if (osm_exit_flag)\r
-               goto Exit;\r
-\r
-       p_madw = osm_mad_pool_get(sm->p_mad_pool,\r
-                                 osm_madw_get_bind_handle(p_req_madw),\r
-                                 MAD_BLOCK_SIZE, NULL);\r
-\r
-       if (p_madw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 1301: Unable to acquire MAD\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Copy the request smp to the response smp, then just\r
-          update the necessary fields.\r
-        */\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_req_smp = osm_madw_get_smp_ptr(p_req_madw);\r
-       resp_make_resp_smp(sm, p_req_smp, mad_status, p_payload, p_smp);\r
-       p_madw->mad_addr.dest_lid =\r
-           p_req_madw->mad_addr.addr_type.smi.source_lid;\r
-       p_madw->mad_addr.addr_type.smi.source_lid =\r
-           p_req_madw->mad_addr.dest_lid;\r
-\r
-       p_madw->resp_expected = FALSE;\r
-       p_madw->fail_msg = CL_DISP_MSGID_NONE;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Responding to %s (0x%X)"\r
-               "\n\t\t\t\tattribute modifier 0x%X, TID 0x%" PRIx64 "\n",\r
-               ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh16(p_smp->attr_id),\r
-               cl_ntoh32(p_smp->attr_mod), cl_ntoh64(p_smp->trans_id));\r
-\r
-       osm_vl15_post(sm->p_vl15, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_router.c b/branches/opensm_3/user/opensm/osm_router.c
deleted file mode 100644 (file)
index c10b7be..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_router_t.\r
- * This object represents an Infiniband router.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_router.h>\r
-\r
-void osm_router_delete(IN OUT osm_router_t ** pp_rtr)\r
-{\r
-       free(*pp_rtr);\r
-       *pp_rtr = NULL;\r
-}\r
-\r
-osm_router_t *osm_router_new(IN osm_port_t * p_port)\r
-{\r
-       osm_router_t *p_rtr;\r
-\r
-       CL_ASSERT(p_port);\r
-\r
-       p_rtr = malloc(sizeof(*p_rtr));\r
-       if (p_rtr) {\r
-               memset(p_rtr, 0, sizeof(*p_rtr));\r
-               p_rtr->p_port = p_port;\r
-       }\r
-\r
-       return p_rtr;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa.c b/branches/opensm_3/user/opensm/osm_sa.c
deleted file mode 100644 (file)
index 279fd95..0000000
+++ /dev/null
@@ -1,1133 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- * Copyright (c) 2010 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sa_t.\r
- * This object represents the Subnet Administration object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <stdlib.h>\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_service.h>\r
-#include <opensm/osm_helper.h>\r
-#include <vendor/osm_vendor_api.h>\r
-\r
-#define  OSM_SA_INITIAL_TID_VALUE 0xabc\r
-\r
-extern void osm_cpi_rcv_process(IN void *context, IN void *data);\r
-extern void osm_gir_rcv_process(IN void *context, IN void *data);\r
-extern void osm_infr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_infir_rcv_process(IN void *context, IN void *data);\r
-extern void osm_lftr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_lr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_mcmr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_mftr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_mpr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_nr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_pr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_pkey_rec_rcv_process(IN void *context, IN void *data);\r
-extern void osm_pir_rcv_process(IN void *context, IN void *data);\r
-extern void osm_sr_rcv_process(IN void *context, IN void *data);\r
-extern void osm_slvl_rec_rcv_process(IN void *context, IN void *data);\r
-extern void osm_smir_rcv_process(IN void *context, IN void *data);\r
-extern void osm_sir_rcv_process(IN void *context, IN void *data);\r
-extern void osm_vlarb_rec_rcv_process(IN void *context, IN void *data);\r
-extern void osm_sr_rcv_lease_cb(IN void *context);\r
-\r
-void osm_sa_construct(IN osm_sa_t * p_sa)\r
-{\r
-       memset(p_sa, 0, sizeof(*p_sa));\r
-       p_sa->state = OSM_SA_STATE_INIT;\r
-       p_sa->sa_trans_id = OSM_SA_INITIAL_TID_VALUE;\r
-\r
-       cl_timer_construct(&p_sa->sr_timer);\r
-}\r
-\r
-void osm_sa_shutdown(IN osm_sa_t * p_sa)\r
-{\r
-       ib_api_status_t status;\r
-       OSM_LOG_ENTER(p_sa->p_log);\r
-\r
-       cl_timer_stop(&p_sa->sr_timer);\r
-\r
-       /* unbind from the mad service */\r
-       status = osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl);\r
-\r
-       /* remove any registered dispatcher message */\r
-       cl_disp_unregister(p_sa->nr_disp_h);\r
-       cl_disp_unregister(p_sa->pir_disp_h);\r
-       cl_disp_unregister(p_sa->gir_disp_h);\r
-       cl_disp_unregister(p_sa->lr_disp_h);\r
-       cl_disp_unregister(p_sa->pr_disp_h);\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       cl_disp_unregister(p_sa->mpr_disp_h);\r
-#endif\r
-       cl_disp_unregister(p_sa->smir_disp_h);\r
-       cl_disp_unregister(p_sa->mcmr_disp_h);\r
-       cl_disp_unregister(p_sa->sr_disp_h);\r
-       cl_disp_unregister(p_sa->infr_disp_h);\r
-       cl_disp_unregister(p_sa->infir_disp_h);\r
-       cl_disp_unregister(p_sa->vlarb_disp_h);\r
-       cl_disp_unregister(p_sa->slvl_disp_h);\r
-       cl_disp_unregister(p_sa->pkey_disp_h);\r
-       cl_disp_unregister(p_sa->lft_disp_h);\r
-       cl_disp_unregister(p_sa->sir_disp_h);\r
-       cl_disp_unregister(p_sa->mft_disp_h);\r
-       osm_sa_mad_ctrl_destroy(&p_sa->mad_ctrl);\r
-\r
-       OSM_LOG_EXIT(p_sa->p_log);\r
-}\r
-\r
-void osm_sa_destroy(IN osm_sa_t * p_sa)\r
-{\r
-       OSM_LOG_ENTER(p_sa->p_log);\r
-\r
-       p_sa->state = OSM_SA_STATE_INIT;\r
-\r
-       cl_timer_destroy(&p_sa->sr_timer);\r
-\r
-       OSM_LOG_EXIT(p_sa->p_log);\r
-}\r
-\r
-ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa,\r
-                           IN osm_subn_t * p_subn, IN osm_vendor_t * p_vendor,\r
-                           IN osm_mad_pool_t * p_mad_pool,\r
-                           IN osm_log_t * p_log, IN osm_stats_t * p_stats,\r
-                           IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_sa->sm = p_sm;\r
-       p_sa->p_subn = p_subn;\r
-       p_sa->p_vendor = p_vendor;\r
-       p_sa->p_mad_pool = p_mad_pool;\r
-       p_sa->p_log = p_log;\r
-       p_sa->p_disp = p_disp;\r
-       p_sa->p_lock = p_lock;\r
-\r
-       p_sa->state = OSM_SA_STATE_READY;\r
-\r
-       status = osm_sa_mad_ctrl_init(&p_sa->mad_ctrl, p_sa, p_sa->p_mad_pool,\r
-                                     p_sa->p_vendor, p_subn, p_log, p_stats,\r
-                                     p_disp);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_timer_init(&p_sa->sr_timer, osm_sr_rcv_lease_cb, p_sa);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = IB_INSUFFICIENT_RESOURCES;\r
-       p_sa->cpi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_CLASS_PORT_INFO,\r
-                                           osm_cpi_rcv_process, p_sa);\r
-       if (p_sa->cpi_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->nr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_RECORD,\r
-                                          osm_nr_rcv_process, p_sa);\r
-       if (p_sa->nr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->pir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORTINFO_RECORD,\r
-                                           osm_pir_rcv_process, p_sa);\r
-       if (p_sa->pir_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->gir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_GUIDINFO_RECORD,\r
-                                           osm_gir_rcv_process, p_sa);\r
-       if (p_sa->gir_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->lr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LINK_RECORD,\r
-                                          osm_lr_rcv_process, p_sa);\r
-       if (p_sa->lr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->pr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PATH_RECORD,\r
-                                          osm_pr_rcv_process, p_sa);\r
-       if (p_sa->pr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       p_sa->mpr_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_MULTIPATH_RECORD,\r
-                            osm_mpr_rcv_process, p_sa);\r
-       if (p_sa->mpr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-#endif\r
-\r
-       p_sa->smir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SMINFO_RECORD,\r
-                                            osm_smir_rcv_process, p_sa);\r
-       if (p_sa->smir_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->mcmr_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_MCMEMBER_RECORD,\r
-                            osm_mcmr_rcv_process, p_sa);\r
-       if (p_sa->mcmr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->sr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SERVICE_RECORD,\r
-                                          osm_sr_rcv_process, p_sa);\r
-       if (p_sa->sr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->infr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO,\r
-                                            osm_infr_rcv_process, p_sa);\r
-       if (p_sa->infr_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->infir_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO_RECORD,\r
-                            osm_infir_rcv_process, p_sa);\r
-       if (p_sa->infir_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->vlarb_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB_RECORD,\r
-                                             osm_vlarb_rec_rcv_process, p_sa);\r
-       if (p_sa->vlarb_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->slvl_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_SLVL_TBL_RECORD,\r
-                            osm_slvl_rec_rcv_process, p_sa);\r
-       if (p_sa->slvl_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->pkey_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_PKEY_TBL_RECORD,\r
-                            osm_pkey_rec_rcv_process, p_sa);\r
-       if (p_sa->pkey_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT_RECORD,\r
-                                           osm_lftr_rcv_process, p_sa);\r
-       if (p_sa->lft_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->sir_disp_h =\r
-           cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO_RECORD,\r
-                            osm_sir_rcv_process, p_sa);\r
-       if (p_sa->sir_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sa->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT_RECORD,\r
-                                           osm_mftr_rcv_process, p_sa);\r
-       if (p_sa->mft_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       status = IB_SUCCESS;\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sa_bind(IN osm_sa_t * p_sa, IN ib_net64_t port_guid)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_sa->p_log);\r
-\r
-       status = osm_sa_mad_ctrl_bind(&p_sa->mad_ctrl, port_guid);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_sa->p_log, OSM_LOG_ERROR, "ERR 4C03: "\r
-                       "SA MAD Controller bind failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_sa->p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sa_send(osm_sa_t *sa, IN osm_madw_t * p_madw,\r
-                           IN boolean_t resp_expected)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       cl_atomic_inc(&sa->p_subn->p_osm->stats.sa_mads_sent);\r
-       status = osm_vendor_send(p_madw->h_bind, p_madw, resp_expected);\r
-       if (status != IB_SUCCESS) {\r
-               cl_atomic_dec(&sa->p_subn->p_osm->stats.sa_mads_sent);\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4C04: "\r
-                       "osm_vendor_send failed, status = %s\n",\r
-                       ib_get_err_str(status));\r
-       }\r
-       return status;\r
-}\r
-\r
-void osm_sa_send_error(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,\r
-                      IN ib_net16_t sa_status)\r
-{\r
-       osm_madw_t *p_resp_madw;\r
-       ib_sa_mad_t *p_resp_sa_mad;\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* avoid races - if we are exiting - exit */\r
-       if (osm_exit_flag) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Ignoring requested send after exit\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,\r
-                                      p_madw->h_bind, MAD_BLOCK_SIZE,\r
-                                      &p_madw->mad_addr);\r
-\r
-       if (p_resp_madw == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4C07: "\r
-                       "Unable to acquire response MAD\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       /*  Copy the MAD header back into the response mad */\r
-       *p_resp_sa_mad = *p_sa_mad;\r
-       p_resp_sa_mad->status = sa_status;\r
-\r
-       if (p_resp_sa_mad->method == IB_MAD_METHOD_SET)\r
-               p_resp_sa_mad->method = IB_MAD_METHOD_GET;\r
-       else if (p_resp_sa_mad->method == IB_MAD_METHOD_GETTABLE)\r
-               p_resp_sa_mad->attr_offset = 0;\r
-\r
-       p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
-\r
-       /*\r
-        * C15-0.1.5 - always return SM_Key = 0 (table 185 p 884)\r
-        */\r
-       p_resp_sa_mad->sm_key = 0;\r
-\r
-       /*\r
-        * o15-0.2.7 - The PathRecord Attribute ID shall be used in\r
-        * the response (to a SubnAdmGetMulti(MultiPathRecord)\r
-        */\r
-       if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)\r
-               p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))\r
-               osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);\r
-\r
-       osm_sa_send(sa, p_resp_madw, FALSE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,\r
-                   cl_qlist_t *list)\r
-{\r
-       struct item_data {\r
-               cl_list_item_t list;\r
-               char data[0];\r
-       };\r
-       cl_list_item_t *item;\r
-       osm_madw_t *resp_madw;\r
-       ib_sa_mad_t *sa_mad, *resp_sa_mad;\r
-       unsigned num_rec, i;\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-       unsigned trim_num_rec;\r
-#endif\r
-       unsigned char *p;\r
-\r
-       sa_mad = osm_madw_get_sa_mad_ptr(madw);\r
-       num_rec = cl_qlist_count(list);\r
-\r
-       /*\r
-        * C15-0.1.30:\r
-        * If we do a SubnAdmGet and got more than one record it is an error!\r
-        */\r
-       if (sa_mad->method == IB_MAD_METHOD_GET && num_rec > 1) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4C05: "\r
-                       "Got %u records for SubnAdmGet(%s) comp_mask 0x%016" PRIx64 "\n",\r
-                       num_rec, ib_get_sa_attr_str(sa_mad->attr_id),\r
-                       cl_ntoh64(sa_mad->comp_mask));\r
-               osm_sa_send_error(sa, madw, IB_SA_MAD_STATUS_TOO_MANY_RECORDS);\r
-               goto Exit;\r
-       }\r
-\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-       trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / attr_size;\r
-       if (trim_num_rec < num_rec) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                       "Number of records:%u trimmed to:%u to fit in one MAD\n",\r
-                       num_rec, trim_num_rec);\r
-               num_rec = trim_num_rec;\r
-       }\r
-#endif\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Returning %u records\n", num_rec);\r
-\r
-       if (sa_mad->method == IB_MAD_METHOD_GET && num_rec == 0) {\r
-               osm_sa_send_error(sa, madw, IB_SA_MAD_STATUS_NO_RECORDS);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Get a MAD to reply. Address of Mad is in the received mad_wrapper\r
-        */\r
-       resp_madw = osm_mad_pool_get(sa->p_mad_pool, madw->h_bind,\r
-                                    num_rec * attr_size + IB_SA_MAD_HDR_SIZE,\r
-                                    &madw->mad_addr);\r
-       if (!resp_madw) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4C06: "\r
-                       "osm_mad_pool_get failed\n");\r
-               osm_sa_send_error(sa, madw, IB_SA_MAD_STATUS_NO_RESOURCES);\r
-               goto Exit;\r
-       }\r
-\r
-       resp_sa_mad = osm_madw_get_sa_mad_ptr(resp_madw);\r
-\r
-       /*\r
-          Copy the MAD header back into the response mad.\r
-          Set the 'R' bit and the payload length,\r
-          Then copy all records from the list into the response payload.\r
-        */\r
-\r
-       memcpy(resp_sa_mad, sa_mad, IB_SA_MAD_HDR_SIZE);\r
-       if (resp_sa_mad->method == IB_MAD_METHOD_SET)\r
-               resp_sa_mad->method = IB_MAD_METHOD_GET;\r
-       resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
-       /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */\r
-       resp_sa_mad->sm_key = 0;\r
-\r
-#ifdef DUAL_SIDED_RMPP\r
-       if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP ||\r
-           resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) {\r
-#else\r
-       if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {\r
-#endif\r
-               /* Fill in the offset (paylen will be done by the rmpp SAR) */\r
-               resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0;\r
-       }\r
-\r
-       p = ib_sa_mad_get_payload_ptr(resp_sa_mad);\r
-\r
-#ifndef VENDOR_RMPP_SUPPORT\r
-       /* we support only one packet RMPP - so we will set the first and\r
-          last flags for gettable */\r
-       if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) {\r
-               resp_sa_mad->rmpp_type = IB_RMPP_TYPE_DATA;\r
-               resp_sa_mad->rmpp_flags =\r
-                   IB_RMPP_FLAG_FIRST | IB_RMPP_FLAG_LAST |\r
-                   IB_RMPP_FLAG_ACTIVE;\r
-       }\r
-#else\r
-       /* forcefully define the packet as RMPP one */\r
-       if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP)\r
-               resp_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;\r
-#endif\r
-\r
-       for (i = 0; i < num_rec; i++) {\r
-               item = cl_qlist_remove_head(list);\r
-               memcpy(p, ((struct item_data *)item)->data, attr_size);\r
-               p += attr_size;\r
-               free(item);\r
-       }\r
-\r
-       osm_dump_sa_mad(sa->p_log, resp_sa_mad, OSM_LOG_FRAMES);\r
-       osm_sa_send(sa, resp_madw, FALSE);\r
-\r
-Exit:\r
-       /* need to set the mem free ... */\r
-       item = cl_qlist_remove_head(list);\r
-       while (item != cl_qlist_end(list)) {\r
-               free(item);\r
-               item = cl_qlist_remove_head(list);\r
-       }\r
-}\r
-\r
-/*\r
- *  SA DB Dumper\r
- *\r
- */\r
-\r
-struct opensm_dump_context {\r
-       osm_opensm_t *p_osm;\r
-       FILE *file;\r
-};\r
-\r
-static int\r
-opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,\r
-                   void (*dump_func) (osm_opensm_t * p_osm, FILE * file))\r
-{\r
-       char path[1024];\r
-       FILE *file;\r
-\r
-       snprintf(path, sizeof(path), "%s/%s",\r
-                p_osm->subn.opt.dump_files_dir, file_name);\r
-\r
-       file = fopen(path, "w");\r
-       if (!file) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C01: "\r
-                       "cannot open file \'%s\': %s\n",\r
-                       file_name, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       chmod(path, S_IRUSR | S_IWUSR);\r
-\r
-       dump_func(p_osm, file);\r
-\r
-       fclose(file);\r
-       return 0;\r
-}\r
-\r
-static void mcast_mgr_dump_one_port(cl_map_item_t * p_map_item, void *cxt)\r
-{\r
-       FILE *file = ((struct opensm_dump_context *)cxt)->file;\r
-       osm_mcm_port_t *p_mcm_port = (osm_mcm_port_t *) p_map_item;\r
-\r
-       fprintf(file, "mcm_port: "\r
-               "port_gid=0x%016" PRIx64 ":0x%016" PRIx64 " "\r
-               "scope_state=0x%02x proxy_join=0x%x" "\n\n",\r
-               cl_ntoh64(p_mcm_port->port_gid.unicast.prefix),\r
-               cl_ntoh64(p_mcm_port->port_gid.unicast.interface_id),\r
-               p_mcm_port->scope_state, p_mcm_port->proxy_join);\r
-}\r
-\r
-static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)\r
-{\r
-       struct opensm_dump_context dump_context;\r
-       osm_opensm_t *p_osm = ((struct opensm_dump_context *)cxt)->p_osm;\r
-       FILE *file = ((struct opensm_dump_context *)cxt)->file;\r
-\r
-       fprintf(file, "MC Group 0x%04x %s:"\r
-               " mgid=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " port_gid=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " qkey=0x%08x mlid=0x%04x mtu=0x%02x tclass=0x%02x"\r
-               " pkey=0x%04x rate=0x%02x pkt_life=0x%02x sl_flow_hop=0x%08x"\r
-               " scope_state=0x%02x proxy_join=0x%x" "\n\n",\r
-               cl_ntoh16(p_mgrp->mlid),\r
-               p_mgrp->well_known ? " (well known)" : "",\r
-               cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.prefix),\r
-               cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.interface_id),\r
-               cl_ntoh64(p_mgrp->mcmember_rec.port_gid.unicast.prefix),\r
-               cl_ntoh64(p_mgrp->mcmember_rec.port_gid.unicast.interface_id),\r
-               cl_ntoh32(p_mgrp->mcmember_rec.qkey),\r
-               cl_ntoh16(p_mgrp->mcmember_rec.mlid),\r
-               p_mgrp->mcmember_rec.mtu,\r
-               p_mgrp->mcmember_rec.tclass,\r
-               cl_ntoh16(p_mgrp->mcmember_rec.pkey),\r
-               p_mgrp->mcmember_rec.rate,\r
-               p_mgrp->mcmember_rec.pkt_life,\r
-               cl_ntoh32(p_mgrp->mcmember_rec.sl_flow_hop),\r
-               p_mgrp->mcmember_rec.scope_state,\r
-               p_mgrp->mcmember_rec.proxy_join);\r
-\r
-       dump_context.p_osm = p_osm;\r
-       dump_context.file = file;\r
-\r
-       cl_qmap_apply_func(&p_mgrp->mcm_port_tbl,\r
-                          mcast_mgr_dump_one_port, &dump_context);\r
-}\r
-\r
-static void sa_dump_one_inform(cl_list_item_t * p_list_item, void *cxt)\r
-{\r
-       FILE *file = ((struct opensm_dump_context *)cxt)->file;\r
-       osm_infr_t *p_infr = (osm_infr_t *) p_list_item;\r
-       ib_inform_info_record_t *p_iir = &p_infr->inform_record;\r
-\r
-       fprintf(file, "InformInfo Record:"\r
-               " subscriber_gid=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " subscriber_enum=0x%x"\r
-               " InformInfo:"\r
-               " gid=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " lid_range_begin=0x%x"\r
-               " lid_range_end=0x%x"\r
-               " is_generic=0x%x"\r
-               " subscribe=0x%x"\r
-               " trap_type=0x%x"\r
-               " trap_num=0x%x"\r
-               " qpn_resp_time_val=0x%x"\r
-               " node_type=0x%06x"\r
-               " rep_addr: lid=0x%04x path_bits=0x%02x static_rate=0x%02x"\r
-               " remote_qp=0x%08x remote_qkey=0x%08x pkey_ix=0x%04x sl=0x%02x"\r
-               "\n\n",\r
-               cl_ntoh64(p_iir->subscriber_gid.unicast.prefix),\r
-               cl_ntoh64(p_iir->subscriber_gid.unicast.interface_id),\r
-               cl_ntoh16(p_iir->subscriber_enum),\r
-               cl_ntoh64(p_iir->inform_info.gid.unicast.prefix),\r
-               cl_ntoh64(p_iir->inform_info.gid.unicast.interface_id),\r
-               cl_ntoh16(p_iir->inform_info.lid_range_begin),\r
-               cl_ntoh16(p_iir->inform_info.lid_range_end),\r
-               p_iir->inform_info.is_generic,\r
-               p_iir->inform_info.subscribe,\r
-               cl_ntoh16(p_iir->inform_info.trap_type),\r
-               cl_ntoh16(p_iir->inform_info.g_or_v.generic.trap_num),\r
-               cl_ntoh32(p_iir->inform_info.g_or_v.generic.qpn_resp_time_val),\r
-               cl_ntoh32(ib_inform_info_get_prod_type(&p_iir->inform_info)),\r
-               cl_ntoh16(p_infr->report_addr.dest_lid),\r
-               p_infr->report_addr.path_bits,\r
-               p_infr->report_addr.static_rate,\r
-               cl_ntoh32(p_infr->report_addr.addr_type.gsi.remote_qp),\r
-               cl_ntoh32(p_infr->report_addr.addr_type.gsi.remote_qkey),\r
-               p_infr->report_addr.addr_type.gsi.pkey_ix,\r
-               p_infr->report_addr.addr_type.gsi.service_level);\r
-}\r
-\r
-static void sa_dump_one_service(cl_list_item_t * p_list_item, void *cxt)\r
-{\r
-       FILE *file = ((struct opensm_dump_context *)cxt)->file;\r
-       osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;\r
-       ib_service_record_t *p_sr = &p_svcr->service_record;\r
-\r
-       fprintf(file, "Service Record: id=0x%016" PRIx64\r
-               " gid=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " pkey=0x%x"\r
-               " lease=0x%x"\r
-               " key=0x%02x%02x%02x%02x%02x%02x%02x%02x"\r
-               ":0x%02x%02x%02x%02x%02x%02x%02x%02x"\r
-               " name=\'%s\'"\r
-               " data8=0x%02x%02x%02x%02x%02x%02x%02x%02x"\r
-               ":0x%02x%02x%02x%02x%02x%02x%02x%02x"\r
-               " data16=0x%04x%04x%04x%04x:0x%04x%04x%04x%04x"\r
-               " data32=0x%08x%08x:0x%08x%08x"\r
-               " data64=0x%016" PRIx64 ":0x%016" PRIx64\r
-               " modified_time=0x%x lease_period=0x%x\n\n",\r
-               cl_ntoh64(p_sr->service_id),\r
-               cl_ntoh64(p_sr->service_gid.unicast.prefix),\r
-               cl_ntoh64(p_sr->service_gid.unicast.interface_id),\r
-               cl_ntoh16(p_sr->service_pkey),\r
-               cl_ntoh32(p_sr->service_lease),\r
-               p_sr->service_key[0], p_sr->service_key[1],\r
-               p_sr->service_key[2], p_sr->service_key[3],\r
-               p_sr->service_key[4], p_sr->service_key[5],\r
-               p_sr->service_key[6], p_sr->service_key[7],\r
-               p_sr->service_key[8], p_sr->service_key[9],\r
-               p_sr->service_key[10], p_sr->service_key[11],\r
-               p_sr->service_key[12], p_sr->service_key[13],\r
-               p_sr->service_key[14], p_sr->service_key[15],\r
-               p_sr->service_name,\r
-               p_sr->service_data8[0], p_sr->service_data8[1],\r
-               p_sr->service_data8[2], p_sr->service_data8[3],\r
-               p_sr->service_data8[4], p_sr->service_data8[5],\r
-               p_sr->service_data8[6], p_sr->service_data8[7],\r
-               p_sr->service_data8[8], p_sr->service_data8[9],\r
-               p_sr->service_data8[10], p_sr->service_data8[11],\r
-               p_sr->service_data8[12], p_sr->service_data8[13],\r
-               p_sr->service_data8[14], p_sr->service_data8[15],\r
-               cl_ntoh16(p_sr->service_data16[0]),\r
-               cl_ntoh16(p_sr->service_data16[1]),\r
-               cl_ntoh16(p_sr->service_data16[2]),\r
-               cl_ntoh16(p_sr->service_data16[3]),\r
-               cl_ntoh16(p_sr->service_data16[4]),\r
-               cl_ntoh16(p_sr->service_data16[5]),\r
-               cl_ntoh16(p_sr->service_data16[6]),\r
-               cl_ntoh16(p_sr->service_data16[7]),\r
-               cl_ntoh32(p_sr->service_data32[0]),\r
-               cl_ntoh32(p_sr->service_data32[1]),\r
-               cl_ntoh32(p_sr->service_data32[2]),\r
-               cl_ntoh32(p_sr->service_data32[3]),\r
-               cl_ntoh64(p_sr->service_data64[0]),\r
-               cl_ntoh64(p_sr->service_data64[1]),\r
-               p_svcr->modified_time, p_svcr->lease_period);\r
-}\r
-\r
-static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)\r
-{\r
-       struct opensm_dump_context dump_context;\r
-       osm_mgrp_t *p_mgrp;\r
-\r
-       dump_context.p_osm = p_osm;\r
-       dump_context.file = file;\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast\n");\r
-       cl_plock_acquire(&p_osm->lock);\r
-       for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&p_osm->subn.mgrp_mgid_tbl);\r
-            p_mgrp != (osm_mgrp_t *) cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl);\r
-            p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))\r
-               sa_dump_one_mgrp(p_mgrp, &dump_context);\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform\n");\r
-       cl_qlist_apply_func(&p_osm->subn.sa_infr_list,\r
-                           sa_dump_one_inform, &dump_context);\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump services\n");\r
-       cl_qlist_apply_func(&p_osm->subn.sa_sr_list,\r
-                           sa_dump_one_service, &dump_context);\r
-       cl_plock_release(&p_osm->lock);\r
-}\r
-\r
-int osm_sa_db_file_dump(osm_opensm_t * p_osm)\r
-{\r
-       int res = 1;\r
-       if (p_osm->sa.dirty) {\r
-               res = opensm_dump_to_file(\r
-                       p_osm, "opensm-sa.dump", sa_dump_all_sa);\r
-               p_osm->sa.dirty = FALSE;\r
-       }\r
-       return res;\r
-}\r
-\r
-/*\r
- *  SA DB Loader\r
- */\r
-static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,\r
-                               ib_member_rec_t * p_mcm_rec,\r
-                               unsigned well_known)\r
-{\r
-       ib_net64_t comp_mask;\r
-       osm_mgrp_t *p_mgrp;\r
-\r
-       cl_plock_excl_acquire(&p_osm->lock);\r
-\r
-       p_mgrp = osm_get_mgrp_by_mgid(&p_osm->subn, &p_mcm_rec->mgid);\r
-       if (p_mgrp) {\r
-               if (p_mgrp->mlid == mlid) {\r
-                       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,\r
-                               "mgrp %04x is already here.", cl_ntoh16(mlid));\r
-                       goto _out;\r
-               }\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "mlid %04x is already used by another MC group. Will "\r
-                       "request clients reregistration.\n", cl_ntoh16(mlid));\r
-               p_mgrp = NULL;\r
-               goto _out;\r
-       }\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL\r
-           | IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;\r
-       if (osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa,\r
-                                                comp_mask, p_mcm_rec,\r
-                                                &p_mgrp) != IB_SUCCESS ||\r
-           !p_mgrp || p_mgrp->mlid != mlid) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                       "cannot create MC group with mlid 0x%04x and mgid "\r
-                       "0x%016" PRIx64 ":0x%016" PRIx64 "\n", cl_ntoh16(mlid),\r
-                       cl_ntoh64(p_mcm_rec->mgid.unicast.prefix),\r
-                       cl_ntoh64(p_mcm_rec->mgid.unicast.interface_id));\r
-               p_mgrp = NULL;\r
-       } else if (well_known)\r
-               p_mgrp->well_known = TRUE;\r
-\r
-_out:\r
-       cl_plock_release(&p_osm->lock);\r
-\r
-       return p_mgrp;\r
-}\r
-\r
-static int load_svcr(osm_opensm_t * p_osm, ib_service_record_t * sr,\r
-                    uint32_t modified_time, uint32_t lease_period)\r
-{\r
-       osm_svcr_t *p_svcr;\r
-       int ret = 0;\r
-\r
-       cl_plock_excl_acquire(&p_osm->lock);\r
-\r
-       if (osm_svcr_get_by_rid(&p_osm->subn, &p_osm->log, sr)) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "ServiceRecord already exists\n");\r
-               goto _out;\r
-       }\r
-\r
-       if (!(p_svcr = osm_svcr_new(sr))) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                       "cannot allocate new service struct\n");\r
-               ret = -1;\r
-               goto _out;\r
-       }\r
-\r
-       p_svcr->modified_time = modified_time;\r
-       p_svcr->lease_period = lease_period;\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "adding ServiceRecord...\n");\r
-\r
-       osm_svcr_insert_to_db(&p_osm->subn, &p_osm->log, p_svcr);\r
-\r
-       if (lease_period != 0xffffffff)\r
-               cl_timer_trim(&p_osm->sa.sr_timer, 1000);\r
-\r
-_out:\r
-       cl_plock_release(&p_osm->lock);\r
-\r
-       return ret;\r
-}\r
-\r
-static int load_infr(osm_opensm_t * p_osm, ib_inform_info_record_t * iir,\r
-                    osm_mad_addr_t * addr)\r
-{\r
-       osm_infr_t infr, *p_infr;\r
-       int ret = 0;\r
-\r
-       infr.h_bind = p_osm->sa.mad_ctrl.h_bind;\r
-       infr.sa = &p_osm->sa;\r
-       /* other possible way to restore mad_addr partially is\r
-          to extract qpn from InformInfo and to find lid by gid */\r
-       infr.report_addr = *addr;\r
-       infr.inform_record = *iir;\r
-\r
-       cl_plock_excl_acquire(&p_osm->lock);\r
-       if (osm_infr_get_by_rec(&p_osm->subn, &p_osm->log, &infr)) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "InformInfo Record already exists\n");\r
-               goto _out;\r
-       }\r
-\r
-       if (!(p_infr = osm_infr_new(&infr))) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                       "cannot allocate new infr struct\n");\r
-               ret = -1;\r
-               goto _out;\r
-       }\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "adding InformInfo Record...\n");\r
-\r
-       osm_infr_insert_to_db(&p_osm->subn, &p_osm->log, p_infr);\r
-\r
-_out:\r
-       cl_plock_release(&p_osm->lock);\r
-\r
-       return ret;\r
-}\r
-\r
-#define UNPACK_FUNC(name,x) \\r
-static int unpack_##name##x(char *p, uint##x##_t *val_ptr) \\r
-{ \\r
-       char *q; \\r
-       unsigned long long num; \\r
-       num = strtoull(p, &q, 16); \\r
-       if (num > ~((uint##x##_t)0x0) \\r
-           || q == p || (!isspace(*q) && *q != ':')) { \\r
-               *val_ptr = 0; \\r
-               return -1; \\r
-       } \\r
-       *val_ptr = cl_hton##x((uint##x##_t)num); \\r
-       return (int)(q - p); \\r
-}\r
-\r
-#define cl_hton8(x) (x)\r
-\r
-UNPACK_FUNC(net, 8);\r
-UNPACK_FUNC(net, 16);\r
-UNPACK_FUNC(net, 32);\r
-UNPACK_FUNC(net, 64);\r
-\r
-static int unpack_string(char *p, uint8_t * buf, unsigned len)\r
-{\r
-       char *q = p;\r
-       char delim = ' ';\r
-\r
-       if (*q == '\'' || *q == '\"')\r
-               delim = *q++;\r
-       while (--len && *q && *q != delim)\r
-               *buf++ = *q++;\r
-       *buf = '\0';\r
-       if (*q == delim && delim != ' ')\r
-               q++;\r
-       return (int)(q - p);\r
-}\r
-\r
-static int unpack_string64(char *p, uint8_t * buf)\r
-{\r
-       return unpack_string(p, buf, 64);\r
-}\r
-\r
-#define PARSE_AHEAD(p, x, name, val_ptr) { int _ret; \\r
-       p = strstr(p, name); \\r
-       if (!p) { \\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR, \\r
-                       "PARSE ERROR: %s:%u: cannot find \"%s\" string\n", \\r
-                       file_name, lineno, (name)); \\r
-               ret = -2; \\r
-               goto _error; \\r
-       } \\r
-       p += strlen(name); \\r
-       _ret = unpack_##x(p, (val_ptr)); \\r
-       if (_ret < 0) { \\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR, \\r
-                       "PARSE ERROR: %s:%u: cannot parse "#x" value " \\r
-                       "after \"%s\"\n", file_name, lineno, (name)); \\r
-               ret = _ret; \\r
-               goto _error; \\r
-       } \\r
-       p += _ret; \\r
-}\r
-\r
-int osm_sa_db_file_load(osm_opensm_t * p_osm)\r
-{\r
-       char line[1024];\r
-       char *file_name;\r
-       FILE *file;\r
-       int ret = 0;\r
-       osm_mgrp_t *p_mgrp = NULL;\r
-       unsigned rereg_clients = 0;\r
-       unsigned lineno;\r
-\r
-       if (!p_osm->subn.first_time_master_sweep) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "Not first sweep - skip SA DB restore\n");\r
-               return 0;\r
-       }\r
-\r
-       file_name = p_osm->subn.opt.sa_db_file;\r
-       if (!file_name) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "sa db file name is not specifed. Skip restore\n");\r
-               return 0;\r
-       }\r
-\r
-       file = fopen(file_name, "r");\r
-       if (!file) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 4C02: "\r
-                       "cannot open sa db file \'%s\'. Skip restoring\n",\r
-                       file_name);\r
-               return -1;\r
-       }\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-               "Restoring SA DB from file \'%s\'\n",\r
-               file_name);\r
-\r
-       lineno = 0;\r
-\r
-       while (fgets(line, sizeof(line) - 1, file) != NULL) {\r
-               char *p;\r
-               uint8_t val;\r
-\r
-               lineno++;\r
-\r
-               p = line;\r
-               while (isspace(*p))\r
-                       p++;\r
-\r
-               if (*p == '#')\r
-                       continue;\r
-\r
-               if (!strncmp(p, "MC Group", 8)) {\r
-                       ib_member_rec_t mcm_rec;\r
-                       ib_net16_t mlid;\r
-                       unsigned well_known = 0;\r
-\r
-                       p_mgrp = NULL;\r
-                       memset(&mcm_rec, 0, sizeof(mcm_rec));\r
-\r
-                       PARSE_AHEAD(p, net16, " 0x", &mlid);\r
-                       if (strstr(p, "well known"))\r
-                               well_known = 1;\r
-                       PARSE_AHEAD(p, net64, " mgid=0x",\r
-                                   &mcm_rec.mgid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &mcm_rec.mgid.unicast.interface_id);\r
-                       PARSE_AHEAD(p, net64, " port_gid=0x",\r
-                                   &mcm_rec.port_gid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &mcm_rec.port_gid.unicast.interface_id);\r
-                       PARSE_AHEAD(p, net32, " qkey=0x", &mcm_rec.qkey);\r
-                       PARSE_AHEAD(p, net16, " mlid=0x", &mcm_rec.mlid);\r
-                       PARSE_AHEAD(p, net8, " mtu=0x", &mcm_rec.mtu);\r
-                       PARSE_AHEAD(p, net8, " tclass=0x", &mcm_rec.tclass);\r
-                       PARSE_AHEAD(p, net16, " pkey=0x", &mcm_rec.pkey);\r
-                       PARSE_AHEAD(p, net8, " rate=0x", &mcm_rec.rate);\r
-                       PARSE_AHEAD(p, net8, " pkt_life=0x", &mcm_rec.pkt_life);\r
-                       PARSE_AHEAD(p, net32, " sl_flow_hop=0x",\r
-                                   &mcm_rec.sl_flow_hop);\r
-                       PARSE_AHEAD(p, net8, " scope_state=0x",\r
-                                   &mcm_rec.scope_state);\r
-                       PARSE_AHEAD(p, net8, " proxy_join=0x", &val);\r
-                       mcm_rec.proxy_join = val;\r
-\r
-                       p_mgrp = load_mcgroup(p_osm, mlid, &mcm_rec,\r
-                                             well_known);\r
-                       if (!p_mgrp)\r
-                               rereg_clients = 1;\r
-               } else if (p_mgrp && !strncmp(p, "mcm_port", 8)) {\r
-                       ib_member_rec_t mcmr;\r
-                       ib_net64_t guid;\r
-                       osm_port_t *port;\r
-                       boolean_t proxy;\r
-\r
-                       PARSE_AHEAD(p, net64, " port_gid=0x",\r
-                                   &mcmr.port_gid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &mcmr.port_gid.unicast.interface_id);\r
-                       PARSE_AHEAD(p, net8, " scope_state=0x", &mcmr.scope_state);\r
-                       PARSE_AHEAD(p, net8, " proxy_join=0x", &val);\r
-                       proxy = val;\r
-\r
-                       guid = mcmr.port_gid.unicast.interface_id;\r
-                       port = osm_get_port_by_guid(&p_osm->subn, guid);\r
-                       if (port &&\r
-                           cl_qmap_get(&p_mgrp->mcm_port_tbl, guid) ==\r
-                           cl_qmap_end(&p_mgrp->mcm_port_tbl) &&\r
-                           !osm_mgrp_add_port(&p_osm->subn, &p_osm->log,\r
-                                               p_mgrp, port, &mcmr, proxy))\r
-                               rereg_clients = 1;\r
-               } else if (!strncmp(p, "Service Record:", 15)) {\r
-                       ib_service_record_t s_rec;\r
-                       uint32_t modified_time, lease_period;\r
-\r
-                       p_mgrp = NULL;\r
-                       memset(&s_rec, 0, sizeof(s_rec));\r
-\r
-                       PARSE_AHEAD(p, net64, " id=0x", &s_rec.service_id);\r
-                       PARSE_AHEAD(p, net64, " gid=0x",\r
-                                   &s_rec.service_gid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &s_rec.service_gid.unicast.interface_id);\r
-                       PARSE_AHEAD(p, net16, " pkey=0x", &s_rec.service_pkey);\r
-                       PARSE_AHEAD(p, net32, " lease=0x",\r
-                                   &s_rec.service_lease);\r
-                       PARSE_AHEAD(p, net64, " key=0x",\r
-                                   (ib_net64_t *) (&s_rec.service_key[0]));\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   (ib_net64_t *) (&s_rec.service_key[8]));\r
-                       PARSE_AHEAD(p, string64, " name=", s_rec.service_name);\r
-                       PARSE_AHEAD(p, net64, " data8=0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data8[0]));\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data8[8]));\r
-                       PARSE_AHEAD(p, net64, " data16=0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data16[0]));\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data16[4]));\r
-                       PARSE_AHEAD(p, net64, " data32=0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data32[0]));\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   (ib_net64_t *) (&s_rec.service_data32[2]));\r
-                       PARSE_AHEAD(p, net64, " data64=0x",\r
-                                   &s_rec.service_data64[0]);\r
-                       PARSE_AHEAD(p, net64, ":0x", &s_rec.service_data64[1]);\r
-                       PARSE_AHEAD(p, net32, " modified_time=0x",\r
-                                   &modified_time);\r
-                       PARSE_AHEAD(p, net32, " lease_period=0x",\r
-                                   &lease_period);\r
-\r
-                       if (load_svcr(p_osm, &s_rec, cl_ntoh32(modified_time),\r
-                                     cl_ntoh32(lease_period)))\r
-                               rereg_clients = 1;\r
-               } else if (!strncmp(p, "InformInfo Record:", 18)) {\r
-                       ib_inform_info_record_t i_rec;\r
-                       osm_mad_addr_t rep_addr;\r
-                       ib_net16_t val16;\r
-\r
-                       p_mgrp = NULL;\r
-                       memset(&i_rec, 0, sizeof(i_rec));\r
-                       memset(&rep_addr, 0, sizeof(rep_addr));\r
-\r
-                       PARSE_AHEAD(p, net64, " subscriber_gid=0x",\r
-                                   &i_rec.subscriber_gid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &i_rec.subscriber_gid.unicast.interface_id);\r
-                       PARSE_AHEAD(p, net16, " subscriber_enum=0x",\r
-                                   &i_rec.subscriber_enum);\r
-                       PARSE_AHEAD(p, net64, " gid=0x",\r
-                                   &i_rec.inform_info.gid.unicast.prefix);\r
-                       PARSE_AHEAD(p, net64, ":0x",\r
-                                   &i_rec.inform_info.gid.unicast.\r
-                                   interface_id);\r
-                       PARSE_AHEAD(p, net16, " lid_range_begin=0x",\r
-                                   &i_rec.inform_info.lid_range_begin);\r
-                       PARSE_AHEAD(p, net16, " lid_range_end=0x",\r
-                                   &i_rec.inform_info.lid_range_end);\r
-                       PARSE_AHEAD(p, net8, " is_generic=0x",\r
-                                   &i_rec.inform_info.is_generic);\r
-                       PARSE_AHEAD(p, net8, " subscribe=0x",\r
-                                   &i_rec.inform_info.subscribe);\r
-                       PARSE_AHEAD(p, net16, " trap_type=0x",\r
-                                   &i_rec.inform_info.trap_type);\r
-                       PARSE_AHEAD(p, net16, " trap_num=0x",\r
-                                   &i_rec.inform_info.g_or_v.generic.trap_num);\r
-                       PARSE_AHEAD(p, net32, " qpn_resp_time_val=0x",\r
-                                   &i_rec.inform_info.g_or_v.generic.\r
-                                   qpn_resp_time_val);\r
-                       PARSE_AHEAD(p, net32, " node_type=0x",\r
-                                   (uint32_t *) & i_rec.inform_info.g_or_v.\r
-                                   generic.reserved2);\r
-\r
-                       PARSE_AHEAD(p, net16, " rep_addr: lid=0x",\r
-                                   &rep_addr.dest_lid);\r
-                       PARSE_AHEAD(p, net8, " path_bits=0x",\r
-                                   &rep_addr.path_bits);\r
-                       PARSE_AHEAD(p, net8, " static_rate=0x",\r
-                                   &rep_addr.static_rate);\r
-                       PARSE_AHEAD(p, net32, " remote_qp=0x",\r
-                                   &rep_addr.addr_type.gsi.remote_qp);\r
-                       PARSE_AHEAD(p, net32, " remote_qkey=0x",\r
-                                   &rep_addr.addr_type.gsi.remote_qkey);\r
-                       PARSE_AHEAD(p, net16, " pkey_ix=0x", &val16);\r
-                       rep_addr.addr_type.gsi.pkey_ix = cl_ntoh16(val16);\r
-                       PARSE_AHEAD(p, net8, " sl=0x",\r
-                                   &rep_addr.addr_type.gsi.service_level);\r
-\r
-                       if (load_infr(p_osm, &i_rec, &rep_addr))\r
-                               rereg_clients = 1;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * If loading succeeded, do whatever 'no_clients_rereg' says.\r
-        * If loading failed at some point, turn off the 'no_clients_rereg'\r
-        * option (turn on re-registartion requests).\r
-        */\r
-       if (rereg_clients)\r
-               p_osm->subn.opt.no_clients_rereg = FALSE;\r
-\r
-       /* We've just finished loading SA DB file - clear the "dirty" flag */\r
-       p_osm->sa.dirty = FALSE;\r
-\r
-_error:\r
-       fclose(file);\r
-       return ret;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_class_port_info.c b/branches/opensm_3/user/opensm/osm_sa_class_port_info.c
deleted file mode 100644 (file)
index b3dd797..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_cpi_rcv_t.\r
- * This object represents the ClassPortInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-#define MAX_MSECS_TO_RTV 24\r
-/* Precalculated table in msec (index is related to encoded value) */\r
-/* 4.096 usec * 2 ** n (where n = 8 - 31) */\r
-const static uint32_t msecs_to_rtv_table[MAX_MSECS_TO_RTV] = {\r
-       1, 2, 4, 8,\r
-       16, 33, 67, 134,\r
-       268, 536, 1073, 2147,\r
-       4294, 8589, 17179, 34359,\r
-       68719, 137438, 274877, 549755,\r
-       1099511, 2199023, 4398046, 8796093\r
-};\r
-\r
-static void cpi_rcv_respond(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)\r
-{\r
-       osm_madw_t *p_resp_madw;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_sa_mad_t *p_resp_sa_mad;\r
-       ib_class_port_info_t *p_resp_cpi;\r
-       ib_gid_t zero_gid;\r
-       uint8_t rtv;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       memset(&zero_gid, 0, sizeof(ib_gid_t));\r
-\r
-       /*\r
-          Get a MAD to reply. Address of Mad is in the received mad_wrapper\r
-        */\r
-       p_resp_madw = osm_mad_pool_get(sa->p_mad_pool, p_madw->h_bind,\r
-                                      MAD_BLOCK_SIZE, &p_madw->mad_addr);\r
-       if (!p_resp_madw) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1408: "\r
-                       "Unable to allocate MAD\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_resp_sa_mad = osm_madw_get_sa_mad_ptr(p_resp_madw);\r
-\r
-       memcpy(p_resp_sa_mad, p_sa_mad, IB_SA_MAD_HDR_SIZE);\r
-       p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
-       /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */\r
-       p_resp_sa_mad->sm_key = 0;\r
-\r
-       p_resp_cpi =\r
-           (ib_class_port_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);\r
-\r
-       /* finally do it (the job) man ! */\r
-       p_resp_cpi->base_ver = 1;\r
-       p_resp_cpi->class_ver = 2;\r
-       /* Calculate encoded response time value */\r
-       /* transaction timeout is in msec */\r
-       if (sa->p_subn->opt.transaction_timeout >\r
-           msecs_to_rtv_table[MAX_MSECS_TO_RTV - 1])\r
-               rtv = MAX_MSECS_TO_RTV - 1;\r
-       else {\r
-               for (rtv = 0; rtv < MAX_MSECS_TO_RTV; rtv++) {\r
-                       if (sa->p_subn->opt.transaction_timeout <=\r
-                           msecs_to_rtv_table[rtv])\r
-                               break;\r
-               }\r
-       }\r
-       rtv += 8;\r
-       ib_class_set_resp_time_val(p_resp_cpi, rtv);\r
-       p_resp_cpi->redir_gid = zero_gid;\r
-       p_resp_cpi->redir_tc_sl_fl = 0;\r
-       p_resp_cpi->redir_lid = 0;\r
-       p_resp_cpi->redir_pkey = 0;\r
-       p_resp_cpi->redir_qp = CL_NTOH32(1);\r
-       p_resp_cpi->redir_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-       p_resp_cpi->trap_gid = zero_gid;\r
-       p_resp_cpi->trap_tc_sl_fl = 0;\r
-       p_resp_cpi->trap_lid = 0;\r
-       p_resp_cpi->trap_pkey = 0;\r
-       p_resp_cpi->trap_hop_qp = 0;\r
-       p_resp_cpi->trap_qkey = IB_QP1_WELL_KNOWN_Q_KEY;\r
-\r
-       /* set specific capability mask bits */\r
-       /* we do not support the following options/optional records:\r
-          OSM_CAP_IS_SUBN_OPT_RECS_SUP :\r
-          RandomForwardingTableRecord,\r
-          ServiceAssociationRecord\r
-          other optional records supported "under the table"\r
-\r
-          OSM_CAP_IS_MULTIPATH_SUP:\r
-          TraceRecord\r
-\r
-          OSM_CAP_IS_REINIT_SUP:\r
-          For reinitialization functionality.\r
-\r
-          So not sending traps, but supporting Get(Notice) and Set(Notice).\r
-        */\r
-\r
-       /* Note host notation replaced later */\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |\r
-           OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED |\r
-           OSM_CAP_IS_MULTIPATH_SUP;\r
-#else\r
-       p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |\r
-           OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;\r
-#endif\r
-       if (sa->p_subn->opt.qos)\r
-               ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_QOS_SUPPORTED);\r
-\r
-       if (!sa->p_subn->opt.disable_multicast)\r
-               p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;\r
-       p_resp_cpi->cap_mask = cl_hton16(p_resp_cpi->cap_mask);\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))\r
-               osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);\r
-\r
-       osm_sa_send(sa, p_resp_madw, FALSE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * This code actually handles the call\r
- **********************************************************************/\r
-void osm_cpi_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       /* we only support GET */\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1403: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO);\r
-\r
-       /* CLASS PORT INFO does not really look at the SMDB - no lock required. */\r
-\r
-       cpi_rcv_respond(sa, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c b/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c
deleted file mode 100644 (file)
index b99cc2c..0000000
+++ /dev/null
@@ -1,346 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_gir_rcv_t.\r
- * This object represents the GUIDInfoRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_gir_item {\r
-       cl_list_item_t list_item;\r
-       ib_guidinfo_record_t rec;\r
-} osm_gir_item_t;\r
-\r
-typedef struct osm_gir_search_ctxt {\r
-       const ib_guidinfo_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_gir_search_ctxt_t;\r
-\r
-static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa,\r
-                                      IN const osm_node_t * p_node,\r
-                                      IN cl_qlist_t * p_list,\r
-                                      IN ib_net64_t const match_port_guid,\r
-                                      IN ib_net16_t const match_lid,\r
-                                      IN const osm_physp_t * p_req_physp,\r
-                                      IN uint8_t const block_num)\r
-{\r
-       osm_gir_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5102: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New GUIDInfoRecord: lid %u, block num %d\n",\r
-               cl_ntoh16(match_lid), block_num);\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = match_lid;\r
-       p_rec_item->rec.block_num = block_num;\r
-       if (!block_num)\r
-               p_rec_item->rec.guid_info.guid[0] =\r
-                   osm_physp_get_port_guid(p_req_physp);\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void sa_gir_create_gir(IN osm_sa_t * sa, IN osm_node_t * p_node,\r
-                             IN cl_qlist_t * p_list,\r
-                             IN ib_net64_t const match_port_guid,\r
-                             IN ib_net16_t const match_lid,\r
-                             IN const osm_physp_t * p_req_physp,\r
-                             IN uint8_t const match_block_num)\r
-{\r
-       const osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       uint16_t match_lid_ho;\r
-       ib_net16_t base_lid_ho;\r
-       ib_net16_t max_lid_ho;\r
-       uint8_t lmc;\r
-       ib_net64_t port_guid;\r
-       uint8_t block_num, start_block_num, end_block_num, num_blocks;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Looking for GUIDRecord with LID: %u GUID:0x%016"\r
-               PRIx64 "\n", cl_ntoh16(match_lid), cl_ntoh64(match_port_guid));\r
-\r
-       /*\r
-          For switches, do not return the GUIDInfo record(s)\r
-          for each port on the switch, just for port 0.\r
-        */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)\r
-               num_ports = 1;\r
-       else\r
-               num_ports = osm_node_get_num_physp(p_node);\r
-\r
-       for (port_num = 0; port_num < num_ports; port_num++) {\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               /* Check to see if the found p_physp and the requester physp\r
-                  share a pkey. If not, continue */\r
-               if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))\r
-                       continue;\r
-\r
-               port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-               if (match_port_guid && (port_guid != match_port_guid))\r
-                       continue;\r
-\r
-               /*\r
-                  Note: the following check is a temporary workaround\r
-                  Since 1. GUIDCap should never be 0 on ports where this applies\r
-                  and   2. GUIDCap should not be used on ports where it doesn't apply\r
-                  So this should really be a check for whether the port is a\r
-                  switch external port or not!\r
-                */\r
-               if (p_physp->port_info.guid_cap == 0)\r
-                       continue;\r
-\r
-               num_blocks = p_physp->port_info.guid_cap / 8;\r
-               if (p_physp->port_info.guid_cap % 8)\r
-                       num_blocks++;\r
-               if (match_block_num == 255) {\r
-                       start_block_num = 0;\r
-                       end_block_num = num_blocks - 1;\r
-               } else {\r
-                       if (match_block_num >= num_blocks)\r
-                               continue;\r
-                       end_block_num = start_block_num = match_block_num;\r
-               }\r
-\r
-               base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_physp));\r
-               match_lid_ho = cl_ntoh16(match_lid);\r
-               if (match_lid_ho) {\r
-                       lmc = osm_physp_get_lmc(p_physp);\r
-                       max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);\r
-\r
-                       /*\r
-                          We validate that the lid belongs to this node.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Comparing LID: %u <= %u <= %u\n",\r
-                               base_lid_ho, match_lid_ho, max_lid_ho);\r
-\r
-                       if (match_lid_ho < base_lid_ho\r
-                           || match_lid_ho > max_lid_ho)\r
-                               continue;\r
-               }\r
-\r
-               for (block_num = start_block_num; block_num <= end_block_num;\r
-                    block_num++)\r
-                       gir_rcv_new_gir(sa, p_node, p_list, port_guid,\r
-                                       cl_ntoh16(base_lid_ho), p_physp,\r
-                                       block_num);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_gir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_gir_search_ctxt_t *p_ctxt = cxt;\r
-       osm_node_t *const p_node = (osm_node_t *) p_map_item;\r
-       const ib_guidinfo_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       osm_sa_t *sa = p_ctxt->sa;\r
-       const ib_guid_info_t *p_comp_gi;\r
-       ib_net64_t const comp_mask = p_ctxt->comp_mask;\r
-       ib_net64_t match_port_guid = 0;\r
-       ib_net16_t match_lid = 0;\r
-       uint8_t match_block_num = 255;\r
-\r
-       OSM_LOG_ENTER(p_ctxt->sa->p_log);\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_LID)\r
-               match_lid = p_rcvd_rec->lid;\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_BLOCKNUM)\r
-               match_block_num = p_rcvd_rec->block_num;\r
-\r
-       p_comp_gi = &p_rcvd_rec->guid_info;\r
-       /* Different rule for block 0 v. other blocks */\r
-       if (comp_mask & IB_GIR_COMPMASK_GID0) {\r
-               if (!p_rcvd_rec->block_num)\r
-                       match_port_guid = osm_physp_get_port_guid(p_req_physp);\r
-               if (p_comp_gi->guid[0] != match_port_guid)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID1) {\r
-               if (p_comp_gi->guid[1] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID2) {\r
-               if (p_comp_gi->guid[2] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID3) {\r
-               if (p_comp_gi->guid[3] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID4) {\r
-               if (p_comp_gi->guid[4] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID5) {\r
-               if (p_comp_gi->guid[5] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID6) {\r
-               if (p_comp_gi->guid[6] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_GIR_COMPMASK_GID7) {\r
-               if (p_comp_gi->guid[7] != 0)\r
-                       goto Exit;\r
-       }\r
-\r
-       sa_gir_create_gir(sa, p_node, p_ctxt->p_list, match_port_guid,\r
-                         match_lid, p_req_physp, match_block_num);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
-}\r
-\r
-void osm_gir_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_guidinfo_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_gir_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_guidinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5105: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5104: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_guidinfo_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, sa_gir_by_comp_mask_cb,\r
-                          &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_guidinfo_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_informinfo.c b/branches/opensm_3/user/opensm/osm_sa_informinfo.c
deleted file mode 100644 (file)
index 4cfe579..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_infr_rcv_t.\r
- * This object represents the InformInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <arpa/inet.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_pkey.h>\r
-\r
-typedef struct osm_iir_item {\r
-       cl_list_item_t list_item;\r
-       ib_inform_info_record_t rec;\r
-} osm_iir_item_t;\r
-\r
-typedef struct osm_iir_search_ctxt {\r
-       const ib_inform_info_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       ib_gid_t subscriber_gid;\r
-       ib_net16_t subscriber_enum;\r
-       osm_sa_t *sa;\r
-       osm_physp_t *p_req_physp;\r
-} osm_iir_search_ctxt_t;\r
-\r
-/**********************************************************************\r
-o13-14.1.1: Except for Set(InformInfo) requests with Inform-\r
-Info:LIDRangeBegin=0xFFFF, managers that support event forwarding\r
-shall, upon receiving a Set(InformInfo), verify that the requester\r
-originating the Set(InformInfo) and a Trap() source identified by Inform-\r
-can access each other - can use path record to verify that.\r
-**********************************************************************/\r
-static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,\r
-                                             IN osm_infr_t * p_infr_rec)\r
-{\r
-       boolean_t valid = TRUE;\r
-       osm_physp_t *p_requester_physp;\r
-       osm_port_t *p_port;\r
-       ib_net64_t portguid;\r
-       uint16_t lid_range_begin, lid_range_end, lid;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* get the requester physp from the request address */\r
-       p_requester_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                                     &p_infr_rec->report_addr);\r
-\r
-       if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {\r
-               /* a gid is defined */\r
-               portguid =\r
-                   p_infr_rec->inform_record.inform_info.gid.unicast.\r
-                   interface_id;\r
-\r
-               p_port = osm_get_port_by_guid(sa->p_subn, portguid);\r
-               if (p_port == NULL) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4301: "\r
-                               "Invalid port guid: 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(portguid));\r
-                       valid = FALSE;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* make sure that the requester and destination port can access\r
-                  each other according to the current partitioning. */\r
-               if (!osm_physp_share_pkey\r
-                   (sa->p_log, p_port->p_physp, p_requester_physp)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "port and requester don't share pkey\n");\r
-                       valid = FALSE;\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               size_t lids_size;\r
-\r
-               /* gid is zero - check if LID range is defined */\r
-               lid_range_begin =\r
-                   cl_ntoh16(p_infr_rec->inform_record.inform_info.\r
-                             lid_range_begin);\r
-               /* if lid is 0xFFFF - meaning all endports managed by the manager */\r
-               if (lid_range_begin == 0xFFFF)\r
-                       goto Exit;\r
-\r
-               lid_range_end =\r
-                   cl_ntoh16(p_infr_rec->inform_record.inform_info.\r
-                             lid_range_end);\r
-\r
-               lids_size = cl_ptr_vector_get_size(&sa->p_subn->port_lid_tbl);\r
-\r
-               /* lid_range_end is set to zero if no range desired. In this\r
-                  case - just make it equal to the lid_range_begin. */\r
-               if (lid_range_end == 0)\r
-                       lid_range_end = lid_range_begin;\r
-               else if (lid_range_end >= lids_size)\r
-                       lid_range_end = lids_size - 1;\r
-\r
-               if (lid_range_begin >= lids_size) {\r
-                       /* requested lids are out of range */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: "\r
-                               "Given LIDs (%u-%u) are out of range (%zu)\n",\r
-                               lid_range_begin, lid_range_end, lids_size);\r
-                       valid = FALSE;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* go over all defined lids within the range and make sure that the\r
-                  requester port can access them according to current partitioning. */\r
-               for (lid = lid_range_begin; lid <= lid_range_end; lid++) {\r
-                       p_port = osm_get_port_by_lid_ho(sa->p_subn, lid);\r
-                       if (p_port == NULL)\r
-                               continue;\r
-\r
-                       /* make sure that the requester and destination port can access\r
-                          each other according to the current partitioning. */\r
-                       if (!osm_physp_share_pkey\r
-                           (sa->p_log, p_port->p_physp, p_requester_physp)) {\r
-                               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                                       "port and requester don't share pkey\n");\r
-                               valid = FALSE;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return valid;\r
-}\r
-\r
-static boolean_t validate_infr(IN osm_sa_t * sa, IN osm_infr_t * p_infr_rec)\r
-{\r
-       boolean_t valid = TRUE;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       valid = validate_ports_access_rights(sa, p_infr_rec);\r
-       if (!valid) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Invalid Access for InformInfo\n");\r
-               valid = FALSE;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return valid;\r
-}\r
-\r
-/**********************************************************************\r
-o13-12.1.1: Confirm a valid request for event subscription by responding\r
-with an InformInfo attribute that is a copy of the data in the\r
-Set(InformInfo) request.\r
-**********************************************************************/\r
-static void infr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       cl_qlist_t rec_list;\r
-       osm_iir_item_t *item;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Generating successful InformInfo response\n");\r
-\r
-       item = malloc(sizeof(*item));\r
-       if (!item) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4303: "\r
-                       "rec_item alloc failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memcpy(&item->rec,\r
-              ib_sa_mad_get_payload_ptr(osm_madw_get_sa_mad_ptr(p_madw)),\r
-              sizeof(item->rec));\r
-\r
-       cl_qlist_init(&rec_list);\r
-       cl_qlist_insert_tail(&rec_list, &item->list_item);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_inform_info_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,\r
-                                           IN const osm_infr_t * p_infr,\r
-                                           osm_iir_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_inform_info_record_t *p_rcvd_rec = NULL;\r
-       ib_net64_t comp_mask;\r
-       ib_net64_t portguid;\r
-       osm_port_t *p_subscriber_port;\r
-       osm_physp_t *p_subscriber_physp;\r
-       const osm_physp_t *p_req_physp;\r
-       osm_iir_item_t *p_rec_item;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       if (comp_mask & IB_IIR_COMPMASK_SUBSCRIBERGID &&\r
-           memcmp(&p_infr->inform_record.subscriber_gid,\r
-                  &p_ctxt->subscriber_gid,\r
-                  sizeof(p_infr->inform_record.subscriber_gid)))\r
-               goto Exit;\r
-\r
-       if (comp_mask & IB_IIR_COMPMASK_ENUM &&\r
-           p_infr->inform_record.subscriber_enum != p_ctxt->subscriber_enum)\r
-               goto Exit;\r
-\r
-       /* Implement any other needed search cases */\r
-\r
-       /* Ensure pkey is shared before returning any records */\r
-       portguid = p_infr->inform_record.subscriber_gid.unicast.interface_id;\r
-       p_subscriber_port = osm_get_port_by_guid(sa->p_subn, portguid);\r
-       if (p_subscriber_port == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 430D: "\r
-                       "Invalid subscriber port guid: 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(portguid));\r
-               goto Exit;\r
-       }\r
-\r
-       /* get the subscriber InformInfo physical port */\r
-       p_subscriber_physp = p_subscriber_port->p_physp;\r
-       /* make sure that the requester and subscriber port can access each\r
-          other according to the current partitioning. */\r
-       if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_subscriber_physp)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "requester and subscriber ports don't share pkey\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 430E: "\r
-                       "rec_item alloc failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       memcpy(&p_rec_item->rec, &p_infr->inform_record,\r
-              sizeof(ib_inform_info_record_t));\r
-       cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * p_list_item,\r
-                                              IN void *context)\r
-{\r
-       const osm_infr_t *p_infr = (osm_infr_t *) p_list_item;\r
-       osm_iir_search_ctxt_t *p_ctxt = context;\r
-\r
-       sa_inform_info_rec_by_comp_mask(p_ctxt->sa, p_infr, p_ctxt);\r
-}\r
-\r
-/**********************************************************************\r
-Received a Get(InformInfoRecord) or GetTable(InformInfoRecord) MAD\r
-**********************************************************************/\r
-static void infr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       char gid_str[INET6_ADDRSTRLEN];\r
-       ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_inform_info_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_iir_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-       osm_iir_item_t *item;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_inform_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4309: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_inform_info_record(sa->p_log, p_rcvd_rec,\r
-                                           OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.subscriber_gid = p_rcvd_rec->subscriber_gid;\r
-       context.subscriber_enum = p_rcvd_rec->subscriber_enum;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Query Subscriber GID:%s(%02X) Enum:0x%X(%02X)\n",\r
-               inet_ntop(AF_INET6, p_rcvd_rec->subscriber_gid.raw,\r
-                         gid_str, sizeof gid_str),\r
-               (p_rcvd_mad->comp_mask & IB_IIR_COMPMASK_SUBSCRIBERGID) != 0,\r
-               cl_ntoh16(p_rcvd_rec->subscriber_enum),\r
-               (p_rcvd_mad->comp_mask & IB_IIR_COMPMASK_ENUM) != 0);\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       cl_qlist_apply_func(&sa->p_subn->sa_infr_list,\r
-                           sa_inform_info_rec_by_comp_mask_cb, &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       /* clear reserved and pad fields in InformInfoRecord */\r
-       for (item = (osm_iir_item_t *) cl_qlist_head(&rec_list);\r
-            item != (osm_iir_item_t *) cl_qlist_end(&rec_list);\r
-            item = (osm_iir_item_t *) cl_qlist_next(&item->list_item)) {\r
-               memset(item->rec.reserved, 0, sizeof(item->rec.reserved));\r
-               memset(item->rec.pad, 0, sizeof(item->rec.pad));\r
-       }\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_inform_info_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/*********************************************************************\r
-Received a Set(InformInfo) MAD\r
-**********************************************************************/\r
-static void infr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_inform_info_t *p_recvd_inform_info;\r
-       osm_infr_t inform_info_rec;     /* actual inform record to be stored for reports */\r
-       osm_infr_t *p_infr;\r
-       ib_net32_t qpn;\r
-       uint8_t resp_time_val;\r
-       ib_api_status_t res;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_inform_info =\r
-           (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-#if 0\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_inform_info(sa->p_log, p_recvd_inform_info,\r
-                                    OSM_LOG_DEBUG);\r
-#endif\r
-\r
-       /* Grab the lock */\r
-       cl_plock_excl_acquire(sa->p_lock);\r
-\r
-       /* define the inform record */\r
-       inform_info_rec.inform_record.inform_info = *p_recvd_inform_info;\r
-\r
-       /* following C13-32.1.2 Tbl 120: we only copy the source address vector */\r
-       inform_info_rec.report_addr = p_madw->mad_addr;\r
-\r
-       /* we will need to know the mad srvc to send back through */\r
-       inform_info_rec.h_bind = p_madw->h_bind;\r
-       inform_info_rec.sa = sa;\r
-\r
-       /* update the subscriber GID according to mad address */\r
-       res = osm_get_gid_by_mad_addr(sa->p_log, sa->p_subn, &p_madw->mad_addr,\r
-                                     &inform_info_rec.inform_record.\r
-                                     subscriber_gid);\r
-       if (res != IB_SUCCESS) {\r
-               cl_plock_release(sa->p_lock);\r
-\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4308 "\r
-                       "Subscribe Request from unknown LID: %u\n",\r
-                       cl_ntoh16(p_madw->mad_addr.dest_lid));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* HACK: enum is always 0 (currently) */\r
-       inform_info_rec.inform_record.subscriber_enum = 0;\r
-\r
-       /* Subscribe values above 1 are undefined */\r
-       if (p_recvd_inform_info->subscribe > 1) {\r
-               cl_plock_release(sa->p_lock);\r
-\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4308 "\r
-                       "Invalid subscribe: %d\n",\r
-                       p_recvd_inform_info->subscribe);\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * MODIFICATIONS DONE ON INCOMING REQUEST:\r
-        *\r
-        * QPN:\r
-        * Internally we keep the QPN field of the InformInfo updated\r
-        * so we can simply compare it in the record - when finding such.\r
-        */\r
-       if (p_recvd_inform_info->subscribe) {\r
-               ib_inform_info_set_qpn(&inform_info_rec.inform_record.\r
-                                      inform_info,\r
-                                      inform_info_rec.report_addr.addr_type.\r
-                                      gsi.remote_qp);\r
-\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Subscribe Request with QPN: 0x%06X\n",\r
-                       cl_ntoh32(inform_info_rec.report_addr.addr_type.gsi.\r
-                                 remote_qp));\r
-       } else {\r
-               ib_inform_info_get_qpn_resp_time(p_recvd_inform_info->g_or_v.\r
-                                                generic.qpn_resp_time_val,\r
-                                                &qpn, &resp_time_val);\r
-\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "UnSubscribe Request with QPN: 0x%06X\n",\r
-                       cl_ntoh32(qpn));\r
-       }\r
-\r
-       /* If record exists with matching InformInfo */\r
-       p_infr = osm_infr_get_by_rec(sa->p_subn, sa->p_log, &inform_info_rec);\r
-\r
-       /* check to see if the request was for subscribe */\r
-       if (p_recvd_inform_info->subscribe) {\r
-               /* validate the request for a new or update InformInfo */\r
-               if (validate_infr(sa, &inform_info_rec) != TRUE) {\r
-                       cl_plock_release(sa->p_lock);\r
-\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4305: "\r
-                               "Failed to validate a new inform object\n");\r
-\r
-                       /* o13-13.1.1: we need to set the subscribe bit to 0 */\r
-                       p_recvd_inform_info->subscribe = 0;\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* ok - we can try and create a new entry */\r
-               if (p_infr == NULL) {\r
-                       /* Create the instance of the osm_infr_t object */\r
-                       p_infr = osm_infr_new(&inform_info_rec);\r
-                       if (p_infr == NULL) {\r
-                               cl_plock_release(sa->p_lock);\r
-\r
-                               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4306: "\r
-                                       "Failed to create a new inform object\n");\r
-\r
-                               /* o13-13.1.1: we need to set the subscribe bit to 0 */\r
-                               p_recvd_inform_info->subscribe = 0;\r
-                               osm_sa_send_error(sa, p_madw,\r
-                                                 IB_SA_MAD_STATUS_NO_RESOURCES);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       /* Add this new osm_infr_t object to subnet object */\r
-                       osm_infr_insert_to_db(sa->p_subn, sa->p_log, p_infr);\r
-               } else\r
-                       /* Update the old instance of the osm_infr_t object */\r
-                       p_infr->inform_record = inform_info_rec.inform_record;\r
-               /* We got an UnSubscribe request */\r
-       } else if (p_infr == NULL) {\r
-               cl_plock_release(sa->p_lock);\r
-\r
-               /* No Such Item - So Error */\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4307: "\r
-                       "Failed to UnSubscribe to non existing inform object\n");\r
-\r
-               /* o13-13.1.1: we need to set the subscribe bit to 0 */\r
-               p_recvd_inform_info->subscribe = 0;\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       } else\r
-               /* Delete this object from the subnet list of informs */\r
-               osm_infr_remove_from_db(sa->p_subn, sa->p_log, p_infr);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       /* send the success response */\r
-       infr_rcv_respond(sa, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_infr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO);\r
-\r
-       if (p_sa_mad->method != IB_MAD_METHOD_SET) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       infr_rcv_process_set_method(sa, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_infir_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD);\r
-\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET &&\r
-           p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       infr_rcv_process_get_method(sa, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_lft_record.c b/branches/opensm_3/user/opensm/osm_sa_lft_record.c
deleted file mode 100644 (file)
index 96b86e2..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_lftr_rcv_t.\r
- *   This object represents the LinearForwardingTable Receiver object.\r
- *   This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_lftr_item {\r
-       cl_list_item_t list_item;\r
-       ib_lft_record_t rec;\r
-} osm_lftr_item_t;\r
-\r
-typedef struct osm_lftr_search_ctxt {\r
-       const ib_lft_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_lftr_search_ctxt_t;\r
-\r
-static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa,\r
-                                        IN const osm_switch_t * p_sw,\r
-                                        IN cl_qlist_t * p_list,\r
-                                        IN ib_net16_t lid, IN uint16_t block)\r
-{\r
-       osm_lftr_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4402: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New LinearForwardingTable: sw 0x%016" PRIx64\r
-               "\n\t\t\t\tblock 0x%02X lid %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),\r
-               block, cl_ntoh16(lid));\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.block_num = cl_hton16(block);\r
-\r
-       /* copy the lft block */\r
-       osm_switch_get_lft_block(p_sw, block, p_rec_item->rec.lft);\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void lftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_lftr_search_ctxt_t *p_ctxt = cxt;\r
-       const osm_switch_t *p_sw = (osm_switch_t *) p_map_item;\r
-       const ib_lft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       osm_sa_t *sa = p_ctxt->sa;\r
-       ib_net64_t const comp_mask = p_ctxt->comp_mask;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       osm_port_t *p_port;\r
-       uint16_t min_lid_ho, max_lid_ho;\r
-       uint16_t min_block, max_block, block;\r
-       const osm_physp_t *p_physp;\r
-\r
-       /* In switches, the port guid is the node guid. */\r
-       p_port = osm_get_port_by_guid(sa->p_subn,\r
-                                     p_sw->p_node->node_info.port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4405: "\r
-                       "Failed to find Port by Node Guid:0x%016" PRIx64\r
-                       "\n", cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               return;\r
-       }\r
-\r
-       /* check that the requester physp and the current physp are under\r
-          the same partition. */\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4406: "\r
-                       "Failed to find default physical Port by Node Guid:0x%016"\r
-                       PRIx64 "\n",\r
-                       cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               return;\r
-       }\r
-       if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))\r
-               return;\r
-\r
-       /* get the port 0 of the switch */\r
-       osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-       /* compare the lids - if required */\r
-       if (comp_mask & IB_LFTR_COMPMASK_LID) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Comparing lid:%u to port lid range: %u .. %u\n",\r
-                       cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);\r
-               /* ok we are ready for range check */\r
-               if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||\r
-                   max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))\r
-                       return;\r
-       }\r
-\r
-       /* now we need to decide which blocks to output */\r
-       max_block = osm_switch_get_max_block_id_in_use(p_sw);\r
-       if (comp_mask & IB_LFTR_COMPMASK_BLOCK) {\r
-               min_block = cl_ntoh16(p_rcvd_rec->block_num);\r
-               if (min_block > max_block)\r
-                       return;\r
-               max_block = min_block;\r
-       } else                  /* use as many blocks as "in use" */\r
-               min_block = 0;\r
-\r
-       /* so we can add these blocks one by one ... */\r
-       for (block = min_block; block <= max_block; block++)\r
-               lftr_rcv_new_lftr(sa, p_sw, p_ctxt->p_list,\r
-                                 osm_port_get_base_lid(p_port), block);\r
-}\r
-\r
-void osm_lftr_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_lft_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_lftr_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec = (ib_lft_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_LFT_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4408: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4407: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /* Go over all switches */\r
-       cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, lftr_rcv_by_comp_mask,\r
-                          &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_lft_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_link_record.c b/branches/opensm_3/user/opensm/osm_sa_link_record.c
deleted file mode 100644 (file)
index 966a3af..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_lr_rcv_t.\r
- * This object represents the LinkRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_lr_item {\r
-       cl_list_item_t list_item;\r
-       ib_link_record_t link_rec;\r
-} osm_lr_item_t;\r
-\r
-static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,\r
-                                   IN ib_net16_t to_lid, IN uint8_t from_port,\r
-                                   IN uint8_t to_port, IN cl_qlist_t * p_list)\r
-{\r
-       osm_lr_item_t *p_lr_item;\r
-\r
-       p_lr_item = malloc(sizeof(*p_lr_item));\r
-       if (p_lr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1801: "\r
-                       "Unable to acquire link record\n"\r
-                       "\t\t\t\tFrom port %u\n" "\t\t\t\tTo port   %u\n"\r
-                       "\t\t\t\tFrom lid  %u\n" "\t\t\t\tTo lid    %u\n",\r
-                       from_port, to_port,\r
-                       cl_ntoh16(from_lid), cl_ntoh16(to_lid));\r
-               return;\r
-       }\r
-       memset(p_lr_item, 0, sizeof(*p_lr_item));\r
-\r
-       p_lr_item->link_rec.from_port_num = from_port;\r
-       p_lr_item->link_rec.to_port_num = to_port;\r
-       p_lr_item->link_rec.to_lid = to_lid;\r
-       p_lr_item->link_rec.from_lid = from_lid;\r
-\r
-       cl_qlist_insert_tail(p_list, &p_lr_item->list_item);\r
-}\r
-\r
-static ib_net16_t get_base_lid(IN const osm_physp_t * p_physp)\r
-{\r
-       if (p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH)\r
-               p_physp = osm_node_get_physp_ptr(p_physp->p_node, 0);\r
-       return osm_physp_get_base_lid(p_physp);\r
-}\r
-\r
-static void lr_rcv_get_physp_link(IN osm_sa_t * sa,\r
-                                 IN const ib_link_record_t * p_lr,\r
-                                 IN const osm_physp_t * p_src_physp,\r
-                                 IN const osm_physp_t * p_dest_physp,\r
-                                 IN const ib_net64_t comp_mask,\r
-                                 IN cl_qlist_t * p_list,\r
-                                 IN const osm_physp_t * p_req_physp)\r
-{\r
-       uint8_t src_port_num;\r
-       uint8_t dest_port_num;\r
-       ib_net16_t from_base_lid;\r
-       ib_net16_t to_base_lid;\r
-       ib_net16_t lmc_mask;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          If only one end of the link is specified, determine\r
-          the other side.\r
-        */\r
-       if (p_src_physp) {\r
-               if (p_dest_physp) {\r
-                       /*\r
-                          Ensure the two physp's are actually connected.\r
-                          If not, bail out.\r
-                        */\r
-                       if (osm_physp_get_remote(p_src_physp) != p_dest_physp)\r
-                               goto Exit;\r
-               } else {\r
-                       p_dest_physp = osm_physp_get_remote(p_src_physp);\r
-                       if (p_dest_physp == NULL)\r
-                               goto Exit;\r
-               }\r
-       } else {\r
-               if (p_dest_physp) {\r
-                       p_src_physp = osm_physp_get_remote(p_dest_physp);\r
-                       if (p_src_physp == NULL)\r
-                               goto Exit;\r
-               } else\r
-                       goto Exit;      /* no physp's, so nothing to do */\r
-       }\r
-\r
-       /* Check that the p_src_physp, p_dest_physp and p_req_physp\r
-          all share a pkey (doesn't have to be the same p_key). */\r
-       if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_dest_physp)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Source and Dest PhysPorts do not share PKey\n");\r
-               goto Exit;\r
-       }\r
-       if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_req_physp)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Source and Requester PhysPorts do not share PKey\n");\r
-               goto Exit;\r
-       }\r
-       if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_dest_physp)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Requester and Dest PhysPorts do not share PKey\n");\r
-               goto Exit;\r
-       }\r
-\r
-       src_port_num = osm_physp_get_port_num(p_src_physp);\r
-       dest_port_num = osm_physp_get_port_num(p_dest_physp);\r
-\r
-       if (comp_mask & IB_LR_COMPMASK_FROM_PORT)\r
-               if (src_port_num != p_lr->from_port_num)\r
-                       goto Exit;\r
-\r
-       if (comp_mask & IB_LR_COMPMASK_TO_PORT)\r
-               if (dest_port_num != p_lr->to_port_num)\r
-                       goto Exit;\r
-\r
-       from_base_lid = get_base_lid(p_src_physp);\r
-       to_base_lid = get_base_lid(p_dest_physp);\r
-\r
-       lmc_mask = ~((1 << sa->p_subn->opt.lmc) - 1);\r
-       lmc_mask = cl_hton16(lmc_mask);\r
-\r
-       if (comp_mask & IB_LR_COMPMASK_FROM_LID)\r
-               if (from_base_lid != (p_lr->from_lid & lmc_mask))\r
-                       goto Exit;\r
-\r
-       if (comp_mask & IB_LR_COMPMASK_TO_LID)\r
-               if (to_base_lid != (p_lr->to_lid & lmc_mask))\r
-                       goto Exit;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Acquiring link record\n"\r
-               "\t\t\t\tsrc port 0x%" PRIx64 " (port %u)"\r
-               ", dest port 0x%" PRIx64 " (port %u)\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)), src_port_num,\r
-               cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)),\r
-               dest_port_num);\r
-\r
-       lr_rcv_build_physp_link(sa, from_base_lid, to_base_lid, src_port_num,\r
-                               dest_port_num, p_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void lr_rcv_get_port_links(IN osm_sa_t * sa,\r
-                                 IN const ib_link_record_t * p_lr,\r
-                                 IN const osm_port_t * p_src_port,\r
-                                 IN const osm_port_t * p_dest_port,\r
-                                 IN const ib_net64_t comp_mask,\r
-                                 IN cl_qlist_t * p_list,\r
-                                 IN const osm_physp_t * p_req_physp)\r
-{\r
-       const osm_physp_t *p_src_physp;\r
-       const osm_physp_t *p_dest_physp;\r
-       const cl_qmap_t *p_node_tbl;\r
-       osm_node_t *p_node;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       uint8_t dest_num_ports;\r
-       uint8_t dest_port_num;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       if (p_src_port) {\r
-               if (p_dest_port) {\r
-                       /*\r
-                          Build an LR for every link connected between both ports.\r
-                          The inner function will discard physp combinations\r
-                          that do not actually connect.  Don't bother screening\r
-                          for that here.\r
-                        */\r
-                       num_ports = osm_node_get_num_physp(p_src_port->p_node);\r
-                       dest_num_ports =\r
-                           osm_node_get_num_physp(p_dest_port->p_node);\r
-                       for (port_num = 1; port_num < num_ports; port_num++) {\r
-                               p_src_physp =\r
-                                   osm_node_get_physp_ptr(p_src_port->p_node,\r
-                                                          port_num);\r
-                               for (dest_port_num = 1;\r
-                                    dest_port_num < dest_num_ports;\r
-                                    dest_port_num++) {\r
-                                       p_dest_physp =\r
-                                           osm_node_get_physp_ptr(p_dest_port->\r
-                                                                  p_node,\r
-                                                                  dest_port_num);\r
-                                       /* both physical ports should be with data */\r
-                                       if (p_src_physp && p_dest_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, p_src_physp,\r
-                                                    p_dest_physp, comp_mask,\r
-                                                    p_list, p_req_physp);\r
-                               }\r
-                       }\r
-               } else {\r
-                       /*\r
-                          Build an LR for every link connected from the source port.\r
-                        */\r
-                       if (comp_mask & IB_LR_COMPMASK_FROM_PORT) {\r
-                               port_num = p_lr->from_port_num;\r
-                               /* If the port number is out of the range of the p_src_port, then\r
-                                  this couldn't be a relevant record. */\r
-                               if (port_num <\r
-                                   p_src_port->p_node->physp_tbl_size) {\r
-                                       p_src_physp =\r
-                                           osm_node_get_physp_ptr(p_src_port->\r
-                                                                  p_node,\r
-                                                                  port_num);\r
-                                       if (p_src_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, p_src_physp,\r
-                                                    NULL, comp_mask, p_list,\r
-                                                    p_req_physp);\r
-                               }\r
-                       } else {\r
-                               num_ports =\r
-                                   osm_node_get_num_physp(p_src_port->p_node);\r
-                               for (port_num = 1; port_num < num_ports;\r
-                                    port_num++) {\r
-                                       p_src_physp =\r
-                                           osm_node_get_physp_ptr(p_src_port->\r
-                                                                  p_node,\r
-                                                                  port_num);\r
-                                       if (p_src_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, p_src_physp,\r
-                                                    NULL, comp_mask, p_list,\r
-                                                    p_req_physp);\r
-                               }\r
-                       }\r
-               }\r
-       } else {\r
-               if (p_dest_port) {\r
-                       /*\r
-                          Build an LR for every link connected to the dest port.\r
-                        */\r
-                       if (comp_mask & IB_LR_COMPMASK_TO_PORT) {\r
-                               port_num = p_lr->to_port_num;\r
-                               /* If the port number is out of the range of the p_dest_port, then\r
-                                  this couldn't be a relevant record. */\r
-                               if (port_num <\r
-                                   p_dest_port->p_node->physp_tbl_size) {\r
-                                       p_dest_physp =\r
-                                           osm_node_get_physp_ptr(p_dest_port->\r
-                                                                  p_node,\r
-                                                                  port_num);\r
-                                       if (p_dest_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, NULL,\r
-                                                    p_dest_physp, comp_mask,\r
-                                                    p_list, p_req_physp);\r
-                               }\r
-                       } else {\r
-                               num_ports =\r
-                                   osm_node_get_num_physp(p_dest_port->p_node);\r
-                               for (port_num = 1; port_num < num_ports;\r
-                                    port_num++) {\r
-                                       p_dest_physp =\r
-                                           osm_node_get_physp_ptr(p_dest_port->\r
-                                                                  p_node,\r
-                                                                  port_num);\r
-                                       if (p_dest_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, NULL,\r
-                                                    p_dest_physp, comp_mask,\r
-                                                    p_list, p_req_physp);\r
-                               }\r
-                       }\r
-               } else {\r
-                       /*\r
-                          Process the world (recurse once back into this function).\r
-                        */\r
-                       p_node_tbl = &sa->p_subn->node_guid_tbl;\r
-                       p_node = (osm_node_t *) cl_qmap_head(p_node_tbl);\r
-\r
-                       while (p_node != (osm_node_t *) cl_qmap_end(p_node_tbl)) {\r
-                               num_ports = osm_node_get_num_physp(p_node);\r
-                               for (port_num = 1; port_num < num_ports;\r
-                                    port_num++) {\r
-                                       p_src_physp =\r
-                                           osm_node_get_physp_ptr(p_node,\r
-                                                                  port_num);\r
-                                       if (p_src_physp)\r
-                                               lr_rcv_get_physp_link\r
-                                                   (sa, p_lr, p_src_physp,\r
-                                                    NULL, comp_mask, p_list,\r
-                                                    p_req_physp);\r
-                               }\r
-                               p_node = (osm_node_t *) cl_qmap_next(&p_node->\r
-                                                                    map_item);\r
-                       }\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Returns the SA status to return to the client.\r
- **********************************************************************/\r
-static ib_net16_t lr_rcv_get_end_points(IN osm_sa_t * sa,\r
-                                       IN const osm_madw_t * p_madw,\r
-                                       OUT const osm_port_t ** pp_src_port,\r
-                                       OUT const osm_port_t ** pp_dest_port)\r
-{\r
-       const ib_link_record_t *p_lr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_net64_t comp_mask;\r
-       ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          Determine what fields are valid and then get a pointer\r
-          to the source and destination port objects, if possible.\r
-        */\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_lr = (ib_link_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       comp_mask = p_sa_mad->comp_mask;\r
-       *pp_src_port = NULL;\r
-       *pp_dest_port = NULL;\r
-\r
-       if (p_sa_mad->comp_mask & IB_LR_COMPMASK_FROM_LID) {\r
-               *pp_src_port = osm_get_port_by_lid(sa->p_subn, p_lr->from_lid);\r
-               if (!*pp_src_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad lid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                               "No source port with LID %u\n",\r
-                               cl_ntoh16(p_lr->from_lid));\r
-\r
-                       sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (p_sa_mad->comp_mask & IB_LR_COMPMASK_TO_LID) {\r
-               *pp_dest_port = osm_get_port_by_lid(sa->p_subn, p_lr->to_lid);\r
-               if (!*pp_dest_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad lid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                               "No dest port with LID %u\n",\r
-                               cl_ntoh16(p_lr->to_lid));\r
-\r
-                       sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return sa_status;\r
-}\r
-\r
-void osm_lr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_link_record_t *p_lr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       const osm_port_t *p_src_port;\r
-       const osm_port_t *p_dest_port;\r
-       cl_qlist_t lr_list;\r
-       ib_net16_t status;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_lr = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_LINK_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET &&\r
-           p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1804: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1805: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_link_record(sa->p_log, p_lr, OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&lr_list);\r
-\r
-       /*\r
-          Most SA functions (including this one) are read-only on the\r
-          subnet object, so we grab the lock non-exclusively.\r
-        */\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       status = lr_rcv_get_end_points(sa, p_madw, &p_src_port, &p_dest_port);\r
-\r
-       if (status == IB_SA_MAD_STATUS_SUCCESS)\r
-               lr_rcv_get_port_links(sa, p_lr, p_src_port, p_dest_port,\r
-                                     p_sa_mad->comp_mask, &lr_list,\r
-                                     p_req_physp);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_link_record_t), &lr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c b/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c
deleted file mode 100644 (file)
index 81aa30d..0000000
+++ /dev/null
@@ -1,565 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sa_mad_ctrl_t.\r
- * This object is part of the SA object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_sa_mad_ctrl.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-/****f* opensm: SA/sa_mad_ctrl_disp_done_callback\r
- * NAME\r
- * sa_mad_ctrl_disp_done_callback\r
- *\r
- * DESCRIPTION\r
- * This function is the Dispatcher callback that indicates\r
- * a received MAD has been processed by the recipient.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sa_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)\r
-{\r
-       osm_sa_mad_ctrl_t *p_ctrl = context;\r
-       osm_madw_t *p_madw = p_data;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-       /*\r
-          Return the MAD & wrapper to the pool.\r
-        */\r
-       osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/************/\r
-\r
-/****f* opensm: SA/sa_mad_ctrl_process\r
- * NAME\r
- * sa_mad_ctrl_process\r
- *\r
- * DESCRIPTION\r
- * This function handles known methods for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * p_ctrl,\r
-                               IN osm_madw_t * p_madw)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-       cl_status_t status;\r
-       cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;\r
-       uint64_t last_dispatched_msg_queue_time_msec;\r
-       uint32_t num_messages;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       /*\r
-          If the dispatcher is showing us that it is overloaded\r
-          there is no point in placing the request in. We should instead\r
-          provide immediate response - IB_RESOURCE_BUSY\r
-          But how do we know?\r
-          The dispatcher reports back the number of outstanding messages and\r
-          the time the last message stayed in the queue.\r
-          HACK: Actually, we cannot send a mad from within the receive callback;\r
-          thus - we will just drop it.\r
-        */\r
-       cl_disp_get_queue_status(p_ctrl->h_disp, &num_messages,\r
-                                &last_dispatched_msg_queue_time_msec);\r
-       if (num_messages > 1 && p_ctrl->p_subn->opt.max_msg_fifo_timeout &&\r
-           last_dispatched_msg_queue_time_msec >\r
-           p_ctrl->p_subn->opt.max_msg_fifo_timeout) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_INFO,\r
-                       /*             "Responding BUSY status since the dispatcher is already" */\r
-                       "Dropping MAD since the dispatcher is already"\r
-                       " overloaded with %u messages and queue time of:"\r
-                       "%" PRIu64 "[msec]\n",\r
-                       num_messages, last_dispatched_msg_queue_time_msec);\r
-\r
-               /* send a busy response */\r
-               /* osm_sa_send_error(p_ctrl->p_resp, p_madw, IB_RESOURCE_BUSY); */\r
-\r
-               /* return the request to the pool */\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-               goto Exit;\r
-       }\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_sa_mad->attr_id) {\r
-       case IB_MAD_ATTR_CLASS_PORT_INFO:\r
-               msg_id = OSM_MSG_MAD_CLASS_PORT_INFO;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_NODE_RECORD:\r
-               msg_id = OSM_MSG_MAD_NODE_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_PORTINFO_RECORD:\r
-               msg_id = OSM_MSG_MAD_PORTINFO_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_LINK_RECORD:\r
-               msg_id = OSM_MSG_MAD_LINK_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_SMINFO_RECORD:\r
-               msg_id = OSM_MSG_MAD_SMINFO_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_SERVICE_RECORD:\r
-               msg_id = OSM_MSG_MAD_SERVICE_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_PATH_RECORD:\r
-               msg_id = OSM_MSG_MAD_PATH_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_MCMEMBER_RECORD:\r
-               msg_id = OSM_MSG_MAD_MCMEMBER_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_INFORM_INFO:\r
-               msg_id = OSM_MSG_MAD_INFORM_INFO;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_VLARB_RECORD:\r
-               msg_id = OSM_MSG_MAD_VL_ARB_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_SLVL_RECORD:\r
-               msg_id = OSM_MSG_MAD_SLVL_TBL_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_PKEY_TBL_RECORD:\r
-               msg_id = OSM_MSG_MAD_PKEY_TBL_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_LFT_RECORD:\r
-               msg_id = OSM_MSG_MAD_LFT_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_GUIDINFO_RECORD:\r
-               msg_id = OSM_MSG_MAD_GUIDINFO_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_INFORM_INFO_RECORD:\r
-               msg_id = OSM_MSG_MAD_INFORM_INFO_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_SWITCH_INFO_RECORD:\r
-               msg_id = OSM_MSG_MAD_SWITCH_INFO_RECORD;\r
-               break;\r
-\r
-       case IB_MAD_ATTR_MFT_RECORD:\r
-               msg_id = OSM_MSG_MAD_MFT_RECORD;\r
-               break;\r
-\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       case IB_MAD_ATTR_MULTIPATH_RECORD:\r
-               msg_id = OSM_MSG_MAD_MULTIPATH_RECORD;\r
-               break;\r
-#endif\r
-\r
-       default:\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A01: "\r
-                       "Unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_sa_mad->attr_id));\r
-               osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_ERROR);\r
-       }\r
-\r
-       if (msg_id != CL_DISP_MSGID_NONE) {\r
-               /*\r
-                  Post this MAD to the dispatcher for asynchronous\r
-                  processing by the appropriate controller.\r
-                */\r
-\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-                       "Posting Dispatcher message %s\n",\r
-                       osm_get_disp_msg_str(msg_id));\r
-\r
-               status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,\r
-                                     sa_mad_ctrl_disp_done_callback, p_ctrl);\r
-\r
-               if (status != CL_SUCCESS) {\r
-                       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A02: "\r
-                               "Dispatcher post message failed (%s) for attribute 0x%X (%s)\n",\r
-                               CL_STATUS_MSG(status),\r
-                               cl_ntoh16(p_sa_mad->attr_id),\r
-                               ib_get_sa_attr_str(p_sa_mad->attr_id));\r
-\r
-                       osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               /*\r
-                  There is an unknown MAD attribute type for which there is\r
-                  no recipient.  Simply retire the MAD here.\r
-                */\r
-               cl_atomic_inc(&p_ctrl->p_stats->sa_mads_rcvd_unknown);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SA/sa_mad_ctrl_rcv_callback\r
- * NAME\r
- * sa_mad_ctrl_rcv_callback\r
- *\r
- * DESCRIPTION\r
- * This is the callback from the transport layer for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, IN void *context,\r
-                                    IN osm_madw_t * p_req_madw)\r
-{\r
-       osm_sa_mad_ctrl_t *p_ctrl = context;\r
-       ib_sa_mad_t *p_sa_mad;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       /*\r
-          A MAD was received from the wire, possibly in response to a request.\r
-        */\r
-       cl_atomic_inc(&p_ctrl->p_stats->sa_mads_rcvd);\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-               "%u SA MADs received\n", p_ctrl->p_stats->sa_mads_rcvd);\r
-\r
-       /*\r
-        * C15-0.1.3 requires not responding to any MAD if the SM is\r
-        * not in active state!\r
-        * We will not respond if the sm_state is not MASTER, or if the\r
-        * first_time_master_sweep flag (of the subnet) is TRUE - this\r
-        * flag indicates that the master still didn't finish its first\r
-        * sweep, so the subnet is not up and stable yet.\r
-        */\r
-       if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER) {\r
-               cl_atomic_inc(&p_ctrl->p_stats->sa_mads_ignored);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,\r
-                       "Received SA MAD while SM not MASTER. MAD ignored\n");\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-       if (p_ctrl->p_subn->first_time_master_sweep == TRUE) {\r
-               cl_atomic_inc(&p_ctrl->p_stats->sa_mads_ignored);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,\r
-                       "Received SA MAD while SM in first sweep. MAD ignored\n");\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_FRAMES))\r
-               osm_dump_sa_mad(p_ctrl->p_log, p_sa_mad, OSM_LOG_FRAMES);\r
-\r
-       /*\r
-        * C15-0.1.5 - Table 185: SA Header - p884\r
-        * SM_key should be either 0 or match the current SM_Key\r
-        * otherwise discard the MAD.\r
-        */\r
-       if (p_sa_mad->sm_key != 0 &&\r
-           p_sa_mad->sm_key != p_ctrl->p_subn->opt.sa_key) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A04: "\r
-                       "Non-Zero SA MAD SM_Key: 0x%" PRIx64 " != SM_Key: 0x%"\r
-                       PRIx64 "; MAD ignored\n", cl_ntoh64(p_sa_mad->sm_key),\r
-                       cl_ntoh64(p_ctrl->p_subn->opt.sa_key));\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       switch (p_sa_mad->method) {\r
-       case IB_MAD_METHOD_REPORT_RESP:\r
-               /* we do not really do anything with report represses -\r
-                  just retire the transaction */\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-                       "Received Report Repress. Retiring the transaction\n");\r
-\r
-               if (p_req_madw)\r
-                       osm_mad_pool_put(p_ctrl->p_mad_pool, p_req_madw);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-               break;\r
-\r
-       case IB_MAD_METHOD_GET:\r
-       case IB_MAD_METHOD_GETTABLE:\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       case IB_MAD_METHOD_GETMULTI:\r
-#endif\r
-       case IB_MAD_METHOD_SET:\r
-       case IB_MAD_METHOD_DELETE:\r
-               sa_mad_ctrl_process(p_ctrl, p_madw);\r
-               break;\r
-\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->sa_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A05: "\r
-                       "Unsupported method = 0x%X\n", p_sa_mad->method);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SA/sa_mad_ctrl_send_err_callback\r
- * NAME\r
- * sa_mad_ctrl_send_err_callback\r
- *\r
- * DESCRIPTION\r
- * This is the callback from the transport layer for send errors\r
- * on MADs that were expecting a response.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sa_mad_ctrl_send_err_callback(IN void *context,\r
-                                         IN osm_madw_t * p_madw)\r
-{\r
-       osm_sa_mad_ctrl_t *p_ctrl = context;\r
-       cl_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A06: "\r
-               "MAD transaction completed in error\n");\r
-\r
-       /*\r
-          We should never be here since the SA never originates a request.\r
-          Unless we generated a Report(Notice)\r
-        */\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       /*\r
-          An error occurred.  No response was received to a request MAD.\r
-          Retire the original request MAD.\r
-        */\r
-\r
-       osm_dump_sa_mad(p_ctrl->p_log, osm_madw_get_sa_mad_ptr(p_madw),\r
-                       OSM_LOG_ERROR);\r
-\r
-       /*  sm_mad_ctrl_update_wire_stats( p_ctrl ); */\r
-\r
-       if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-                       "Posting Dispatcher message %s\n",\r
-                       osm_get_disp_msg_str(osm_madw_get_err_msg(p_madw)));\r
-\r
-               status = cl_disp_post(p_ctrl->h_disp,\r
-                                     osm_madw_get_err_msg(p_madw), p_madw,\r
-                                     sa_mad_ctrl_disp_done_callback, p_ctrl);\r
-               if (status != CL_SUCCESS) {\r
-                       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A07: "\r
-                               "Dispatcher post message failed (%s)\n",\r
-                               CL_STATUS_MSG(status));\r
-               }\r
-       } else                  /* No error message was provided, just retire the MAD. */\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl)\r
-{\r
-       CL_ASSERT(p_ctrl);\r
-       memset(p_ctrl, 0, sizeof(*p_ctrl));\r
-       p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;\r
-}\r
-\r
-void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * p_ctrl)\r
-{\r
-       CL_ASSERT(p_ctrl);\r
-       cl_disp_unregister(p_ctrl->h_disp);\r
-}\r
-\r
-ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * p_ctrl,\r
-                                    IN osm_sa_t * sa,\r
-                                    IN osm_mad_pool_t * p_mad_pool,\r
-                                    IN osm_vendor_t * p_vendor,\r
-                                    IN osm_subn_t * p_subn,\r
-                                    IN osm_log_t * p_log,\r
-                                    IN osm_stats_t * p_stats,\r
-                                    IN cl_dispatcher_t * p_disp)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       osm_sa_mad_ctrl_construct(p_ctrl);\r
-\r
-       p_ctrl->sa = sa;\r
-       p_ctrl->p_log = p_log;\r
-       p_ctrl->p_disp = p_disp;\r
-       p_ctrl->p_mad_pool = p_mad_pool;\r
-       p_ctrl->p_vendor = p_vendor;\r
-       p_ctrl->p_stats = p_stats;\r
-       p_ctrl->p_subn = p_subn;\r
-\r
-       p_ctrl->h_disp = cl_disp_register(p_disp, CL_DISP_MSGID_NONE, NULL,\r
-                                         p_ctrl);\r
-\r
-       if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 1A08: "\r
-                       "Dispatcher registration failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * p_ctrl,\r
-                                    IN ib_net64_t port_guid)\r
-{\r
-       osm_bind_info_t bind_info;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       if (p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A09: "\r
-                       "Multiple binds not allowed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       bind_info.class_version = 2;\r
-       bind_info.is_responder = TRUE;\r
-       bind_info.is_report_processor = FALSE;\r
-       bind_info.is_trap_processor = FALSE;\r
-       bind_info.mad_class = IB_MCLASS_SUBN_ADM;\r
-       bind_info.port_guid = port_guid;\r
-       bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE;\r
-       bind_info.send_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE;\r
-       bind_info.timeout = p_ctrl->sa->p_subn->opt.transaction_timeout;\r
-       bind_info.retries = p_ctrl->sa->p_subn->opt.transaction_retries;\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,\r
-               "Binding to port GUID 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor, &bind_info,\r
-                                        p_ctrl->p_mad_pool,\r
-                                        sa_mad_ctrl_rcv_callback,\r
-                                        sa_mad_ctrl_send_err_callback, p_ctrl);\r
-\r
-       if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               status = IB_ERROR;\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A10: "\r
-                       "Vendor specific bind failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * p_ctrl)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 1A11: "\r
-                       "No previous bind\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osm_vendor_unbind(p_ctrl->h_bind);\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c b/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c
deleted file mode 100644 (file)
index 6698d6f..0000000
+++ /dev/null
@@ -1,1513 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mcmr_recv_t.\r
- * This object represents the MCMemberRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-#define JOIN_MC_COMP_MASK (IB_MCR_COMPMASK_MGID | \\r
-                               IB_MCR_COMPMASK_PORT_GID | \\r
-                               IB_MCR_COMPMASK_JOIN_STATE)\r
-\r
-#define REQUIRED_MC_CREATE_COMP_MASK (IB_MCR_COMPMASK_MGID | \\r
-                                       IB_MCR_COMPMASK_PORT_GID | \\r
-                                       IB_MCR_COMPMASK_JOIN_STATE | \\r
-                                       IB_MCR_COMPMASK_QKEY | \\r
-                                       IB_MCR_COMPMASK_TCLASS | \\r
-                                       IB_MCR_COMPMASK_PKEY | \\r
-                                       IB_MCR_COMPMASK_FLOW | \\r
-                                       IB_MCR_COMPMASK_SL)\r
-\r
-typedef struct osm_mcmr_item {\r
-       cl_list_item_t list_item;\r
-       ib_member_rec_t rec;\r
-} osm_mcmr_item_t;\r
-\r
-/*********************************************************************\r
- Copy certain fields between two mcmember records\r
- used during the process of join request to copy data from the mgrp\r
- to the port record.\r
-**********************************************************************/\r
-static void copy_from_create_mc_rec(IN ib_member_rec_t * dest,\r
-                                   IN const ib_member_rec_t * src)\r
-{\r
-       dest->qkey = src->qkey;\r
-       dest->mlid = src->mlid;\r
-       dest->tclass = src->tclass;\r
-       dest->pkey = src->pkey;\r
-       dest->sl_flow_hop = src->sl_flow_hop;\r
-       dest->mtu = src->mtu;\r
-       dest->rate = src->rate;\r
-       dest->pkt_life = src->pkt_life;\r
-}\r
-\r
-/*********************************************************************\r
- Return mlid to the pool of free mlids.\r
- But this implementation is not a pool - it simply scans through\r
- the MGRP database for unused mlids...\r
-*********************************************************************/\r
-static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)\r
-{\r
-       UNUSED_PARAM(sa);\r
-       UNUSED_PARAM(mlid);\r
-}\r
-\r
-/*********************************************************************\r
- Get a new unused mlid by scanning all the used ones in the subnet.\r
-**********************************************************************/\r
-/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */\r
-/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */\r
-/* Where Z is the scope, XXXX is the P_Key, and\r
- * YYYYYY is the last 24 bits of the port guid */\r
-#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)\r
-#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)\r
-#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)\r
-#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)\r
-\r
-static int compare_ipv6_snm_mgids(const void *m1, const void *m2)\r
-{\r
-       return memcmp(m1, m2, sizeof(ib_gid_t) - 6);\r
-}\r
-\r
-static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid)\r
-{\r
-       osm_mgrp_t *m = (osm_mgrp_t *)cl_fmap_match(&subn->mgrp_mgid_tbl, mgid,\r
-                                                   compare_ipv6_snm_mgids);\r
-       if (m != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))\r
-               return m->mlid;\r
-       return 0;\r
-}\r
-\r
-static unsigned match_ipv6_snm_mgid(ib_gid_t * mgid)\r
-{\r
-       return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&\r
-               (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE);\r
-}\r
-\r
-static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)\r
-{\r
-       osm_subn_t *p_subn = sa->p_subn;\r
-       ib_net16_t requested_mlid = mcmr->mlid;\r
-       unsigned i, max;\r
-\r
-       if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO\r
-           && cl_ntoh16(requested_mlid) <= p_subn->max_mcast_lid_ho\r
-           && !osm_get_mbox_by_mlid(p_subn, requested_mlid))\r
-               return requested_mlid;\r
-\r
-       if (sa->p_subn->opt.consolidate_ipv6_snm_req\r
-           && match_ipv6_snm_mgid(&mcmr->mgid)\r
-           && (requested_mlid = find_ipv6_snm_mlid(sa->p_subn, &mcmr->mgid))) {\r
-               char str[INET6_ADDRSTRLEN];\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Special Case Solicited Node Mcast Join for MGID %s\n",\r
-                       inet_ntop(AF_INET6, mcmr->mgid.raw, str, sizeof(str)));\r
-               return requested_mlid;\r
-       }\r
-\r
-       max = p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1;\r
-       for (i = 0; i < max; i++)\r
-               if (!sa->p_subn->mboxes[i])\r
-                       return cl_hton16(i + IB_LID_MCAST_START_HO);\r
-\r
-       return 0;\r
-}\r
-\r
-static inline boolean_t check_join_comp_mask(ib_net64_t comp_mask)\r
-{\r
-       return ((comp_mask & JOIN_MC_COMP_MASK) == JOIN_MC_COMP_MASK);\r
-}\r
-\r
-static boolean_t check_create_comp_mask(ib_net64_t comp_mask,\r
-                                       ib_member_rec_t * p_recvd_mcmember_rec)\r
-{\r
-       return ((comp_mask & REQUIRED_MC_CREATE_COMP_MASK) ==\r
-               REQUIRED_MC_CREATE_COMP_MASK);\r
-}\r
-\r
-/**********************************************************************\r
- Generate the response MAD\r
-**********************************************************************/\r
-static void mcmr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,\r
-                            IN ib_member_rec_t * p_mcmember_rec)\r
-{\r
-       cl_qlist_t rec_list;\r
-       osm_mcmr_item_t *item;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       item = malloc(sizeof(*item));\r
-       if (!item) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B16: "\r
-                       "rec_item alloc failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       item->rec = *p_mcmember_rec;\r
-\r
-       /* Fill in the mtu, rate, and packet lifetime selectors */\r
-       item->rec.mtu &= 0x3f;\r
-       item->rec.mtu |= 2 << 6;        /* exactly */\r
-       item->rec.rate &= 0x3f;\r
-       item->rec.rate |= 2 << 6;       /* exactly */\r
-       item->rec.pkt_life &= 0x3f;\r
-       item->rec.pkt_life |= 2 << 6;   /* exactly */\r
-\r
-       cl_qlist_init(&rec_list);\r
-       cl_qlist_insert_tail(&rec_list, &item->list_item);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_member_rec_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/*********************************************************************\r
- In joining an existing group, or when querying the mc groups,\r
- we make sure the following components provided match: MTU and RATE\r
- HACK: Currently we ignore the PKT_LIFETIME field.\r
-**********************************************************************/\r
-static boolean_t validate_more_comp_fields(osm_log_t * p_log,\r
-                                          const osm_mgrp_t * p_mgrp,\r
-                                          const ib_member_rec_t *\r
-                                          p_recvd_mcmember_rec,\r
-                                          ib_net64_t comp_mask)\r
-{\r
-       uint8_t mtu_sel;\r
-       uint8_t mtu_required;\r
-       uint8_t mtu_mgrp;\r
-       uint8_t rate_sel;\r
-       uint8_t rate_required;\r
-       uint8_t rate_mgrp;\r
-\r
-       if (comp_mask & IB_MCR_COMPMASK_MTU_SEL) {\r
-               mtu_sel = (uint8_t) (p_recvd_mcmember_rec->mtu >> 6);\r
-               /* Clearing last 2 bits */\r
-               mtu_required = (uint8_t) (p_recvd_mcmember_rec->mtu & 0x3F);\r
-               mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F);\r
-               switch (mtu_sel) {\r
-               case 0: /* Greater than MTU specified */\r
-                       if (mtu_mgrp <= mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has MTU %x, "\r
-                                       "which is not greater than %x\n",\r
-                                       mtu_mgrp, mtu_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               case 1: /* Less than MTU specified */\r
-                       if (mtu_mgrp >= mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has MTU %x, "\r
-                                       "which is not less than %x\n",\r
-                                       mtu_mgrp, mtu_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               case 2: /* Exactly MTU specified */\r
-                       if (mtu_mgrp != mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has MTU %x, "\r
-                                       "which is not equal to %x\n",\r
-                                       mtu_mgrp, mtu_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-       }\r
-\r
-       /* what about rate ? */\r
-       if (comp_mask & IB_MCR_COMPMASK_RATE_SEL) {\r
-               rate_sel = (uint8_t) (p_recvd_mcmember_rec->rate >> 6);\r
-               /* Clearing last 2 bits */\r
-               rate_required = (uint8_t) (p_recvd_mcmember_rec->rate & 0x3F);\r
-               rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);\r
-               switch (rate_sel) {\r
-               case 0: /* Greater than RATE specified */\r
-                       if (rate_mgrp <= rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has RATE %x, "\r
-                                       "which is not greater than %x\n",\r
-                                       rate_mgrp, rate_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               case 1: /* Less than RATE specified */\r
-                       if (rate_mgrp >= rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has RATE %x, "\r
-                                       "which is not less than %x\n",\r
-                                       rate_mgrp, rate_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               case 2: /* Exactly RATE specified */\r
-                       if (rate_mgrp != rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested mcast group has RATE %x, "\r
-                                       "which is not equal to %x\n",\r
-                                       rate_mgrp, rate_required);\r
-                               return FALSE;\r
-                       }\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-/*********************************************************************\r
- In joining an existing group, we make sure the following components\r
- are physically realizable: MTU and RATE\r
-**********************************************************************/\r
-static boolean_t validate_port_caps(osm_log_t * p_log,\r
-                                   const osm_mgrp_t * p_mgrp,\r
-                                   const osm_physp_t * p_physp)\r
-{\r
-       uint8_t mtu_required;\r
-       uint8_t mtu_mgrp;\r
-       uint8_t rate_required;\r
-       uint8_t rate_mgrp;\r
-\r
-       mtu_required = ib_port_info_get_mtu_cap(&p_physp->port_info);\r
-       mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F);\r
-       if (mtu_required < mtu_mgrp) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "Port's MTU %x is less than %x\n",\r
-                       mtu_required, mtu_mgrp);\r
-               return FALSE;\r
-       }\r
-\r
-       rate_required = ib_port_info_compute_rate(&p_physp->port_info);\r
-       rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);\r
-       if (rate_required < rate_mgrp) {\r
-               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                       "Port's RATE %x is less than %x\n",\r
-                       rate_required, rate_mgrp);\r
-               return FALSE;\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-/**********************************************************************\r
- * o15-0.2.1: If SA supports UD multicast, then if SA receives a SubnAdmSet()\r
- * or SubnAdmDelete() method that would modify an existing\r
- * MCMemberRecord, SA shall not modify that MCMemberRecord and shall\r
- * return an error status of ERR_REQ_INVALID in response in the\r
- * following cases:\r
- * 1. Saved MCMemberRecord.ProxyJoin is not set and the request is\r
- * issued by a requester with a GID other than the Port-GID.\r
- * 2. Saved MCMemberRecord.ProxyJoin is set and the requester is not\r
- * part of the partition for that MCMemberRecord.\r
- **********************************************************************/\r
-static boolean_t validate_modify(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,\r
-                                IN osm_mad_addr_t * p_mad_addr,\r
-                                IN ib_member_rec_t * p_recvd_mcmember_rec,\r
-                                OUT osm_mcm_port_t ** pp_mcm_port)\r
-{\r
-       ib_net64_t portguid;\r
-       ib_gid_t request_gid;\r
-       osm_physp_t *p_request_physp;\r
-       ib_api_status_t res;\r
-\r
-       portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;\r
-\r
-       *pp_mcm_port = osm_mgrp_get_mcm_port(p_mgrp, portguid);\r
-\r
-       /* o15-0.2.1: If this is a new port being added - nothing to check */\r
-       if (!*pp_mcm_port) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "This is a new port in the MC group\n");\r
-               return TRUE;\r
-       }\r
-\r
-       /* We validate the request according the the proxy_join.\r
-          Check if the proxy_join is set or not */\r
-       if ((*pp_mcm_port)->proxy_join == FALSE) {\r
-               /* The proxy_join is not set. Modifying can by done only\r
-                  if the requester GID == PortGID */\r
-               res = osm_get_gid_by_mad_addr(sa->p_log, sa->p_subn, p_mad_addr,\r
-                                             &request_gid);\r
-               if (res != IB_SUCCESS) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Could not find port for requested address\n");\r
-                       return FALSE;\r
-               }\r
-\r
-               if (memcmp(&(*pp_mcm_port)->port_gid, &request_gid,\r
-                          sizeof(ib_gid_t))) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "No ProxyJoin but different ports: stored:"\r
-                               "0x%016" PRIx64 " request:0x%016" PRIx64 "\n",\r
-                               cl_ntoh64((*pp_mcm_port)->port_gid.unicast.\r
-                                         interface_id),\r
-                               cl_ntoh64(p_mad_addr->addr_type.gsi.grh_info.\r
-                                         src_gid.unicast.interface_id));\r
-                       return FALSE;\r
-               }\r
-       } else {\r
-               /* The proxy_join is set. Modification allowed only if the\r
-                  requester is part of the partition for this MCMemberRecord */\r
-               p_request_physp = osm_get_physp_by_mad_addr(sa->p_log,\r
-                                                           sa->p_subn,\r
-                                                           p_mad_addr);\r
-               if (p_request_physp == NULL)\r
-                       return FALSE;\r
-\r
-               if (!osm_physp_has_pkey(sa->p_log, p_mgrp->mcmember_rec.pkey,\r
-                                       p_request_physp)) {\r
-                       /* the request port is not part of the partition for this mgrp */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "ProxyJoin but port not in partition. stored:"\r
-                               "0x%016" PRIx64 " request:0x%016" PRIx64 "\n",\r
-                               cl_ntoh64((*pp_mcm_port)->port->guid),\r
-                               cl_ntoh64(p_mad_addr->addr_type.gsi.grh_info.\r
-                                         src_gid.unicast.interface_id));\r
-                       return FALSE;\r
-               }\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-/*\r
- * Check legality of the requested MGID DELETE\r
- * o15-0.1.14 = VALID DELETE:\r
- * To be a valid delete MAD needs to:\r
- * 1 the MADs PortGID and MGID components match the PortGID and\r
- *   MGID of a stored MCMemberRecord;\r
- * 2 the MADs JoinState component contains at least one bit set to 1\r
- *   in the same position as that stored MCMemberRecords JoinState\r
- *   has a bit set to 1,\r
- *   i.e., the logical AND of the two JoinState components\r
- *   is not all zeros;\r
- * 3 the MADs JoinState component does not have some bits set\r
- *   which are not set in the stored MCMemberRecords JoinState component;\r
- * 4 either the stored MCMemberRecord:ProxyJoin is reset (0), and the\r
- *   MADs source is the stored PortGID;\r
- *   OR\r
- *   the stored MCMemberRecord:ProxyJoin is set (1), (see o15-\r
- *   0.1.2:); and the MADs source is a member of the partition indicated\r
- *   by the stored MCMemberRecord:P_Key.\r
- */\r
-static boolean_t validate_delete(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,\r
-                                IN osm_mad_addr_t * p_mad_addr,\r
-                                IN ib_member_rec_t * p_recvd_mcmember_rec,\r
-                                OUT osm_mcm_port_t ** pp_mcm_port)\r
-{\r
-       ib_net64_t portguid;\r
-\r
-       portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;\r
-\r
-       *pp_mcm_port = osm_mgrp_get_mcm_port(p_mgrp, portguid);\r
-\r
-       /* 1 */\r
-       if (!*pp_mcm_port) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Failed to find the port in the MC group\n");\r
-               return FALSE;\r
-       }\r
-\r
-       /* 2 */\r
-       if (!(p_recvd_mcmember_rec->scope_state & 0x0F &\r
-             (*pp_mcm_port)->scope_state)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Could not find any matching bits in the stored "\r
-                       "and requested JoinStates\n");\r
-               return FALSE;\r
-       }\r
-\r
-       /* 3 */\r
-       if (((p_recvd_mcmember_rec->scope_state & 0x0F) |\r
-            (0x0F & (*pp_mcm_port)->scope_state)) !=\r
-           (0x0F & (*pp_mcm_port)->scope_state)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Some bits in the request JoinState (0x%X) are not "\r
-                       "set in the stored port (0x%X)\n",\r
-                       (p_recvd_mcmember_rec->scope_state & 0x0F),\r
-                       (0x0F & (*pp_mcm_port)->scope_state));\r
-               return FALSE;\r
-       }\r
-\r
-       /* 4 */\r
-       /* Validate according the the proxy_join (o15-0.1.2) */\r
-       if (validate_modify(sa, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,\r
-                           pp_mcm_port) == FALSE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "proxy_join validation failure\n");\r
-               return FALSE;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-/*\r
- * Check legality of the requested MGID (note this does not hold for SA\r
- * created MGIDs)\r
- *\r
- * Implementing o15-0.1.5:\r
- * A multicast GID is considered to be invalid if:\r
- * 1. It does not comply with the rules as specified in 4.1.1 "GID Usage and\r
- *    Properties" on page 145:\r
- *\r
- * 14) The multicast GID format is (bytes are comma sep):\r
- *     0xff,<Fl><Sc>,<Si>,<Si>,<P>,<P>,<P>,<P>,<P>,<P>,<P>,<P>,<Id>,<Id>,<Id>,<Id>\r
- *     Fl  4bit = Flags (b)\r
- *     Sc  4bit = Scope (c)\r
- *     Si 16bit = Signature (2)\r
- *     P  64bit = GID Prefix (should be a subnet unique ID - normally Subnet Prefix)\r
- *     Id 32bit = Unique ID in the Subnet (might be MLID or Pkey ?)\r
- *\r
- *  a) 8-bits of 11111111 at the start of the GID identifies this as being a\r
- *     multicast GID.\r
- *  b) Flags is a set of four 1-bit flags: 000T with three flags reserved\r
- *     and defined as zero (0). The T flag is defined as follows:\r
- *     i) T = 0 indicates this is a permanently assigned (i.e. wellknown)\r
- *        multicast GID. See RFC 2373 and RFC 2375 as reference\r
- *        for these permanently assigned GIDs.\r
- *     ii) T = 1 indicates this is a non-permanently assigned (i.e. transient)\r
- *        multicast GID.\r
- *  c) Scope is a 4-bit multicast scope value used to limit the scope of\r
- *     the multicast group. The following table defines scope value and\r
- *     interpretation.\r
- *\r
- *     Multicast Address Scope Values:\r
- *     0x2 Link-local\r
- *     0x5 Site-local\r
- *     0x8 Organization-local\r
- *     0xE Global\r
- *\r
- * 2. It contains the SA-specific signature of 0xA01B and has the link-local\r
- *    scope bits set. (EZ: the idea here is that SA created MGIDs are the\r
- *    only source for this signature with link-local scope)\r
- */\r
-static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,\r
-                                              IN const ib_member_rec_t *\r
-                                              p_mcm_rec)\r
-{\r
-       uint16_t signature;\r
-       boolean_t valid = TRUE;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* 14-a: mcast GID must start with 0xFF */\r
-       if (p_mcm_rec->mgid.multicast.header[0] != 0xFF) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B01: "\r
-                       "Wrong MGID Prefix 0x%02X must be 0xFF\n",\r
-                       cl_ntoh16(p_mcm_rec->mgid.multicast.header[0]));\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       /* the MGID signature can mark IPoIB or SA assigned MGIDs */\r
-       memcpy(&signature, &(p_mcm_rec->mgid.multicast.raw_group_id),\r
-              sizeof(signature));\r
-       signature = cl_ntoh16(signature);\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "MGID Signed as 0x%04X\n", signature);\r
-\r
-       /*\r
-        * We skip any checks for MGIDs that follow IPoIB\r
-        * GID structure as defined by the IETF ipoib-link-multicast.\r
-        *\r
-        * For IPv4 over IB, the signature will be "0x401B".\r
-        *\r
-        * |   8    |  4 |  4 |     16 bits     | 16 bits | 48 bits  | 32 bits |\r
-        * +--------+----+----+-----------------+---------+----------+---------+\r
-        * |11111111|0001|scop|<IPoIB signature>|< P_Key >|00.......0|<all 1's>|\r
-        * +--------+----+----+-----------------+---------+----------+---------+\r
-        *\r
-        * For IPv6 over IB, the signature will be "0x601B".\r
-        *\r
-        * |   8    |  4 |  4 |     16 bits     | 16 bits |       80 bits      |\r
-        * +--------+----+----+-----------------+---------+--------------------+\r
-        * |11111111|0001|scop|<IPoIB signature>|< P_Key >|000.............0001|\r
-        * +--------+----+----+-----------------+---------+--------------------+\r
-        *\r
-        */\r
-       if (signature == 0x401B || signature == 0x601B) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Skipping MGID Validation for IPoIB Signed (0x%04X) MGIDs\n",\r
-                       signature);\r
-               goto Exit;\r
-       }\r
-\r
-       /* 14-b: the 3 upper bits in the "flags" should be zero: */\r
-       if (p_mcm_rec->mgid.multicast.header[1] & 0xE0) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B28: "\r
-                       "MGID uses Reserved Flags: flags=0x%X\n",\r
-                       (p_mcm_rec->mgid.multicast.header[1] & 0xE0) >> 4);\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       /* 2 - now what if the link local format 0xA01B is used -\r
-          the scope should not be link local */\r
-       if (signature == 0xA01B &&\r
-           (p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==\r
-           IB_MC_SCOPE_LINK_LOCAL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B24: "\r
-                       "MGID uses 0xA01B signature but with link-local scope\n");\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * For SA assigned MGIDs (signature 0xA01B):\r
-        * There is no real way to make sure the Unique MGID Prefix is really unique.\r
-        * If we could enforce using the Subnet Prefix for that purpose it would\r
-        * have been nice. But the spec does not require it.\r
-        */\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return valid;\r
-}\r
-\r
-/**********************************************************************\r
- Check if the requested new MC group parameters are realizable.\r
- Also set the default MTU and Rate if not provided by the user.\r
-**********************************************************************/\r
-static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,\r
-                                           IN ib_net64_t comp_mask,\r
-                                           IN ib_member_rec_t * p_mcm_rec,\r
-                                           IN const osm_physp_t * p_physp)\r
-{\r
-       uint8_t mtu_sel = 2;    /* exactly */\r
-       uint8_t mtu_required, mtu, port_mtu;\r
-       uint8_t rate_sel = 2;   /* exactly */\r
-       uint8_t rate_required, rate, port_rate;\r
-       osm_log_t *p_log = sa->p_log;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-        * End of o15-0.2.3 specifies:\r
-        * ....\r
-        * The entity may also supply the other components such as HopLimit,\r
-        * MTU, etc. during group creation time. If these components are not\r
-        * provided during group creation time, SA will provide them for the\r
-        * group. The values chosen are vendor-dependent and beyond the scope\r
-        * of the specification.\r
-        *\r
-        * so we might also need to assign RATE/MTU if they are not comp\r
-        * masked in.\r
-        */\r
-\r
-       port_mtu = p_physp ? ib_port_info_get_mtu_cap(&p_physp->port_info) : 0;\r
-       if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||\r
-           !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||\r
-           (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)\r
-               mtu = port_mtu ? port_mtu : sa->p_subn->min_ca_mtu;\r
-       else {\r
-               mtu_required = (uint8_t) (p_mcm_rec->mtu & 0x3F);\r
-               mtu = mtu_required;\r
-               switch (mtu_sel) {\r
-               case 0: /* Greater than MTU specified */\r
-                       if (port_mtu && mtu_required >= port_mtu) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested MTU %x >= the port\'s mtu:%x\n",\r
-                                       mtu_required, port_mtu);\r
-                               return FALSE;\r
-                       }\r
-                       /* we provide the largest MTU possible if we can */\r
-                       if (port_mtu)\r
-                               mtu = port_mtu;\r
-                       else if (mtu_required < sa->p_subn->min_ca_mtu)\r
-                               mtu = sa->p_subn->min_ca_mtu;\r
-                       else\r
-                               mtu++;\r
-                       break;\r
-               case 1: /* Less than MTU specified */\r
-                       /* use the smaller of the two:\r
-                          a. one lower then the required\r
-                          b. the mtu of the requesting port (if exists) */\r
-                       if (port_mtu && mtu_required > port_mtu)\r
-                               mtu = port_mtu;\r
-                       else\r
-                               mtu--;\r
-                       break;\r
-               case 2: /* Exactly MTU specified */\r
-               default:\r
-                       break;\r
-               }\r
-               /* make sure it still be in the range */\r
-               if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) {\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "Calculated MTU %x is out of range\n", mtu);\r
-                       return FALSE;\r
-               }\r
-       }\r
-       p_mcm_rec->mtu = (mtu_sel << 6) | mtu;\r
-\r
-       port_rate =\r
-           p_physp ? ib_port_info_compute_rate(&p_physp->port_info) : 0;\r
-       if (!(comp_mask & IB_MCR_COMPMASK_RATE)\r
-           || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL)\r
-           || (rate_sel = (p_mcm_rec->rate >> 6)) == 3)\r
-               rate = port_rate ? port_rate : sa->p_subn->min_ca_rate;\r
-       else {\r
-               rate_required = (uint8_t) (p_mcm_rec->rate & 0x3F);\r
-               rate = rate_required;\r
-               switch (rate_sel) {\r
-               case 0: /* Greater than RATE specified */\r
-                       if (port_rate && rate_required >= port_rate) {\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "Requested RATE %x >= the port\'s rate:%x\n",\r
-                                       rate_required, port_rate);\r
-                               return FALSE;\r
-                       }\r
-                       /* we provide the largest RATE possible if we can */\r
-                       if (port_rate)\r
-                               rate = port_rate;\r
-                       else if (rate_required < sa->p_subn->min_ca_rate)\r
-                               rate = sa->p_subn->min_ca_rate;\r
-                       else\r
-                               rate++;\r
-                       break;\r
-               case 1: /* Less than RATE specified */\r
-                       /* use the smaller of the two:\r
-                          a. one lower then the required\r
-                          b. the rate of the requesting port (if exists) */\r
-                       if (port_rate && rate_required > port_rate)\r
-                               rate = port_rate;\r
-                       else\r
-                               rate--;\r
-                       break;\r
-               case 2: /* Exactly RATE specified */\r
-               default:\r
-                       break;\r
-               }\r
-               /* make sure it still is in the range */\r
-               if (rate < IB_MIN_RATE || rate > IB_MAX_RATE) {\r
-                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                               "Calculated RATE %x is out of range\n", rate);\r
-                       return FALSE;\r
-               }\r
-       }\r
-       p_mcm_rec->rate = (rate_sel << 6) | rate;\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return TRUE;\r
-}\r
-\r
-static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask,\r
-                              ib_member_rec_t * mcmr)\r
-{\r
-       static uint32_t uniq_count;\r
-       ib_gid_t *mgid = &mcmr->mgid;\r
-       uint8_t scope;\r
-       unsigned i;\r
-\r
-       /* use the given scope state only if requested! */\r
-       if (comp_mask & IB_MCR_COMPMASK_SCOPE)\r
-               ib_member_get_scope_state(mcmr->scope_state, &scope, NULL);\r
-       else\r
-       /* to guarantee no collision with other subnets use local scope! */\r
-               scope = IB_MC_SCOPE_LINK_LOCAL;\r
-\r
-       mgid->raw[0] = 0xff;\r
-       mgid->raw[1] = 0x10 | scope;\r
-       mgid->raw[2] = 0xa0;\r
-       mgid->raw[3] = 0x1b;\r
-\r
-       /* HACK: use the SA port gid to make it globally unique */\r
-       memcpy(&mgid->raw[4], &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));\r
-\r
-       for (i = 0; i < 1000; i++) {\r
-               memcpy(&mgid->raw[10], &uniq_count, 4);\r
-               uniq_count++;\r
-               if (!osm_get_mgrp_by_mgid(sa->p_subn, mgid))\r
-                       return 1;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-/**********************************************************************\r
- Call this function to create a new mgrp.\r
-**********************************************************************/\r
-static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,\r
-                                               IN ib_net64_t comp_mask,\r
-                                               IN const ib_member_rec_t *\r
-                                               p_recvd_mcmember_rec,\r
-                                               IN const osm_physp_t * p_physp,\r
-                                               OUT osm_mgrp_t ** pp_mgrp)\r
-{\r
-       ib_net16_t mlid;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec;        /* copy for modifications */\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* we need to create the new MGID if it was not defined */\r
-       if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) {\r
-               /* create a new MGID */\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-\r
-               if (!build_new_mgid(sa, comp_mask, &mcm_rec)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B23: "\r
-                               "cannot allocate unique MGID value\n");\r
-                       status = IB_SA_MAD_STATUS_NO_RESOURCES;\r
-                       goto Exit;\r
-               }\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Allocated new MGID:%s\n",\r
-                       inet_ntop(AF_INET6, mcm_rec.mgid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-       } else if (!validate_requested_mgid(sa, &mcm_rec)) {\r
-               /* a specific MGID was requested so validate the resulting MGID */\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B22: "\r
-                       "Invalid requested MGID\n");\r
-               status = IB_SA_MAD_STATUS_REQ_INVALID;\r
-               goto Exit;\r
-       }\r
-\r
-       /* check the requested parameters are realizable */\r
-       if (mgrp_request_is_realizable(sa, comp_mask, &mcm_rec, p_physp) ==\r
-           FALSE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B26: "\r
-                       "Requested MGRP parameters are not realizable\n");\r
-               status = IB_SA_MAD_STATUS_REQ_INVALID;\r
-               goto Exit;\r
-       }\r
-\r
-       mlid = get_new_mlid(sa, &mcm_rec);\r
-       if (mlid == 0) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: "\r
-                       "get_new_mlid failed request mlid 0x%04x\n",\r
-                       cl_ntoh16(mcm_rec.mlid));\r
-               status = IB_SA_MAD_STATUS_NO_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n",\r
-               cl_ntoh16(mlid));\r
-\r
-       mcm_rec.mlid = mlid;\r
-       /* create a new MC Group */\r
-       *pp_mgrp = osm_mgrp_new(sa->p_subn, mlid, &mcm_rec);\r
-       if (*pp_mgrp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B08: "\r
-                       "osm_mgrp_new failed\n");\r
-               free_mlid(sa, mlid);\r
-               status = IB_SA_MAD_STATUS_NO_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       /* the mcmember_record should have mtu_sel, rate_sel, and pkt_lifetime_sel = 2 */\r
-       (*pp_mgrp)->mcmember_rec.mtu &= 0x3f;\r
-       (*pp_mgrp)->mcmember_rec.mtu |= 2 << 6; /* exactly */\r
-       (*pp_mgrp)->mcmember_rec.rate &= 0x3f;\r
-       (*pp_mgrp)->mcmember_rec.rate |= 2 << 6;        /* exactly */\r
-       (*pp_mgrp)->mcmember_rec.pkt_life &= 0x3f;\r
-       (*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6;    /* exactly */\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Call this function to find or create a new mgrp.\r
-**********************************************************************/\r
-ib_api_status_t osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,\r
-                                                    IN ib_net64_t comp_mask,\r
-                                                    IN ib_member_rec_t *\r
-                                                    p_recvd_mcmember_rec,\r
-                                                    OUT osm_mgrp_t ** pp_mgrp)\r
-{\r
-       osm_mgrp_t *mgrp;\r
-\r
-       if ((mgrp = osm_get_mgrp_by_mgid(sa->p_subn,\r
-                                        &p_recvd_mcmember_rec->mgid))) {\r
-               *pp_mgrp = mgrp;\r
-               return IB_SUCCESS;\r
-       }\r
-       return mcmr_rcv_create_new_mgrp(sa, comp_mask, p_recvd_mcmember_rec,\r
-                                       NULL, pp_mgrp);\r
-}\r
-\r
-/*********************************************************************\r
-Process a request for leaving the group\r
-**********************************************************************/\r
-static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       osm_mgrp_t *p_mgrp;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_member_rec_t *p_recvd_mcmember_rec;\r
-       ib_member_rec_t mcmember_rec;\r
-       ib_net64_t portguid;\r
-       osm_mcm_port_t *p_mcm_port;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_mcmember_rec =\r
-           (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       mcmember_rec = *p_recvd_mcmember_rec;\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of record\n");\r
-               osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);\r
-       p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid);\r
-       if (!p_mgrp) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Failed since multicast group %s not present\n",\r
-                       inet_ntop(AF_INET6, p_recvd_mcmember_rec->mgid.raw,\r
-                                 gid_str, sizeof gid_str));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;\r
-\r
-       /* check validity of the delete request o15-0.1.14 */\r
-       if (!validate_delete(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),\r
-                            p_recvd_mcmember_rec, &p_mcm_port)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               char gid_str2[INET6_ADDRSTRLEN];\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B25: "\r
-                       "Received an invalid delete request for "\r
-                       "MGID: %s for PortGID: %s\n",\r
-                       inet_ntop(AF_INET6, p_recvd_mcmember_rec->mgid.raw,\r
-                                 gid_str, sizeof gid_str),\r
-                       inet_ntop(AF_INET6, p_recvd_mcmember_rec->port_gid.raw,\r
-                                 gid_str2, sizeof gid_str2));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* remove port and/or update join state */\r
-       osm_mgrp_remove_port(sa->p_subn, sa->p_log, p_mgrp, p_mcm_port,\r
-                            &mcmember_rec);\r
-       CL_PLOCK_RELEASE(sa->p_lock);\r
-\r
-       mcmr_rcv_respond(sa, p_madw, &mcmember_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Handle a join (or create) request\r
-**********************************************************************/\r
-static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       osm_mgrp_t *p_mgrp = NULL;\r
-       ib_api_status_t status;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_member_rec_t *p_recvd_mcmember_rec;\r
-       ib_member_rec_t mcmember_rec;\r
-       osm_mcm_port_t *p_mcmr_port;\r
-       ib_net64_t portguid;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_request_physp;\r
-       uint8_t is_new_group;   /* TRUE = there is a need to create a group */\r
-       uint8_t join_state;\r
-       boolean_t proxy;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_mcmember_rec = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;\r
-\r
-       mcmember_rec = *p_recvd_mcmember_rec;\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Dump of incoming record\n");\r
-               osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);\r
-\r
-       /* make sure the requested port guid is known to the SM */\r
-       p_port = osm_get_port_by_guid(sa->p_subn, portguid);\r
-       if (!p_port) {\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Unknown port GUID 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(portguid));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       p_physp = p_port->p_physp;\r
-       /* Check that the p_physp and the requester physp are in the same\r
-          partition. */\r
-       p_request_physp =\r
-           osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                     osm_madw_get_mad_addr_ptr(p_madw));\r
-       if (p_request_physp == NULL) {\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               goto Exit;\r
-       }\r
-\r
-       proxy = (p_physp != p_request_physp);\r
-\r
-       if (proxy && !osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) {\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                       "Port and requester don't share pkey\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       ib_member_get_scope_state(p_recvd_mcmember_rec->scope_state, NULL,\r
-                                 &join_state);\r
-\r
-       /* do we need to create a new group? */\r
-       p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid);\r
-       if (!p_mgrp) {\r
-               /* check for JoinState.FullMember = 1 o15.0.1.9 */\r
-               if ((join_state & 0x01) != 0x01) {\r
-                       char gid_str[INET6_ADDRSTRLEN];\r
-                       CL_PLOCK_RELEASE(sa->p_lock);\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B10: "\r
-                               "Provided Join State != FullMember - "\r
-                               "required for create, "\r
-                               "MGID: %s from port 0x%016" PRIx64 " (%s)\n",\r
-                               inet_ntop(AF_INET6,\r
-                                         p_recvd_mcmember_rec->mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               cl_ntoh64(portguid),\r
-                               p_port->p_node->print_desc);\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* check the comp_mask */\r
-               if (!check_create_comp_mask(p_sa_mad->comp_mask,\r
-                                           p_recvd_mcmember_rec)) {\r
-                       char gid_str[INET6_ADDRSTRLEN];\r
-                       CL_PLOCK_RELEASE(sa->p_lock);\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B11: "\r
-                               "method = %s, scope_state = 0x%x, "\r
-                               "component mask = 0x%016" PRIx64 ", "\r
-                               "expected comp mask = 0x%016" PRIx64 ", "\r
-                               "MGID: %s from port 0x%016" PRIx64 " (%s)\n",\r
-                               ib_get_sa_method_str(p_sa_mad->method),\r
-                               p_recvd_mcmember_rec->scope_state,\r
-                               cl_ntoh64(p_sa_mad->comp_mask),\r
-                               CL_NTOH64(REQUIRED_MC_CREATE_COMP_MASK),\r
-                               inet_ntop(AF_INET6,\r
-                                         p_recvd_mcmember_rec->mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               cl_ntoh64(portguid),\r
-                               p_port->p_node->print_desc);\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_INSUF_COMPS);\r
-                       goto Exit;\r
-               }\r
-\r
-               status = mcmr_rcv_create_new_mgrp(sa, p_sa_mad->comp_mask,\r
-                                                 p_recvd_mcmember_rec,\r
-                                                 p_physp, &p_mgrp);\r
-               if (status != IB_SUCCESS) {\r
-                       CL_PLOCK_RELEASE(sa->p_lock);\r
-                       osm_sa_send_error(sa, p_madw, status);\r
-                       goto Exit;\r
-               }\r
-               /* copy the MGID to the result */\r
-               mcmember_rec.mgid = p_mgrp->mcmember_rec.mgid;\r
-               is_new_group = 1;\r
-       } else\r
-               /* no need for a new group */\r
-               is_new_group = 0;\r
-\r
-       CL_ASSERT(p_mgrp);\r
-\r
-       /*\r
-        * o15-0.2.4: If SA supports UD multicast, then SA shall cause an\r
-        * endport to join an existing multicast group if:\r
-        * 1. It receives a SubnAdmSet() method for a MCMemberRecord, and\r
-        *    - WE KNOW THAT ALREADY\r
-        * 2. The MGID is specified and matches an existing multicast\r
-        *    group, and\r
-        *    - WE KNOW THAT ALREADY\r
-        * 3. The MCMemberRecord:JoinState is not all 0s, and\r
-        * 4. PortGID is specified and\r
-        *    - WE KNOW THAT ALREADY (as it matched a real one)\r
-        * 5. All other components match that existing group, either by\r
-        *    being wildcarded or by having values identical to those specified\r
-        *    by the component mask and in use by the group with the exception\r
-        *    of components such as ProxyJoin and Reserved, which are ignored\r
-        *    by SA.\r
-        *\r
-        * We need to check #3 and #5 here:\r
-        */\r
-       if (!validate_more_comp_fields(sa->p_log, p_mgrp, p_recvd_mcmember_rec,\r
-                                      p_sa_mad->comp_mask)\r
-           || !validate_port_caps(sa->p_log, p_mgrp, p_physp)\r
-           || !(join_state != 0)) {\r
-               /* since we might have created the new group we need to cleanup */\r
-               osm_mgrp_cleanup(sa->p_subn, p_mgrp);\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B12: "\r
-                       "validate_more_comp_fields, validate_port_caps, "\r
-                       "or JoinState = 0 failed from port 0x%016" PRIx64\r
-                       " (%s), " "sending IB_SA_MAD_STATUS_REQ_INVALID\n",\r
-                       cl_ntoh64(portguid), p_port->p_node->print_desc);\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * o15-0.2.1 requires validation of the requesting port\r
-        * in the case of modification:\r
-        */\r
-       if (!is_new_group &&\r
-           !validate_modify(sa, p_mgrp, osm_madw_get_mad_addr_ptr(p_madw),\r
-                            p_recvd_mcmember_rec, &p_mcmr_port)) {\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B13: "\r
-                       "validate_modify failed from port 0x%016" PRIx64\r
-                       " (%s), sending IB_SA_MAD_STATUS_REQ_INVALID\n",\r
-                       cl_ntoh64(portguid), p_port->p_node->print_desc);\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* copy qkey mlid tclass pkey sl_flow_hop mtu rate pkt_life sl_flow_hop */\r
-       copy_from_create_mc_rec(&mcmember_rec, &p_mgrp->mcmember_rec);\r
-\r
-       /* create or update existing port (join-state will be updated) */\r
-       p_mcmr_port = osm_mgrp_add_port(sa->p_subn, sa->p_log, p_mgrp, p_port,\r
-                                       &mcmember_rec, proxy);\r
-       if (!p_mcmr_port) {\r
-               /* we fail to add the port so we might need to delete the group */\r
-               osm_mgrp_cleanup(sa->p_subn, p_mgrp);\r
-               CL_PLOCK_RELEASE(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B06: "\r
-                       "osm_mgrp_add_port failed\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);\r
-               goto Exit;\r
-       }\r
-\r
-       /* Release the lock as we don't need it. */\r
-       CL_PLOCK_RELEASE(sa->p_lock);\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);\r
-\r
-       mcmr_rcv_respond(sa, p_madw, &mcmember_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Add a patched multicast group to the results list\r
-**********************************************************************/\r
-static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa,\r
-                                        IN const ib_member_rec_t * p_rcvd_rec,\r
-                                        IN cl_qlist_t * p_list)\r
-{\r
-       osm_mcmr_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B15: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       /* HACK: Untrusted requesters should result with 0 Join\r
-          State, Port Guid, and Proxy */\r
-       p_rec_item->rec = *p_rcvd_rec;\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Match the given mgrp to the requested mcmr\r
-**********************************************************************/\r
-static void mcmr_by_comp_mask(osm_sa_t * sa, const ib_member_rec_t * p_rcvd_rec,\r
-                             ib_net64_t comp_mask, osm_mgrp_t * p_mgrp,\r
-                             const osm_physp_t * p_req_physp,\r
-                             boolean_t trusted_req, cl_qlist_t * list)\r
-{\r
-       /* since we might change scope_state */\r
-       ib_member_rec_t match_rec;\r
-       osm_mcm_port_t *p_mcm_port;\r
-       ib_net64_t portguid = p_rcvd_rec->port_gid.unicast.interface_id;\r
-       /* will be used for group or port info */\r
-       uint8_t scope_state;\r
-       uint8_t scope_state_mask = 0;\r
-       cl_map_item_t *p_item;\r
-       ib_gid_t port_gid;\r
-       boolean_t proxy_join = FALSE;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Checking mlid:0x%X\n", cl_ntoh16(p_mgrp->mlid));\r
-\r
-       /* first try to eliminate the group by MGID, MLID, or P_Key */\r
-       if ((IB_MCR_COMPMASK_MGID & comp_mask) &&\r
-           memcmp(&p_rcvd_rec->mgid, &p_mgrp->mcmember_rec.mgid,\r
-                  sizeof(ib_gid_t)))\r
-               goto Exit;\r
-\r
-       if ((IB_MCR_COMPMASK_MLID & comp_mask) &&\r
-           memcmp(&p_rcvd_rec->mlid, &p_mgrp->mcmember_rec.mlid,\r
-                  sizeof(uint16_t)))\r
-               goto Exit;\r
-\r
-       /* if the requester physical port doesn't have the pkey that is defined\r
-          for the group - exit. */\r
-       if (!osm_physp_has_pkey(sa->p_log, p_mgrp->mcmember_rec.pkey,\r
-                               p_req_physp))\r
-               goto Exit;\r
-\r
-       /* now do the rest of the match */\r
-       if ((IB_MCR_COMPMASK_QKEY & comp_mask) &&\r
-           p_rcvd_rec->qkey != p_mgrp->mcmember_rec.qkey)\r
-               goto Exit;\r
-\r
-       if ((IB_MCR_COMPMASK_PKEY & comp_mask) &&\r
-           p_rcvd_rec->pkey != p_mgrp->mcmember_rec.pkey)\r
-               goto Exit;\r
-\r
-       if ((IB_MCR_COMPMASK_TCLASS & comp_mask) &&\r
-           p_rcvd_rec->tclass != p_mgrp->mcmember_rec.tclass)\r
-               goto Exit;\r
-\r
-       /* check SL, Flow, and Hop limit */\r
-       {\r
-               uint8_t mgrp_sl, query_sl;\r
-               uint32_t mgrp_flow, query_flow;\r
-               uint8_t mgrp_hop, query_hop;\r
-\r
-               ib_member_get_sl_flow_hop(p_rcvd_rec->sl_flow_hop,\r
-                                         &query_sl, &query_flow, &query_hop);\r
-\r
-               ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,\r
-                                         &mgrp_sl, &mgrp_flow, &mgrp_hop);\r
-\r
-               if ((IB_MCR_COMPMASK_SL & comp_mask) && query_sl != mgrp_sl)\r
-                       goto Exit;\r
-\r
-               if ((IB_MCR_COMPMASK_FLOW & comp_mask) &&\r
-                   query_flow != mgrp_flow)\r
-                       goto Exit;\r
-\r
-               if ((IB_MCR_COMPMASK_HOP & comp_mask) && query_hop != mgrp_hop)\r
-                       goto Exit;\r
-       }\r
-\r
-       if ((IB_MCR_COMPMASK_PROXY & comp_mask) &&\r
-           p_rcvd_rec->proxy_join != p_mgrp->mcmember_rec.proxy_join)\r
-               goto Exit;\r
-\r
-       /* need to validate mtu, rate, and pkt_lifetime fields */\r
-       if (validate_more_comp_fields(sa->p_log, p_mgrp, p_rcvd_rec,\r
-                                     comp_mask) == FALSE)\r
-               goto Exit;\r
-\r
-       /* Port specific fields */\r
-       /* so did we get the PortGUID mask */\r
-       if (IB_MCR_COMPMASK_PORT_GID & comp_mask) {\r
-               /* try to find this port */\r
-               p_mcm_port = osm_mgrp_get_mcm_port(p_mgrp, portguid);\r
-               if (!p_mcm_port) /* port not in group */\r
-                       goto Exit;\r
-               scope_state = p_mcm_port->scope_state;\r
-               memcpy(&port_gid, &(p_mcm_port->port_gid), sizeof(ib_gid_t));\r
-               proxy_join = p_mcm_port->proxy_join;\r
-       } else /* point to the group information */\r
-               scope_state = p_mgrp->mcmember_rec.scope_state;\r
-\r
-       if (IB_MCR_COMPMASK_SCOPE & comp_mask)\r
-               scope_state_mask = 0xF0;\r
-\r
-       if (IB_MCR_COMPMASK_JOIN_STATE & comp_mask)\r
-               scope_state_mask = scope_state_mask | 0x0F;\r
-\r
-       /* Many MC records returned */\r
-       if (trusted_req == TRUE && !(IB_MCR_COMPMASK_PORT_GID & comp_mask)) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Trusted req is TRUE and no specific port defined\n");\r
-\r
-               /* return all the ports that match in this MC group */\r
-               p_item = cl_qmap_head(&(p_mgrp->mcm_port_tbl));\r
-               while (p_item != cl_qmap_end(&(p_mgrp->mcm_port_tbl))) {\r
-                       p_mcm_port = (osm_mcm_port_t *) p_item;\r
-\r
-                       if ((scope_state_mask & p_rcvd_rec->scope_state) ==\r
-                           (scope_state_mask & p_mcm_port->scope_state)) {\r
-                               /* add to the list */\r
-                               match_rec = p_mgrp->mcmember_rec;\r
-                               match_rec.scope_state = p_mcm_port->scope_state;\r
-                               memcpy(&match_rec.port_gid,\r
-                                      &p_mcm_port->port_gid, sizeof(ib_gid_t));\r
-                               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                                       "Record of port_gid: %s"\r
-                                       " in multicast_lid: 0x%X is returned\n",\r
-                                       inet_ntop(AF_INET6,\r
-                                                 match_rec.port_gid.raw,\r
-                                                 gid_str, sizeof gid_str),\r
-                                       cl_ntoh16(p_mgrp->mlid));\r
-\r
-                               match_rec.proxy_join =\r
-                                   (uint8_t) (p_mcm_port->proxy_join);\r
-\r
-                               mcmr_rcv_new_mcmr(sa, &match_rec, list);\r
-                       }\r
-                       p_item = cl_qmap_next(p_item);\r
-               }\r
-       } else { /* One MC record returned */\r
-               if ((scope_state_mask & p_rcvd_rec->scope_state) !=\r
-                   (scope_state_mask & scope_state))\r
-                       goto Exit;\r
-\r
-               /* add to the list */\r
-               match_rec = p_mgrp->mcmember_rec;\r
-               match_rec.scope_state = scope_state;\r
-               memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));\r
-               match_rec.proxy_join = (uint8_t) proxy_join;\r
-\r
-               mcmr_rcv_new_mcmr(sa, &match_rec, list);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Handle a query request\r
-**********************************************************************/\r
-static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_member_rec_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_req_physp;\r
-       boolean_t trusted_req;\r
-       osm_mgrp_t *p_mgrp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec = (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-       comp_mask = p_rcvd_mad->comp_mask;\r
-\r
-       /*\r
-          if sm_key is not zero and does not match we never get here\r
-          see main SA receiver\r
-        */\r
-       trusted_req = (p_rcvd_mad->sm_key != 0);\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B04: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       CL_PLOCK_ACQUIRE(sa->p_lock);\r
-\r
-       /* simply go over all MCGs and match */\r
-       for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&sa->p_subn->mgrp_mgid_tbl);\r
-            p_mgrp != (osm_mgrp_t *) cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl);\r
-            p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))\r
-               mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,\r
-                                 p_req_physp, trusted_req, &rec_list);\r
-\r
-       CL_PLOCK_RELEASE(sa->p_lock);\r
-\r
-       /*\r
-          p923 - The PortGID, JoinState and ProxyJoin shall be zero,\r
-          except in the case of a trusted request.\r
-          Note: In the mad controller we check that the SM_Key received on\r
-          the mad is valid. Meaning - is either zero or equal to the local\r
-          sm_key.\r
-        */\r
-\r
-       if (!p_rcvd_mad->sm_key) {\r
-               osm_mcmr_item_t *item;\r
-               for (item = (osm_mcmr_item_t *) cl_qlist_head(&rec_list);\r
-                    item != (osm_mcmr_item_t *) cl_qlist_end(&rec_list);\r
-                    item =\r
-                    (osm_mcmr_item_t *) cl_qlist_next(&item->list_item)) {\r
-                       memset(&item->rec.port_gid, 0, sizeof(ib_gid_t));\r
-                       ib_member_set_join_state(&item->rec, 0);\r
-                       item->rec.proxy_join = 0;\r
-               }\r
-       }\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_member_rec_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_mcmr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_member_rec_t *p_recvd_mcmember_rec;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_mcmember_rec =\r
-           (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD);\r
-\r
-       switch (p_sa_mad->method) {\r
-       case IB_MAD_METHOD_SET:\r
-               if (!check_join_comp_mask(p_sa_mad->comp_mask)) {\r
-                       char gid_str[INET6_ADDRSTRLEN];\r
-                       char gid_str2[INET6_ADDRSTRLEN];\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B18: "\r
-                               "component mask = 0x%016" PRIx64 ", "\r
-                               "expected comp mask = 0x%016" PRIx64 ", "\r
-                               "MGID: %s for PortGID: %s\n",\r
-                               cl_ntoh64(p_sa_mad->comp_mask),\r
-                               CL_NTOH64(JOIN_MC_COMP_MASK),\r
-                               inet_ntop(AF_INET6,\r
-                                         p_recvd_mcmember_rec->mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               inet_ntop(AF_INET6,\r
-                                         p_recvd_mcmember_rec->port_gid.raw,\r
-                                         gid_str2, sizeof gid_str2));\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-\r
-               /*\r
-                * Join or Create Multicast Group\r
-                */\r
-               mcmr_rcv_join_mgrp(sa, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_DELETE:\r
-               if (!check_join_comp_mask(p_sa_mad->comp_mask)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B20: "\r
-                               "component mask = 0x%016" PRIx64 ", "\r
-                               "expected comp mask = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_sa_mad->comp_mask),\r
-                               CL_NTOH64(JOIN_MC_COMP_MASK));\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-\r
-               /*\r
-                * Leave Multicast Group\r
-                */\r
-               mcmr_rcv_leave_mgrp(sa, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_GET:\r
-       case IB_MAD_METHOD_GETTABLE:\r
-               /*\r
-                * Querying a Multicast Group\r
-                */\r
-               mcmr_query_mgrp(sa, p_madw);\r
-               break;\r
-       default:\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B21: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               break;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_mft_record.c b/branches/opensm_3/user/opensm/osm_sa_mft_record.c
deleted file mode 100644 (file)
index a38ee51..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_mftr_rcv_t.\r
- *   This object represents the MulticastForwardingTable Receiver object.\r
- *   This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_mftr_item {\r
-       cl_list_item_t list_item;\r
-       ib_mft_record_t rec;\r
-} osm_mftr_item_t;\r
-\r
-typedef struct osm_mftr_search_ctxt {\r
-       const ib_mft_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_mftr_search_ctxt_t;\r
-\r
-static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa,\r
-                                        IN osm_switch_t * p_sw,\r
-                                        IN cl_qlist_t * p_list,\r
-                                        IN ib_net16_t lid, IN uint16_t block,\r
-                                        IN uint8_t position)\r
-{\r
-       osm_mftr_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint16_t position_block_num;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A02: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New MulticastForwardingTable: sw 0x%016" PRIx64\r
-               "\n\t\t\t\tblock %u position %u lid %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),\r
-               block, position, cl_ntoh16(lid));\r
-\r
-       position_block_num = ((uint16_t) position << 12) |\r
-           (block & IB_MCAST_BLOCK_ID_MASK_HO);\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.position_block_num = cl_hton16(position_block_num);\r
-\r
-       /* copy the mft block */\r
-       osm_switch_get_mft_block(p_sw, block, position, p_rec_item->rec.mft);\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_mftr_search_ctxt_t *p_ctxt = cxt;\r
-       osm_switch_t *p_sw = (osm_switch_t *) p_map_item;\r
-       const ib_mft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       osm_sa_t *sa = p_ctxt->sa;\r
-       ib_net64_t const comp_mask = p_ctxt->comp_mask;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       osm_port_t *p_port;\r
-       uint16_t min_lid_ho, max_lid_ho;\r
-       uint16_t position_block_num_ho;\r
-       uint16_t min_block, max_block, block;\r
-       const osm_physp_t *p_physp;\r
-       uint8_t min_position, max_position, position;\r
-\r
-       /* In switches, the port guid is the node guid. */\r
-       p_port =\r
-           osm_get_port_by_guid(sa->p_subn, p_sw->p_node->node_info.port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A05: "\r
-                       "Failed to find Port by Node Guid:0x%016" PRIx64\r
-                       "\n", cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               return;\r
-       }\r
-\r
-       /* check that the requester physp and the current physp are under\r
-          the same partition. */\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A06: "\r
-                       "Failed to find default physical Port by Node Guid:0x%016"\r
-                       PRIx64 "\n",\r
-                       cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               return;\r
-       }\r
-       if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))\r
-               return;\r
-\r
-       /* get the port 0 of the switch */\r
-       osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-       /* compare the lids - if required */\r
-       if (comp_mask & IB_MFTR_COMPMASK_LID) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Comparing lid:%u to port lid range: %u .. %u\n",\r
-                       cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);\r
-               /* ok we are ready for range check */\r
-               if (min_lid_ho > cl_ntoh16(p_rcvd_rec->lid) ||\r
-                   max_lid_ho < cl_ntoh16(p_rcvd_rec->lid))\r
-                       return;\r
-       }\r
-\r
-       if (!osm_switch_supports_mcast(p_sw))\r
-               return;\r
-\r
-       /* Are there any blocks in use ? */\r
-       if (osm_switch_get_mft_max_block_in_use(p_sw) == -1)\r
-               return;\r
-\r
-       position_block_num_ho = cl_ntoh16(p_rcvd_rec->position_block_num);\r
-\r
-       /* now we need to decide which blocks to output */\r
-       if (comp_mask & IB_MFTR_COMPMASK_BLOCK) {\r
-               max_block = min_block =\r
-                   position_block_num_ho & IB_MCAST_BLOCK_ID_MASK_HO;\r
-               if (max_block > osm_switch_get_mft_max_block_in_use(p_sw))\r
-                       return;\r
-       } else {\r
-               /* use as many blocks as needed */\r
-               min_block = 0;\r
-               max_block = osm_switch_get_mft_max_block_in_use(p_sw);\r
-       }\r
-\r
-       /* need to decide which positions to output */\r
-       if (comp_mask & IB_MFTR_COMPMASK_POSITION) {\r
-               min_position = max_position =\r
-                   (position_block_num_ho & 0xF000) >> 12;\r
-               if (max_position > osm_switch_get_mft_max_position(p_sw))\r
-                       return;\r
-       } else {\r
-               /* use as many positions as needed */\r
-               min_position = 0;\r
-               max_position = osm_switch_get_mft_max_position(p_sw);\r
-       }\r
-\r
-       /* so we can add these one by one ... */\r
-       for (block = min_block; block <= max_block; block++)\r
-               for (position = min_position; position <= max_position;\r
-                    position++)\r
-                       mftr_rcv_new_mftr(sa, p_sw, p_ctxt->p_list,\r
-                                         osm_port_get_base_lid(p_port), block,\r
-                                         position);\r
-}\r
-\r
-void osm_mftr_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_mft_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_mftr_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec = (ib_mft_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_MFT_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A08: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A07: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /* Go over all switches */\r
-       cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, mftr_rcv_by_comp_mask,\r
-                          &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_mft_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_multipath_record.c b/branches/opensm_3/user/opensm/osm_sa_multipath_record.c
deleted file mode 100644 (file)
index 9712bd5..0000000
+++ /dev/null
@@ -1,1482 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Implementation of osm_mpr_rcv_t.\r
- *     This object represents the MultiPath Record Receiver object.\r
- *     This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_qos_policy.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-#define OSM_SA_MPR_MAX_NUM_PATH        127\r
-\r
-typedef struct osm_mpr_item {\r
-       cl_list_item_t list_item;\r
-       ib_path_rec_t path_rec;\r
-       const osm_port_t *p_src_port;\r
-       const osm_port_t *p_dest_port;\r
-       int hops;\r
-} osm_mpr_item_t;\r
-\r
-typedef struct osm_path_parms {\r
-       ib_net16_t pkey;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t sl;\r
-       uint8_t pkt_life;\r
-       boolean_t reversible;\r
-       int hops;\r
-} osm_path_parms_t;\r
-\r
-static boolean_t sa_multipath_rec_is_tavor_port(IN const osm_port_t * p_port)\r
-{\r
-       osm_node_t const *p_node;\r
-       ib_net32_t vend_id;\r
-\r
-       p_node = p_port->p_node;\r
-       vend_id = ib_node_info_get_vendor_id(&p_node->node_info);\r
-\r
-       return ((p_node->node_info.device_id == CL_HTON16(23108)) &&\r
-               ((vend_id == CL_HTON32(OSM_VENDOR_ID_MELLANOX)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_TOPSPIN)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_SILVERSTORM)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));\r
-}\r
-\r
-static boolean_t\r
-sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,\r
-                                      IN const osm_port_t * p_src_port,\r
-                                      IN const osm_port_t * p_dest_port,\r
-                                      IN const ib_net64_t comp_mask)\r
-{\r
-       uint8_t required_mtu;\r
-\r
-       /* only if at least one of the ports is a Tavor device */\r
-       if (!sa_multipath_rec_is_tavor_port(p_src_port) &&\r
-           !sa_multipath_rec_is_tavor_port(p_dest_port))\r
-               return FALSE;\r
-\r
-       /*\r
-          we can apply the patch if either:\r
-          1. No MTU required\r
-          2. Required MTU <\r
-          3. Required MTU = 1K or 512 or 256\r
-          4. Required MTU > 256 or 512\r
-        */\r
-       required_mtu = ib_multipath_rec_mtu(p_mpr);\r
-       if ((comp_mask & IB_MPR_COMPMASK_MTUSELEC) &&\r
-           (comp_mask & IB_MPR_COMPMASK_MTU)) {\r
-               switch (ib_multipath_rec_mtu_sel(p_mpr)) {\r
-               case 0: /* must be greater than */\r
-               case 2: /* exact match */\r
-                       if (IB_MTU_LEN_1024 < required_mtu)\r
-                               return FALSE;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* the ULP intentionally requested */\r
-                       /* the largest MTU possible */\r
-                       return FALSE;\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_multipath_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,\r
-                                             IN const ib_multipath_rec_t *\r
-                                             p_mpr,\r
-                                             IN const osm_port_t * p_src_port,\r
-                                             IN const osm_port_t * p_dest_port,\r
-                                             IN const uint16_t dest_lid_ho,\r
-                                             IN const ib_net64_t comp_mask,\r
-                                             OUT osm_path_parms_t * p_parms)\r
-{\r
-       const osm_node_t *p_node;\r
-       const osm_physp_t *p_physp;\r
-       const osm_physp_t *p_src_physp;\r
-       const osm_physp_t *p_dest_physp;\r
-       const osm_prtn_t *p_prtn = NULL;\r
-       const ib_port_info_t *p_pi;\r
-       ib_slvl_table_t *p_slvl_tbl;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t pkt_life;\r
-       uint8_t required_mtu;\r
-       uint8_t required_rate;\r
-       ib_net16_t required_pkey;\r
-       uint8_t required_sl;\r
-       uint8_t required_pkt_life;\r
-       ib_net16_t dest_lid;\r
-       int hops = 0;\r
-       int in_port_num = 0;\r
-       uint8_t i;\r
-       osm_qos_level_t *p_qos_level = NULL;\r
-       uint16_t valid_sl_mask = 0xffff;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       dest_lid = cl_hton16(dest_lid_ho);\r
-\r
-       p_dest_physp = p_dest_port->p_physp;\r
-       p_physp = p_src_port->p_physp;\r
-       p_src_physp = p_physp;\r
-       p_pi = &p_physp->port_info;\r
-\r
-       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-       /*\r
-          Mellanox Tavor device performance is better using 1K MTU.\r
-          If required MTU and MTU selector are such that 1K is OK\r
-          and at least one end of the path is Tavor we override the\r
-          port MTU with 1K.\r
-        */\r
-       if (sa->p_subn->opt.enable_quirks &&\r
-           sa_multipath_rec_apply_tavor_mtu_limit(p_mpr, p_src_port,\r
-                                                  p_dest_port, comp_mask))\r
-               if (mtu > IB_MTU_LEN_1024) {\r
-                       mtu = IB_MTU_LEN_1024;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Optimized Path MTU to 1K for Mellanox Tavor device\n");\r
-               }\r
-\r
-       /*\r
-          Walk the subnet object from source to destination,\r
-          tracking the most restrictive rate and mtu values along the way...\r
-\r
-          If source port node is a switch, then p_physp should\r
-          point to the port that routes the destination lid\r
-        */\r
-\r
-       p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-       if (p_node->sw) {\r
-               /*\r
-                * Source node is a switch.\r
-                * Make sure that p_physp points to the out port of the\r
-                * switch that routes to the destination lid (dest_lid_ho)\r
-                */\r
-               p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4514: "\r
-                               "Can't find routing to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (sa->p_subn->opt.qos) {\r
-\r
-               /*\r
-                * Whether this node is switch or CA, the IN port for\r
-                * the sl2vl table is 0, because this is a source node.\r
-                */\r
-               p_slvl_tbl = osm_physp_get_slvl_tbl(p_physp, 0);\r
-\r
-               /* update valid SLs that still exist on this route */\r
-               for (i = 0; i < IB_MAX_NUM_VLS; i++) {\r
-                       if (valid_sl_mask & (1 << i) &&\r
-                           ib_slvl_table_get(p_slvl_tbl, i) == IB_DROP_VL)\r
-                               valid_sl_mask &= ~(1 << i);\r
-               }\r
-               if (!valid_sl_mask) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "All the SLs lead to VL15 on this path\n");\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Same as above\r
-        */\r
-       p_node = osm_physp_get_node_ptr(p_dest_physp);\r
-\r
-       if (p_node->sw) {\r
-               /*\r
-                * if destination is switch, we want p_dest_physp to point to port 0\r
-                */\r
-               p_dest_physp =\r
-                   osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-\r
-               if (p_dest_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4515: "\r
-                               "Can't find routing to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       }\r
-\r
-       /*\r
-        * Now go through the path step by step\r
-        */\r
-\r
-       while (p_physp != p_dest_physp) {\r
-\r
-               p_node = osm_physp_get_node_ptr(p_physp);\r
-               p_physp = osm_physp_get_remote(p_physp);\r
-\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4505: "\r
-                               "Can't find remote phys port when routing to LID %u from node GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               hops++;\r
-               in_port_num = osm_physp_get_port_num(p_physp);\r
-\r
-               /*\r
-                  This is point to point case (no switch in between)\r
-                */\r
-               if (p_physp == p_dest_physp)\r
-                       break;\r
-\r
-               p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-               if (!p_node->sw) {\r
-                       /*\r
-                          There is some sort of problem in the subnet object!\r
-                          If this isn't a switch, we should have reached\r
-                          the destination by now!\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4503: "\r
-                               "Internal error, bad path\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               /*\r
-                  Check parameters for the ingress port in this switch.\r
-                */\r
-               p_pi = &p_physp->port_info;\r
-\r
-               if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-                       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-               if (rate > ib_port_info_compute_rate(p_pi))\r
-                       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-               /*\r
-                  Continue with the egress port on this switch.\r
-                */\r
-               p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4516: "\r
-                               "Dead end on path to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               p_pi = &p_physp->port_info;\r
-\r
-               if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-                       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-               if (rate > ib_port_info_compute_rate(p_pi))\r
-                       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-               if (sa->p_subn->opt.qos) {\r
-                       /*\r
-                        * Check SL2VL table of the switch and update valid SLs\r
-                        */\r
-                       p_slvl_tbl =\r
-                           osm_physp_get_slvl_tbl(p_physp, in_port_num);\r
-                       for (i = 0; i < IB_MAX_NUM_VLS; i++) {\r
-                               if (valid_sl_mask & (1 << i) &&\r
-                                   ib_slvl_table_get(p_slvl_tbl,\r
-                                                     i) == IB_DROP_VL)\r
-                                       valid_sl_mask &= ~(1 << i);\r
-                       }\r
-                       if (!valid_sl_mask) {\r
-                               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                                       "All the SLs lead to VL15 "\r
-                                       "on this path\n");\r
-                               status = IB_NOT_FOUND;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-          p_physp now points to the destination\r
-        */\r
-       p_pi = &p_physp->port_info;\r
-\r
-       if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-               mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-       if (rate > ib_port_info_compute_rate(p_pi))\r
-               rate = ib_port_info_compute_rate(p_pi);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Path min MTU = %u, min rate = %u\n", mtu, rate);\r
-\r
-       /*\r
-        * Get QoS Level object according to the MultiPath request\r
-        * and adjust MultiPath parameters according to QoS settings\r
-        */\r
-       if (sa->p_subn->opt.qos && sa->p_subn->p_qos_policy &&\r
-           (p_qos_level =\r
-            osm_qos_policy_get_qos_level_by_mpr(sa->p_subn->p_qos_policy,\r
-                                                p_mpr, p_src_physp,\r
-                                                p_dest_physp, comp_mask))) {\r
-\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "MultiPathRecord request matches QoS Level '%s' (%s)\n",\r
-                       p_qos_level->name,\r
-                       p_qos_level->use ? p_qos_level->use : "no description");\r
-\r
-               if (p_qos_level->mtu_limit_set\r
-                   && (mtu > p_qos_level->mtu_limit))\r
-                       mtu = p_qos_level->mtu_limit;\r
-\r
-               if (p_qos_level->rate_limit_set\r
-                   && (rate > p_qos_level->rate_limit))\r
-                       rate = p_qos_level->rate_limit;\r
-\r
-               if (p_qos_level->sl_set) {\r
-                       required_sl = p_qos_level->sl;\r
-                       if (!(valid_sl_mask & (1 << required_sl))) {\r
-                               status = IB_NOT_FOUND;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-          Determine if these values meet the user criteria\r
-        */\r
-\r
-       /* we silently ignore cases where only the MTU selector is defined */\r
-       if ((comp_mask & IB_MPR_COMPMASK_MTUSELEC) &&\r
-           (comp_mask & IB_MPR_COMPMASK_MTU)) {\r
-               required_mtu = ib_multipath_rec_mtu(p_mpr);\r
-               switch (ib_multipath_rec_mtu_sel(p_mpr)) {\r
-               case 0: /* must be greater than */\r
-                       if (mtu <= required_mtu)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (mtu >= required_mtu) {\r
-                               /* adjust to use the highest mtu\r
-                                  lower then the required one */\r
-                               if (required_mtu > 1)\r
-                                       mtu = required_mtu - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (mtu < required_mtu)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               mtu = required_mtu;\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_multipath_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* we silently ignore cases where only the Rate selector is defined */\r
-       if ((comp_mask & IB_MPR_COMPMASK_RATESELEC) &&\r
-           (comp_mask & IB_MPR_COMPMASK_RATE)) {\r
-               required_rate = ib_multipath_rec_rate(p_mpr);\r
-               switch (ib_multipath_rec_rate_sel(p_mpr)) {\r
-               case 0: /* must be greater than */\r
-                       if (rate <= required_rate)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (rate >= required_rate) {\r
-                               /* adjust the rate to use the highest rate\r
-                                  lower then the required one */\r
-                               if (required_rate > 2)\r
-                                       rate = required_rate - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (rate < required_rate)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               rate = required_rate;\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_multipath_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Verify the pkt_life_time */\r
-       /* According to spec definition IBA 1.2 Table 205 PacketLifeTime description,\r
-          for loopback paths, packetLifeTime shall be zero. */\r
-       if (p_src_port == p_dest_port)\r
-               pkt_life = 0;   /* loopback */\r
-       else if (p_qos_level && p_qos_level->pkt_life_set)\r
-               pkt_life = p_qos_level->pkt_life;\r
-       else\r
-               pkt_life = sa->p_subn->opt.subnet_timeout;\r
-\r
-       /* we silently ignore cases where only the PktLife selector is defined */\r
-       if ((comp_mask & IB_MPR_COMPMASK_PKTLIFETIMESELEC) &&\r
-           (comp_mask & IB_MPR_COMPMASK_PKTLIFETIME)) {\r
-               required_pkt_life = ib_multipath_rec_pkt_life(p_mpr);\r
-               switch (ib_multipath_rec_pkt_life_sel(p_mpr)) {\r
-               case 0: /* must be greater than */\r
-                       if (pkt_life <= required_pkt_life)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (pkt_life >= required_pkt_life) {\r
-                               /* adjust the lifetime to use the highest possible\r
-                                  lower then the required one */\r
-                               if (required_pkt_life > 1)\r
-                                       pkt_life = required_pkt_life - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (pkt_life < required_pkt_life)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               pkt_life = required_pkt_life;\r
-                       break;\r
-\r
-               case 3: /* smallest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_path_rec_pkt_life_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /*\r
-        * set Pkey for this MultiPath record request\r
-        */\r
-\r
-       if (comp_mask & IB_MPR_COMPMASK_RAWTRAFFIC &&\r
-           cl_ntoh32(p_mpr->hop_flow_raw) & (1 << 31))\r
-               required_pkey =\r
-                   osm_physp_find_common_pkey(p_src_physp, p_dest_physp);\r
-\r
-       else if (comp_mask & IB_MPR_COMPMASK_PKEY) {\r
-               /*\r
-                * MPR request has a specific pkey:\r
-                * Check that source and destination share this pkey.\r
-                * If QoS level has pkeys, check that this pkey exists\r
-                * in the QoS level pkeys.\r
-                * MPR returned pkey is the requested pkey.\r
-                */\r
-               required_pkey = p_mpr->pkey;\r
-               if (!osm_physp_share_this_pkey\r
-                   (p_src_physp, p_dest_physp, required_pkey)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4518: "\r
-                               "Ports do not share specified PKey 0x%04x\n"\r
-                               "\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",\r
-                               cl_ntoh16(required_pkey),\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-               if (p_qos_level && p_qos_level->pkey_range_len &&\r
-                   !osm_qos_level_has_pkey(p_qos_level, required_pkey)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451C: "\r
-                               "Ports do not share PKeys defined by QoS level\n");\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       } else if (p_qos_level && p_qos_level->pkey_range_len) {\r
-               /*\r
-                * MPR request doesn't have a specific pkey, but QoS level\r
-                * has pkeys - get shared pkey from QoS level pkeys\r
-                */\r
-               required_pkey = osm_qos_level_get_shared_pkey(p_qos_level,\r
-                                                             p_src_physp,\r
-                                                             p_dest_physp);\r
-               if (!required_pkey) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451D: "\r
-                               "Ports do not share PKeys defined by QoS level\n");\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       } else {\r
-               /*\r
-                * Neither MPR request nor QoS level have pkey.\r
-                * Just get any shared pkey.\r
-                */\r
-               required_pkey =\r
-                   osm_physp_find_common_pkey(p_src_physp, p_dest_physp);\r
-               if (!required_pkey) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4519: "\r
-                               "Ports do not have any shared PKeys\n"\r
-                               "\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (required_pkey) {\r
-               p_prtn =\r
-                   (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,\r
-                                              required_pkey &\r
-                                              cl_ntoh16((uint16_t) ~ 0x8000));\r
-               if (p_prtn ==\r
-                   (osm_prtn_t *) cl_qmap_end(&sa->p_subn->prtn_pkey_tbl))\r
-                       p_prtn = NULL;\r
-       }\r
-\r
-       /*\r
-        * Set MultiPathRecord SL.\r
-        */\r
-\r
-       if (comp_mask & IB_MPR_COMPMASK_SL) {\r
-               /*\r
-                * Specific SL was requested\r
-                */\r
-               required_sl = ib_multipath_rec_sl(p_mpr);\r
-\r
-               if (p_qos_level && p_qos_level->sl_set &&\r
-                   p_qos_level->sl != required_sl) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451E: "\r
-                               "QoS constraints: required MultiPathRecord SL (%u) "\r
-                               "doesn't match QoS policy SL (%u)\n",\r
-                               required_sl, p_qos_level->sl);\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       } else if (p_qos_level && p_qos_level->sl_set) {\r
-               /*\r
-                * No specific SL was requested,\r
-                * but there is an SL in QoS level.\r
-                */\r
-               required_sl = p_qos_level->sl;\r
-\r
-               if (required_pkey && p_prtn && p_prtn->sl != p_qos_level->sl)\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "QoS level SL (%u) overrides partition SL (%u)\n",\r
-                               p_qos_level->sl, p_prtn->sl);\r
-\r
-       } else if (required_pkey) {\r
-               /*\r
-                * No specific SL in request or in QoS level - use partition SL\r
-                */\r
-               p_prtn =\r
-                   (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,\r
-                                              required_pkey &\r
-                                              cl_ntoh16((uint16_t) ~ 0x8000));\r
-               if (!p_prtn) {\r
-                       required_sl = OSM_DEFAULT_SL;\r
-                       /* this may be possible when pkey tables are created somehow in\r
-                          previous runs or things are going wrong here */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451A: "\r
-                               "No partition found for PKey 0x%04x - using default SL %d\n",\r
-                               cl_ntoh16(required_pkey), required_sl);\r
-               } else\r
-                       required_sl = p_prtn->sl;\r
-\r
-       } else if (sa->p_subn->opt.qos) {\r
-               if (valid_sl_mask & (1 << OSM_DEFAULT_SL))\r
-                       required_sl = OSM_DEFAULT_SL;\r
-               else {\r
-                       for (i = 0; i < IB_MAX_NUM_VLS; i++)\r
-                               if (valid_sl_mask & (1 << i))\r
-                                       break;\r
-                       required_sl = i;\r
-               }\r
-       } else\r
-               required_sl = OSM_DEFAULT_SL;\r
-\r
-       if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << required_sl))) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 451F: "\r
-                       "Selected SL (%u) leads to VL15\n", required_sl);\r
-               status = IB_NOT_FOUND;\r
-               goto Exit;\r
-       }\r
-\r
-       /* reset pkey when raw traffic */\r
-       if (comp_mask & IB_MPR_COMPMASK_RAWTRAFFIC &&\r
-           cl_ntoh32(p_mpr->hop_flow_raw) & (1 << 31))\r
-               required_pkey = 0;\r
-\r
-       p_parms->mtu = mtu;\r
-       p_parms->rate = rate;\r
-       p_parms->pkey = required_pkey;\r
-       p_parms->pkt_life = pkt_life;\r
-       p_parms->sl = required_sl;\r
-       p_parms->hops = hops;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "MultiPath params:"\r
-               " mtu = %u, rate = %u, packet lifetime = %u,"\r
-               " pkey = 0x%04X, sl = %u, hops = %u\n", mtu, rate,\r
-               pkt_life, cl_ntoh16(required_pkey), required_sl, hops);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void mpr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,\r
-                            IN const osm_port_t * p_dest_port,\r
-                            IN uint16_t src_lid_ho, IN uint16_t dest_lid_ho,\r
-                            IN uint8_t preference,\r
-                            IN const osm_path_parms_t * p_parms,\r
-                            OUT ib_path_rec_t * p_pr)\r
-{\r
-       const osm_physp_t *p_src_physp;\r
-       const osm_physp_t *p_dest_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_src_physp = p_src_port->p_physp;\r
-       p_dest_physp = p_dest_port->p_physp;\r
-\r
-       p_pr->dgid.unicast.prefix = osm_physp_get_subnet_prefix(p_dest_physp);\r
-       p_pr->dgid.unicast.interface_id = osm_physp_get_port_guid(p_dest_physp);\r
-\r
-       p_pr->sgid.unicast.prefix = osm_physp_get_subnet_prefix(p_src_physp);\r
-       p_pr->sgid.unicast.interface_id = osm_physp_get_port_guid(p_src_physp);\r
-\r
-       p_pr->dlid = cl_hton16(dest_lid_ho);\r
-       p_pr->slid = cl_hton16(src_lid_ho);\r
-\r
-       p_pr->hop_flow_raw &= cl_hton32(1 << 31);\r
-\r
-       p_pr->pkey = p_parms->pkey;\r
-       ib_path_rec_set_qos_class(p_pr, 0);\r
-       ib_path_rec_set_sl(p_pr, p_parms->sl);\r
-       p_pr->mtu = (uint8_t) (p_parms->mtu | 0x80);\r
-       p_pr->rate = (uint8_t) (p_parms->rate | 0x80);\r
-\r
-       /* According to 1.2 spec definition Table 205 PacketLifeTime description,\r
-          for loopback paths, packetLifeTime shall be zero. */\r
-       if (p_src_port == p_dest_port)\r
-               p_pr->pkt_life = 0x80;  /* loopback */\r
-       else\r
-               p_pr->pkt_life = (uint8_t) (p_parms->pkt_life | 0x80);\r
-\r
-       p_pr->preference = preference;\r
-\r
-       /* always return num_path = 0 so this is only the reversible component */\r
-       if (p_parms->reversible)\r
-               p_pr->num_path = 0x80;\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,\r
-                                                IN const ib_multipath_rec_t *\r
-                                                p_mpr,\r
-                                                IN const osm_port_t *\r
-                                                p_src_port,\r
-                                                IN const osm_port_t *\r
-                                                p_dest_port,\r
-                                                IN const uint16_t src_lid_ho,\r
-                                                IN const uint16_t dest_lid_ho,\r
-                                                IN const ib_net64_t comp_mask,\r
-                                                IN const uint8_t preference)\r
-{\r
-       osm_path_parms_t path_parms;\r
-       osm_path_parms_t rev_path_parms;\r
-       osm_mpr_item_t *p_pr_item;\r
-       ib_api_status_t status, rev_path_status;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID %u, Dest LID %u\n",\r
-               src_lid_ho, dest_lid_ho);\r
-\r
-       p_pr_item = malloc(sizeof(*p_pr_item));\r
-       if (p_pr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4501: "\r
-                       "Unable to allocate path record\n");\r
-               goto Exit;\r
-       }\r
-       memset(p_pr_item, 0, sizeof(*p_pr_item));\r
-\r
-       status = mpr_rcv_get_path_parms(sa, p_mpr, p_src_port, p_dest_port,\r
-                                       dest_lid_ho, comp_mask, &path_parms);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               free(p_pr_item);\r
-               p_pr_item = NULL;\r
-               goto Exit;\r
-       }\r
-\r
-       /* now try the reversible path */\r
-       rev_path_status = mpr_rcv_get_path_parms(sa, p_mpr, p_dest_port,\r
-                                                p_src_port, src_lid_ho,\r
-                                                comp_mask, &rev_path_parms);\r
-       path_parms.reversible = (rev_path_status == IB_SUCCESS);\r
-\r
-       /* did we get a Reversible Path compmask ? */\r
-       /*\r
-          NOTE that if the reversible component = 0, it is a don't care\r
-          rather then requiring non-reversible paths ...\r
-          see Vol1 Ver1.2 p900 l16\r
-        */\r
-       if (comp_mask & IB_MPR_COMPMASK_REVERSIBLE) {\r
-               if ((!path_parms.reversible && (p_mpr->num_path & 0x80))) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Requested reversible path but failed to get one\n");\r
-\r
-                       free(p_pr_item);\r
-                       p_pr_item = NULL;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       p_pr_item->p_src_port = p_src_port;\r
-       p_pr_item->p_dest_port = p_dest_port;\r
-       p_pr_item->hops = path_parms.hops;\r
-\r
-       mpr_rcv_build_pr(sa, p_src_port, p_dest_port, src_lid_ho, dest_lid_ho,\r
-                        preference, &path_parms, &p_pr_item->path_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return p_pr_item;\r
-}\r
-\r
-static uint32_t mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,\r
-                                           IN const ib_multipath_rec_t * p_mpr,\r
-                                           IN const osm_port_t * p_req_port,\r
-                                           IN const osm_port_t * p_src_port,\r
-                                           IN const osm_port_t * p_dest_port,\r
-                                           IN const uint32_t rem_paths,\r
-                                           IN const ib_net64_t comp_mask,\r
-                                           IN cl_qlist_t * p_list)\r
-{\r
-       osm_mpr_item_t *p_pr_item;\r
-       uint16_t src_lid_min_ho;\r
-       uint16_t src_lid_max_ho;\r
-       uint16_t dest_lid_min_ho;\r
-       uint16_t dest_lid_max_ho;\r
-       uint16_t src_lid_ho;\r
-       uint16_t dest_lid_ho;\r
-       uint32_t path_num = 0;\r
-       uint8_t preference;\r
-       unsigned src_offset, dest_offset;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Src port 0x%016" PRIx64 ", Dst port 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(osm_port_get_guid(p_src_port)),\r
-               cl_ntoh64(osm_port_get_guid(p_dest_port)));\r
-\r
-       /* Check that the req_port, src_port and dest_port all share a\r
-          pkey. The check is done on the default physical port of the ports. */\r
-       if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE\r
-           || osm_port_share_pkey(sa->p_log, p_req_port,\r
-                                  p_dest_port) == FALSE\r
-           || osm_port_share_pkey(sa->p_log, p_src_port, p_dest_port) == FALSE)\r
-               /* One of the pairs doesn't share a pkey so the path is disqualified. */\r
-               goto Exit;\r
-\r
-       /*\r
-          We shouldn't be here if the paths are disqualified in some way...\r
-          Thus, we assume every possible connection is valid.\r
-\r
-          We desire to return high-quality paths first.\r
-          In OpenSM, higher quality mean least overlap with other paths.\r
-          This is acheived in practice by returning paths with\r
-          different LID value on each end, which means these\r
-          paths are more redundant that paths with the same LID repeated\r
-          on one side.  For example, in OpenSM the paths between two\r
-          endpoints with LMC = 1 might be as follows:\r
-\r
-          Port A, LID 1 <-> Port B, LID 3\r
-          Port A, LID 1 <-> Port B, LID 4\r
-          Port A, LID 2 <-> Port B, LID 3\r
-          Port A, LID 2 <-> Port B, LID 4\r
-\r
-          The OpenSM unicast routing algorithms attempt to disperse each path\r
-          to as varied a physical path as is reasonable.  1<->3 and 1<->4 have\r
-          more physical overlap (hence less redundancy) than 1<->3 and 2<->4.\r
-\r
-          OpenSM ranks paths in three preference groups:\r
-\r
-          Preference Value           Description\r
-          ----------------           -------------------------------------------\r
-          0                  Redundant in both directions with other\r
-          pref value = 0 paths\r
-\r
-          1                  Redundant in one direction with other\r
-          pref value = 0 and pref value = 1 paths\r
-\r
-          2                  Not redundant in either direction with\r
-          other paths\r
-\r
-          3-FF                       Unused\r
-\r
-          SA clients don't need to know these details, only that the lower\r
-          preference paths are preferred, as stated in the spec.  The paths\r
-          may not actually be physically redundant depending on the topology\r
-          of the subnet, but the point of LMC > 0 is to offer redundancy,\r
-          so I assume the subnet is physically appropriate for the specified\r
-          LMC value.  A more advanced implementation could inspect for physical\r
-          redundancy, but I'm not going to bother with that now.\r
-        */\r
-\r
-       osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho, &src_lid_max_ho);\r
-       osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,\r
-                                 &dest_lid_max_ho);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID [%u-%u], Dest LID [%u-%u]\n",\r
-               src_lid_min_ho, src_lid_max_ho,\r
-               dest_lid_min_ho, dest_lid_max_ho);\r
-\r
-       src_lid_ho = src_lid_min_ho;\r
-       dest_lid_ho = dest_lid_min_ho;\r
-\r
-       /*\r
-          Preferred paths come first in OpenSM\r
-        */\r
-       preference = 0;\r
-\r
-       while (path_num < rem_paths) {\r
-               /*\r
-                  These paths are "fully redundant"\r
-                */\r
-               p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr, p_src_port,\r
-                                                     p_dest_port, src_lid_ho,\r
-                                                     dest_lid_ho, comp_mask,\r
-                                                     preference);\r
-\r
-               if (p_pr_item) {\r
-                       cl_qlist_insert_tail(p_list, &p_pr_item->list_item);\r
-                       ++path_num;\r
-               }\r
-\r
-               if (++src_lid_ho > src_lid_max_ho)\r
-                       break;\r
-\r
-               if (++dest_lid_ho > dest_lid_max_ho)\r
-                       break;\r
-       }\r
-\r
-       /*\r
-          Check if we've accumulated all the paths that the user cares to see\r
-        */\r
-       if (path_num == rem_paths)\r
-               goto Exit;\r
-\r
-       /*\r
-          Don't bother reporting preference 1 paths for now.\r
-          It's more trouble than it's worth and can only occur\r
-          if ports have different LMC values, which isn't supported\r
-          by OpenSM right now anyway.\r
-        */\r
-       preference = 2;\r
-       src_lid_ho = src_lid_min_ho;\r
-       dest_lid_ho = dest_lid_min_ho;\r
-       src_offset = 0;\r
-       dest_offset = 0;\r
-\r
-       /*\r
-          Iterate over the remaining paths\r
-        */\r
-       while (path_num < rem_paths) {\r
-               dest_offset++;\r
-               dest_lid_ho++;\r
-\r
-               if (dest_lid_ho > dest_lid_max_ho) {\r
-                       src_offset++;\r
-                       src_lid_ho++;\r
-\r
-                       if (src_lid_ho > src_lid_max_ho)\r
-                               break;  /* done */\r
-\r
-                       dest_offset = 0;\r
-                       dest_lid_ho = dest_lid_min_ho;\r
-               }\r
-\r
-               /*\r
-                  These paths are "fully non-redundant" with paths already\r
-                  identified above and consequently not of much value.\r
-\r
-                  Don't return paths we already identified above, as indicated\r
-                  by the offset values being equal.\r
-                */\r
-               if (src_offset == dest_offset)\r
-                       continue;       /* already reported */\r
-\r
-               p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr, p_src_port,\r
-                                                     p_dest_port, src_lid_ho,\r
-                                                     dest_lid_ho, comp_mask,\r
-                                                     preference);\r
-\r
-               if (p_pr_item) {\r
-                       cl_qlist_insert_tail(p_list, &p_pr_item->list_item);\r
-                       ++path_num;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return path_num;\r
-}\r
-\r
-#undef min\r
-#define min(x,y)       (((x) < (y)) ? (x) : (y))\r
-\r
-static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,\r
-                                                      IN const\r
-                                                      ib_multipath_rec_t *\r
-                                                      p_mpr,\r
-                                                      IN const osm_port_t *\r
-                                                      p_src_port,\r
-                                                      IN const osm_port_t *\r
-                                                      p_dest_port,\r
-                                                      IN int base_offs,\r
-                                                      IN const ib_net64_t\r
-                                                      comp_mask,\r
-                                                      IN cl_qlist_t * p_list)\r
-{\r
-       osm_mpr_item_t *p_pr_item = 0;\r
-       uint16_t src_lid_min_ho;\r
-       uint16_t src_lid_max_ho;\r
-       uint16_t dest_lid_min_ho;\r
-       uint16_t dest_lid_max_ho;\r
-       uint16_t src_lid_ho;\r
-       uint16_t dest_lid_ho;\r
-       unsigned iterations;\r
-       int src_lids, dest_lids;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src port 0x%016" PRIx64 ", "\r
-               "Dst port 0x%016" PRIx64 ", base offs %d\n",\r
-               cl_ntoh64(osm_port_get_guid(p_src_port)),\r
-               cl_ntoh64(osm_port_get_guid(p_dest_port)), base_offs);\r
-\r
-       osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho, &src_lid_max_ho);\r
-       osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,\r
-                                 &dest_lid_max_ho);\r
-\r
-       src_lid_ho = src_lid_min_ho;\r
-       dest_lid_ho = dest_lid_min_ho;\r
-\r
-       src_lids = src_lid_max_ho - src_lid_min_ho + 1;\r
-       dest_lids = dest_lid_max_ho - dest_lid_min_ho + 1;\r
-\r
-       src_lid_ho += base_offs % src_lids;\r
-       dest_lid_ho += base_offs % dest_lids;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Src LIDs [%u-%u] hashed %u, "\r
-               "Dest LIDs [%u-%u] hashed %u\n",\r
-               src_lid_min_ho, src_lid_max_ho, src_lid_ho,\r
-               dest_lid_min_ho, dest_lid_max_ho, dest_lid_ho);\r
-\r
-       iterations = min(src_lids, dest_lids);\r
-\r
-       while (iterations--) {\r
-               /*\r
-                  These paths are "fully redundant"\r
-                */\r
-               p_pr_item = mpr_rcv_get_lid_pair_path(sa, p_mpr, p_src_port,\r
-                                                     p_dest_port, src_lid_ho,\r
-                                                     dest_lid_ho, comp_mask,\r
-                                                     0);\r
-\r
-               if (p_pr_item) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Found matching path from Src LID %u to Dest LID %u with %d hops\n",\r
-                               src_lid_ho, dest_lid_ho, p_pr_item->hops);\r
-                       break;\r
-               }\r
-\r
-               if (++src_lid_ho > src_lid_max_ho)\r
-                       src_lid_ho = src_lid_min_ho;\r
-\r
-               if (++dest_lid_ho > dest_lid_max_ho)\r
-                       dest_lid_ho = dest_lid_min_ho;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return p_pr_item;\r
-}\r
-\r
-static ib_net16_t mpr_rcv_get_gids(IN osm_sa_t * sa, IN const ib_gid_t * gids,\r
-                                  IN int ngids, IN int is_sgid,\r
-                                  OUT osm_port_t ** pp_port)\r
-{\r
-       osm_port_t *p_port;\r
-       ib_net16_t ib_status = IB_SUCCESS;\r
-       int i;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       for (i = 0; i < ngids; i++, gids++) {\r
-               if (!ib_gid_is_link_local(gids)) {\r
-                       if ((is_sgid && ib_gid_is_multicast(gids)) ||\r
-                           (ib_gid_get_subnet_prefix(gids) !=\r
-                            sa->p_subn->opt.subnet_prefix)) {\r
-                               /*\r
-                                  This 'error' is the client's fault (bad gid)\r
-                                  so don't enter it as an error in our own log.\r
-                                  Return an error response to the client.\r
-                                */\r
-                               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "ERR 451B: "\r
-                                       "%sGID 0x%016" PRIx64\r
-                                       " is multicast or non local subnet prefix\n",\r
-                                       is_sgid ? "S" : "D",\r
-                                       cl_ntoh64(gids->unicast.prefix));\r
-\r
-                               ib_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-\r
-               p_port =\r
-                   osm_get_port_by_guid(sa->p_subn,\r
-                                        gids->unicast.interface_id);\r
-               if (!p_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad gid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4506: "\r
-                               "No port with GUID 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(gids->unicast.interface_id));\r
-\r
-                       ib_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                       goto Exit;\r
-               }\r
-\r
-               pp_port[i] = p_port;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-\r
-       return ib_status;\r
-}\r
-\r
-static ib_net16_t mpr_rcv_get_end_points(IN osm_sa_t * sa,\r
-                                        IN const osm_madw_t * p_madw,\r
-                                        OUT osm_port_t ** pp_ports,\r
-                                        OUT int *nsrc, OUT int *ndest)\r
-{\r
-       const ib_multipath_rec_t *p_mpr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_net64_t comp_mask;\r
-       ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;\r
-       ib_gid_t *gids;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          Determine what fields are valid and then get a pointer\r
-          to the source and destination port objects, if possible.\r
-        */\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_mpr = (ib_multipath_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-       gids = (ib_gid_t *) p_mpr->gids;\r
-\r
-       comp_mask = p_sa_mad->comp_mask;\r
-\r
-       /*\r
-          Check a few easy disqualifying cases up front before getting\r
-          into the endpoints.\r
-        */\r
-       *nsrc = *ndest = 0;\r
-\r
-       if (comp_mask & IB_MPR_COMPMASK_SGIDCOUNT) {\r
-               *nsrc = p_mpr->sgid_count;\r
-               if (*nsrc > IB_MULTIPATH_MAX_GIDS)\r
-                       *nsrc = IB_MULTIPATH_MAX_GIDS;\r
-               sa_status = mpr_rcv_get_gids(sa, gids, *nsrc, 1, pp_ports);\r
-               if (sa_status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_MPR_COMPMASK_DGIDCOUNT) {\r
-               *ndest = p_mpr->dgid_count;\r
-               if (*ndest + *nsrc > IB_MULTIPATH_MAX_GIDS)\r
-                       *ndest = IB_MULTIPATH_MAX_GIDS - *nsrc;\r
-               sa_status =\r
-                   mpr_rcv_get_gids(sa, gids + *nsrc, *ndest, 0,\r
-                                    pp_ports + *nsrc);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return sa_status;\r
-}\r
-\r
-#define hash_lids(a, b, lmc)   \\r
-       (((((a) >> (lmc)) << 4) | ((b) >> (lmc))) % 103)\r
-\r
-static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,\r
-                                 IN const ib_multipath_rec_t * p_mpr,\r
-                                 IN const osm_port_t * p_req_port,\r
-                                 IN osm_port_t ** _pp_ports,\r
-                                 IN const ib_net64_t comp_mask,\r
-                                 IN cl_qlist_t * p_list)\r
-{\r
-       osm_port_t *pp_ports[4];\r
-       osm_mpr_item_t *matrix[2][2];\r
-       int base_offs, src_lid_ho, dest_lid_ho;\r
-       int sumA, sumB, minA, minB;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-        * We want to:\r
-        *    1. use different lid offsets (from base) for the resultant paths\r
-        *    to increase the probability of redundant paths or in case\r
-        *    of Clos - to ensure it (different offset => different spine!)\r
-        *    2. keep consistent paths no matter of direction and order of ports\r
-        *    3. distibute the lid offsets to balance the load\r
-        * So, we sort the ports (within the srcs, and within the dests),\r
-        * hash the lids of S0, D0 (after the sort), and call mpr_rcv_get_apm_port_pair_paths\r
-        * with base_lid for S0, D0 and base_lid + 1 for S1, D1. This way we will get\r
-        * always the same offsets - order independent, and make sure different spines are used.\r
-        * Note that the diagonals on a Clos have the same number of hops, so it doesn't\r
-        * really matter which diagonal we use.\r
-        */\r
-       if (_pp_ports[0]->guid < _pp_ports[1]->guid) {\r
-               pp_ports[0] = _pp_ports[0];\r
-               pp_ports[1] = _pp_ports[1];\r
-       } else {\r
-               pp_ports[0] = _pp_ports[1];\r
-               pp_ports[1] = _pp_ports[0];\r
-       }\r
-       if (_pp_ports[2]->guid < _pp_ports[3]->guid) {\r
-               pp_ports[2] = _pp_ports[2];\r
-               pp_ports[3] = _pp_ports[3];\r
-       } else {\r
-               pp_ports[2] = _pp_ports[3];\r
-               pp_ports[3] = _pp_ports[2];\r
-       }\r
-\r
-       src_lid_ho = osm_port_get_base_lid(pp_ports[0]);\r
-       dest_lid_ho = osm_port_get_base_lid(pp_ports[2]);\r
-\r
-       base_offs = src_lid_ho < dest_lid_ho ?\r
-           hash_lids(src_lid_ho, dest_lid_ho, sa->p_subn->opt.lmc) :\r
-           hash_lids(dest_lid_ho, src_lid_ho, sa->p_subn->opt.lmc);\r
-\r
-       matrix[0][0] =\r
-           mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0], pp_ports[2],\r
-                                           base_offs, comp_mask, p_list);\r
-       matrix[0][1] =\r
-           mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0], pp_ports[3],\r
-                                           base_offs, comp_mask, p_list);\r
-       matrix[1][0] =\r
-           mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1], pp_ports[2],\r
-                                           base_offs + 1, comp_mask, p_list);\r
-       matrix[1][1] =\r
-           mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1], pp_ports[3],\r
-                                           base_offs + 1, comp_mask, p_list);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "APM matrix:\n"\r
-               "\t{0,0} 0x%X->0x%X (%d)\t| {0,1} 0x%X->0x%X (%d)\n"\r
-               "\t{1,0} 0x%X->0x%X (%d)\t| {1,1} 0x%X->0x%X (%d)\n",\r
-               matrix[0][0]->path_rec.slid, matrix[0][0]->path_rec.dlid,\r
-               matrix[0][0]->hops, matrix[0][1]->path_rec.slid,\r
-               matrix[0][1]->path_rec.dlid, matrix[0][1]->hops,\r
-               matrix[1][0]->path_rec.slid, matrix[1][0]->path_rec.dlid,\r
-               matrix[1][0]->hops, matrix[1][1]->path_rec.slid,\r
-               matrix[1][1]->path_rec.dlid, matrix[1][1]->hops);\r
-\r
-       /* check diagonal A {(0,0), (1,1)} */\r
-       sumA = matrix[0][0]->hops + matrix[1][1]->hops;\r
-       minA = min(matrix[0][0]->hops, matrix[1][1]->hops);\r
-\r
-       /* check diagonal B {(0,1), (1,0)} */\r
-       sumB = matrix[0][1]->hops + matrix[1][0]->hops;\r
-       minB = min(matrix[0][1]->hops, matrix[1][0]->hops);\r
-\r
-       /* and the winner is... */\r
-       if (minA <= minB || (minA == minB && sumA < sumB)) {\r
-               /* Diag A */\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Diag {0,0} & {1,1} is the best:\n"\r
-                       "\t{0,0} 0x%X->0x%X (%d)\t & {1,1} 0x%X->0x%X (%d)\n",\r
-                       matrix[0][0]->path_rec.slid,\r
-                       matrix[0][0]->path_rec.dlid, matrix[0][0]->hops,\r
-                       matrix[1][1]->path_rec.slid,\r
-                       matrix[1][1]->path_rec.dlid, matrix[1][1]->hops);\r
-               cl_qlist_insert_tail(p_list, &matrix[0][0]->list_item);\r
-               cl_qlist_insert_tail(p_list, &matrix[1][1]->list_item);\r
-               free(matrix[0][1]);\r
-               free(matrix[1][0]);\r
-       } else {\r
-               /* Diag B */\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Diag {0,1} & {1,0} is the best:\n"\r
-                       "\t{0,1} 0x%X->0x%X (%d)\t & {1,0} 0x%X->0x%X (%d)\n",\r
-                       matrix[0][1]->path_rec.slid,\r
-                       matrix[0][1]->path_rec.dlid, matrix[0][1]->hops,\r
-                       matrix[1][0]->path_rec.slid,\r
-                       matrix[1][0]->path_rec.dlid, matrix[1][0]->hops);\r
-               cl_qlist_insert_tail(p_list, &matrix[0][1]->list_item);\r
-               cl_qlist_insert_tail(p_list, &matrix[1][0]->list_item);\r
-               free(matrix[0][0]);\r
-               free(matrix[1][1]);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void mpr_rcv_process_pairs(IN osm_sa_t * sa,\r
-                                 IN const ib_multipath_rec_t * p_mpr,\r
-                                 IN osm_port_t * p_req_port,\r
-                                 IN osm_port_t ** pp_ports, IN const int nsrc,\r
-                                 IN int ndest, IN ib_net64_t comp_mask,\r
-                                 IN cl_qlist_t * p_list)\r
-{\r
-       osm_port_t **pp_src_port, **pp_es;\r
-       osm_port_t **pp_dest_port, **pp_ed;\r
-       uint32_t max_paths, num_paths, total_paths = 0;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       if (comp_mask & IB_MPR_COMPMASK_NUMBPATH)\r
-               max_paths = p_mpr->num_path & 0x7F;\r
-       else\r
-               max_paths = OSM_SA_MPR_MAX_NUM_PATH;\r
-\r
-       for (pp_src_port = pp_ports, pp_es = pp_ports + nsrc;\r
-            pp_src_port < pp_es; pp_src_port++) {\r
-               for (pp_dest_port = pp_es, pp_ed = pp_es + ndest;\r
-                    pp_dest_port < pp_ed; pp_dest_port++) {\r
-                       num_paths =\r
-                           mpr_rcv_get_port_pair_paths(sa, p_mpr, p_req_port,\r
-                                                       *pp_src_port,\r
-                                                       *pp_dest_port,\r
-                                                       max_paths - total_paths,\r
-                                                       comp_mask, p_list);\r
-                       total_paths += num_paths;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "%d paths %d total paths %d max paths\n",\r
-                               num_paths, total_paths, max_paths);\r
-                       /* Just take first NumbPaths found */\r
-                       if (total_paths >= max_paths)\r
-                               goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_mpr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_multipath_rec_t *p_mpr;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       osm_port_t *requester_port;\r
-       osm_port_t *pp_ports[IB_MULTIPATH_MAX_GIDS];\r
-       cl_qlist_t pr_list;\r
-       ib_net16_t sa_status;\r
-       int nsrc, ndest;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_mpr = (ib_multipath_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD);\r
-\r
-       if ((p_sa_mad->rmpp_flags & IB_RMPP_FLAG_ACTIVE) != IB_RMPP_FLAG_ACTIVE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4510: "\r
-                       "Invalid request since RMPP_FLAG_ACTIVE is not set\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* we only support SubnAdmGetMulti method */\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GETMULTI) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4513: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                                 osm_madw_get_mad_addr_ptr\r
-                                                 (p_madw));\r
-       if (requester_port == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4517: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_multipath_record(sa->p_log, p_mpr, OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&pr_list);\r
-\r
-       /*\r
-          Most SA functions (including this one) are read-only on the\r
-          subnet object, so we grab the lock non-exclusively.\r
-        */\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       sa_status = mpr_rcv_get_end_points(sa, p_madw, pp_ports, &nsrc, &ndest);\r
-\r
-       if (sa_status != IB_SA_MAD_STATUS_SUCCESS || !nsrc || !ndest) {\r
-               if (sa_status == IB_SA_MAD_STATUS_SUCCESS && (!nsrc || !ndest))\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4512: "\r
-                               "mpr_rcv_get_end_points failed, not enough GIDs "\r
-                               "(nsrc %d ndest %d)\n", nsrc, ndest);\r
-               cl_plock_release(sa->p_lock);\r
-               if (sa_status == IB_SA_MAD_STATUS_SUCCESS)\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-               else\r
-                       osm_sa_send_error(sa, p_madw, sa_status);\r
-               goto Exit;\r
-       }\r
-\r
-       /* APM request */\r
-       if (nsrc == 2 && ndest == 2 && (p_mpr->num_path & 0x7F) == 2)\r
-               mpr_rcv_get_apm_paths(sa, p_mpr, requester_port, pp_ports,\r
-                                     p_sa_mad->comp_mask, &pr_list);\r
-       else\r
-               mpr_rcv_process_pairs(sa, p_mpr, requester_port, pp_ports,\r
-                                     nsrc, ndest, p_sa_mad->comp_mask,\r
-                                     &pr_list);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       /* o15-0.2.7: If MultiPath is supported, then SA shall respond to a\r
-          SubnAdmGetMulti() containing a valid MultiPathRecord attribute with\r
-          a set of zero or more PathRecords satisfying the constraints\r
-          indicated in the MultiPathRecord received. The PathRecord Attribute\r
-          ID shall be used in the response.\r
-        */\r
-       p_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_path_rec_t), &pr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-#endif\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_node_record.c b/branches/opensm_3/user/opensm/osm_sa_node_record.c
deleted file mode 100644 (file)
index 8a2f83a..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_nr_rcv_t.\r
- * This object represents the NodeInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_nr_item {\r
-       cl_list_item_t list_item;\r
-       ib_node_record_t rec;\r
-} osm_nr_item_t;\r
-\r
-typedef struct osm_nr_search_ctxt {\r
-       const ib_node_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_nr_search_ctxt_t;\r
-\r
-static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa,\r
-                                    IN const osm_node_t * p_node,\r
-                                    IN cl_qlist_t * p_list,\r
-                                    IN ib_net64_t port_guid, IN ib_net16_t lid)\r
-{\r
-       osm_nr_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1D02: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New NodeRecord: node 0x%016" PRIx64\r
-               "\n\t\t\t\tport 0x%016" PRIx64 ", lid %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-               cl_ntoh64(port_guid), cl_ntoh16(lid));\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-\r
-       p_rec_item->rec.node_info = p_node->node_info;\r
-       p_rec_item->rec.node_info.port_guid = port_guid;\r
-       memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc),\r
-              IB_NODE_DESCRIPTION_SIZE);\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node,\r
-                            IN cl_qlist_t * p_list,\r
-                            IN ib_net64_t const match_port_guid,\r
-                            IN ib_net16_t const match_lid,\r
-                            IN const osm_physp_t * p_req_physp,\r
-                            IN const ib_net64_t comp_mask)\r
-{\r
-       const osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       uint16_t match_lid_ho;\r
-       ib_net16_t base_lid;\r
-       ib_net16_t base_lid_ho;\r
-       ib_net16_t max_lid_ho;\r
-       uint8_t lmc;\r
-       ib_net64_t port_guid;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Looking for NodeRecord with LID: %u GUID:0x%016"\r
-               PRIx64 "\n", cl_ntoh16(match_lid), cl_ntoh64(match_port_guid));\r
-\r
-       /*\r
-          For switches, do not return the NodeInfo record\r
-          for each port on the switch, just for port 0.\r
-        */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)\r
-               num_ports = 1;\r
-       else\r
-               num_ports = osm_node_get_num_physp(p_node);\r
-\r
-       for (port_num = 0; port_num < num_ports; port_num++) {\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               /* Check to see if the found p_physp and the requester physp\r
-                  share a pkey. If not - continue */\r
-               if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))\r
-                       continue;\r
-\r
-               port_guid = osm_physp_get_port_guid(p_physp);\r
-\r
-               if ((comp_mask & IB_NR_COMPMASK_PORTGUID)\r
-                   && (port_guid != match_port_guid))\r
-                       continue;\r
-\r
-               base_lid = osm_physp_get_base_lid(p_physp);\r
-               base_lid_ho = cl_ntoh16(base_lid);\r
-               lmc = osm_physp_get_lmc(p_physp);\r
-               max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);\r
-               match_lid_ho = cl_ntoh16(match_lid);\r
-\r
-               if (comp_mask & IB_NR_COMPMASK_LID) {\r
-                       /*\r
-                          We validate that the lid belongs to this node.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Comparing LID: %u <= %u <= %u\n",\r
-                               base_lid_ho, match_lid_ho, max_lid_ho);\r
-\r
-                       if (match_lid_ho < base_lid_ho\r
-                           || match_lid_ho > max_lid_ho)\r
-                               continue;\r
-               }\r
-\r
-               nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context)\r
-{\r
-       const osm_nr_search_ctxt_t *p_ctxt = context;\r
-       osm_node_t *p_node = (osm_node_t *) p_map_item;\r
-       const ib_node_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       osm_sa_t *sa = p_ctxt->sa;\r
-       ib_net64_t comp_mask = p_ctxt->comp_mask;\r
-       ib_net64_t match_port_guid = 0;\r
-       ib_net16_t match_lid = 0;\r
-\r
-       OSM_LOG_ENTER(p_ctxt->sa->p_log);\r
-\r
-       osm_dump_node_info(p_ctxt->sa->p_log, &p_node->node_info,\r
-                          OSM_LOG_DEBUG);\r
-\r
-       if (comp_mask & IB_NR_COMPMASK_LID)\r
-               match_lid = p_rcvd_rec->lid;\r
-\r
-       if (comp_mask & IB_NR_COMPMASK_NODEGUID) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Looking for node 0x%016" PRIx64\r
-                       ", found 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_rcvd_rec->node_info.node_guid),\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-               if (p_node->node_info.node_guid !=\r
-                   p_rcvd_rec->node_info.node_guid)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_NR_COMPMASK_PORTGUID)\r
-               match_port_guid = p_rcvd_rec->node_info.port_guid;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_SYSIMAGEGUID) &&\r
-           p_node->node_info.sys_guid != p_rcvd_rec->node_info.sys_guid)\r
-                       goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_BASEVERSION) &&\r
-           p_node->node_info.base_version !=\r
-           p_rcvd_rec->node_info.base_version)\r
-                       goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_CLASSVERSION) &&\r
-           p_node->node_info.class_version !=\r
-           p_rcvd_rec->node_info.class_version)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_NODETYPE) &&\r
-           p_node->node_info.node_type != p_rcvd_rec->node_info.node_type)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_NUMPORTS) &&\r
-           p_node->node_info.num_ports != p_rcvd_rec->node_info.num_ports)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_PARTCAP) &&\r
-           p_node->node_info.partition_cap !=\r
-           p_rcvd_rec->node_info.partition_cap)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_DEVID) &&\r
-           p_node->node_info.device_id != p_rcvd_rec->node_info.device_id)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_REV) &&\r
-           p_node->node_info.revision !=\r
-           p_rcvd_rec->node_info.revision)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_PORTNUM)  &&\r
-           ib_node_info_get_local_port_num(&p_node->node_info) !=\r
-           ib_node_info_get_local_port_num(&p_rcvd_rec->node_info))\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_VENDID) &&\r
-           ib_node_info_get_vendor_id(&p_node->node_info) !=\r
-           ib_node_info_get_vendor_id(&p_rcvd_rec->node_info))\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_NR_COMPMASK_NODEDESC) &&\r
-           strncmp((char *)&p_node->node_desc, (char *)&p_rcvd_rec->node_desc,\r
-                   sizeof(ib_node_desc_t)))\r
-               goto Exit;\r
-\r
-       nr_rcv_create_nr(sa, p_node, p_ctxt->p_list, match_port_guid,\r
-                        match_lid, p_req_physp, comp_mask);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
-}\r
-\r
-void osm_nr_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_node_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_nr_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec = (ib_node_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_NODE_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1D05: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1D04: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_node_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, nr_rcv_by_comp_mask,\r
-                          &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_node_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_path_record.c b/branches/opensm_3/user/opensm/osm_sa_path_record.c
deleted file mode 100644 (file)
index 203a191..0000000
+++ /dev/null
@@ -1,1611 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_pr_rcv_t.\r
- * This object represents the PathRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_base.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_qos_policy.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_router.h>\r
-#include <opensm/osm_prefix_route.h>\r
-#include <opensm/osm_ucast_lash.h>\r
-\r
-#define MAX_HOPS 64\r
-\r
-typedef struct osm_pr_item {\r
-       cl_list_item_t list_item;\r
-       ib_path_rec_t path_rec;\r
-} osm_pr_item_t;\r
-\r
-typedef struct osm_path_parms {\r
-       ib_net16_t pkey;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t sl;\r
-       uint8_t pkt_life;\r
-       boolean_t reversible;\r
-} osm_path_parms_t;\r
-\r
-static inline boolean_t sa_path_rec_is_tavor_port(IN const osm_port_t * p_port)\r
-{\r
-       osm_node_t const *p_node;\r
-       ib_net32_t vend_id;\r
-\r
-       p_node = p_port->p_node;\r
-       vend_id = ib_node_info_get_vendor_id(&p_node->node_info);\r
-\r
-       return ((p_node->node_info.device_id == CL_HTON16(23108)) &&\r
-               ((vend_id == CL_HTON32(OSM_VENDOR_ID_MELLANOX)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_TOPSPIN)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_SILVERSTORM)) ||\r
-                (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));\r
-}\r
-\r
-static boolean_t\r
-sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,\r
-                                 IN const osm_port_t * p_src_port,\r
-                                 IN const osm_port_t * p_dest_port,\r
-                                 IN const ib_net64_t comp_mask)\r
-{\r
-       uint8_t required_mtu;\r
-\r
-       /* only if at least one of the ports is a Tavor device */\r
-       if (!sa_path_rec_is_tavor_port(p_src_port) &&\r
-           !sa_path_rec_is_tavor_port(p_dest_port))\r
-               return FALSE;\r
-\r
-       /*\r
-          we can apply the patch if either:\r
-          1. No MTU required\r
-          2. Required MTU <\r
-          3. Required MTU = 1K or 512 or 256\r
-          4. Required MTU > 256 or 512\r
-        */\r
-       required_mtu = ib_path_rec_mtu(p_pr);\r
-       if ((comp_mask & IB_PR_COMPMASK_MTUSELEC) &&\r
-           (comp_mask & IB_PR_COMPMASK_MTU)) {\r
-               switch (ib_path_rec_mtu_sel(p_pr)) {\r
-               case 0: /* must be greater than */\r
-               case 2: /* exact match */\r
-                       if (IB_MTU_LEN_1024 < required_mtu)\r
-                               return FALSE;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* the ULP intentionally requested */\r
-                       /* the largest MTU possible */\r
-                       return FALSE;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_path_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,\r
-                                            IN const ib_path_rec_t * p_pr,\r
-                                            IN const osm_port_t * p_src_port,\r
-                                            IN const osm_port_t * p_dest_port,\r
-                                            IN const uint16_t dest_lid_ho,\r
-                                            IN const ib_net64_t comp_mask,\r
-                                            OUT osm_path_parms_t * p_parms)\r
-{\r
-       const osm_node_t *p_node;\r
-       const osm_physp_t *p_physp;\r
-       const osm_physp_t *p_src_physp;\r
-       const osm_physp_t *p_dest_physp;\r
-       const osm_prtn_t *p_prtn = NULL;\r
-       osm_opensm_t *p_osm;\r
-       const ib_port_info_t *p_pi;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net16_t pkey;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t pkt_life;\r
-       uint8_t required_mtu;\r
-       uint8_t required_rate;\r
-       uint8_t required_pkt_life;\r
-       uint8_t sl;\r
-       uint8_t in_port_num;\r
-       ib_net16_t dest_lid;\r
-       uint8_t i;\r
-       ib_slvl_table_t *p_slvl_tbl = NULL;\r
-       osm_qos_level_t *p_qos_level = NULL;\r
-       uint16_t valid_sl_mask = 0xffff;\r
-       int is_lash;\r
-       int hops = 0;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       dest_lid = cl_hton16(dest_lid_ho);\r
-\r
-       p_dest_physp = p_dest_port->p_physp;\r
-       p_physp = p_src_port->p_physp;\r
-       p_src_physp = p_physp;\r
-       p_pi = &p_physp->port_info;\r
-       p_osm = sa->p_subn->p_osm;\r
-\r
-       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-       /*\r
-          Mellanox Tavor device performance is better using 1K MTU.\r
-          If required MTU and MTU selector are such that 1K is OK\r
-          and at least one end of the path is Tavor we override the\r
-          port MTU with 1K.\r
-        */\r
-       if (sa->p_subn->opt.enable_quirks &&\r
-           sa_path_rec_apply_tavor_mtu_limit(p_pr, p_src_port, p_dest_port,\r
-                                             comp_mask))\r
-               if (mtu > IB_MTU_LEN_1024) {\r
-                       mtu = IB_MTU_LEN_1024;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Optimized Path MTU to 1K for Mellanox Tavor device\n");\r
-               }\r
-\r
-       /*\r
-          Walk the subnet object from source to destination,\r
-          tracking the most restrictive rate and mtu values along the way...\r
-\r
-          If source port node is a switch, then p_physp should\r
-          point to the port that routes the destination lid\r
-        */\r
-\r
-       p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-       if (p_node->sw) {\r
-               /*\r
-                * Source node is a switch.\r
-                * Make sure that p_physp points to the out port of the\r
-                * switch that routes to the destination lid (dest_lid_ho)\r
-                */\r
-               p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F02: "\r
-                               "Cannot find routing to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (sa->p_subn->opt.qos) {\r
-               /*\r
-                * Whether this node is switch or CA, the IN port for\r
-                * the sl2vl table is 0, because this is a source node.\r
-                */\r
-               p_slvl_tbl = osm_physp_get_slvl_tbl(p_physp, 0);\r
-\r
-               /* update valid SLs that still exist on this route */\r
-               for (i = 0; i < IB_MAX_NUM_VLS; i++) {\r
-                       if (valid_sl_mask & (1 << i) &&\r
-                           ib_slvl_table_get(p_slvl_tbl, i) == IB_DROP_VL)\r
-                               valid_sl_mask &= ~(1 << i);\r
-               }\r
-               if (!valid_sl_mask) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "All the SLs lead to VL15 on this path\n");\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Same as above\r
-        */\r
-       p_node = osm_physp_get_node_ptr(p_dest_physp);\r
-\r
-       if (p_node->sw) {\r
-               /*\r
-                * if destination is switch, we want p_dest_physp to point to port 0\r
-                */\r
-               p_dest_physp =\r
-                   osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-\r
-               if (p_dest_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F03: "\r
-                               "Cannot find routing to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       }\r
-\r
-       /*\r
-        * Now go through the path step by step\r
-        */\r
-\r
-       while (p_physp != p_dest_physp) {\r
-\r
-               p_node = osm_physp_get_node_ptr(p_physp);\r
-               p_physp = osm_physp_get_remote(p_physp);\r
-\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F05: "\r
-                               "Cannot find remote phys port when routing to LID %u from node GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               in_port_num = osm_physp_get_port_num(p_physp);\r
-\r
-               /*\r
-                  This is point to point case (no switch in between)\r
-                */\r
-               if (p_physp == p_dest_physp)\r
-                       break;\r
-\r
-               p_node = osm_physp_get_node_ptr(p_physp);\r
-\r
-               if (!p_node->sw) {\r
-                       /*\r
-                          There is some sort of problem in the subnet object!\r
-                          If this isn't a switch, we should have reached\r
-                          the destination by now!\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F06: "\r
-                               "Internal error, bad path\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               /*\r
-                  Check parameters for the ingress port in this switch.\r
-                */\r
-               p_pi = &p_physp->port_info;\r
-\r
-               if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-                       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-               if (rate > ib_port_info_compute_rate(p_pi))\r
-                       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-               /*\r
-                  Continue with the egress port on this switch.\r
-                */\r
-               p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);\r
-               if (p_physp == 0) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F07: "\r
-                               "Dead end on path to LID %u from switch for GUID 0x%016"\r
-                               PRIx64 "\n", dest_lid_ho,\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               p_pi = &p_physp->port_info;\r
-\r
-               if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-                       mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-               if (rate > ib_port_info_compute_rate(p_pi))\r
-                       rate = ib_port_info_compute_rate(p_pi);\r
-\r
-               if (sa->p_subn->opt.qos) {\r
-                       /*\r
-                        * Check SL2VL table of the switch and update valid SLs\r
-                        */\r
-                       p_slvl_tbl =\r
-                           osm_physp_get_slvl_tbl(p_physp, in_port_num);\r
-                       for (i = 0; i < IB_MAX_NUM_VLS; i++) {\r
-                               if (valid_sl_mask & (1 << i) &&\r
-                                   ib_slvl_table_get(p_slvl_tbl,\r
-                                                     i) == IB_DROP_VL)\r
-                                       valid_sl_mask &= ~(1 << i);\r
-                       }\r
-                       if (!valid_sl_mask) {\r
-                               OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "All the SLs "\r
-                                       "lead to VL15 on this path\n");\r
-                               status = IB_NOT_FOUND;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-\r
-               /* update number of hops traversed */\r
-               hops++;\r
-               if (hops > MAX_HOPS) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR,\r
-                               "Path from GUID 0x%016" PRIx64 " (%s) to"\r
-                               " lid %u GUID 0x%016" PRIx64 " (%s) needs"\r
-                               " more than %d hops, max %d hops allowed\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),\r
-                               p_src_physp->p_node->print_desc, dest_lid_ho,\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)),\r
-                               p_dest_physp->p_node->print_desc, hops,\r
-                               MAX_HOPS);\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /*\r
-          p_physp now points to the destination\r
-        */\r
-       p_pi = &p_physp->port_info;\r
-\r
-       if (mtu > ib_port_info_get_mtu_cap(p_pi))\r
-               mtu = ib_port_info_get_mtu_cap(p_pi);\r
-\r
-       if (rate > ib_port_info_compute_rate(p_pi))\r
-               rate = ib_port_info_compute_rate(p_pi);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Path min MTU = %u, min rate = %u\n", mtu, rate);\r
-\r
-       /*\r
-        * Get QoS Level object according to the path request\r
-        * and adjust path parameters according to QoS settings\r
-        */\r
-       if (sa->p_subn->opt.qos &&\r
-           sa->p_subn->p_qos_policy &&\r
-           (p_qos_level =\r
-            osm_qos_policy_get_qos_level_by_pr(sa->p_subn->p_qos_policy,\r
-                                               p_pr, p_src_physp, p_dest_physp,\r
-                                               comp_mask))) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "PathRecord request matches QoS Level '%s' (%s)\n",\r
-                       p_qos_level->name, p_qos_level->use ?\r
-                       p_qos_level->use : "no description");\r
-\r
-               if (p_qos_level->mtu_limit_set\r
-                   && (mtu > p_qos_level->mtu_limit))\r
-                       mtu = p_qos_level->mtu_limit;\r
-\r
-               if (p_qos_level->rate_limit_set\r
-                   && (rate > p_qos_level->rate_limit))\r
-                       rate = p_qos_level->rate_limit;\r
-\r
-               if (p_qos_level->sl_set) {\r
-                       sl = p_qos_level->sl;\r
-                       if (!(valid_sl_mask & (1 << sl))) {\r
-                               status = IB_NOT_FOUND;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Set packet lifetime.\r
-        * According to spec definition IBA 1.2 Table 205\r
-        * PacketLifeTime description, for loopback paths,\r
-        * packetLifeTime shall be zero.\r
-        */\r
-       if (p_src_port == p_dest_port)\r
-               pkt_life = 0;\r
-       else if (p_qos_level && p_qos_level->pkt_life_set)\r
-               pkt_life = p_qos_level->pkt_life;\r
-       else\r
-               pkt_life = sa->p_subn->opt.subnet_timeout;\r
-\r
-       /*\r
-          Determine if these values meet the user criteria\r
-          and adjust appropriately\r
-        */\r
-\r
-       /* we silently ignore cases where only the MTU selector is defined */\r
-       if ((comp_mask & IB_PR_COMPMASK_MTUSELEC) &&\r
-           (comp_mask & IB_PR_COMPMASK_MTU)) {\r
-               required_mtu = ib_path_rec_mtu(p_pr);\r
-               switch (ib_path_rec_mtu_sel(p_pr)) {\r
-               case 0: /* must be greater than */\r
-                       if (mtu <= required_mtu)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (mtu >= required_mtu) {\r
-                               /* adjust to use the highest mtu\r
-                                  lower then the required one */\r
-                               if (required_mtu > 1)\r
-                                       mtu = required_mtu - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (mtu < required_mtu)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               mtu = required_mtu;\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_path_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* we silently ignore cases where only the Rate selector is defined */\r
-       if ((comp_mask & IB_PR_COMPMASK_RATESELEC) &&\r
-           (comp_mask & IB_PR_COMPMASK_RATE)) {\r
-               required_rate = ib_path_rec_rate(p_pr);\r
-               switch (ib_path_rec_rate_sel(p_pr)) {\r
-               case 0: /* must be greater than */\r
-                       if (rate <= required_rate)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (rate >= required_rate) {\r
-                               /* adjust the rate to use the highest rate\r
-                                  lower then the required one */\r
-                               if (required_rate > 2)\r
-                                       rate = required_rate - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (rate < required_rate)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               rate = required_rate;\r
-                       break;\r
-\r
-               case 3: /* largest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_path_rec_mtu_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* we silently ignore cases where only the PktLife selector is defined */\r
-       if ((comp_mask & IB_PR_COMPMASK_PKTLIFETIMESELEC) &&\r
-           (comp_mask & IB_PR_COMPMASK_PKTLIFETIME)) {\r
-               required_pkt_life = ib_path_rec_pkt_life(p_pr);\r
-               switch (ib_path_rec_pkt_life_sel(p_pr)) {\r
-               case 0: /* must be greater than */\r
-                       if (pkt_life <= required_pkt_life)\r
-                               status = IB_NOT_FOUND;\r
-                       break;\r
-\r
-               case 1: /* must be less than */\r
-                       if (pkt_life >= required_pkt_life) {\r
-                               /* adjust the lifetime to use the highest possible\r
-                                  lower then the required one */\r
-                               if (required_pkt_life > 1)\r
-                                       pkt_life = required_pkt_life - 1;\r
-                               else\r
-                                       status = IB_NOT_FOUND;\r
-                       }\r
-                       break;\r
-\r
-               case 2: /* exact match */\r
-                       if (pkt_life < required_pkt_life)\r
-                               status = IB_NOT_FOUND;\r
-                       else\r
-                               pkt_life = required_pkt_life;\r
-                       break;\r
-\r
-               case 3: /* smallest available */\r
-                       /* can't be disqualified by this one */\r
-                       break;\r
-\r
-               default:\r
-                       /* if we're here, there's a bug in ib_path_rec_pkt_life_sel() */\r
-                       CL_ASSERT(FALSE);\r
-                       status = IB_ERROR;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /*\r
-        * set Pkey for this path record request\r
-        */\r
-\r
-       if ((comp_mask & IB_PR_COMPMASK_RAWTRAFFIC) &&\r
-           (cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31)))\r
-               pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp);\r
-\r
-       else if (comp_mask & IB_PR_COMPMASK_PKEY) {\r
-               /*\r
-                * PR request has a specific pkey:\r
-                * Check that source and destination share this pkey.\r
-                * If QoS level has pkeys, check that this pkey exists\r
-                * in the QoS level pkeys.\r
-                * PR returned pkey is the requested pkey.\r
-                */\r
-               pkey = p_pr->pkey;\r
-               if (!osm_physp_share_this_pkey(p_src_physp, p_dest_physp, pkey)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1A: "\r
-                               "Ports 0x%016" PRIx64 " 0x%016" PRIx64\r
-                               " do not share specified PKey 0x%04x\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)), cl_ntoh16(pkey));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-               if (p_qos_level && p_qos_level->pkey_range_len &&\r
-                   !osm_qos_level_has_pkey(p_qos_level, pkey)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1D: "\r
-                               "Ports do not share PKeys defined by QoS level\n");\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       } else if (p_qos_level && p_qos_level->pkey_range_len) {\r
-               /*\r
-                * PR request doesn't have a specific pkey, but QoS level\r
-                * has pkeys - get shared pkey from QoS level pkeys\r
-                */\r
-               pkey = osm_qos_level_get_shared_pkey(p_qos_level,\r
-                                                    p_src_physp, p_dest_physp);\r
-               if (!pkey) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1E: "\r
-                               "Ports 0x%016" PRIx64 " 0x%016" PRIx64\r
-                               " do not share PKeys defined by QoS level\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               /*\r
-                * Neither PR request nor QoS level have pkey.\r
-                * Just get any shared pkey.\r
-                */\r
-               pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp);\r
-               if (!pkey) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1B: "\r
-                               "Ports 0x%016" PRIx64 " 0x%016" PRIx64\r
-                               " do not have any shared PKeys\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),\r
-                               cl_ntoh64(osm_physp_get_port_guid\r
-                                         (p_dest_physp)));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (pkey) {\r
-               p_prtn =\r
-                   (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,\r
-                                              pkey & cl_hton16((uint16_t) ~\r
-                                                               0x8000));\r
-               if (p_prtn ==\r
-                   (osm_prtn_t *) cl_qmap_end(&sa->p_subn->prtn_pkey_tbl))\r
-                       p_prtn = NULL;\r
-       }\r
-\r
-       /*\r
-        * Set PathRecord SL\r
-        */\r
-\r
-       is_lash = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_LASH);\r
-\r
-       if (comp_mask & IB_PR_COMPMASK_SL) {\r
-               /*\r
-                * Specific SL was requested\r
-                */\r
-               sl = ib_path_rec_sl(p_pr);\r
-\r
-               if (p_qos_level && p_qos_level->sl_set\r
-                   && (p_qos_level->sl != sl)) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1F: "\r
-                               "QoS constraints: required PathRecord SL (%u) "\r
-                               "doesn't match QoS policy SL (%u)\n", sl,\r
-                               p_qos_level->sl);\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-               if (is_lash\r
-                   && osm_get_lash_sl(p_osm, p_src_port, p_dest_port) != sl) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F23: "\r
-                               "Required PathRecord SL (%u) doesn't "\r
-                               "match LASH SL\n", sl);\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-\r
-       } else if (is_lash) {\r
-               /*\r
-                * No specific SL in PathRecord request.\r
-                * If it's LASH routing - use its SL.\r
-                * slid and dest_lid are stored in network in lash.\r
-                */\r
-               sl = osm_get_lash_sl(p_osm, p_src_port, p_dest_port);\r
-       } else if (p_qos_level && p_qos_level->sl_set) {\r
-               /*\r
-                * No specific SL was requested, and we're not in\r
-                * LASH routing, but there is an SL in QoS level.\r
-                */\r
-               sl = p_qos_level->sl;\r
-\r
-               if (pkey && p_prtn && p_prtn->sl != p_qos_level->sl)\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "QoS level SL (%u) overrides partition SL (%u)\n",\r
-                               p_qos_level->sl, p_prtn->sl);\r
-\r
-       } else if (pkey) {\r
-               /*\r
-                * No specific SL in request or in QoS level - use partition SL\r
-                */\r
-               if (!p_prtn) {\r
-                       sl = OSM_DEFAULT_SL;\r
-                       /* this may be possible when pkey tables are created somehow in\r
-                          previous runs or things are going wrong here */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1C: "\r
-                               "No partition found for PKey 0x%04x - using default SL %d\n",\r
-                               cl_ntoh16(pkey), sl);\r
-               } else\r
-                       sl = p_prtn->sl;\r
-       } else if (sa->p_subn->opt.qos) {\r
-               if (valid_sl_mask & (1 << OSM_DEFAULT_SL))\r
-                       sl = OSM_DEFAULT_SL;\r
-               else {\r
-                       for (i = 0; i < IB_MAX_NUM_VLS; i++)\r
-                               if (valid_sl_mask & (1 << i))\r
-                                       break;\r
-                       sl = i;\r
-               }\r
-       } else\r
-               sl = OSM_DEFAULT_SL;\r
-\r
-       if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << sl))) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F24: "\r
-                       "Selected SL (%u) leads to VL15\n", sl);\r
-               status = IB_NOT_FOUND;\r
-               goto Exit;\r
-       }\r
-\r
-       /* reset pkey when raw traffic */\r
-       if (comp_mask & IB_PR_COMPMASK_RAWTRAFFIC &&\r
-           cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31))\r
-               pkey = 0;\r
-\r
-       p_parms->mtu = mtu;\r
-       p_parms->rate = rate;\r
-       p_parms->pkt_life = pkt_life;\r
-       p_parms->pkey = pkey;\r
-       p_parms->sl = sl;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Path params: mtu = %u, rate = %u,"\r
-               " packet lifetime = %u, pkey = 0x%04X, sl = %u\n",\r
-               mtu, rate, pkt_life, cl_ntoh16(pkey), sl);\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,\r
-                           IN const osm_port_t * p_dest_port,\r
-                           IN const ib_gid_t * p_dgid,\r
-                           IN const uint16_t src_lid_ho,\r
-                           IN const uint16_t dest_lid_ho,\r
-                           IN const uint8_t preference,\r
-                           IN const osm_path_parms_t * p_parms,\r
-                           OUT ib_path_rec_t * p_pr)\r
-{\r
-       const osm_physp_t *p_src_physp;\r
-       const osm_physp_t *p_dest_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_src_physp = p_src_port->p_physp;\r
-\r
-       if (p_dgid)\r
-               p_pr->dgid = *p_dgid;\r
-       else {\r
-               p_dest_physp = p_dest_port->p_physp;\r
-\r
-               p_pr->dgid.unicast.prefix =\r
-                   osm_physp_get_subnet_prefix(p_dest_physp);\r
-               p_pr->dgid.unicast.interface_id =\r
-                   osm_physp_get_port_guid(p_dest_physp);\r
-       }\r
-\r
-       p_pr->sgid.unicast.prefix = osm_physp_get_subnet_prefix(p_src_physp);\r
-       p_pr->sgid.unicast.interface_id = osm_physp_get_port_guid(p_src_physp);\r
-\r
-       p_pr->dlid = cl_hton16(dest_lid_ho);\r
-       p_pr->slid = cl_hton16(src_lid_ho);\r
-\r
-       p_pr->hop_flow_raw &= cl_hton32(1 << 31);\r
-\r
-       /* Only set HopLimit if going through a router */\r
-       if (p_dgid)\r
-               p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX);\r
-\r
-       p_pr->pkey = p_parms->pkey;\r
-       ib_path_rec_set_sl(p_pr, p_parms->sl);\r
-       ib_path_rec_set_qos_class(p_pr, 0);\r
-       p_pr->mtu = (uint8_t) (p_parms->mtu | 0x80);\r
-       p_pr->rate = (uint8_t) (p_parms->rate | 0x80);\r
-\r
-       /* According to 1.2 spec definition Table 205 PacketLifeTime description,\r
-          for loopback paths, packetLifeTime shall be zero. */\r
-       if (p_src_port == p_dest_port)\r
-               p_pr->pkt_life = 0x80;  /* loopback */\r
-       else\r
-               p_pr->pkt_life = (uint8_t) (p_parms->pkt_life | 0x80);\r
-\r
-       p_pr->preference = preference;\r
-\r
-       /* always return num_path = 0 so this is only the reversible component */\r
-       if (p_parms->reversible)\r
-               p_pr->num_path = 0x80;\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,\r
-                                              IN const ib_path_rec_t * p_pr,\r
-                                              IN const osm_port_t * p_src_port,\r
-                                              IN const osm_port_t *\r
-                                              p_dest_port,\r
-                                              IN const ib_gid_t * p_dgid,\r
-                                              IN const uint16_t src_lid_ho,\r
-                                              IN const uint16_t dest_lid_ho,\r
-                                              IN const ib_net64_t comp_mask,\r
-                                              IN const uint8_t preference)\r
-{\r
-       osm_path_parms_t path_parms;\r
-       osm_path_parms_t rev_path_parms;\r
-       osm_pr_item_t *p_pr_item;\r
-       ib_api_status_t status, rev_path_status;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID %u, Dest LID %u\n",\r
-               src_lid_ho, dest_lid_ho);\r
-\r
-       p_pr_item = malloc(sizeof(*p_pr_item));\r
-       if (p_pr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F01: "\r
-                       "Unable to allocate path record\n");\r
-               goto Exit;\r
-       }\r
-       memset(p_pr_item, 0, sizeof(*p_pr_item));\r
-\r
-       status = pr_rcv_get_path_parms(sa, p_pr, p_src_port, p_dest_port,\r
-                                      dest_lid_ho, comp_mask, &path_parms);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               free(p_pr_item);\r
-               p_pr_item = NULL;\r
-               goto Exit;\r
-       }\r
-\r
-       /* now try the reversible path */\r
-       rev_path_status = pr_rcv_get_path_parms(sa, p_pr, p_dest_port,\r
-                                               p_src_port, src_lid_ho,\r
-                                               comp_mask, &rev_path_parms);\r
-       path_parms.reversible = (rev_path_status == IB_SUCCESS);\r
-\r
-       /* did we get a Reversible Path compmask ? */\r
-       /*\r
-          NOTE that if the reversible component = 0, it is a don't care\r
-          rather then requiring non-reversible paths ...\r
-          see Vol1 Ver1.2 p900 l16\r
-        */\r
-       if ((comp_mask & IB_PR_COMPMASK_REVERSIBLE) &&\r
-           !path_parms.reversible && (p_pr->num_path & 0x80)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Requested reversible path but failed to get one\n");\r
-               free(p_pr_item);\r
-               p_pr_item = NULL;\r
-               goto Exit;\r
-       }\r
-\r
-       pr_rcv_build_pr(sa, p_src_port, p_dest_port, p_dgid, src_lid_ho,\r
-                       dest_lid_ho, preference, &path_parms,\r
-                       &p_pr_item->path_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return p_pr_item;\r
-}\r
-\r
-static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,\r
-                                      IN const ib_sa_mad_t *sa_mad,\r
-                                      IN const osm_port_t * p_req_port,\r
-                                      IN const osm_port_t * p_src_port,\r
-                                      IN const osm_port_t * p_dest_port,\r
-                                      IN const ib_gid_t * p_dgid,\r
-                                      IN cl_qlist_t * p_list)\r
-{\r
-       const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);\r
-       ib_net64_t comp_mask = sa_mad->comp_mask;\r
-       osm_pr_item_t *p_pr_item;\r
-       uint16_t src_lid_min_ho;\r
-       uint16_t src_lid_max_ho;\r
-       uint16_t dest_lid_min_ho;\r
-       uint16_t dest_lid_max_ho;\r
-       uint16_t src_lid_ho;\r
-       uint16_t dest_lid_ho;\r
-       uint32_t path_num;\r
-       uint8_t preference;\r
-       unsigned iterations, src_offset, dest_offset;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Src port 0x%016" PRIx64 ", Dst port 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(osm_port_get_guid(p_src_port)),\r
-               cl_ntoh64(osm_port_get_guid(p_dest_port)));\r
-\r
-       /* Check that the req_port, src_port and dest_port all share a\r
-          pkey. The check is done on the default physical port of the ports. */\r
-       if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE\r
-           || osm_port_share_pkey(sa->p_log, p_req_port,\r
-                                  p_dest_port) == FALSE\r
-           || osm_port_share_pkey(sa->p_log, p_src_port, p_dest_port) == FALSE)\r
-               /* One of the pairs doesn't share a pkey so the path is disqualified. */\r
-               goto Exit;\r
-\r
-       /*\r
-          We shouldn't be here if the paths are disqualified in some way...\r
-          Thus, we assume every possible connection is valid.\r
-\r
-          We desire to return high-quality paths first.\r
-          In OpenSM, higher quality means least overlap with other paths.\r
-          This is acheived in practice by returning paths with\r
-          different LID value on each end, which means these\r
-          paths are more redundant that paths with the same LID repeated\r
-          on one side.  For example, in OpenSM the paths between two\r
-          endpoints with LMC = 1 might be as follows:\r
-\r
-          Port A, LID 1 <-> Port B, LID 3\r
-          Port A, LID 1 <-> Port B, LID 4\r
-          Port A, LID 2 <-> Port B, LID 3\r
-          Port A, LID 2 <-> Port B, LID 4\r
-\r
-          The OpenSM unicast routing algorithms attempt to disperse each path\r
-          to as varied a physical path as is reasonable.  1<->3 and 1<->4 have\r
-          more physical overlap (hence less redundancy) than 1<->3 and 2<->4.\r
-\r
-          OpenSM ranks paths in three preference groups:\r
-\r
-          Preference Value    Description\r
-          ----------------    -------------------------------------------\r
-          0             Redundant in both directions with other\r
-          pref value = 0 paths\r
-\r
-          1             Redundant in one direction with other\r
-          pref value = 0 and pref value = 1 paths\r
-\r
-          2             Not redundant in either direction with\r
-          other paths\r
-\r
-          3-FF          Unused\r
-\r
-          SA clients don't need to know these details, only that the lower\r
-          preference paths are preferred, as stated in the spec.  The paths\r
-          may not actually be physically redundant depending on the topology\r
-          of the subnet, but the point of LMC > 0 is to offer redundancy,\r
-          so it is assumed that the subnet is physically appropriate for the\r
-          specified LMC value.  A more advanced implementation would inspect for\r
-          physical redundancy, but I'm not going to bother with that now.\r
-        */\r
-\r
-       /*\r
-          Refine our search if the client specified end-point LIDs\r
-        */\r
-       if (comp_mask & IB_PR_COMPMASK_DLID)\r
-               dest_lid_max_ho = dest_lid_min_ho = cl_ntoh16(p_pr->dlid);\r
-       else\r
-               osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,\r
-                                         &dest_lid_max_ho);\r
-\r
-       if (comp_mask & IB_PR_COMPMASK_SLID)\r
-               src_lid_max_ho = src_lid_min_ho = cl_ntoh16(p_pr->slid);\r
-       else\r
-               osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho,\r
-                                         &src_lid_max_ho);\r
-\r
-       if (src_lid_min_ho == 0) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F20:"\r
-                       "Obtained source LID of 0. No such LID possible\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (dest_lid_min_ho == 0) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F21:"\r
-                       "Obtained destination LID of 0. No such LID possible\n");\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Src LIDs [%u-%u], Dest LIDs [%u-%u]\n",\r
-               src_lid_min_ho, src_lid_max_ho,\r
-               dest_lid_min_ho, dest_lid_max_ho);\r
-\r
-       src_lid_ho = src_lid_min_ho;\r
-       dest_lid_ho = dest_lid_min_ho;\r
-\r
-       /*\r
-          Preferred paths come first in OpenSM\r
-        */\r
-       preference = 0;\r
-       path_num = 0;\r
-\r
-       /* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */\r
-       if (sa_mad->method == IB_MAD_METHOD_GET)\r
-               iterations = 1;\r
-       else if (comp_mask & IB_PR_COMPMASK_NUMBPATH)\r
-               iterations = ib_path_rec_num_path(p_pr);\r
-       else\r
-               iterations = (unsigned) (-1);\r
-\r
-       while (path_num < iterations) {\r
-               /*\r
-                  These paths are "fully redundant"\r
-                */\r
-\r
-               p_pr_item = pr_rcv_get_lid_pair_path(sa, p_pr, p_src_port,\r
-                                                    p_dest_port, p_dgid,\r
-                                                    src_lid_ho, dest_lid_ho,\r
-                                                    comp_mask, preference);\r
-\r
-               if (p_pr_item) {\r
-                       cl_qlist_insert_tail(p_list, &p_pr_item->list_item);\r
-                       ++path_num;\r
-               }\r
-\r
-               if (++src_lid_ho > src_lid_max_ho)\r
-                       break;\r
-\r
-               if (++dest_lid_ho > dest_lid_max_ho)\r
-                       break;\r
-       }\r
-\r
-       /*\r
-          Check if we've accumulated all the paths that the user cares to see\r
-        */\r
-       if (path_num == iterations)\r
-               goto Exit;\r
-\r
-       /*\r
-          Don't bother reporting preference 1 paths for now.\r
-          It's more trouble than it's worth and can only occur\r
-          if ports have different LMC values, which isn't supported\r
-          by OpenSM right now anyway.\r
-        */\r
-       preference = 2;\r
-       src_lid_ho = src_lid_min_ho;\r
-       dest_lid_ho = dest_lid_min_ho;\r
-       src_offset = 0;\r
-       dest_offset = 0;\r
-\r
-       /*\r
-          Iterate over the remaining paths\r
-        */\r
-       while (path_num < iterations) {\r
-               dest_offset++;\r
-               dest_lid_ho++;\r
-\r
-               if (dest_lid_ho > dest_lid_max_ho) {\r
-                       src_offset++;\r
-                       src_lid_ho++;\r
-\r
-                       if (src_lid_ho > src_lid_max_ho)\r
-                               break;  /* done */\r
-\r
-                       dest_offset = 0;\r
-                       dest_lid_ho = dest_lid_min_ho;\r
-               }\r
-\r
-               /*\r
-                  These paths are "fully non-redundant" with paths already\r
-                  identified above and consequently not of much value.\r
-\r
-                  Don't return paths we already identified above, as indicated\r
-                  by the offset values being equal.\r
-                */\r
-               if (src_offset == dest_offset)\r
-                       continue;       /* already reported */\r
-\r
-               p_pr_item = pr_rcv_get_lid_pair_path(sa, p_pr, p_src_port,\r
-                                                    p_dest_port, p_dgid,\r
-                                                    src_lid_ho, dest_lid_ho,\r
-                                                    comp_mask, preference);\r
-\r
-               if (p_pr_item) {\r
-                       cl_qlist_insert_tail(p_list, &p_pr_item->list_item);\r
-                       ++path_num;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-/* Find the router port that is configured to handle this prefix, if any */\r
-static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix)\r
-{\r
-       osm_prefix_route_t *route = NULL;\r
-       osm_router_t *rtr;\r
-       cl_qlist_t *l = &sa->p_subn->prefix_routes_list;\r
-       cl_list_item_t *i;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Non local DGID subnet prefix "\r
-               "0x%016" PRIx64 "\n", cl_ntoh64(prefix));\r
-\r
-       for (i = cl_qlist_head(l); i != cl_qlist_end(l); i = cl_qlist_next(i)) {\r
-               osm_prefix_route_t *r = (osm_prefix_route_t *)i;\r
-               if (!r->prefix || r->prefix == prefix) {\r
-                       route = r;\r
-                       break;\r
-               }\r
-       }\r
-       if (!route)\r
-               return 0;\r
-\r
-       if (route->guid == 0) /* first router */\r
-               rtr = (osm_router_t *) cl_qmap_head(&sa->p_subn->rtr_guid_tbl);\r
-       else\r
-               rtr = (osm_router_t *) cl_qmap_get(&sa->p_subn->rtr_guid_tbl,\r
-                                                  route->guid);\r
-\r
-       if (rtr == (osm_router_t *) cl_qmap_end(&sa->p_subn->rtr_guid_tbl))\r
-               return 0;\r
-\r
-       return osm_port_get_guid(osm_router_get_port_ptr(rtr));\r
-}\r
-\r
-static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,\r
-                                       IN const ib_sa_mad_t *sa_mad,\r
-                                       OUT const osm_port_t ** pp_src_port,\r
-                                       OUT const osm_port_t ** pp_dest_port,\r
-                                       OUT const ib_gid_t ** pp_dgid)\r
-{\r
-       const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);\r
-       ib_net64_t comp_mask = sa_mad->comp_mask;\r
-       ib_net64_t dest_guid;\r
-       ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          Determine what fields are valid and then get a pointer\r
-          to the source and destination port objects, if possible.\r
-        */\r
-\r
-       /*\r
-          Check a few easy disqualifying cases up front before getting\r
-          into the endpoints.\r
-        */\r
-\r
-       if (comp_mask & IB_PR_COMPMASK_SGID) {\r
-               if (!ib_gid_is_link_local(&p_pr->sgid)) {\r
-                       if (ib_gid_get_subnet_prefix(&p_pr->sgid) !=\r
-                           sa->p_subn->opt.subnet_prefix) {\r
-                               /*\r
-                                  This 'error' is the client's fault (bad gid)\r
-                                  so don't enter it as an error in our own log.\r
-                                  Return an error response to the client.\r
-                                */\r
-                               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                                       "Non local SGID subnet prefix 0x%016"\r
-                                       PRIx64 "\n",\r
-                                       cl_ntoh64(p_pr->sgid.unicast.prefix));\r
-                               sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-\r
-               *pp_src_port = osm_get_port_by_guid(sa->p_subn,\r
-                                                   p_pr->sgid.unicast.\r
-                                                   interface_id);\r
-               if (!*pp_src_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad gid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                               "No source port with GUID 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_pr->sgid.unicast.interface_id));\r
-                       sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                       goto Exit;\r
-               }\r
-       } else if (comp_mask & IB_PR_COMPMASK_SLID) {\r
-               *pp_src_port = osm_get_port_by_lid(sa->p_subn, p_pr->slid);\r
-               if (!*pp_src_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad lid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No source port "\r
-                               "with LID %u\n", cl_ntoh16(p_pr->slid));\r
-                       sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\r
-                       goto Exit;\r
-               }\r
-       } else\r
-               *pp_src_port = NULL;\r
-\r
-       if (comp_mask & IB_PR_COMPMASK_DGID) {\r
-               if (!ib_gid_is_link_local(&p_pr->dgid) &&\r
-                   !ib_gid_is_multicast(&p_pr->dgid) &&\r
-                   ib_gid_get_subnet_prefix(&p_pr->dgid) !=\r
-                   sa->p_subn->opt.subnet_prefix) {\r
-                       dest_guid = find_router(sa, p_pr->dgid.unicast.prefix);\r
-                       if (!dest_guid) {\r
-                               char gid_str[INET6_ADDRSTRLEN];\r
-                               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                                       "Off subnet DGID %s, but router not "\r
-                                       "found\n",\r
-                                       inet_ntop(AF_INET6, p_pr->dgid.raw,\r
-                                                 gid_str, sizeof(gid_str)));\r
-                               sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                               goto Exit;\r
-                       }\r
-                       if (pp_dgid)\r
-                               *pp_dgid = &p_pr->dgid;\r
-               } else\r
-                       dest_guid = p_pr->dgid.unicast.interface_id;\r
-\r
-               *pp_dest_port = osm_get_port_by_guid(sa->p_subn, dest_guid);\r
-               if (!*pp_dest_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad gid) so\r
-                          don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                               "No dest port with GUID 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(dest_guid));\r
-                       sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
-                       goto Exit;\r
-               }\r
-       } else if (comp_mask & IB_PR_COMPMASK_DLID) {\r
-               *pp_dest_port = osm_get_port_by_lid(sa->p_subn, p_pr->dlid);\r
-               if (!*pp_dest_port) {\r
-                       /*\r
-                          This 'error' is the client's fault (bad lid)\r
-                          so don't enter it as an error in our own log.\r
-                          Return an error response to the client.\r
-                        */\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No dest port "\r
-                               "with LID %u\n", cl_ntoh16(p_pr->dlid));\r
-                       sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\r
-                       goto Exit;\r
-               }\r
-       } else\r
-               *pp_dest_port = NULL;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return sa_status;\r
-}\r
-\r
-static void pr_rcv_process_world(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,\r
-                                IN const osm_port_t * requester_port,\r
-                                IN const ib_gid_t * p_dgid,\r
-                                IN cl_qlist_t * p_list)\r
-{\r
-       const cl_qmap_t *p_tbl;\r
-       const osm_port_t *p_dest_port;\r
-       const osm_port_t *p_src_port;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          Iterate the entire port space over itself.\r
-          A path record from a port to itself is legit, so no\r
-          need for a special case there.\r
-\r
-          We compute both A -> B and B -> A, since we don't have\r
-          any check to determine the reversability of the paths.\r
-        */\r
-       p_tbl = &sa->p_subn->port_guid_tbl;\r
-\r
-       p_dest_port = (osm_port_t *) cl_qmap_head(p_tbl);\r
-       while (p_dest_port != (osm_port_t *) cl_qmap_end(p_tbl)) {\r
-               p_src_port = (osm_port_t *) cl_qmap_head(p_tbl);\r
-               while (p_src_port != (osm_port_t *) cl_qmap_end(p_tbl)) {\r
-                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
-                                                  p_src_port, p_dest_port,\r
-                                                  p_dgid, p_list);\r
-                       if (sa_mad->method == IB_MAD_METHOD_GET &&\r
-                           cl_qlist_count(p_list) > 0)\r
-                               goto Exit;\r
-\r
-                       p_src_port =\r
-                           (osm_port_t *) cl_qmap_next(&p_src_port->map_item);\r
-               }\r
-\r
-               p_dest_port =\r
-                   (osm_port_t *) cl_qmap_next(&p_dest_port->map_item);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void pr_rcv_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,\r
-                               IN const osm_port_t * requester_port,\r
-                               IN const osm_port_t * p_src_port,\r
-                               IN const osm_port_t * p_dest_port,\r
-                               IN const ib_gid_t * p_dgid,\r
-                               IN cl_qlist_t * p_list)\r
-{\r
-       const cl_qmap_t *p_tbl;\r
-       const osm_port_t *p_port;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /*\r
-          Iterate over every port, looking for matches...\r
-          A path record from a port to itself is legit, so no\r
-          need to special case that one.\r
-        */\r
-       p_tbl = &sa->p_subn->port_guid_tbl;\r
-\r
-       if (p_src_port) {\r
-               /*\r
-                  The src port if fixed, so iterate over destination ports.\r
-                */\r
-               p_port = (osm_port_t *) cl_qmap_head(p_tbl);\r
-               while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {\r
-                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
-                                                  p_src_port, p_port, p_dgid,\r
-                                                  p_list);\r
-                       if (sa_mad->method == IB_MAD_METHOD_GET &&\r
-                           cl_qlist_count(p_list) > 0)\r
-                               break;\r
-                       p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item);\r
-               }\r
-       } else {\r
-               /*\r
-                  The dest port if fixed, so iterate over source ports.\r
-                */\r
-               p_port = (osm_port_t *) cl_qmap_head(p_tbl);\r
-               while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {\r
-                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
-                                                  p_port, p_dest_port, p_dgid,\r
-                                                  p_list);\r
-                       if (sa_mad->method == IB_MAD_METHOD_GET &&\r
-                           cl_qlist_count(p_list) > 0)\r
-                               break;\r
-                       p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item);\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,\r
-                               IN const osm_port_t * requester_port,\r
-                               IN const osm_port_t * p_src_port,\r
-                               IN const osm_port_t * p_dest_port,\r
-                               IN const ib_gid_t * p_dgid,\r
-                               IN cl_qlist_t * p_list)\r
-{\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_src_port,\r
-                                  p_dest_port, p_dgid, p_list);\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa,\r
-                                               IN const ib_sa_mad_t * sa_mad,\r
-                                               IN const osm_mgrp_t * p_mgrp)\r
-{\r
-       const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);\r
-       ib_net64_t comp_mask = sa_mad->comp_mask;\r
-       const osm_port_t *port;\r
-       ib_api_status_t status = IB_ERROR;\r
-       uint32_t flow_label;\r
-       uint8_t sl, hop_limit;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* check that MLID of the MC group matches the PathRecord DLID */\r
-       if ((comp_mask & IB_PR_COMPMASK_DLID) && p_mgrp->mlid != p_pr->dlid)\r
-               goto Exit;\r
-\r
-       /* If SGID and/or SLID specified, should validate as member of MC group */\r
-       if (comp_mask & IB_PR_COMPMASK_SGID) {\r
-               port = osm_get_port_by_guid(sa->p_subn,\r
-                                           p_pr->sgid.unicast.interface_id);\r
-               if (!port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid))\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_PR_COMPMASK_SLID) {\r
-               port = osm_get_port_by_lid(sa->p_subn, p_pr->slid);\r
-               if (!port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid))\r
-                       goto Exit;\r
-       }\r
-\r
-       /* Also, MTU, rate, packet lifetime, and raw traffic requested are not currently checked */\r
-       if ((comp_mask & IB_PR_COMPMASK_PKEY) &&\r
-           p_pr->pkey != p_mgrp->mcmember_rec.pkey)\r
-               goto Exit;\r
-\r
-       ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,\r
-                                 &sl, &flow_label, &hop_limit);\r
-\r
-       if ((comp_mask & IB_PR_COMPMASK_SL) && ib_path_rec_sl(p_pr) != sl)\r
-               goto Exit;\r
-\r
-       /* If SubnAdmGet, assume NumbPaths of 1 (1.2 erratum) */\r
-       if ((comp_mask & IB_PR_COMPMASK_NUMBPATH) &&\r
-           sa_mad->method != IB_MAD_METHOD_GET &&\r
-           ib_path_rec_num_path(p_pr) == 0)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_PR_COMPMASK_FLOWLABEL) &&\r
-           ib_path_rec_flow_lbl(p_pr) != flow_label)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_PR_COMPMASK_HOPLIMIT) &&\r
-           ib_path_rec_hop_limit(p_pr) != hop_limit)\r
-               goto Exit;\r
-\r
-       if ((comp_mask & IB_PR_COMPMASK_TCLASS) &&\r
-           p_pr->tclass != p_mgrp->mcmember_rec.tclass)\r
-               goto Exit;\r
-\r
-       status = IB_SUCCESS;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,\r
-                                cl_qlist_t *list)\r
-{\r
-       ib_path_rec_t *pr = ib_sa_mad_get_payload_ptr(sa_mad);\r
-       osm_mgrp_t *mgrp;\r
-       ib_api_status_t status;\r
-       osm_pr_item_t *pr_item;\r
-       uint32_t flow_label;\r
-       uint8_t sl, hop_limit;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");\r
-\r
-       mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &pr->dgid);\r
-       if (!mgrp) {\r
-               char gid_str[INET6_ADDRSTRLEN];\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: "\r
-                       "No MC group found for PathRecord destination GID %s\n",\r
-                       inet_ntop(AF_INET6, pr->dgid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-               return;\r
-       }\r
-\r
-       /* Make sure the rest of the PathRecord matches the MC group attributes */\r
-       status = pr_match_mgrp_attributes(sa, sa_mad, mgrp);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F19: "\r
-                       "MC group attributes don't match PathRecord request\n");\r
-               return;\r
-       }\r
-\r
-       pr_item = malloc(sizeof(*pr_item));\r
-       if (pr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: "\r
-                       "Unable to allocate path record for MC group\n");\r
-               return;\r
-       }\r
-       memset(pr_item, 0, sizeof(*pr_item));\r
-\r
-       /* Copy PathRecord request into response */\r
-       pr_item->path_rec = *pr;\r
-\r
-       /* Now, use the MC info to cruft up the PathRecord response */\r
-       pr_item->path_rec.dgid = mgrp->mcmember_rec.mgid;\r
-       pr_item->path_rec.dlid = mgrp->mcmember_rec.mlid;\r
-       pr_item->path_rec.tclass = mgrp->mcmember_rec.tclass;\r
-       pr_item->path_rec.num_path = 1;\r
-       pr_item->path_rec.pkey = mgrp->mcmember_rec.pkey;\r
-\r
-       /* MTU, rate, and packet lifetime should be exactly */\r
-       pr_item->path_rec.mtu = (2 << 6) | mgrp->mcmember_rec.mtu;\r
-       pr_item->path_rec.rate = (2 << 6) | mgrp->mcmember_rec.rate;\r
-       pr_item->path_rec.pkt_life = (2 << 6) | mgrp->mcmember_rec.pkt_life;\r
-\r
-       /* SL, Hop Limit, and Flow Label */\r
-       ib_member_get_sl_flow_hop(mgrp->mcmember_rec.sl_flow_hop,\r
-                                 &sl, &flow_label, &hop_limit);\r
-       ib_path_rec_set_sl(&pr_item->path_rec, sl);\r
-       ib_path_rec_set_qos_class(&pr_item->path_rec, 0);\r
-\r
-       /* HopLimit is not yet set in non link local MC groups */\r
-       /* If it were, this would not be needed */\r
-       if (ib_mgid_get_scope(&mgrp->mcmember_rec.mgid) !=\r
-           IB_MC_SCOPE_LINK_LOCAL)\r
-               hop_limit = IB_HOPLIMIT_MAX;\r
-\r
-       pr_item->path_rec.hop_flow_raw =\r
-           cl_hton32(hop_limit) | (flow_label << 8);\r
-\r
-       cl_qlist_insert_tail(list, &pr_item->list_item);\r
-}\r
-\r
-void osm_pr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-       cl_qlist_t pr_list;\r
-       const ib_gid_t *p_dgid = NULL;\r
-       const osm_port_t *p_src_port, *p_dest_port;\r
-       osm_port_t *requester_port;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET &&\r
-           p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F17: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                                 osm_madw_get_mad_addr_ptr\r
-                                                 (p_madw));\r
-       if (requester_port == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F16: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_path_record(sa->p_log, p_pr, OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&pr_list);\r
-\r
-       /*\r
-          Most SA functions (including this one) are read-only on the\r
-          subnet object, so we grab the lock non-exclusively.\r
-        */\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /* Handle multicast destinations separately */\r
-       if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID) &&\r
-           ib_gid_is_multicast(&p_pr->dgid)) {\r
-               pr_process_multicast(sa, p_sa_mad, &pr_list);\r
-               goto Unlock;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n");\r
-\r
-       if (pr_rcv_get_end_points(sa, p_sa_mad, &p_src_port, &p_dest_port,\r
-                                 &p_dgid) != IB_SA_MAD_STATUS_SUCCESS)\r
-               goto Unlock;\r
-       /*\r
-          What happens next depends on the type of endpoint information\r
-          that was specified....\r
-        */\r
-       if (p_src_port) {\r
-               if (p_dest_port)\r
-                       pr_rcv_process_pair(sa, p_sa_mad, requester_port,\r
-                                           p_src_port, p_dest_port, p_dgid,\r
-                                           &pr_list);\r
-               else\r
-                       pr_rcv_process_half(sa, p_sa_mad, requester_port,\r
-                                           p_src_port, NULL, p_dgid, &pr_list);\r
-       } else {\r
-               if (p_dest_port)\r
-                       pr_rcv_process_half(sa, p_sa_mad, requester_port,\r
-                                           NULL, p_dest_port, p_dgid, &pr_list);\r
-               else\r
-                       /*\r
-                          Katie, bar the door!\r
-                        */\r
-                       pr_rcv_process_world(sa, p_sa_mad, requester_port,\r
-                                            p_dgid, &pr_list);\r
-       }\r
-\r
-Unlock:\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       /* Now, (finally) respond to the PathRecord request */\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_path_rec_t), &pr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_pkey_record.c b/branches/opensm_3/user/opensm/osm_sa_pkey_record.c
deleted file mode 100644 (file)
index 0bbc7f5..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_pkey_item {\r
-       cl_list_item_t list_item;\r
-       ib_pkey_table_record_t rec;\r
-} osm_pkey_item_t;\r
-\r
-typedef struct osm_pkey_search_ctxt {\r
-       const ib_pkey_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       uint16_t block_num;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_pkey_search_ctxt_t;\r
-\r
-static void sa_pkey_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,\r
-                          IN osm_pkey_search_ctxt_t * p_ctxt,\r
-                          IN uint16_t block)\r
-{\r
-       osm_pkey_item_t *p_rec_item;\r
-       uint16_t lid;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4602: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)\r
-               lid = p_physp->port_info.base_lid;\r
-       else\r
-               lid = osm_node_get_base_lid(p_physp->p_node, 0);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New P_Key table for: port 0x%016" PRIx64\r
-               ", lid %u, port %u Block:%u\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-               cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.block_num = block;\r
-       p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);\r
-       p_rec_item->rec.pkey_tbl =\r
-           *(osm_pkey_tbl_block_get(osm_physp_get_pkey_tbl(p_physp), block));\r
-\r
-       cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pkey_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,\r
-                               osm_pkey_search_ctxt_t * p_ctxt)\r
-{\r
-       ib_net64_t comp_mask = p_ctxt->comp_mask;\r
-       uint16_t block, num_blocks;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* we got here with the phys port - all is left is to get the right block */\r
-       if (comp_mask & IB_PKEY_COMPMASK_BLOCK) {\r
-               sa_pkey_create(sa, p_physp, p_ctxt, p_ctxt->block_num);\r
-       } else {\r
-               num_blocks =\r
-                   osm_pkey_tbl_get_num_blocks(osm_physp_get_pkey_tbl\r
-                                               (p_physp));\r
-               for (block = 0; block < num_blocks; block++)\r
-                       sa_pkey_create(sa, p_physp, p_ctxt, block);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pkey_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,\r
-                                osm_pkey_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_pkey_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       const osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       port_num = p_rcvd_rec->port_num;\r
-       p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       /* if this is a switch port we can search all ports\r
-          otherwise we must be looking on port 0 */\r
-       if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {\r
-               /* we put it in the comp mask and port num */\r
-               port_num = p_port->p_physp->port_num;\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Using Physical Default Port Number: 0x%X (for End Node)\n",\r
-                       port_num);\r
-               comp_mask |= IB_PKEY_COMPMASK_PORT;\r
-       }\r
-\r
-       if (comp_mask & IB_PKEY_COMPMASK_PORT) {\r
-               if (port_num < osm_node_get_num_physp(p_port->p_node)) {\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_port->p_node, port_num);\r
-                       /* Check that the p_physp is valid, and that is shares a pkey\r
-                          with the p_req_physp. */\r
-                       if (p_physp &&\r
-                           osm_physp_share_pkey(sa->p_log, p_req_physp,\r
-                                                p_physp))\r
-                               sa_pkey_check_physp(sa, p_physp, p_ctxt);\r
-               } else {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4603: "\r
-                               "Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",\r
-                               port_num,\r
-                               osm_node_get_num_physp(p_port->p_node));\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               num_ports = osm_node_get_num_physp(p_port->p_node);\r
-               for (port_num = 0; port_num < num_ports; port_num++) {\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_port->p_node, port_num);\r
-                       if (!p_physp)\r
-                               continue;\r
-\r
-                       /* if the requester and the p_physp don't share a pkey -\r
-                          continue */\r
-                       if (!osm_physp_share_pkey\r
-                           (sa->p_log, p_req_physp, p_physp))\r
-                               continue;\r
-\r
-                       sa_pkey_check_physp(sa, p_physp, p_ctxt);\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pkey_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_port_t *p_port = (osm_port_t *) p_map_item;\r
-       osm_pkey_search_ctxt_t *p_ctxt = cxt;\r
-\r
-       sa_pkey_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
-}\r
-\r
-void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_pkey_table_record_t *p_rcvd_rec;\r
-       const osm_port_t *p_port = NULL;\r
-       const ib_pkey_table_t *p_pkey;\r
-       cl_qlist_t rec_list;\r
-       osm_pkey_search_ctxt_t context;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_pkey_table_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-       comp_mask = p_rcvd_mad->comp_mask;\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_PKEY_TBL_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4605: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          p922 - P_KeyTableRecords shall only be provided in response\r
-          to trusted requests.\r
-          Check that the requester is a trusted one.\r
-        */\r
-       if (p_rcvd_mad->sm_key != sa->p_subn->opt.sa_key) {\r
-               /* This is not a trusted requester! */\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4608: "\r
-                       "Request from non-trusted requester: "\r
-                       "Given SM_Key:0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_rcvd_mad->sm_key));\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4604: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_pkey = ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.block_num = p_rcvd_rec->block_num;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Got Query Lid:%u(%02X), Block:0x%02X(%02X), Port:0x%02X(%02X)\n",\r
-               cl_ntoh16(p_rcvd_rec->lid),\r
-               (comp_mask & IB_PKEY_COMPMASK_LID) != 0, p_rcvd_rec->port_num,\r
-               (comp_mask & IB_PKEY_COMPMASK_PORT) != 0, p_rcvd_rec->block_num,\r
-               (comp_mask & IB_PKEY_COMPMASK_BLOCK) != 0);\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /*\r
-          If the user specified a LID, it obviously narrows our\r
-          work load, since we don't have to search every port\r
-        */\r
-       if (comp_mask & IB_PKEY_COMPMASK_LID) {\r
-               p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);\r
-               if (!p_port)\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 460B: "\r
-                               "No port found with LID %u\n",\r
-                               cl_ntoh16(p_rcvd_rec->lid));\r
-               else\r
-                       sa_pkey_by_comp_mask(sa, p_port, &context);\r
-       } else\r
-               cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,\r
-                                  sa_pkey_by_comp_mask_cb, &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_pkey_table_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c b/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c
deleted file mode 100644 (file)
index 8702d6b..0000000
+++ /dev/null
@@ -1,539 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_pir_rcv_t.\r
- * This object represents the PortInfoRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_pir_item {\r
-       cl_list_item_t list_item;\r
-       ib_portinfo_record_t rec;\r
-} osm_pir_item_t;\r
-\r
-typedef struct osm_pir_search_ctxt {\r
-       const ib_portinfo_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-       boolean_t is_enhanced_comp_mask;\r
-} osm_pir_search_ctxt_t;\r
-\r
-static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,\r
-                                      IN const osm_physp_t * p_physp,\r
-                                      IN cl_qlist_t * p_list,\r
-                                      IN ib_net16_t const lid)\r
-{\r
-       osm_pir_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2102: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New PortInfoRecord: port 0x%016" PRIx64\r
-               ", lid %u, port %u\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-               cl_ntoh16(lid), osm_physp_get_port_num(p_physp));\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.port_info = p_physp->port_info;\r
-       p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void sa_pir_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,\r
-                         IN osm_pir_search_ctxt_t * p_ctxt)\r
-{\r
-       uint8_t lmc;\r
-       uint16_t max_lid_ho;\r
-       uint16_t base_lid_ho;\r
-       uint16_t match_lid_ho;\r
-       osm_physp_t *p_node_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       if (p_physp->p_node->sw) {\r
-               p_node_physp = osm_node_get_physp_ptr(p_physp->p_node, 0);\r
-               base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_node_physp));\r
-               lmc =\r
-                   osm_switch_sp0_is_lmc_capable(p_physp->p_node->sw,\r
-                                                 sa->p_subn) ?\r
-                   osm_physp_get_lmc(p_node_physp) : 0;\r
-       } else {\r
-               lmc = osm_physp_get_lmc(p_physp);\r
-               base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_physp));\r
-       }\r
-       max_lid_ho = (uint16_t) (base_lid_ho + (1 << lmc) - 1);\r
-\r
-       if (p_ctxt->comp_mask & IB_PIR_COMPMASK_LID) {\r
-               match_lid_ho = cl_ntoh16(p_ctxt->p_rcvd_rec->lid);\r
-\r
-               /*\r
-                  We validate that the lid belongs to this node.\r
-                */\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Comparing LID: %u <= %u <= %u\n",\r
-                       base_lid_ho, match_lid_ho, max_lid_ho);\r
-\r
-               if (match_lid_ho < base_lid_ho || match_lid_ho > max_lid_ho)\r
-                       goto Exit;\r
-       }\r
-\r
-       pir_rcv_new_pir(sa, p_physp, p_ctxt->p_list, cl_hton16(base_lid_ho));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pir_check_physp(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,\r
-                              osm_pir_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_portinfo_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       const ib_port_info_t *p_comp_pi;\r
-       const ib_port_info_t *p_pi;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       p_comp_pi = &p_rcvd_rec->port_info;\r
-       p_pi = &p_physp->port_info;\r
-\r
-       osm_dump_port_info(sa->p_log, osm_node_get_node_guid(p_physp->p_node),\r
-                          p_physp->port_guid, p_physp->port_num,\r
-                          &p_physp->port_info, OSM_LOG_DEBUG);\r
-\r
-       /* We have to re-check the base_lid, since if the given\r
-          base_lid in p_pi is zero - we are comparing on all ports. */\r
-       if (comp_mask & IB_PIR_COMPMASK_BASELID) {\r
-               if (p_comp_pi->base_lid != p_pi->base_lid)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MKEY) {\r
-               if (p_comp_pi->m_key != p_pi->m_key)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_GIDPRE) {\r
-               if (p_comp_pi->subnet_prefix != p_pi->subnet_prefix)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_SMLID) {\r
-               if (p_comp_pi->master_sm_base_lid != p_pi->master_sm_base_lid)\r
-                       goto Exit;\r
-       }\r
-\r
-       /* IBTA 1.2 errata provides support for bitwise compare if the bit 31\r
-          of the attribute modifier of the Get/GetTable is set */\r
-       if (comp_mask & IB_PIR_COMPMASK_CAPMASK) {\r
-               if (p_ctxt->is_enhanced_comp_mask) {\r
-                       if ((p_comp_pi->capability_mask & p_pi->\r
-                            capability_mask) != p_comp_pi->capability_mask)\r
-                               goto Exit;\r
-               } else {\r
-                       if (p_comp_pi->capability_mask != p_pi->capability_mask)\r
-                               goto Exit;\r
-               }\r
-       }\r
-\r
-       if (comp_mask & IB_PIR_COMPMASK_DIAGCODE) {\r
-               if (p_comp_pi->diag_code != p_pi->diag_code)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MKEYLEASEPRD) {\r
-               if (p_comp_pi->m_key_lease_period != p_pi->m_key_lease_period)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LOCALPORTNUM) {\r
-               if (p_comp_pi->local_port_num != p_pi->local_port_num)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LNKWIDTHSUPPORT) {\r
-               if (p_comp_pi->link_width_supported !=\r
-                   p_pi->link_width_supported)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LNKWIDTHACTIVE) {\r
-               if (p_comp_pi->link_width_active != p_pi->link_width_active)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LINKWIDTHENABLED) {\r
-               if (p_comp_pi->link_width_enabled != p_pi->link_width_enabled)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LNKSPEEDSUPPORT) {\r
-               if (ib_port_info_get_link_speed_sup(p_comp_pi) !=\r
-                   ib_port_info_get_link_speed_sup(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_PORTSTATE) {\r
-               if (ib_port_info_get_port_state(p_comp_pi) !=\r
-                   ib_port_info_get_port_state(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_PORTPHYSTATE) {\r
-               if (ib_port_info_get_port_phys_state(p_comp_pi) !=\r
-                   ib_port_info_get_port_phys_state(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LINKDWNDFLTSTATE) {\r
-               if (ib_port_info_get_link_down_def_state(p_comp_pi) !=\r
-                   ib_port_info_get_link_down_def_state(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MKEYPROTBITS) {\r
-               if (ib_port_info_get_mpb(p_comp_pi) !=\r
-                   ib_port_info_get_mpb(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LMC) {\r
-               if (ib_port_info_get_lmc(p_comp_pi) !=\r
-                   ib_port_info_get_lmc(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LINKSPEEDACTIVE) {\r
-               if (ib_port_info_get_link_speed_active(p_comp_pi) !=\r
-                   ib_port_info_get_link_speed_active(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LINKSPEEDENABLE) {\r
-               if (ib_port_info_get_link_speed_enabled(p_comp_pi) !=\r
-                   ib_port_info_get_link_speed_enabled(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_NEIGHBORMTU) {\r
-               if (ib_port_info_get_neighbor_mtu(p_comp_pi) !=\r
-                   ib_port_info_get_neighbor_mtu(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MASTERSMSL) {\r
-               if (ib_port_info_get_master_smsl(p_comp_pi) !=\r
-                   ib_port_info_get_master_smsl(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_VLCAP) {\r
-               if (ib_port_info_get_vl_cap(p_comp_pi) !=\r
-                   ib_port_info_get_vl_cap(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_INITTYPE) {\r
-               if (ib_port_info_get_init_type(p_comp_pi) !=\r
-                   ib_port_info_get_init_type(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_VLHIGHLIMIT) {\r
-               if (p_comp_pi->vl_high_limit != p_pi->vl_high_limit)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_VLARBHIGHCAP) {\r
-               if (p_comp_pi->vl_arb_high_cap != p_pi->vl_arb_high_cap)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_VLARBLOWCAP) {\r
-               if (p_comp_pi->vl_arb_low_cap != p_pi->vl_arb_low_cap)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MTUCAP) {\r
-               if (ib_port_info_get_mtu_cap(p_comp_pi) !=\r
-                   ib_port_info_get_mtu_cap(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_VLSTALLCNT) {\r
-               if (ib_port_info_get_vl_stall_count(p_comp_pi) !=\r
-                   ib_port_info_get_vl_stall_count(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_HOQLIFE) {\r
-               if ((p_comp_pi->vl_stall_life & 0x1F) !=\r
-                   (p_pi->vl_stall_life & 0x1F))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_OPVLS) {\r
-               if ((p_comp_pi->vl_enforce & 0xF0) != (p_pi->vl_enforce & 0xF0))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_PARENFIN) {\r
-               if ((p_comp_pi->vl_enforce & 0x08) != (p_pi->vl_enforce & 0x08))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_PARENFOUT) {\r
-               if ((p_comp_pi->vl_enforce & 0x04) != (p_pi->vl_enforce & 0x04))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_FILTERRAWIN) {\r
-               if ((p_comp_pi->vl_enforce & 0x02) != (p_pi->vl_enforce & 0x02))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_FILTERRAWOUT) {\r
-               if ((p_comp_pi->vl_enforce & 0x01) != (p_pi->vl_enforce & 0x01))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_MKEYVIO) {\r
-               if (p_comp_pi->m_key_violations != p_pi->m_key_violations)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_PKEYVIO) {\r
-               if (p_comp_pi->p_key_violations != p_pi->p_key_violations)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_QKEYVIO) {\r
-               if (p_comp_pi->q_key_violations != p_pi->q_key_violations)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_GUIDCAP) {\r
-               if (p_comp_pi->guid_cap != p_pi->guid_cap)\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_SUBNTO) {\r
-               if (ib_port_info_get_timeout(p_comp_pi) !=\r
-                   ib_port_info_get_timeout(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_RESPTIME) {\r
-               if ((p_comp_pi->resp_time_value & 0x1F) !=\r
-                   (p_pi->resp_time_value & 0x1F))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_LOCALPHYERR) {\r
-               if (ib_port_info_get_local_phy_err_thd(p_comp_pi) !=\r
-                   ib_port_info_get_local_phy_err_thd(p_pi))\r
-                       goto Exit;\r
-       }\r
-       if (comp_mask & IB_PIR_COMPMASK_OVERRUNERR) {\r
-               if (ib_port_info_get_overrun_err_thd(p_comp_pi) !=\r
-                   ib_port_info_get_overrun_err_thd(p_pi))\r
-                       goto Exit;\r
-       }\r
-\r
-       sa_pir_create(sa, p_physp, p_ctxt);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node,\r
-                               osm_pir_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_portinfo_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       const osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       const osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       num_ports = osm_node_get_num_physp(p_node);\r
-\r
-       if (comp_mask & IB_PIR_COMPMASK_PORTNUM) {\r
-               if (p_rcvd_rec->port_num < num_ports) {\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_node,\r
-                                                  p_rcvd_rec->port_num);\r
-                       /* Check that the p_physp is valid, and that the\r
-                          p_physp and the p_req_physp share a pkey. */\r
-                       if (p_physp &&\r
-                           osm_physp_share_pkey(sa->p_log, p_req_physp,\r
-                                                p_physp))\r
-                               sa_pir_check_physp(sa, p_physp, p_ctxt);\r
-               }\r
-       } else {\r
-               for (port_num = 0; port_num < num_ports; port_num++) {\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (!p_physp)\r
-                               continue;\r
-\r
-                       /* if the requester and the p_physp don't share a pkey -\r
-                          continue */\r
-                       if (!osm_physp_share_pkey\r
-                           (sa->p_log, p_req_physp, p_physp))\r
-                               continue;\r
-\r
-                       sa_pir_check_physp(sa, p_physp, p_ctxt);\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_pir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) p_map_item;\r
-       osm_pir_search_ctxt_t *p_ctxt = cxt;\r
-\r
-       sa_pir_by_comp_mask(p_ctxt->sa, p_node, p_ctxt);\r
-}\r
-\r
-void osm_pir_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_portinfo_record_t *p_rcvd_rec;\r
-       const osm_port_t *p_port = NULL;\r
-       const ib_port_info_t *p_pi;\r
-       cl_qlist_t rec_list;\r
-       osm_pir_search_ctxt_t context;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_portinfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-       comp_mask = p_rcvd_mad->comp_mask;\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2105: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2104: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_portinfo_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);\r
-\r
-       p_pi = &p_rcvd_rec->port_info;\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-       context.is_enhanced_comp_mask =\r
-           cl_ntoh32(p_rcvd_mad->attr_mod) & (1 << 31);\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /*\r
-          If the user specified a LID, it obviously narrows our\r
-          work load, since we don't have to search every port\r
-        */\r
-       if (comp_mask & (IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_BASELID)) {\r
-               p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);\r
-               if (p_port)\r
-                       sa_pir_by_comp_mask(sa, p_port->p_node, &context);\r
-               else\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2109: "\r
-                               "No port found with LID %u\n",\r
-                               cl_ntoh16(p_rcvd_rec->lid));\r
-       } else\r
-               cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,\r
-                                  sa_pir_by_comp_mask_cb, &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       /*\r
-          p922 - The M_Key returned shall be zero, except in the case of a\r
-          trusted request.\r
-          Note: In the mad controller we check that the SM_Key received on\r
-          the mad is valid. Meaning - is either zero or equal to the local\r
-          sm_key.\r
-        */\r
-       if (!p_rcvd_mad->sm_key) {\r
-               osm_pir_item_t *item;\r
-               for (item = (osm_pir_item_t *) cl_qlist_head(&rec_list);\r
-                    item != (osm_pir_item_t *) cl_qlist_end(&rec_list);\r
-                    item = (osm_pir_item_t *) cl_qlist_next(&item->list_item))\r
-                       item->rec.port_info.m_key = 0;\r
-       }\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_portinfo_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_service_record.c b/branches/opensm_3/user/opensm/osm_sa_service_record.c
deleted file mode 100644 (file)
index e007e02..0000000
+++ /dev/null
@@ -1,800 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sr_rcv_t.\r
- * This object represents the ServiceRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_service.h>\r
-#include <opensm/osm_pkey.h>\r
-\r
-typedef struct osm_sr_item {\r
-       cl_list_item_t list_item;\r
-       ib_service_record_t service_rec;\r
-} osm_sr_item_t;\r
-\r
-typedef struct osm_sr_match_item {\r
-       cl_qlist_t sr_list;\r
-       ib_service_record_t *p_service_rec;\r
-       ib_net64_t comp_mask;\r
-       osm_sa_t *sa;\r
-} osm_sr_match_item_t;\r
-\r
-typedef struct osm_sr_search_ctxt {\r
-       osm_sr_match_item_t *p_sr_item;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_sr_search_ctxt_t;\r
-\r
-static boolean_t\r
-match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,\r
-                                  IN const osm_madw_t * p_madw,\r
-                                  ib_service_record_t * p_service_rec,\r
-                                  ib_net64_t const comp_mask)\r
-{\r
-       boolean_t valid = TRUE;\r
-       osm_physp_t *p_req_physp;\r
-       ib_net64_t service_guid;\r
-       osm_port_t *service_port;\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2404: "\r
-                       "Cannot find requester physical port\n");\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SPKEY) == IB_SR_COMPMASK_SPKEY) {\r
-               /* We have a ServiceP_Key - check matching on requester port, and\r
-                  ServiceGid port (if such exists) */\r
-               /* Make sure it matches the p_req_physp */\r
-               if (!osm_physp_has_pkey\r
-                   (sa->p_log, p_service_rec->service_pkey, p_req_physp)) {\r
-                       valid = FALSE;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* Make sure it matches the port of the ServiceGid */\r
-               if ((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID) {\r
-                       service_guid =\r
-                           p_service_rec->service_gid.unicast.interface_id;\r
-                       service_port =\r
-                           osm_get_port_by_guid(sa->p_subn, service_guid);\r
-                       if (!service_port) {\r
-                               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2405: "\r
-                                       "No port object for port 0x%016" PRIx64\r
-                                       "\n", cl_ntoh64(service_guid));\r
-                               valid = FALSE;\r
-                               goto Exit;\r
-                       }\r
-                       /* check on the table of the default physical port of the service port */\r
-                       if (!osm_physp_has_pkey(sa->p_log,\r
-                                               p_service_rec->service_pkey,\r
-                                               service_port->p_physp)) {\r
-                               valid = FALSE;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-\r
-Exit:\r
-       return valid;\r
-}\r
-\r
-static boolean_t\r
-match_name_to_key_association(IN osm_sa_t * sa,\r
-                             ib_service_record_t * p_service_rec,\r
-                             ib_net64_t comp_mask)\r
-{\r
-       UNUSED_PARAM(p_service_rec);\r
-       UNUSED_PARAM(sa);\r
-\r
-       if ((comp_mask & (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) ==\r
-           (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) {\r
-               /* For now, we are not maintaining the ServiceAssociation record\r
-                * so just return TRUE\r
-                */\r
-               return TRUE;\r
-       }\r
-\r
-       return TRUE;\r
-}\r
-\r
-static boolean_t validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)\r
-{\r
-       boolean_t valid = TRUE;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_service_record_t *p_recvd_service_rec;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_service_rec =\r
-           (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       valid = match_service_pkey_with_ports_pkey(sa, p_madw,\r
-                                                  p_recvd_service_rec,\r
-                                                  p_sa_mad->comp_mask);\r
-       if (!valid) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "No Match for Service Pkey\n");\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-       valid = match_name_to_key_association(sa, p_recvd_service_rec,\r
-                                             p_sa_mad->comp_mask);\r
-       if (!valid) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Service Record Name to key matching failed\n");\r
-               valid = FALSE;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return valid;\r
-}\r
-\r
-static void sr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,\r
-                          IN cl_qlist_t * p_list)\r
-{\r
-       /* p923 - The ServiceKey shall be set to 0, except in the case of\r
-          a trusted request.\r
-          Note: In the mad controller we check that the SM_Key received on\r
-          the mad is valid. Meaning - is either zero or equal to the local\r
-          sm_key.\r
-        */\r
-       if (!osm_madw_get_sa_mad_ptr(p_madw)->sm_key) {\r
-               osm_sr_item_t *item;\r
-               for (item = (osm_sr_item_t *) cl_qlist_head(p_list);\r
-                    item != (osm_sr_item_t *) cl_qlist_end(p_list);\r
-                    item = (osm_sr_item_t *) cl_qlist_next(&item->list_item))\r
-                       memset(item->service_rec.service_key, 0,\r
-                              sizeof(item->service_rec.service_key));\r
-       }\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_service_record_t), p_list);\r
-}\r
-\r
-static void get_matching_sr(IN cl_list_item_t * p_list_item, IN void *context)\r
-{\r
-       osm_sr_search_ctxt_t *p_ctxt = context;\r
-       osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;\r
-       osm_sr_item_t *p_sr_pool_item;\r
-       osm_sr_match_item_t *p_sr_item = p_ctxt->p_sr_item;\r
-       ib_net64_t comp_mask = p_sr_item->comp_mask;\r
-       const osm_physp_t *p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SID) == IB_SR_COMPMASK_SID) {\r
-               if (p_sr_item->p_service_rec->service_id !=\r
-                   p_svcr->service_record.service_id)\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SGID) == IB_SR_COMPMASK_SGID) {\r
-               if (memcmp(&p_sr_item->p_service_rec->service_gid,\r
-                          &p_svcr->service_record.service_gid,\r
-                          sizeof(p_svcr->service_record.service_gid)) != 0)\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SPKEY) == IB_SR_COMPMASK_SPKEY) {\r
-               if (p_sr_item->p_service_rec->service_pkey !=\r
-                   p_svcr->service_record.service_pkey)\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SKEY) == IB_SR_COMPMASK_SKEY) {\r
-               if (memcmp(p_sr_item->p_service_rec->service_key,\r
-                          p_svcr->service_record.service_key,\r
-                          16 * sizeof(uint8_t)))\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SNAME) == IB_SR_COMPMASK_SNAME) {\r
-               if (memcmp(p_sr_item->p_service_rec->service_name,\r
-                          p_svcr->service_record.service_name,\r
-                          sizeof(p_svcr->service_record.service_name)) != 0)\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_0) == IB_SR_COMPMASK_SDATA8_0) {\r
-               if (p_sr_item->p_service_rec->service_data8[0] !=\r
-                   p_svcr->service_record.service_data8[0])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_1) == IB_SR_COMPMASK_SDATA8_1) {\r
-               if (p_sr_item->p_service_rec->service_data8[1] !=\r
-                   p_svcr->service_record.service_data8[1])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_2) == IB_SR_COMPMASK_SDATA8_2) {\r
-               if (p_sr_item->p_service_rec->service_data8[2] !=\r
-                   p_svcr->service_record.service_data8[2])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_3) == IB_SR_COMPMASK_SDATA8_3) {\r
-               if (p_sr_item->p_service_rec->service_data8[3] !=\r
-                   p_svcr->service_record.service_data8[3])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_4) == IB_SR_COMPMASK_SDATA8_4) {\r
-               if (p_sr_item->p_service_rec->service_data8[4] !=\r
-                   p_svcr->service_record.service_data8[4])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_5) == IB_SR_COMPMASK_SDATA8_5) {\r
-               if (p_sr_item->p_service_rec->service_data8[5] !=\r
-                   p_svcr->service_record.service_data8[5])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_6) == IB_SR_COMPMASK_SDATA8_6) {\r
-               if (p_sr_item->p_service_rec->service_data8[6] !=\r
-                   p_svcr->service_record.service_data8[6])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_7) == IB_SR_COMPMASK_SDATA8_7) {\r
-               if (p_sr_item->p_service_rec->service_data8[7] !=\r
-                   p_svcr->service_record.service_data8[7])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_8) == IB_SR_COMPMASK_SDATA8_8) {\r
-               if (p_sr_item->p_service_rec->service_data8[8] !=\r
-                   p_svcr->service_record.service_data8[8])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_9) == IB_SR_COMPMASK_SDATA8_9) {\r
-               if (p_sr_item->p_service_rec->service_data8[9] !=\r
-                   p_svcr->service_record.service_data8[9])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_10) == IB_SR_COMPMASK_SDATA8_10) {\r
-               if (p_sr_item->p_service_rec->service_data8[10] !=\r
-                   p_svcr->service_record.service_data8[10])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_11) == IB_SR_COMPMASK_SDATA8_11) {\r
-               if (p_sr_item->p_service_rec->service_data8[11] !=\r
-                   p_svcr->service_record.service_data8[11])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_12) == IB_SR_COMPMASK_SDATA8_12) {\r
-               if (p_sr_item->p_service_rec->service_data8[12] !=\r
-                   p_svcr->service_record.service_data8[12])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_13) == IB_SR_COMPMASK_SDATA8_13) {\r
-               if (p_sr_item->p_service_rec->service_data8[13] !=\r
-                   p_svcr->service_record.service_data8[13])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_14) == IB_SR_COMPMASK_SDATA8_14) {\r
-               if (p_sr_item->p_service_rec->service_data8[14] !=\r
-                   p_svcr->service_record.service_data8[14])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA8_15) == IB_SR_COMPMASK_SDATA8_15) {\r
-               if (p_sr_item->p_service_rec->service_data8[15] !=\r
-                   p_svcr->service_record.service_data8[15])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_0) == IB_SR_COMPMASK_SDATA16_0) {\r
-               if (p_sr_item->p_service_rec->service_data16[0] !=\r
-                   p_svcr->service_record.service_data16[0])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_1) == IB_SR_COMPMASK_SDATA16_1) {\r
-               if (p_sr_item->p_service_rec->service_data16[1] !=\r
-                   p_svcr->service_record.service_data16[1])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_2) == IB_SR_COMPMASK_SDATA16_2) {\r
-               if (p_sr_item->p_service_rec->service_data16[2] !=\r
-                   p_svcr->service_record.service_data16[2])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_3) == IB_SR_COMPMASK_SDATA16_3) {\r
-               if (p_sr_item->p_service_rec->service_data16[3] !=\r
-                   p_svcr->service_record.service_data16[3])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_4) == IB_SR_COMPMASK_SDATA16_4) {\r
-               if (p_sr_item->p_service_rec->service_data16[4] !=\r
-                   p_svcr->service_record.service_data16[4])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_5) == IB_SR_COMPMASK_SDATA16_5) {\r
-               if (p_sr_item->p_service_rec->service_data16[5] !=\r
-                   p_svcr->service_record.service_data16[5])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_6) == IB_SR_COMPMASK_SDATA16_6) {\r
-               if (p_sr_item->p_service_rec->service_data16[6] !=\r
-                   p_svcr->service_record.service_data16[6])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA16_7) == IB_SR_COMPMASK_SDATA16_7) {\r
-               if (p_sr_item->p_service_rec->service_data16[7] !=\r
-                   p_svcr->service_record.service_data16[7])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA32_0) == IB_SR_COMPMASK_SDATA32_0) {\r
-               if (p_sr_item->p_service_rec->service_data32[0] !=\r
-                   p_svcr->service_record.service_data32[0])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA32_1) == IB_SR_COMPMASK_SDATA32_1) {\r
-               if (p_sr_item->p_service_rec->service_data32[1] !=\r
-                   p_svcr->service_record.service_data32[1])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA32_2) == IB_SR_COMPMASK_SDATA32_2) {\r
-               if (p_sr_item->p_service_rec->service_data32[2] !=\r
-                   p_svcr->service_record.service_data32[2])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA32_3) == IB_SR_COMPMASK_SDATA32_3) {\r
-               if (p_sr_item->p_service_rec->service_data32[3] !=\r
-                   p_svcr->service_record.service_data32[3])\r
-                       return;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA64_0) == IB_SR_COMPMASK_SDATA64_0) {\r
-               if (p_sr_item->p_service_rec->service_data64[0] !=\r
-                   p_svcr->service_record.service_data64[0])\r
-                       return;\r
-       }\r
-       if ((comp_mask & IB_SR_COMPMASK_SDATA64_1) == IB_SR_COMPMASK_SDATA64_1) {\r
-               if (p_sr_item->p_service_rec->service_data64[1] !=\r
-                   p_svcr->service_record.service_data64[1])\r
-                       return;\r
-       }\r
-\r
-       /* Check that the requester port has the pkey which is the service_pkey.\r
-          If not - then it cannot receive this ServiceRecord. */\r
-       /* The check is relevant only if the service_pkey is valid */\r
-       if (!ib_pkey_is_invalid(p_svcr->service_record.service_pkey)) {\r
-               if (!osm_physp_has_pkey(p_sr_item->sa->p_log,\r
-                                       p_svcr->service_record.service_pkey,\r
-                                       p_req_physp)) {\r
-                       OSM_LOG(p_sr_item->sa->p_log, OSM_LOG_VERBOSE,\r
-                               "requester port doesn't have the service_pkey: 0x%X\n",\r
-                               cl_ntoh16(p_svcr->service_record.service_pkey));\r
-                       return;\r
-               }\r
-       }\r
-\r
-       p_sr_pool_item = malloc(sizeof(*p_sr_pool_item));\r
-       if (p_sr_pool_item == NULL) {\r
-               OSM_LOG(p_sr_item->sa->p_log, OSM_LOG_ERROR, "ERR 2408: "\r
-                       "Unable to acquire Service Record from pool\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_sr_pool_item->service_rec = p_svcr->service_record;\r
-\r
-       cl_qlist_insert_tail(&p_sr_item->sr_list, &p_sr_pool_item->list_item);\r
-\r
-Exit:\r
-       return;\r
-}\r
-\r
-static void sr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_service_record_t *p_recvd_service_rec;\r
-       osm_sr_match_item_t sr_match_item;\r
-       osm_sr_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2409: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_service_rec =\r
-           (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_service_record(sa->p_log, p_recvd_service_rec,\r
-                                       OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&sr_match_item.sr_list);\r
-       sr_match_item.p_service_rec = p_recvd_service_rec;\r
-       sr_match_item.comp_mask = p_sa_mad->comp_mask;\r
-       sr_match_item.sa = sa;\r
-\r
-       context.p_sr_item = &sr_match_item;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       /* Grab the lock */\r
-       cl_plock_excl_acquire(sa->p_lock);\r
-\r
-       cl_qlist_apply_func(&sa->p_subn->sa_sr_list, get_matching_sr, &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       if (p_sa_mad->method == IB_MAD_METHOD_GET &&\r
-           cl_qlist_count(&sr_match_item.sr_list) == 0) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "No records matched the Service Record query\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RECORDS);\r
-               goto Exit;\r
-       }\r
-\r
-       sr_rcv_respond(sa, p_madw, &sr_match_item.sr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return;\r
-}\r
-\r
-static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_service_record_t *p_recvd_service_rec;\r
-       ib_net64_t comp_mask;\r
-       osm_svcr_t *p_svcr;\r
-       osm_sr_item_t *p_sr_item;\r
-       cl_qlist_t sr_list;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_service_rec =\r
-           (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       comp_mask = p_sa_mad->comp_mask;\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_service_record(sa->p_log, p_recvd_service_rec,\r
-                                       OSM_LOG_DEBUG);\r
-\r
-       if ((comp_mask & (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) !=\r
-           (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                       "Component Mask RID check failed for METHOD_SET\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);\r
-               goto Exit;\r
-       }\r
-\r
-       /* if we were not provided with a service lease make it\r
-          infinite */\r
-       if ((comp_mask & IB_SR_COMPMASK_SLEASE) != IB_SR_COMPMASK_SLEASE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "ServiceLease Component Mask not set - using infinite lease\n");\r
-               p_recvd_service_rec->service_lease = 0xFFFFFFFF;\r
-       }\r
-\r
-       /* Grab the lock */\r
-       cl_plock_excl_acquire(sa->p_lock);\r
-\r
-       /* If Record exists with matching RID */\r
-       p_svcr = osm_svcr_get_by_rid(sa->p_subn, sa->p_log,\r
-                                    p_recvd_service_rec);\r
-\r
-       if (p_svcr == NULL) {\r
-               /* Create the instance of the osm_svcr_t object */\r
-               p_svcr = osm_svcr_new(p_recvd_service_rec);\r
-               if (p_svcr == NULL) {\r
-                       cl_plock_release(sa->p_lock);\r
-\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2411: "\r
-                               "osm_svcr_get_by_rid failed\n");\r
-\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_NO_RESOURCES);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* Add this new osm_svcr_t object to subnet object */\r
-               osm_svcr_insert_to_db(sa->p_subn, sa->p_log, p_svcr);\r
-\r
-       } else                  /* Update the old instance of the osm_svcr_t object */\r
-               osm_svcr_init(p_svcr, p_recvd_service_rec);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       if (p_recvd_service_rec->service_lease != 0xFFFFFFFF) {\r
-#if 0\r
-               cl_timer_trim(&sa->sr_timer,\r
-                             p_recvd_service_rec->service_lease * 1000);\r
-#endif\r
-               /*  This was a bug since no check was made to see if too long */\r
-               /*  just make sure the timer works - get a call back within a second */\r
-               cl_timer_trim(&sa->sr_timer, 1000);\r
-               p_svcr->modified_time = cl_get_time_stamp_sec();\r
-       }\r
-\r
-       p_sr_item = malloc(sizeof(*p_sr_item));\r
-       if (p_sr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2412: "\r
-                       "Unable to acquire Service record\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);\r
-               goto Exit;\r
-       }\r
-\r
-       if ((comp_mask & IB_SR_COMPMASK_SPKEY) != IB_SR_COMPMASK_SPKEY)\r
-               /* Set the Default Service P_Key in the response */\r
-               p_recvd_service_rec->service_pkey = IB_DEFAULT_PKEY;\r
-\r
-       p_sr_item->service_rec = *p_recvd_service_rec;\r
-       cl_qlist_init(&sr_list);\r
-\r
-       cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);\r
-\r
-       sr_rcv_respond(sa, p_madw, &sr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)\r
-{\r
-       ib_sa_mad_t *p_sa_mad;\r
-       ib_service_record_t *p_recvd_service_rec;\r
-       ib_net64_t comp_mask;\r
-       osm_svcr_t *p_svcr;\r
-       osm_sr_item_t *p_sr_item;\r
-       cl_qlist_t sr_list;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_recvd_service_rec =\r
-           (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       comp_mask = p_sa_mad->comp_mask;\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_service_record(sa->p_log, p_recvd_service_rec,\r
-                                       OSM_LOG_DEBUG);\r
-\r
-       /* Grab the lock */\r
-       cl_plock_excl_acquire(sa->p_lock);\r
-\r
-       /* If Record exists with matching RID */\r
-       p_svcr = osm_svcr_get_by_rid(sa->p_subn, sa->p_log,\r
-                                    p_recvd_service_rec);\r
-\r
-       if (p_svcr == NULL) {\r
-               cl_plock_release(sa->p_lock);\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "No records matched the RID\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RECORDS);\r
-               goto Exit;\r
-       } else {\r
-               osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);\r
-       }\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       p_sr_item = malloc(sizeof(*p_sr_item));\r
-       if (p_sr_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2413: "\r
-                       "Unable to acquire Service record\n");\r
-               osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES);\r
-               goto Exit;\r
-       }\r
-\r
-       /* provide back the copy of the record */\r
-       p_sr_item->service_rec = p_svcr->service_record;\r
-       cl_qlist_init(&sr_list);\r
-\r
-       cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);\r
-\r
-       if (p_svcr)\r
-               osm_svcr_delete(p_svcr);\r
-\r
-       sr_rcv_respond(sa, p_madw, &sr_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return;\r
-}\r
-\r
-void osm_sr_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sa_t *sa = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_sa_mad_t *p_sa_mad;\r
-       boolean_t valid;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-\r
-       CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD);\r
-\r
-       switch (p_sa_mad->method) {\r
-       case IB_MAD_METHOD_SET:\r
-               valid = validate_sr(sa, p_madw);\r
-               if (!valid) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                               "Component Mask check failed for set request\n");\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-               sr_rcv_process_set_method(sa, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_DELETE:\r
-               valid = validate_sr(sa, p_madw);\r
-               if (!valid) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Component Mask check failed for delete request\n");\r
-                       osm_sa_send_error(sa, p_madw,\r
-                                         IB_SA_MAD_STATUS_REQ_INVALID);\r
-                       goto Exit;\r
-               }\r
-               sr_rcv_process_delete_method(sa, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_GET:\r
-       case IB_MAD_METHOD_GETTABLE:\r
-               sr_rcv_process_get_method(sa, p_madw);\r
-               break;\r
-       default:\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_sa_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               break;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-void osm_sr_rcv_lease_cb(IN void *context)\r
-{\r
-       osm_sa_t *sa = context;\r
-       cl_list_item_t *p_list_item;\r
-       cl_list_item_t *p_next_list_item;\r
-       osm_svcr_t *p_svcr;\r
-       uint32_t curr_time;\r
-       uint32_t elapsed_time;\r
-       uint32_t trim_time = 20;        /*  maxiaml timer refresh is 20 seconds */\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       cl_plock_excl_acquire(sa->p_lock);\r
-\r
-       p_list_item = cl_qlist_head(&sa->p_subn->sa_sr_list);\r
-\r
-       while (p_list_item != cl_qlist_end(&sa->p_subn->sa_sr_list)) {\r
-               p_svcr = (osm_svcr_t *) p_list_item;\r
-\r
-               if (p_svcr->service_record.service_lease == 0xFFFFFFFF) {\r
-                       p_list_item = cl_qlist_next(p_list_item);\r
-                       continue;\r
-               }\r
-\r
-               /* current time in seconds */\r
-               curr_time = cl_get_time_stamp_sec();\r
-               /* elapsed time from last modify */\r
-               elapsed_time = curr_time - p_svcr->modified_time;\r
-               /* but it can not be less then 1 */\r
-               if (elapsed_time < 1)\r
-                       elapsed_time = 1;\r
-\r
-               if (elapsed_time < p_svcr->lease_period) {\r
-                       /*\r
-                          Just update the service lease period\r
-                          note: for simplicity we work with a uint32_t field\r
-                          external to the network order lease_period of the MAD\r
-                        */\r
-                       p_svcr->lease_period -= elapsed_time;\r
-\r
-                       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                               "Remaining time for Service Name:%s is:0x%X\n",\r
-                               p_svcr->service_record.service_name,\r
-                               p_svcr->lease_period);\r
-\r
-                       p_svcr->modified_time = curr_time;\r
-\r
-                       /* Update the trim timer */\r
-                       if (trim_time > p_svcr->lease_period) {\r
-                               trim_time = p_svcr->lease_period;\r
-                               if (trim_time < 1)\r
-                                       trim_time = 1;\r
-                       }\r
-\r
-                       p_list_item = cl_qlist_next(p_list_item);\r
-                       continue;\r
-\r
-               } else {\r
-                       p_next_list_item = cl_qlist_next(p_list_item);\r
-\r
-                       /* Remove the service Record */\r
-                       osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);\r
-\r
-                       osm_svcr_delete(p_svcr);\r
-\r
-                       p_list_item = p_next_list_item;\r
-                       continue;\r
-               }\r
-       }\r
-\r
-       /* Release the Lock */\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       if (trim_time != 0xFFFFFFFF) {\r
-               cl_timer_trim(&sa->sr_timer, trim_time * 1000); /* Convert to milli seconds */\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_slvl_record.c b/branches/opensm_3/user/opensm/osm_sa_slvl_record.c
deleted file mode 100644 (file)
index 5dbbb6a..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_slvl_rec_rcv_t.\r
- * This object represents the SLtoVL Mapping Query Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_slvl_item {\r
-       cl_list_item_t list_item;\r
-       ib_slvl_table_record_t rec;\r
-} osm_slvl_item_t;\r
-\r
-typedef struct osm_slvl_search_ctxt {\r
-       const ib_slvl_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       uint8_t in_port_num;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_slvl_search_ctxt_t;\r
-\r
-static void sa_slvl_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,\r
-                          IN osm_slvl_search_ctxt_t * p_ctxt,\r
-                          IN uint8_t in_port_idx)\r
-{\r
-       osm_slvl_item_t *p_rec_item;\r
-       uint16_t lid;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2602: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)\r
-               lid = p_physp->port_info.base_lid;\r
-       else\r
-               lid = osm_node_get_base_lid(p_physp->p_node, 0);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New SLtoVL Map for: OUT port 0x%016" PRIx64\r
-               ", lid 0x%X, port %u to In Port:%u\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-               cl_ntoh16(lid), osm_physp_get_port_num(p_physp), in_port_idx);\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.out_port_num = osm_physp_get_port_num(p_physp);\r
-       p_rec_item->rec.in_port_num = in_port_idx;\r
-       p_rec_item->rec.slvl_tbl =\r
-           *(osm_physp_get_slvl_tbl(p_physp, in_port_idx));\r
-\r
-       cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,\r
-                                osm_slvl_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_slvl_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       const osm_physp_t *p_out_physp, *p_in_physp;\r
-       uint8_t in_port_num, out_port_num;\r
-       uint8_t num_ports;\r
-       uint8_t in_port_start, in_port_end;\r
-       uint8_t out_port_start, out_port_end;\r
-       const osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       num_ports = osm_node_get_num_physp(p_port->p_node);\r
-       in_port_start = 0;\r
-       in_port_end = num_ports - 1;\r
-       out_port_start = 0;\r
-       out_port_end = num_ports - 1;\r
-       p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Using Physical Default Port Number: 0x%X (for End Node)\n",\r
-                       p_port->p_physp->port_num);\r
-               p_out_physp = p_port->p_physp;\r
-               /* check that the p_out_physp and the p_req_physp share a pkey */\r
-               if (osm_physp_share_pkey(sa->p_log, p_req_physp, p_out_physp))\r
-                       sa_slvl_create(sa, p_out_physp, p_ctxt, 0);\r
-       } else {\r
-               if (comp_mask & IB_SLVL_COMPMASK_OUT_PORT)\r
-                       out_port_start = out_port_end =\r
-                           p_rcvd_rec->out_port_num;\r
-               if (comp_mask & IB_SLVL_COMPMASK_IN_PORT)\r
-                       in_port_start = in_port_end = p_rcvd_rec->in_port_num;\r
-\r
-               for (out_port_num = out_port_start;\r
-                    out_port_num <= out_port_end; out_port_num++) {\r
-                       p_out_physp =\r
-                           osm_node_get_physp_ptr(p_port->p_node,\r
-                                                  out_port_num);\r
-                       if (!p_out_physp)\r
-                               continue;\r
-\r
-                       for (in_port_num = in_port_start;\r
-                            in_port_num <= in_port_end; in_port_num++) {\r
-#if 0\r
-                               if (out_port_num && out_port_num == in_port_num)\r
-                                       continue;\r
-#endif\r
-\r
-                               p_in_physp =\r
-                                   osm_node_get_physp_ptr(p_port->p_node,\r
-                                                          in_port_num);\r
-                               if (!p_in_physp)\r
-                                       continue;\r
-\r
-                               /* if the requester and the p_out_physp don't share a pkey -\r
-                                  continue */\r
-                               if (!osm_physp_share_pkey\r
-                                   (sa->p_log, p_req_physp, p_out_physp))\r
-                                       continue;\r
-\r
-                               sa_slvl_create(sa, p_out_physp, p_ctxt,\r
-                                              in_port_num);\r
-                       }\r
-               }\r
-       }\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_slvl_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_port_t *p_port = (osm_port_t *) p_map_item;\r
-       osm_slvl_search_ctxt_t *p_ctxt = cxt;\r
-\r
-       sa_slvl_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
-}\r
-\r
-void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *p_rcvd_mad;\r
-       const ib_slvl_table_record_t *p_rcvd_rec;\r
-       const osm_port_t *p_port = NULL;\r
-       cl_qlist_t rec_list;\r
-       osm_slvl_search_ctxt_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_slvl_table_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);\r
-       comp_mask = p_rcvd_mad->comp_mask;\r
-\r
-       CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_SLVL_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&\r
-           p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2604: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(p_rcvd_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2603: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = p_rcvd_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.in_port_num = p_rcvd_rec->in_port_num;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Got Query Lid:%u(%02X), In-Port:0x%02X(%02X), Out-Port:0x%02X(%02X)\n",\r
-               cl_ntoh16(p_rcvd_rec->lid),\r
-               (comp_mask & IB_SLVL_COMPMASK_LID) != 0,\r
-               p_rcvd_rec->in_port_num,\r
-               (comp_mask & IB_SLVL_COMPMASK_IN_PORT) != 0,\r
-               p_rcvd_rec->out_port_num,\r
-               (comp_mask & IB_SLVL_COMPMASK_OUT_PORT) != 0);\r
-\r
-       /*\r
-          If the user specified a LID, it obviously narrows our\r
-          work load, since we don't have to search every port\r
-        */\r
-       if (comp_mask & IB_SLVL_COMPMASK_LID) {\r
-               p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);\r
-               if (!p_port) {\r
-                       status = IB_NOT_FOUND;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2608: "\r
-                               "No port found with LID %u\n",\r
-                               cl_ntoh16(p_rcvd_rec->lid));\r
-               }\r
-       }\r
-\r
-       if (status == IB_SUCCESS) {\r
-               /* if we have a unique port - no need for a port search */\r
-               if (p_port)\r
-                       /*  this does the loop on all the port phys ports */\r
-                       sa_slvl_by_comp_mask(sa, p_port, &context);\r
-               else\r
-                       cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,\r
-                                          sa_slvl_by_comp_mask_cb, &context);\r
-       }\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_slvl_table_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c b/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c
deleted file mode 100644 (file)
index 3b77263..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_smir_rcv_t.\r
- * This object represents the SMInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_remote_sm.h>\r
-#include <opensm/osm_sa.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-typedef struct osm_smir_item {\r
-       cl_list_item_t list_item;\r
-       ib_sminfo_record_t rec;\r
-} osm_smir_item_t;\r
-\r
-typedef struct osm_smir_search_ctxt {\r
-       const ib_sminfo_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_smir_search_ctxt_t;\r
-\r
-static ib_api_status_t smir_rcv_new_smir(IN osm_sa_t * sa,\r
-                                        IN const osm_port_t * p_port,\r
-                                        IN cl_qlist_t * p_list,\r
-                                        IN ib_net64_t const guid,\r
-                                        IN ib_net32_t const act_count,\r
-                                        IN uint8_t const pri_state,\r
-                                        IN const osm_physp_t * p_req_physp)\r
-{\r
-       osm_smir_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2801: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New SMInfo: GUID 0x%016" PRIx64 "\n", cl_ntoh64(guid));\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = osm_port_get_base_lid(p_port);\r
-       p_rec_item->rec.sm_info.guid = guid;\r
-       p_rec_item->rec.sm_info.act_count = act_count;\r
-       p_rec_item->rec.sm_info.pri_state = pri_state;\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void sa_smir_by_comp_mask(IN osm_sa_t * sa,\r
-                                IN const osm_remote_sm_t * p_rem_sm,\r
-                                osm_smir_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_sminfo_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       ib_net64_t const comp_mask = p_ctxt->comp_mask;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       if (comp_mask & IB_SMIR_COMPMASK_GUID) {\r
-               if (p_rem_sm->smi.guid != p_rcvd_rec->sm_info.guid)\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_SMIR_COMPMASK_PRIORITY) {\r
-               if (ib_sminfo_get_priority(&p_rem_sm->smi) !=\r
-                   ib_sminfo_get_priority(&p_rcvd_rec->sm_info))\r
-                       goto Exit;\r
-       }\r
-\r
-       if (comp_mask & IB_SMIR_COMPMASK_SMSTATE) {\r
-               if (ib_sminfo_get_state(&p_rem_sm->smi) !=\r
-                   ib_sminfo_get_state(&p_rcvd_rec->sm_info))\r
-                       goto Exit;\r
-       }\r
-\r
-       /* Implement any other needed search cases */\r
-\r
-       smir_rcv_new_smir(sa, p_rem_sm->p_port, p_ctxt->p_list,\r
-                         p_rem_sm->smi.guid, p_rem_sm->smi.act_count,\r
-                         p_rem_sm->smi.pri_state, p_req_physp);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_smir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_remote_sm_t *p_rem_sm = (osm_remote_sm_t *) p_map_item;\r
-       osm_smir_search_ctxt_t *p_ctxt = cxt;\r
-\r
-       sa_smir_by_comp_mask(p_ctxt->sa, p_rem_sm, p_ctxt);\r
-}\r
-\r
-void osm_smir_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *sad_mad;\r
-       const ib_sminfo_record_t *p_rcvd_rec;\r
-       const osm_port_t *p_port = NULL;\r
-       const ib_sm_info_t *p_smi;\r
-       cl_qlist_t rec_list;\r
-       osm_smir_search_ctxt_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net64_t comp_mask;\r
-       ib_net64_t port_guid;\r
-       osm_physp_t *p_req_physp;\r
-       osm_port_t *local_port;\r
-       osm_remote_sm_t *p_rem_sm;\r
-       cl_qmap_t *p_sm_guid_tbl;\r
-       uint8_t pri_state;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       sad_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec = (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);\r
-       comp_mask = sad_mad->comp_mask;\r
-\r
-       CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (sad_mad->method != IB_MAD_METHOD_GET &&\r
-           sad_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2804: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(sad_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2803: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_sm_info_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);\r
-\r
-       p_smi = &p_rcvd_rec->sm_info;\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = sad_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /*\r
-          If the user specified a LID, it obviously narrows our\r
-          work load, since we don't have to search every port\r
-        */\r
-       if (comp_mask & IB_SMIR_COMPMASK_LID) {\r
-               p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);\r
-               if (!p_port) {\r
-                       status = IB_NOT_FOUND;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2806: "\r
-                               "No port found with LID %u\n",\r
-                               cl_ntoh16(p_rcvd_rec->lid));\r
-               }\r
-       }\r
-\r
-       if (status == IB_SUCCESS) {\r
-               /* Handle our own SM first */\r
-               local_port = osm_get_port_by_guid(sa->p_subn,\r
-                                                 sa->p_subn->sm_port_guid);\r
-               if (!local_port) {\r
-                       cl_plock_release(sa->p_lock);\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2809: "\r
-                               "No port found with GUID 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(sa->p_subn->sm_port_guid));\r
-                       goto Exit;\r
-               }\r
-\r
-               if (!p_port || local_port == p_port) {\r
-                       if (FALSE ==\r
-                           osm_physp_share_pkey(sa->p_log, p_req_physp,\r
-                                                local_port->p_physp)) {\r
-                               cl_plock_release(sa->p_lock);\r
-                               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2805: "\r
-                                       "Cannot get SMInfo record due to pkey violation\n");\r
-                               goto Exit;\r
-                       }\r
-\r
-                       /* Check that other search components specified match */\r
-                       if ((comp_mask & IB_SMIR_COMPMASK_GUID) &&\r
-                           sa->p_subn->sm_port_guid != p_smi->guid)\r
-                               goto Remotes;\r
-                       if ((comp_mask & IB_SMIR_COMPMASK_PRIORITY) &&\r
-                           sa->p_subn->opt.sm_priority !=\r
-                           ib_sminfo_get_priority(p_smi))\r
-                               goto Remotes;\r
-                       if ((comp_mask & IB_SMIR_COMPMASK_SMSTATE) &&\r
-                           sa->p_subn->sm_state != ib_sminfo_get_state(p_smi))\r
-                               goto Remotes;\r
-\r
-                       /* Now, add local SMInfo to list */\r
-                       pri_state = sa->p_subn->sm_state & 0x0F;\r
-                       pri_state |= (sa->p_subn->opt.sm_priority & 0x0F) << 4;\r
-                       smir_rcv_new_smir(sa, local_port, context.p_list,\r
-                                         sa->p_subn->sm_port_guid,\r
-                                         cl_ntoh32(sa->p_subn->p_osm->stats.\r
-                                                   qp0_mads_sent), pri_state,\r
-                                         p_req_physp);\r
-               }\r
-\r
-             Remotes:\r
-               if (p_port && p_port != local_port) {\r
-                       /* Find remote SM corresponding to p_port */\r
-                       port_guid = osm_port_get_guid(p_port);\r
-                       p_sm_guid_tbl = &sa->p_subn->sm_guid_tbl;\r
-                       p_rem_sm =\r
-                           (osm_remote_sm_t *) cl_qmap_get(p_sm_guid_tbl,\r
-                                                           port_guid);\r
-                       if (p_rem_sm !=\r
-                           (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl))\r
-                               sa_smir_by_comp_mask(sa, p_rem_sm, &context);\r
-                       else\r
-                               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 280A: "\r
-                                       "No remote SM for GUID 0x%016" PRIx64\r
-                                       "\n", cl_ntoh64(port_guid));\r
-               } else {\r
-                       /* Go over all other known (remote) SMs */\r
-                       cl_qmap_apply_func(&sa->p_subn->sm_guid_tbl,\r
-                                          sa_smir_by_comp_mask_cb, &context);\r
-               }\r
-       }\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_sminfo_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c b/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c
deleted file mode 100644 (file)
index a58c6f5..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sir_rcv_t.\r
- * This object represents the SwitchInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_sir_item {\r
-       cl_list_item_t list_item;\r
-       ib_switch_info_record_t rec;\r
-} osm_sir_item_t;\r
-\r
-typedef struct osm_sir_search_ctxt {\r
-       const ib_switch_info_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_sir_search_ctxt_t;\r
-\r
-static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa,\r
-                                      IN const osm_switch_t * p_sw,\r
-                                      IN cl_qlist_t * p_list,\r
-                                      IN ib_net16_t lid)\r
-{\r
-       osm_sir_item_t *p_rec_item;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5308: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New SwitchInfoRecord: lid %u\n", cl_ntoh16(lid));\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.switch_info = p_sw->switch_info;\r
-\r
-       cl_qlist_insert_tail(p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return status;\r
-}\r
-\r
-static void sir_rcv_create_sir(IN osm_sa_t * sa, IN const osm_switch_t * p_sw,\r
-                              IN cl_qlist_t * p_list, IN ib_net16_t match_lid,\r
-                              IN const osm_physp_t * p_req_physp)\r
-{\r
-       osm_port_t *p_port;\r
-       const osm_physp_t *p_physp;\r
-       uint16_t match_lid_ho;\r
-       ib_net16_t min_lid_ho;\r
-       ib_net16_t max_lid_ho;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Looking for SwitchInfoRecord with LID: %u\n",\r
-               cl_ntoh16(match_lid));\r
-\r
-       /* In switches, the port guid is the node guid. */\r
-       p_port =\r
-           osm_get_port_by_guid(sa->p_subn, p_sw->p_node->node_info.port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 530A: "\r
-                       "Failed to find Port by Node Guid:0x%016" PRIx64\r
-                       "\n", cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               goto Exit;\r
-       }\r
-\r
-       /* check that the requester physp and the current physp are under\r
-          the same partition. */\r
-       p_physp = p_port->p_physp;\r
-       if (!p_physp) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 530B: "\r
-                       "Failed to find default physical Port by Node Guid:0x%016"\r
-                       PRIx64 "\n",\r
-                       cl_ntoh64(p_sw->p_node->node_info.node_guid));\r
-               goto Exit;\r
-       }\r
-       if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))\r
-               goto Exit;\r
-\r
-       /* get the port 0 of the switch */\r
-       osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-       match_lid_ho = cl_ntoh16(match_lid);\r
-       if (match_lid_ho) {\r
-               /*\r
-                  We validate that the lid belongs to this switch.\r
-                */\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Comparing LID: %u <= %u <= %u\n",\r
-                       min_lid_ho, match_lid_ho, max_lid_ho);\r
-\r
-               if (match_lid_ho < min_lid_ho || match_lid_ho > max_lid_ho)\r
-                       goto Exit;\r
-\r
-       }\r
-\r
-       sir_rcv_new_sir(sa, p_sw, p_list, osm_port_get_base_lid(p_port));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sir_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)\r
-{\r
-       const osm_sir_search_ctxt_t *p_ctxt = cxt;\r
-       const osm_switch_t *p_sw = (osm_switch_t *) p_map_item;\r
-       const ib_switch_info_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;\r
-       osm_sa_t *sa = p_ctxt->sa;\r
-       ib_net64_t const comp_mask = p_ctxt->comp_mask;\r
-       ib_net16_t match_lid = 0;\r
-\r
-       OSM_LOG_ENTER(p_ctxt->sa->p_log);\r
-\r
-       osm_dump_switch_info(p_ctxt->sa->p_log, &p_sw->switch_info,\r
-                            OSM_LOG_VERBOSE);\r
-\r
-       if (comp_mask & IB_SWIR_COMPMASK_LID) {\r
-               match_lid = p_rcvd_rec->lid;\r
-               if (!match_lid)\r
-                       goto Exit;\r
-       }\r
-\r
-       sir_rcv_create_sir(sa, p_sw, p_ctxt->p_list, match_lid, p_req_physp);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
-}\r
-\r
-void osm_sir_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *sad_mad;\r
-       const ib_switch_info_record_t *p_rcvd_rec;\r
-       cl_qlist_t rec_list;\r
-       osm_sir_search_ctxt_t context;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       sad_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_switch_info_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);\r
-\r
-       CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_SWITCH_INFO_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (sad_mad->method != IB_MAD_METHOD_GET &&\r
-           sad_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5305: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(sad_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5304: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))\r
-               osm_dump_switch_info_record(sa->p_log, p_rcvd_rec,\r
-                                           OSM_LOG_DEBUG);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = sad_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /* Go over all switches */\r
-       cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl, sir_rcv_by_comp_mask,\r
-                          &context);\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_switch_info_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c b/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c
deleted file mode 100644 (file)
index 92a34d4..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_vlarb_rec_rcv_t.\r
- * This object represents the VLArbitrationRecord Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_pkey.h>\r
-#include <opensm/osm_sa.h>\r
-\r
-typedef struct osm_vl_arb_item {\r
-       cl_list_item_t list_item;\r
-       ib_vl_arb_table_record_t rec;\r
-} osm_vl_arb_item_t;\r
-\r
-typedef struct osm_vl_arb_search_ctxt {\r
-       const ib_vl_arb_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       uint8_t block_num;\r
-       cl_qlist_t *p_list;\r
-       osm_sa_t *sa;\r
-       const osm_physp_t *p_req_physp;\r
-} osm_vl_arb_search_ctxt_t;\r
-\r
-static void sa_vl_arb_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,\r
-                            IN osm_vl_arb_search_ctxt_t * p_ctxt,\r
-                            IN uint8_t block)\r
-{\r
-       osm_vl_arb_item_t *p_rec_item;\r
-       uint16_t lid;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rec_item = malloc(sizeof(*p_rec_item));\r
-       if (p_rec_item == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A02: "\r
-                       "rec_item alloc failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)\r
-               lid = p_physp->port_info.base_lid;\r
-       else\r
-               lid = osm_node_get_base_lid(p_physp->p_node, 0);\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "New VLArbitration for: port 0x%016" PRIx64\r
-               ", lid %u, port %u Block:%u\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p_physp)),\r
-               cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);\r
-\r
-       memset(p_rec_item, 0, sizeof(*p_rec_item));\r
-\r
-       p_rec_item->rec.lid = lid;\r
-       p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);\r
-       p_rec_item->rec.block_num = block;\r
-       p_rec_item->rec.vl_arb_tbl = *(osm_physp_get_vla_tbl(p_physp, block));\r
-\r
-       cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_vl_arb_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,\r
-                                 osm_vl_arb_search_ctxt_t * p_ctxt)\r
-{\r
-       ib_net64_t comp_mask = p_ctxt->comp_mask;\r
-       uint8_t block;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       /* we got here with the phys port - all that's left is to get the right block */\r
-       for (block = 1; block <= 4; block++) {\r
-               if (!(comp_mask & IB_VLA_COMPMASK_BLOCK)\r
-                   || block == p_ctxt->block_num)\r
-                       sa_vl_arb_create(sa, p_physp, p_ctxt, block);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_vl_arb_by_comp_mask(osm_sa_t * sa, IN const osm_port_t * p_port,\r
-                                  osm_vl_arb_search_ctxt_t * p_ctxt)\r
-{\r
-       const ib_vl_arb_table_record_t *p_rcvd_rec;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       const osm_physp_t *p_req_physp;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       p_rcvd_rec = p_ctxt->p_rcvd_rec;\r
-       comp_mask = p_ctxt->comp_mask;\r
-       port_num = p_rcvd_rec->port_num;\r
-       p_req_physp = p_ctxt->p_req_physp;\r
-\r
-       /* if this is a switch port we can search all ports\r
-          otherwise we must be looking on port 0 */\r
-       if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {\r
-               /* we put it in the comp mask and port num */\r
-               port_num = p_port->p_physp->port_num;\r
-               OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-                       "Using Physical Default Port Number: 0x%X (for End Node)\n",\r
-                       port_num);\r
-               comp_mask |= IB_VLA_COMPMASK_OUT_PORT;\r
-       }\r
-\r
-       if (comp_mask & IB_VLA_COMPMASK_OUT_PORT) {\r
-               if (port_num < osm_node_get_num_physp(p_port->p_node)) {\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_port->p_node, port_num);\r
-                       /* check that the p_physp is valid, and that the requester\r
-                          and the p_physp share a pkey. */\r
-                       if (p_physp &&\r
-                           osm_physp_share_pkey(sa->p_log, p_req_physp,\r
-                                                p_physp))\r
-                               sa_vl_arb_check_physp(sa, p_physp, p_ctxt);\r
-               } else {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A03: "\r
-                               "Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",\r
-                               port_num,\r
-                               osm_node_get_num_physp(p_port->p_node));\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               num_ports = osm_node_get_num_physp(p_port->p_node);\r
-               for (port_num = 0; port_num < num_ports; port_num++) {\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_port->p_node, port_num);\r
-                       if (!p_physp)\r
-                               continue;\r
-\r
-                       /* if the requester and the p_physp don't share a pkey -\r
-                          continue */\r
-                       if (!osm_physp_share_pkey\r
-                           (sa->p_log, p_req_physp, p_physp))\r
-                               continue;\r
-\r
-                       sa_vl_arb_check_physp(sa, p_physp, p_ctxt);\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
-\r
-static void sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * p_map_item, void *cxt)\r
-{\r
-       const osm_port_t *p_port = (osm_port_t *) p_map_item;\r
-       osm_vl_arb_search_ctxt_t *p_ctxt = cxt;\r
-\r
-       sa_vl_arb_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
-}\r
-\r
-void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)\r
-{\r
-       osm_sa_t *sa = ctx;\r
-       osm_madw_t *p_madw = data;\r
-       const ib_sa_mad_t *sad_mad;\r
-       const ib_vl_arb_table_record_t *p_rcvd_rec;\r
-       const osm_port_t *p_port = NULL;\r
-       const ib_vl_arb_table_t *p_vl_arb;\r
-       cl_qlist_t rec_list;\r
-       osm_vl_arb_search_ctxt_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_net64_t comp_mask;\r
-       osm_physp_t *p_req_physp;\r
-\r
-       CL_ASSERT(sa);\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       sad_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_rcvd_rec =\r
-           (ib_vl_arb_table_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);\r
-       comp_mask = sad_mad->comp_mask;\r
-\r
-       CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD);\r
-\r
-       /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
-       if (sad_mad->method != IB_MAD_METHOD_GET &&\r
-           sad_mad->method != IB_MAD_METHOD_GETTABLE) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A05: "\r
-                       "Unsupported Method (%s)\n",\r
-                       ib_get_sa_method_str(sad_mad->method));\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the requester physical port. */\r
-       p_req_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                               osm_madw_get_mad_addr_ptr\r
-                                               (p_madw));\r
-       if (p_req_physp == NULL) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A04: "\r
-                       "Cannot find requester physical port\n");\r
-               goto Exit;\r
-       }\r
-\r
-       p_vl_arb = (ib_vl_arb_table_t *) ib_sa_mad_get_payload_ptr(sad_mad);\r
-\r
-       cl_qlist_init(&rec_list);\r
-\r
-       context.p_rcvd_rec = p_rcvd_rec;\r
-       context.p_list = &rec_list;\r
-       context.comp_mask = sad_mad->comp_mask;\r
-       context.sa = sa;\r
-       context.block_num = p_rcvd_rec->block_num;\r
-       context.p_req_physp = p_req_physp;\r
-\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG,\r
-               "Got Query Lid:%u(%02X), Port:0x%02X(%02X), Block:0x%02X(%02X)\n",\r
-               cl_ntoh16(p_rcvd_rec->lid),\r
-               (comp_mask & IB_VLA_COMPMASK_LID) != 0, p_rcvd_rec->port_num,\r
-               (comp_mask & IB_VLA_COMPMASK_OUT_PORT) != 0,\r
-               p_rcvd_rec->block_num,\r
-               (comp_mask & IB_VLA_COMPMASK_BLOCK) != 0);\r
-\r
-       cl_plock_acquire(sa->p_lock);\r
-\r
-       /*\r
-          If the user specified a LID, it obviously narrows our\r
-          work load, since we don't have to search every port\r
-        */\r
-       if (comp_mask & IB_VLA_COMPMASK_LID) {\r
-               p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid);\r
-               if (!p_port) {\r
-                       status = IB_NOT_FOUND;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A09: "\r
-                               "No port found with LID %u\n",\r
-                               cl_ntoh16(p_rcvd_rec->lid));\r
-               }\r
-       }\r
-\r
-       if (status == IB_SUCCESS) {\r
-               /* if we got a unique port - no need for a port search */\r
-               if (p_port)\r
-                       /*  this does the loop on all the port phys ports */\r
-                       sa_vl_arb_by_comp_mask(sa, p_port, &context);\r
-               else\r
-                       cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,\r
-                                          sa_vl_arb_by_comp_mask_cb, &context);\r
-       }\r
-\r
-       cl_plock_release(sa->p_lock);\r
-\r
-       osm_sa_respond(sa, p_madw, sizeof(ib_vl_arb_table_record_t), &rec_list);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_service.c b/branches/opensm_3/user/opensm/osm_service.c
deleted file mode 100644 (file)
index bf7c752..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of service record functions.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_timer.h>\r
-#include <opensm/osm_service.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-void osm_svcr_delete(IN osm_svcr_t * p_svcr)\r
-{\r
-       free(p_svcr);\r
-}\r
-\r
-void osm_svcr_init(IN osm_svcr_t * p_svcr,\r
-                  IN const ib_service_record_t * p_svc_rec)\r
-{\r
-       CL_ASSERT(p_svcr);\r
-\r
-       p_svcr->modified_time = cl_get_time_stamp_sec();\r
-\r
-       /* We track the time left for this service in\r
-          an external field to avoid extra cl_ntoh/hton\r
-          required for working with the MAD field */\r
-       p_svcr->lease_period = cl_ntoh32(p_svc_rec->service_lease);\r
-       p_svcr->service_record = *p_svc_rec;\r
-}\r
-\r
-osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec)\r
-{\r
-       osm_svcr_t *p_svcr;\r
-\r
-       CL_ASSERT(p_svc_rec);\r
-\r
-       p_svcr = (osm_svcr_t *) malloc(sizeof(*p_svcr));\r
-       if (p_svcr) {\r
-               memset(p_svcr, 0, sizeof(*p_svcr));\r
-               osm_svcr_init(p_svcr, p_svc_rec);\r
-       }\r
-\r
-       return p_svcr;\r
-}\r
-\r
-static cl_status_t match_rid_of_svc_rec(IN const cl_list_item_t * p_list_item,\r
-                                       IN void *context)\r
-{\r
-       ib_service_record_t *p_svc_rec = (ib_service_record_t *) context;\r
-       osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;\r
-\r
-       if (memcmp(&p_svcr->service_record, p_svc_rec,\r
-                  sizeof(p_svc_rec->service_id) +\r
-                  sizeof(p_svc_rec->service_gid) +\r
-                  sizeof(p_svc_rec->service_pkey)))\r
-               return CL_NOT_FOUND;\r
-       else\r
-               return CL_SUCCESS;\r
-}\r
-\r
-osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,\r
-                               IN osm_log_t * p_log,\r
-                               IN ib_service_record_t * p_svc_rec)\r
-{\r
-       cl_list_item_t *p_list_item;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_list_item = cl_qlist_find_from_head(&p_subn->sa_sr_list,\r
-                                             match_rid_of_svc_rec, p_svc_rec);\r
-       if (p_list_item == cl_qlist_end(&p_subn->sa_sr_list))\r
-               p_list_item = NULL;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return (osm_svcr_t *) p_list_item;\r
-}\r
-\r
-void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                          IN osm_svcr_t * p_svcr)\r
-{\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Inserting new Service Record into Database\n");\r
-\r
-       cl_qlist_insert_head(&p_subn->sa_sr_list, &p_svcr->list_item);\r
-       p_subn->p_osm->sa.dirty = TRUE;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,\r
-                            IN osm_svcr_t * p_svcr)\r
-{\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Removing Service Record Name:%s ID:0x%016" PRIx64\r
-               " from Database\n", p_svcr->service_record.service_name,\r
-               p_svcr->service_record.service_id);\r
-\r
-       cl_qlist_remove_item(&p_subn->sa_sr_list, &p_svcr->list_item);\r
-       p_subn->p_osm->sa.dirty = TRUE;\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c b/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c
deleted file mode 100644 (file)
index 351bf5b..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_slvl_rcv_t.\r
- * This object represents the SLtoVL Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sm.h>\r
-\r
-/*\r
- * WE ONLY RECEIVE GET or SET responses\r
- */\r
-void osm_slvl_rcv_process(IN void *context, IN void *p_data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = p_data;\r
-       ib_slvl_table_t *p_slvl_tbl;\r
-       ib_smp_t *p_smp;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       osm_slvl_context_t *p_context;\r
-       ib_net64_t port_guid;\r
-       ib_net64_t node_guid;\r
-       uint32_t attr_mod;\r
-       uint8_t startinport, endinport, startoutport, endoutport;\r
-       uint8_t in_port, out_port;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_context = osm_madw_get_slvl_context_ptr(p_madw);\r
-       p_slvl_tbl = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       port_guid = p_context->port_guid;\r
-       node_guid = p_context->node_guid;\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE);\r
-\r
-       cl_plock_excl_acquire(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C06: "\r
-                       "No port object for port with GUID 0x%" PRIx64\r
-                       "\n\t\t\t\tfor parent node GUID 0x%" PRIx64\r
-                       ", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),\r
-                       cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-               goto Exit;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       CL_ASSERT(p_node);\r
-\r
-       /* in case of a non switch node the attr modifier should be ignored */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {\r
-               unsigned num_ports = osm_node_get_num_physp(p_node) - 1;\r
-               attr_mod = cl_ntoh32(p_smp->attr_mod);\r
-\r
-               if (attr_mod & 0x10000) {\r
-                       startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;\r
-                       endoutport = osm_node_get_num_physp(p_node) - 1;\r
-               } else\r
-                       startoutport = endoutport = attr_mod & 0xff;\r
-\r
-               if (attr_mod & 0x20000) {\r
-                       startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;\r
-                       endinport = osm_node_get_num_physp(p_node) - 1;\r
-               } else\r
-                       startinport = endinport = (attr_mod >> 8) & 0xff;\r
-\r
-               if (startinport > num_ports || startoutport > num_ports) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C07"\r
-                               "Invalid attribute modifier 0x%x received in"\r
-                               " response from switch 0x%" PRIx64 "\n",\r
-                               cl_ntoh32(attr_mod), cl_ntoh64(node_guid));\r
-                       goto Exit;\r
-               }\r
-\r
-       } else {\r
-               startoutport = endoutport = p_port->p_physp->port_num;\r
-               startinport = endinport = 0;\r
-       }\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received SLtoVL GetResp"\r
-               " in_port_num %u out_port_num %u with GUID 0x%" PRIx64\r
-               " for parent node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",\r
-               startinport == endinport ? startinport : 0xff,\r
-               startoutport == endoutport ? startoutport : 0xff,\r
-               cl_ntoh64(port_guid), cl_ntoh64(node_guid),\r
-               cl_ntoh64(p_smp->trans_id));\r
-\r
-       osm_dump_slvl_map_table(sm->p_log, port_guid,\r
-                               startinport == endinport ? startinport : 0xff,\r
-                               startoutport == endoutport ? startoutport : 0xff,\r
-                               p_slvl_tbl, OSM_LOG_DEBUG);\r
-\r
-       for (out_port = startoutport; out_port <= endoutport; out_port++) {\r
-               p_physp = osm_node_get_physp_ptr(p_node, out_port);\r
-               for (in_port = startinport; in_port <= endinport; in_port++)\r
-                       osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port);\r
-       }\r
-\r
-Exit:\r
-       cl_plock_release(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sm.c b/branches/opensm_3/user/opensm/osm_sm.c
deleted file mode 100644 (file)
index 9687f0e..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sm_t.\r
- * This object represents the SM Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_thread.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-#define  OSM_SM_INITIAL_TID_VALUE 0x1233\r
-\r
-extern void osm_lft_rcv_process(IN void *context, IN void *data);\r
-extern void osm_mft_rcv_process(IN void *context, IN void *data);\r
-extern void osm_nd_rcv_process(IN void *context, IN void *data);\r
-extern void osm_ni_rcv_process(IN void *context, IN void *data);\r
-extern void osm_pkey_rcv_process(IN void *context, IN void *data);\r
-extern void osm_pi_rcv_process(IN void *context, IN void *data);\r
-extern void osm_slvl_rcv_process(IN void *context, IN void *p_data);\r
-extern void osm_sminfo_rcv_process(IN void *context, IN void *data);\r
-extern void osm_si_rcv_process(IN void *context, IN void *data);\r
-extern void osm_trap_rcv_process(IN void *context, IN void *data);\r
-extern void osm_vla_rcv_process(IN void *context, IN void *data);\r
-\r
-extern void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal);\r
-extern void osm_sm_state_mgr_polling_callback(IN void *context);\r
-\r
-static void sm_process(osm_sm_t * sm, osm_signal_t signal)\r
-{\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       if (signal == OSM_SIGNAL_PERFMGR_SWEEP)\r
-               osm_perfmgr_process(&sm->p_subn->p_osm->perfmgr);\r
-       else\r
-#endif\r
-               osm_state_mgr_process(sm, signal);\r
-}\r
-\r
-static void sm_sweeper(IN void *p_ptr)\r
-{\r
-       ib_api_status_t status;\r
-       osm_sm_t * p_sm = p_ptr;\r
-       unsigned signals, i;\r
-\r
-       OSM_LOG_ENTER(p_sm->p_log);\r
-\r
-       while (p_sm->thread_state == OSM_THREAD_STATE_RUN) {\r
-               /*\r
-                * Wait on the event with a timeout.\r
-                * Sweeps may be initiated "off schedule" by simply\r
-                * signaling the event.\r
-                */\r
-               status = cl_event_wait_on(&p_sm->signal_event,\r
-                                         EVENT_NO_TIMEOUT, TRUE);\r
-\r
-               if (status == CL_SUCCESS)\r
-                       OSM_LOG(p_sm->p_log, OSM_LOG_DEBUG,\r
-                               "Off schedule sweep signalled\n");\r
-               else if (status != CL_TIMEOUT) {\r
-                       OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E01: "\r
-                               "Event wait failed (%s)\n",\r
-                               CL_STATUS_MSG(status));\r
-                       continue;\r
-               }\r
-\r
-               if (osm_exit_flag)\r
-                       break;\r
-\r
-               cl_spinlock_acquire(&p_sm->signal_lock);\r
-               signals = p_sm->signal_mask;\r
-               p_sm->signal_mask = 0;\r
-               cl_spinlock_release(&p_sm->signal_lock);\r
-\r
-               for (i = 0; signals; signals >>= 1, i++)\r
-                       if (signals & 1)\r
-                               sm_process(p_sm, i);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_sm->p_log);\r
-}\r
-\r
-static void sm_sweep(void *arg)\r
-{\r
-       osm_sm_t *sm = arg;\r
-\r
-       /*  do the sweep only if we are in MASTER state */\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER ||\r
-           sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING)\r
-               osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-       cl_timer_start(&sm->sweep_timer, sm->p_subn->opt.sweep_interval * 1000);\r
-}\r
-\r
-static void sweep_fail_process(IN void *context, IN void *p_data)\r
-{\r
-       osm_sm_t *sm = context;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "light sweep failed\n");\r
-       sm->p_subn->force_heavy_sweep = TRUE;\r
-}\r
-\r
-void osm_sm_construct(IN osm_sm_t * p_sm)\r
-{\r
-       memset(p_sm, 0, sizeof(*p_sm));\r
-       p_sm->thread_state = OSM_THREAD_STATE_NONE;\r
-       p_sm->sm_trans_id = OSM_SM_INITIAL_TID_VALUE;\r
-       cl_spinlock_construct(&p_sm->signal_lock);\r
-       cl_spinlock_construct(&p_sm->state_lock);\r
-       cl_timer_construct(&p_sm->polling_timer);\r
-       cl_event_construct(&p_sm->signal_event);\r
-       cl_event_construct(&p_sm->subnet_up_event);\r
-       cl_event_wheel_construct(&p_sm->trap_aging_tracker);\r
-       cl_thread_construct(&p_sm->sweeper);\r
-       osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);\r
-       osm_lid_mgr_construct(&p_sm->lid_mgr);\r
-       osm_ucast_mgr_construct(&p_sm->ucast_mgr);\r
-}\r
-\r
-void osm_sm_shutdown(IN osm_sm_t * p_sm)\r
-{\r
-       boolean_t signal_event = FALSE;\r
-\r
-       OSM_LOG_ENTER(p_sm->p_log);\r
-\r
-       /*\r
-        * Signal our threads that we're leaving.\r
-        */\r
-       if (p_sm->thread_state != OSM_THREAD_STATE_NONE)\r
-               signal_event = TRUE;\r
-\r
-       p_sm->thread_state = OSM_THREAD_STATE_EXIT;\r
-\r
-       /*\r
-        * Don't trigger unless event has been initialized.\r
-        * Destroy the thread before we tear down the other objects.\r
-        */\r
-       if (signal_event)\r
-               cl_event_signal(&p_sm->signal_event);\r
-\r
-       cl_timer_stop(&p_sm->polling_timer);\r
-       cl_timer_stop(&p_sm->sweep_timer);\r
-       cl_thread_destroy(&p_sm->sweeper);\r
-\r
-       /*\r
-        * Always destroy controllers before the corresponding\r
-        * receiver to guarantee that all callbacks from the\r
-        * dispatcher are complete.\r
-        */\r
-       osm_sm_mad_ctrl_destroy(&p_sm->mad_ctrl);\r
-       cl_disp_unregister(p_sm->ni_disp_h);\r
-       cl_disp_unregister(p_sm->pi_disp_h);\r
-       cl_disp_unregister(p_sm->si_disp_h);\r
-       cl_disp_unregister(p_sm->nd_disp_h);\r
-       cl_disp_unregister(p_sm->lft_disp_h);\r
-       cl_disp_unregister(p_sm->mft_disp_h);\r
-       cl_disp_unregister(p_sm->sm_info_disp_h);\r
-       cl_disp_unregister(p_sm->trap_disp_h);\r
-       cl_disp_unregister(p_sm->slvl_disp_h);\r
-       cl_disp_unregister(p_sm->vla_disp_h);\r
-       cl_disp_unregister(p_sm->pkey_disp_h);\r
-       cl_disp_unregister(p_sm->sweep_fail_disp_h);\r
-\r
-       OSM_LOG_EXIT(p_sm->p_log);\r
-}\r
-\r
-void osm_sm_destroy(IN osm_sm_t * p_sm)\r
-{\r
-       OSM_LOG_ENTER(p_sm->p_log);\r
-       osm_lid_mgr_destroy(&p_sm->lid_mgr);\r
-       osm_ucast_mgr_destroy(&p_sm->ucast_mgr);\r
-       cl_event_wheel_destroy(&p_sm->trap_aging_tracker);\r
-       cl_timer_destroy(&p_sm->sweep_timer);\r
-       cl_timer_destroy(&p_sm->polling_timer);\r
-       cl_event_destroy(&p_sm->signal_event);\r
-       cl_event_destroy(&p_sm->subnet_up_event);\r
-       cl_spinlock_destroy(&p_sm->signal_lock);\r
-       cl_spinlock_destroy(&p_sm->state_lock);\r
-       free(p_sm->mlids_req);\r
-\r
-       osm_log(p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n");      /* Format Waived */\r
-       OSM_LOG_EXIT(p_sm->p_log);\r
-}\r
-\r
-ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn,\r
-                           IN osm_db_t * p_db, IN osm_vendor_t * p_vendor,\r
-                           IN osm_mad_pool_t * p_mad_pool,\r
-                           IN osm_vl15_t * p_vl15, IN osm_log_t * p_log,\r
-                           IN osm_stats_t * p_stats,\r
-                           IN cl_dispatcher_t * p_disp, IN cl_plock_t * p_lock)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_sm->p_subn = p_subn;\r
-       p_sm->p_db = p_db;\r
-       p_sm->p_vendor = p_vendor;\r
-       p_sm->p_mad_pool = p_mad_pool;\r
-       p_sm->p_vl15 = p_vl15;\r
-       p_sm->p_log = p_log;\r
-       p_sm->p_disp = p_disp;\r
-       p_sm->p_lock = p_lock;\r
-\r
-       status = cl_spinlock_init(&p_sm->signal_lock);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_spinlock_init(&p_sm->state_lock);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_event_init(&p_sm->signal_event, FALSE);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_event_init(&p_sm->subnet_up_event, FALSE);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_timer_init(&p_sm->sweep_timer, sm_sweep, p_sm);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_timer_init(&p_sm->polling_timer,\r
-                              osm_sm_state_mgr_polling_callback, p_sm);\r
-       if (status != CL_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_sm->mlids_req_max = 0;\r
-       p_sm->mlids_req = malloc((IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO +\r
-                                 1) * sizeof(p_sm->mlids_req[0]));\r
-       if (!p_sm->mlids_req)\r
-               goto Exit;\r
-       memset(p_sm->mlids_req, 0,\r
-              (IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO +\r
-               1) * sizeof(p_sm->mlids_req[0]));\r
-\r
-       status = osm_sm_mad_ctrl_init(&p_sm->mad_ctrl, p_sm->p_subn,\r
-                                     p_sm->p_mad_pool, p_sm->p_vl15,\r
-                                     p_sm->p_vendor,\r
-                                     p_log, p_stats, p_lock, p_disp);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = cl_event_wheel_init(&p_sm->trap_aging_tracker);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_lid_mgr_init(&p_sm->lid_mgr, p_sm);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osm_ucast_mgr_init(&p_sm->ucast_mgr, p_sm);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = IB_INSUFFICIENT_RESOURCES;\r
-       p_sm->sweep_fail_disp_h = cl_disp_register(p_disp,\r
-                                                  OSM_MSG_LIGHT_SWEEP_FAIL,\r
-                                                  sweep_fail_process, p_sm);\r
-       if (p_sm->sweep_fail_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->ni_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_INFO,\r
-                                          osm_ni_rcv_process, p_sm);\r
-       if (p_sm->ni_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->pi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORT_INFO,\r
-                                          osm_pi_rcv_process, p_sm);\r
-       if (p_sm->pi_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->si_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO,\r
-                                          osm_si_rcv_process, p_sm);\r
-       if (p_sm->si_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->nd_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_DESC,\r
-                                          osm_nd_rcv_process, p_sm);\r
-       if (p_sm->nd_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT,\r
-                                           osm_lft_rcv_process, p_sm);\r
-       if (p_sm->lft_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT,\r
-                                           osm_mft_rcv_process, p_sm);\r
-       if (p_sm->mft_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->sm_info_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SM_INFO,\r
-                                               osm_sminfo_rcv_process, p_sm);\r
-       if (p_sm->sm_info_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->trap_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NOTICE,\r
-                                            osm_trap_rcv_process, p_sm);\r
-       if (p_sm->trap_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->slvl_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SLVL,\r
-                                            osm_slvl_rcv_process, p_sm);\r
-       if (p_sm->slvl_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->vla_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB,\r
-                                           osm_vla_rcv_process, p_sm);\r
-       if (p_sm->vla_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_sm->pkey_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PKEY,\r
-                                            osm_pkey_rcv_process, p_sm);\r
-       if (p_sm->pkey_disp_h == CL_DISP_INVALID_HANDLE)\r
-               goto Exit;\r
-\r
-       p_subn->sm_state = p_subn->opt.sm_inactive ?\r
-           IB_SMINFO_STATE_NOTACTIVE : IB_SMINFO_STATE_DISCOVERING;\r
-       osm_report_sm_state(p_sm);\r
-\r
-       /*\r
-        * Now that the component objects are initialized, start\r
-        * the sweeper thread if the user wants sweeping.\r
-        */\r
-       p_sm->thread_state = OSM_THREAD_STATE_RUN;\r
-       status = cl_thread_init(&p_sm->sweeper, sm_sweeper, p_sm,\r
-                               "opensm sweeper");\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (p_sm->p_subn->opt.sweep_interval)\r
-               cl_timer_start(&p_sm->sweep_timer,\r
-                              p_sm->p_subn->opt.sweep_interval * 1000);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal)\r
-{\r
-       cl_spinlock_acquire(&p_sm->signal_lock);\r
-       p_sm->signal_mask |= 1 << signal;\r
-       cl_event_signal(&p_sm->signal_event);\r
-       cl_spinlock_release(&p_sm->signal_lock);\r
-}\r
-\r
-void osm_sm_sweep(IN osm_sm_t * p_sm)\r
-{\r
-       OSM_LOG_ENTER(p_sm->p_log);\r
-       osm_sm_signal(p_sm, OSM_SIGNAL_SWEEP);\r
-       OSM_LOG_EXIT(p_sm->p_log);\r
-}\r
-\r
-ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_sm->p_log);\r
-\r
-       status = osm_sm_mad_ctrl_bind(&p_sm->mad_ctrl, port_guid);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E10: "\r
-                       "SM MAD Controller bind failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_sm->p_log);\r
-       return status;\r
-}\r
-\r
-void osm_sm_reroute_mlid(osm_sm_t * sm, ib_net16_t mlid)\r
-{\r
-       mlid = cl_ntoh16(mlid) - IB_LID_MCAST_START_HO;\r
-       sm->mlids_req[mlid] = 1;\r
-       if (sm->mlids_req_max < mlid)\r
-               sm->mlids_req_max = mlid;\r
-       osm_sm_signal(sm, OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST);\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "rerouting requested for MLID 0x%x\n",\r
-               mlid + IB_LID_MCAST_START_HO);\r
-}\r
-\r
-void osm_set_sm_priority(osm_sm_t * sm, uint8_t priority)\r
-{\r
-       uint8_t old_pri = sm->p_subn->opt.sm_priority;\r
-\r
-       sm->p_subn->opt.sm_priority = priority;\r
-\r
-       if (old_pri < priority &&\r
-           sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY)\r
-               osm_send_trap144(sm, TRAP_144_MASK_SM_PRIORITY_CHANGE);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c b/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c
deleted file mode 100644 (file)
index a74f11e..0000000
+++ /dev/null
@@ -1,905 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sm_mad_ctrl_t.\r
- * This object represents the SM MAD request controller object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_sm_mad_ctrl.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_retire_trans_mad\r
- * NAME\r
- * sm_mad_ctrl_retire_trans_mad\r
- *\r
- * DESCRIPTION\r
- * This function handles clean-up of MADs associated with the SM's\r
- * outstanding transactions on the wire.\r
- *\r
- * SYNOPSIS\r
- */\r
-\r
-static void sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                        IN osm_madw_t * p_madw)\r
-{\r
-       uint32_t outstanding;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-       /*\r
-          Return the MAD & wrapper to the pool.\r
-        */\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-               "Retiring MAD with TID 0x%" PRIx64 "\n",\r
-               cl_ntoh64(osm_madw_get_smp_ptr(p_madw)->trans_id));\r
-\r
-       osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-       outstanding = osm_stats_dec_qp0_outstanding(p_ctrl->p_stats);\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "%u QP0 MADs outstanding%s\n",\r
-               p_ctrl->p_stats->qp0_mads_outstanding,\r
-               outstanding ? "" : ": wire is clean.");\r
-\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/************/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_disp_done_callback\r
- * NAME\r
- * sm_mad_ctrl_disp_done_callback\r
- *\r
- * DESCRIPTION\r
- * This function is the Dispatcher callback that indicates\r
- * a received MAD has been processed by the recipient.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_disp_done_callback(IN void *context, IN void *p_data)\r
-{\r
-       osm_sm_mad_ctrl_t *p_ctrl = context;\r
-       osm_madw_t *p_madw = p_data;\r
-       ib_smp_t *p_smp;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       /*\r
-          If the MAD that just finished processing was a response,\r
-          then retire the transaction, since we must have generated\r
-          the request.\r
-\r
-          Otherwise, retire the transaction if a response was expected,\r
-          as in the case of a send failure. If a response was not expected,\r
-          just put the MAD back in the pool, because the MAD was a query\r
-          from some outside agent, e.g. Get(SMInfo) from another SM.\r
-        */\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       if (ib_smp_is_response(p_smp)) {\r
-               CL_ASSERT(p_madw->resp_expected == FALSE);\r
-               sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-       } else if (p_madw->resp_expected == TRUE)\r
-               sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-       else\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/************/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_update_wire_stats\r
- * NAME\r
- * sm_mad_ctrl_update_wire_stats\r
- *\r
- * DESCRIPTION\r
- * Updates wire stats for outstanding MADs and calls the VL15 poller.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_update_wire_stats(IN osm_sm_mad_ctrl_t * p_ctrl)\r
-{\r
-       uint32_t mads_on_wire;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       mads_on_wire =\r
-           cl_atomic_dec(&p_ctrl->p_stats->qp0_mads_outstanding_on_wire);\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-               "%u SMPs on the wire, %u outstanding\n", mads_on_wire,\r
-               p_ctrl->p_stats->qp0_mads_outstanding);\r
-\r
-       /*\r
-          We can signal the VL15 controller to send another MAD\r
-          if any are waiting for transmission.\r
-        */\r
-       osm_vl15_poll(p_ctrl->p_vl15);\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_process_get_resp\r
- * NAME\r
- * sm_mad_ctrl_process_get_resp\r
- *\r
- * DESCRIPTION\r
- * This function handles method GetResp() for received MADs.\r
- * This is the most common path for QP0 MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                        IN osm_madw_t * p_madw,\r
-                                        IN void *transaction_context)\r
-{\r
-       ib_smp_t *p_smp;\r
-       cl_status_t status;\r
-       osm_madw_t *p_old_madw;\r
-       cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-       CL_ASSERT(transaction_context);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR && !ib_smp_is_d(p_smp)) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3102: "\r
-                       "'D' bit not set in returned SMP\n");\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-       }\r
-\r
-       p_old_madw = transaction_context;\r
-\r
-       sm_mad_ctrl_update_wire_stats(p_ctrl);\r
-\r
-       /*\r
-          Copy the MAD Wrapper context from the requesting MAD\r
-          to the new MAD.  This mechanism allows the recipient\r
-          controller to recover its own context regarding this\r
-          MAD transaction.  Once we've copied the context, we\r
-          can return the original MAD to the pool.\r
-        */\r
-       osm_madw_copy_context(p_madw, p_old_madw);\r
-       osm_mad_pool_put(p_ctrl->p_mad_pool, p_old_madw);\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_smp->attr_id) {\r
-       case IB_MAD_ATTR_NODE_DESC:\r
-               msg_id = OSM_MSG_MAD_NODE_DESC;\r
-               break;\r
-       case IB_MAD_ATTR_NODE_INFO:\r
-               msg_id = OSM_MSG_MAD_NODE_INFO;\r
-               break;\r
-       case IB_MAD_ATTR_SWITCH_INFO:\r
-               msg_id = OSM_MSG_MAD_SWITCH_INFO;\r
-               break;\r
-       case IB_MAD_ATTR_PORT_INFO:\r
-               msg_id = OSM_MSG_MAD_PORT_INFO;\r
-               break;\r
-       case IB_MAD_ATTR_LIN_FWD_TBL:\r
-               msg_id = OSM_MSG_MAD_LFT;\r
-               break;\r
-       case IB_MAD_ATTR_MCAST_FWD_TBL:\r
-               msg_id = OSM_MSG_MAD_MFT;\r
-               break;\r
-       case IB_MAD_ATTR_SM_INFO:\r
-               msg_id = OSM_MSG_MAD_SM_INFO;\r
-               break;\r
-       case IB_MAD_ATTR_SLVL_TABLE:\r
-               msg_id = OSM_MSG_MAD_SLVL;\r
-               break;\r
-       case IB_MAD_ATTR_VL_ARBITRATION:\r
-               msg_id = OSM_MSG_MAD_VL_ARB;\r
-               break;\r
-       case IB_MAD_ATTR_P_KEY_TABLE:\r
-               msg_id = OSM_MSG_MAD_PKEY;\r
-               break;\r
-       case IB_MAD_ATTR_GUID_INFO:\r
-       case IB_MAD_ATTR_CLASS_PORT_INFO:\r
-       case IB_MAD_ATTR_NOTICE:\r
-       case IB_MAD_ATTR_INFORM_INFO:\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3103: "\r
-                       "Unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_smp->attr_id));\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Post this MAD to the dispatcher for asynchronous\r
-          processing by the appropriate controller.\r
-        */\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "Posting Dispatcher message %s\n",\r
-               osm_get_disp_msg_str(msg_id));\r
-\r
-       status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,\r
-                             sm_mad_ctrl_disp_done_callback, p_ctrl);\r
-\r
-       if (status != CL_SUCCESS) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3104: "\r
-                       "Dispatcher post message failed (%s) for attribute 0x%X (%s)\n",\r
-                       CL_STATUS_MSG(status), cl_ntoh16(p_smp->attr_id),\r
-                       ib_get_sm_attr_str(p_smp->attr_id));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_process_get\r
- * NAME\r
- * sm_mad_ctrl_process_get\r
- *\r
- * DESCRIPTION\r
- * This function handles method Get() for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                   IN osm_madw_t * p_madw)\r
-{\r
-       ib_smp_t *p_smp;\r
-       cl_status_t status;\r
-       cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_smp->attr_id) {\r
-       case IB_MAD_ATTR_SM_INFO:\r
-               msg_id = OSM_MSG_MAD_SM_INFO;\r
-               break;\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,\r
-                       "Ignoring SubnGet MAD - unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_smp->attr_id));\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Post this MAD to the dispatcher for asynchronous\r
-          processing by the appropriate controller.\r
-        */\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "Posting Dispatcher message %s\n",\r
-               osm_get_disp_msg_str(msg_id));\r
-\r
-       status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,\r
-                             sm_mad_ctrl_disp_done_callback, p_ctrl);\r
-\r
-       if (status != CL_SUCCESS) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3106: "\r
-                       "Dispatcher post message failed (%s)\n",\r
-                       CL_STATUS_MSG(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_process_set\r
- * NAME\r
- * sm_mad_ctrl_process_set\r
- *\r
- * DESCRIPTION\r
- * This function handles method Set() for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                   IN osm_madw_t * p_madw)\r
-{\r
-       ib_smp_t *p_smp;\r
-       cl_status_t status;\r
-       cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_smp->attr_id) {\r
-       case IB_MAD_ATTR_SM_INFO:\r
-               msg_id = OSM_MSG_MAD_SM_INFO;\r
-               break;\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3107: "\r
-                       "Unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_smp->attr_id));\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Post this MAD to the dispatcher for asynchronous\r
-          processing by the appropriate controller.\r
-        */\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "Posting Dispatcher message %s\n",\r
-               osm_get_disp_msg_str(msg_id));\r
-\r
-       status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,\r
-                             sm_mad_ctrl_disp_done_callback, p_ctrl);\r
-\r
-       if (status != CL_SUCCESS) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3108: "\r
-                       "Dispatcher post message failed (%s)\n",\r
-                       CL_STATUS_MSG(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_process_trap\r
- * NAME\r
- * sm_mad_ctrl_process_trap\r
- *\r
- * DESCRIPTION\r
- * This function handles method Trap() for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                    IN osm_madw_t * p_madw)\r
-{\r
-       ib_smp_t *p_smp;\r
-       cl_status_t status;\r
-       cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /* Make sure OpenSM is master. If not - then we should not process the trap */\r
-       if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-                       "Received trap but OpenSM is not in MASTER state. "\r
-                       "Dropping mad\n");\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_smp->attr_id) {\r
-       case IB_MAD_ATTR_NOTICE:\r
-               msg_id = OSM_MSG_MAD_NOTICE;\r
-               break;\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3109: "\r
-                       "Unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_smp->attr_id));\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-          Post this MAD to the dispatcher for asynchronous\r
-          processing by the appropriate controller.\r
-        */\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "Posting Dispatcher message %s\n",\r
-               osm_get_disp_msg_str(msg_id));\r
-\r
-       status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,\r
-                             sm_mad_ctrl_disp_done_callback, p_ctrl);\r
-\r
-       if (status != CL_SUCCESS) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3110: "\r
-                       "Dispatcher post message failed (%s)\n",\r
-                       CL_STATUS_MSG(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_process_trap_repress\r
- * NAME\r
- * sm_mad_ctrl_process_trap_repress\r
- *\r
- * DESCRIPTION\r
- * This function handles method TrapRepress() for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                            IN osm_madw_t * p_madw)\r
-{\r
-       ib_smp_t *p_smp;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /*\r
-          Note that attr_id (like the rest of the MAD) is in\r
-          network byte order.\r
-        */\r
-       switch (p_smp->attr_id) {\r
-       case IB_MAD_ATTR_NOTICE:\r
-               sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-               break;\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3105: "\r
-                       "Unsupported attribute 0x%X\n",\r
-                       cl_ntoh16(p_smp->attr_id));\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               break;\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-static void log_rcv_cb_error(osm_log_t *p_log, ib_smp_t *p_smp, ib_net16_t status)\r
-{\r
-       char buf[BUF_SIZE];\r
-       uint32_t i;\r
-\r
-       if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {\r
-               char ipath[BUF_SIZE], rpath[BUF_SIZE];\r
-               int ni = sprintf(ipath, "%d", p_smp->initial_path[0]);\r
-               int nr = sprintf(rpath, "%d", p_smp->return_path[0]);\r
-               for (i = 1; i <= p_smp->hop_count; i++) {\r
-                       ni += sprintf(ipath + ni, ",%d", p_smp->initial_path[i]);\r
-                       nr += sprintf(rpath + nr, ",%d", p_smp->return_path[i]);\r
-               }\r
-               snprintf(buf, sizeof(buf),\r
-                        "\n\t\t\tInitial path: %s Return path: %s",\r
-                        ipath, rpath);\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 3111: "\r
-               "Received MAD with error status = 0x%X\n"\r
-               "\t\t\t%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "%s\n",\r
-               cl_ntoh16(status), ib_get_sm_method_str(p_smp->method),\r
-               ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod),\r
-               cl_ntoh64(p_smp->trans_id),\r
-               p_smp->mgmt_class == IB_MCLASS_SUBN_DIR ? buf : "");\r
-\r
-       osm_dump_dr_smp(p_log, p_smp, OSM_LOG_VERBOSE);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_rcv_callback\r
- * NAME\r
- * sm_mad_ctrl_rcv_callback\r
- *\r
- * DESCRIPTION\r
- * This is the callback from the transport layer for received MADs.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,\r
-                                    IN void *bind_context,\r
-                                    IN osm_madw_t * p_req_madw)\r
-{\r
-       osm_sm_mad_ctrl_t *p_ctrl = bind_context;\r
-       ib_smp_t *p_smp;\r
-       ib_net16_t status;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       /*\r
-          A MAD was received from the wire, possibly in response to a request.\r
-        */\r
-       cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd);\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "%u QP0 MADs received\n",\r
-               p_ctrl->p_stats->qp0_mads_rcvd);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /* if we are closing down simply do nothing */\r
-       if (osm_exit_flag) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR,\r
-                       "Ignoring received mad - since we are exiting\n");\r
-\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_DEBUG);\r
-\r
-               /* retire the mad or put it back */\r
-               if (ib_smp_is_response(p_smp)) {\r
-                       CL_ASSERT(p_madw->resp_expected == FALSE);\r
-                       sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-               } else if (p_madw->resp_expected == TRUE)\r
-                       sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-               else\r
-                       osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-\r
-               goto Exit;\r
-       }\r
-\r
-       if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_FRAMES))\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_FRAMES);\r
-\r
-       if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR)\r
-               status = ib_smp_get_status(p_smp);\r
-       else\r
-               status = p_smp->status;\r
-\r
-       if (status != 0)\r
-               log_rcv_cb_error(p_ctrl->p_log, p_smp, status);\r
-\r
-       switch (p_smp->method) {\r
-       case IB_MAD_METHOD_GET_RESP:\r
-               CL_ASSERT(p_req_madw != NULL);\r
-               sm_mad_ctrl_process_get_resp(p_ctrl, p_madw, p_req_madw);\r
-               break;\r
-       case IB_MAD_METHOD_GET:\r
-               CL_ASSERT(p_req_madw == NULL);\r
-               sm_mad_ctrl_process_get(p_ctrl, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_TRAP:\r
-               CL_ASSERT(p_req_madw == NULL);\r
-               sm_mad_ctrl_process_trap(p_ctrl, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_SET:\r
-               CL_ASSERT(p_req_madw == NULL);\r
-               sm_mad_ctrl_process_set(p_ctrl, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_TRAP_REPRESS:\r
-               CL_ASSERT(p_req_madw != NULL);\r
-               sm_mad_ctrl_process_trap_repress(p_ctrl, p_madw);\r
-               break;\r
-       case IB_MAD_METHOD_SEND:\r
-       case IB_MAD_METHOD_REPORT:\r
-       case IB_MAD_METHOD_REPORT_RESP:\r
-       default:\r
-               cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3112: "\r
-                       "Unsupported method = 0x%X\n", p_smp->method);\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\r
-               osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* opensm: SM/sm_mad_ctrl_send_err_cb\r
- * NAME\r
- * sm_mad_ctrl_send_err_cb\r
- *\r
- * DESCRIPTION\r
- * This is the callback from the transport layer for send errors\r
- * on MADs that were expecting a response.\r
- *\r
- * SYNOPSIS\r
- */\r
-static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)\r
-{\r
-       osm_sm_mad_ctrl_t *p_ctrl = context;\r
-       ib_api_status_t status;\r
-       ib_smp_t *p_smp;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3113: "\r
-               "MAD completed in error (%s): "\r
-               "%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "\n",\r
-               ib_get_err_str(p_madw->status),\r
-               ib_get_sm_method_str(p_smp->method),\r
-               ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod),\r
-               cl_ntoh64(p_smp->trans_id));\r
-\r
-       /*\r
-          If this was a SubnSet MAD, then this error might indicate a problem\r
-          in configuring the subnet. In this case - need to mark that there was\r
-          such a problem. The subnet will not be up, and the next sweep should\r
-          be a heavy sweep as well.\r
-        */\r
-       if (p_smp->method == IB_MAD_METHOD_SET &&\r
-           (p_smp->attr_id == IB_MAD_ATTR_PORT_INFO ||\r
-            p_smp->attr_id == IB_MAD_ATTR_MCAST_FWD_TBL ||\r
-            p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO ||\r
-            p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL ||\r
-            p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE)) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3119: "\r
-                       "Set method failed for attribute 0x%X (%s)\n",\r
-                       cl_ntoh16(p_smp->attr_id),\r
-                       ib_get_sm_attr_str(p_smp->attr_id));\r
-               p_ctrl->p_subn->subnet_initialization_error = TRUE;\r
-       }\r
-\r
-       osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_VERBOSE);\r
-\r
-       /*\r
-          Since we did not get any response we suspect the DR path\r
-          used for the target port.\r
-          Find it and replace it with an alternate path.\r
-          This is true only if the destination lid is not 0xFFFF, since\r
-          then we are aiming for a specific path and not specific destination\r
-          lid.\r
-        */\r
-       /* For now - do not add the alternate dr path to the release */\r
-#if 0\r
-       if (p_madw->mad_addr.dest_lid != 0xFFFF) {\r
-               osm_physp_t *p_physp = osm_get_physp_by_mad_addr(p_ctrl->p_log,\r
-                                                                p_ctrl->p_subn,\r
-                                                                &(p_madw->\r
-                                                                  mad_addr));\r
-               if (!p_physp) {\r
-                       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3114: "\r
-                               "Failed to find the corresponding phys port\n");\r
-               } else {\r
-                       osm_physp_replace_dr_path_with_alternate_dr_path\r
-                           (p_ctrl->p_log, p_ctrl->p_subn, p_physp,\r
-                            p_madw->h_bind);\r
-               }\r
-       }\r
-#endif\r
-\r
-       /*\r
-          An error occurred.  No response was received to a request MAD.\r
-          Retire the original request MAD.\r
-        */\r
-       sm_mad_ctrl_update_wire_stats(p_ctrl);\r
-\r
-       if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG,\r
-                       "Posting Dispatcher message %s\n",\r
-                       osm_get_disp_msg_str(osm_madw_get_err_msg(p_madw)));\r
-\r
-               status = cl_disp_post(p_ctrl->h_disp,\r
-                                     osm_madw_get_err_msg(p_madw), p_madw,\r
-                                     sm_mad_ctrl_disp_done_callback, p_ctrl);\r
-               if (status != CL_SUCCESS)\r
-                       OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3115: "\r
-                               "Dispatcher post message failed (%s)\n",\r
-                               CL_STATUS_MSG(status));\r
-       } else\r
-               /*\r
-                  No error message was provided, just retire the MAD.\r
-                */\r
-               sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);\r
-\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-}\r
-\r
-/*\r
- * PARAMETERS\r
- *\r
- * RETURN VALUES\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl)\r
-{\r
-       CL_ASSERT(p_ctrl);\r
-       memset(p_ctrl, 0, sizeof(*p_ctrl));\r
-       p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;\r
-}\r
-\r
-void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl)\r
-{\r
-       CL_ASSERT(p_ctrl);\r
-\r
-       if (p_ctrl->h_bind != CL_DISP_INVALID_HANDLE)\r
-               osm_vendor_unbind(p_ctrl->h_bind);\r
-       cl_disp_unregister(p_ctrl->h_disp);\r
-}\r
-\r
-ib_api_status_t osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                    IN osm_subn_t * p_subn,\r
-                                    IN osm_mad_pool_t * p_mad_pool,\r
-                                    IN osm_vl15_t * p_vl15,\r
-                                    IN osm_vendor_t * p_vendor,\r
-                                    IN osm_log_t * p_log,\r
-                                    IN osm_stats_t * p_stats,\r
-                                    IN cl_plock_t * p_lock,\r
-                                    IN cl_dispatcher_t * p_disp)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       osm_sm_mad_ctrl_construct(p_ctrl);\r
-\r
-       p_ctrl->p_subn = p_subn;\r
-       p_ctrl->p_log = p_log;\r
-       p_ctrl->p_disp = p_disp;\r
-       p_ctrl->p_mad_pool = p_mad_pool;\r
-       p_ctrl->p_vendor = p_vendor;\r
-       p_ctrl->p_stats = p_stats;\r
-       p_ctrl->p_lock = p_lock;\r
-       p_ctrl->p_vl15 = p_vl15;\r
-\r
-       p_ctrl->h_disp = cl_disp_register(p_disp, CL_DISP_MSGID_NONE, NULL,\r
-                                         NULL);\r
-\r
-       if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 3116: "\r
-                       "Dispatcher registration failed\n");\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * p_ctrl,\r
-                                    IN ib_net64_t port_guid)\r
-{\r
-       osm_bind_info_t bind_info;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_ctrl->p_log);\r
-\r
-       if (p_ctrl->h_bind != OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3117: "\r
-                       "Multiple binds not allowed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       bind_info.class_version = 1;\r
-       bind_info.is_report_processor = FALSE;\r
-       bind_info.is_responder = TRUE;\r
-       bind_info.is_trap_processor = TRUE;\r
-       bind_info.mad_class = IB_MCLASS_SUBN_DIR;\r
-       bind_info.port_guid = port_guid;\r
-       bind_info.recv_q_size = OSM_SM_DEFAULT_QP0_RCV_SIZE;\r
-       bind_info.send_q_size = OSM_SM_DEFAULT_QP0_SEND_SIZE;\r
-       bind_info.timeout = p_ctrl->p_subn->opt.transaction_timeout;\r
-       bind_info.retries = p_ctrl->p_subn->opt.transaction_retries;\r
-\r
-       OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE,\r
-               "Binding to port 0x%" PRIx64 "\n", cl_ntoh64(port_guid));\r
-\r
-       p_ctrl->h_bind = osm_vendor_bind(p_ctrl->p_vendor, &bind_info,\r
-                                        p_ctrl->p_mad_pool,\r
-                                        sm_mad_ctrl_rcv_callback,\r
-                                        sm_mad_ctrl_send_err_cb, p_ctrl);\r
-\r
-       if (p_ctrl->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               status = IB_ERROR;\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3118: "\r
-                       "Vendor specific bind failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_ctrl->p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sm_state_mgr.c b/branches/opensm_3/user/opensm/osm_sm_state_mgr.c
deleted file mode 100644 (file)
index a8acd3d..0000000
+++ /dev/null
@@ -1,540 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sm_state_mgr_t.\r
- * This file implements the SM State Manager object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <time.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-void osm_report_sm_state(osm_sm_t * sm)\r
-{\r
-       char buf[64];\r
-       const char *state_str = osm_get_sm_mgr_state_str(sm->p_subn->sm_state);\r
-\r
-       osm_log(sm->p_log, OSM_LOG_SYS, "Entering %s state\n", state_str);\r
-       snprintf(buf, sizeof(buf), "ENTERING SM %s STATE", state_str);\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf);\r
-}\r
-\r
-static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)\r
-{\r
-       osm_madw_context_t context;\r
-       const osm_port_t *p_port;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY) {\r
-               /*\r
-                * We are in STANDBY state - this means we need to poll the\r
-                * master SM (according to master_guid).\r
-                * Send a query of SubnGet(SMInfo) to the subn\r
-                * master_sm_base_lid object.\r
-                */\r
-               p_port = osm_get_port_by_guid(sm->p_subn, sm->master_sm_guid);\r
-       } else {\r
-               /*\r
-                * We are not in STANDBY - this means we are in MASTER state -\r
-                * so we need to poll the SM that is saved in p_polling_sm\r
-                * under sm.\r
-                * Send a query of SubnGet(SMInfo) to that SM.\r
-                */\r
-               p_port = sm->p_polling_sm->p_port;\r
-       }\r
-       if (p_port == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3203: "\r
-                       "No port object for GUID 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(sm->master_sm_guid));\r
-               goto Exit;\r
-       }\r
-\r
-       context.smi_context.port_guid = p_port->guid;\r
-       context.smi_context.set_method = FALSE;\r
-\r
-       status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),\r
-                            IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE,\r
-                            &context);\r
-\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3204: "\r
-                       "Failure requesting SMInfo (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void sm_state_mgr_start_polling(osm_sm_t * sm)\r
-{\r
-       uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout;\r
-       cl_status_t cl_status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * Init the retry_number back to zero - need to restart counting\r
-        */\r
-       sm->retry_number = 0;\r
-\r
-       /*\r
-        * Send a SubnGet(SMInfo) query to the current (or new) master found.\r
-        */\r
-       sm_state_mgr_send_master_sm_info_req(sm);\r
-\r
-       /*\r
-        * Start a timer that will wake up every sminfo_polling_timeout milliseconds.\r
-        * The callback of the timer will send a SubnGet(SMInfo) to the Master SM\r
-        * and restart the timer\r
-        */\r
-       cl_status = cl_timer_start(&sm->polling_timer, timeout);\r
-       if (cl_status != CL_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3210: "\r
-                       "Failed to start timer\n");\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_sm_state_mgr_polling_callback(IN void *context)\r
-{\r
-       osm_sm_t *sm = context;\r
-       uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout;\r
-       cl_status_t cl_status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * We can be here in one of two cases:\r
-        * 1. We are a STANDBY sm polling on the master SM.\r
-        * 2. We are a MASTER sm, waiting for a handover from a remote master sm.\r
-        * If we are not in one of these cases - don't need to restart the poller.\r
-        */\r
-       if (!((sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER &&\r
-              sm->p_polling_sm != NULL) ||\r
-             sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY))\r
-               goto Exit;\r
-\r
-       /*\r
-        * If we are a STANDBY sm and the osm_exit_flag is set, then let's\r
-        * signal the subnet_up. This is relevant for the case of running only\r
-        * once. In that case - the program is stuck until this signal is\r
-        * received. In other cases - it is not relevant whether or not the\r
-        * signal is on - since we are currently in exit flow\r
-        */\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY && osm_exit_flag) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Signalling subnet_up_event\n");\r
-               cl_event_signal(&sm->subnet_up_event);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Incr the retry number.\r
-        * If it reached the max_retry_number in the subnet opt - call\r
-        * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT\r
-        */\r
-       sm->retry_number++;\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Retry number:%d\n",\r
-               sm->retry_number);\r
-\r
-       if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Reached polling_retry_number value in retry_number. "\r
-                       "Go to DISCOVERY state\n");\r
-               osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_POLLING_TIMEOUT);\r
-               goto Exit;\r
-       }\r
-\r
-       /* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */\r
-       sm_state_mgr_send_master_sm_info_req(sm);\r
-\r
-       /* restart the timer */\r
-       cl_status = cl_timer_start(&sm->polling_timer, timeout);\r
-       if (cl_status != CL_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3211: "\r
-                       "Failed to restart timer\n");\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void sm_state_mgr_signal_error(osm_sm_t * sm, IN osm_sm_signal_t signal)\r
-{\r
-       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3207: "\r
-               "Invalid signal %s in state %s\n",\r
-               osm_get_sm_mgr_signal_str(signal),\r
-               osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-}\r
-\r
-void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm)\r
-{\r
-       OSM_LOG_ENTER(sm->p_log);\r
-       sm->retry_number = 0;\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,\r
-                                        IN osm_sm_signal_t signal)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * The state lock prevents many race conditions from screwing\r
-        * up the state transition process.\r
-        */\r
-       cl_spinlock_acquire(&sm->state_lock);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Received signal %s in state %s\n",\r
-               osm_get_sm_mgr_signal_str(signal),\r
-               osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-\r
-       switch (sm->p_subn->sm_state) {\r
-       case IB_SMINFO_STATE_DISCOVERING:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:\r
-                       /*\r
-                        * Update the state of the SM to MASTER\r
-                        */\r
-                       /* Turn on the first_time_master_sweep flag */\r
-                       sm->p_subn->first_time_master_sweep = TRUE;\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_MASTER;\r
-                       osm_report_sm_state(sm);\r
-                       /*\r
-                        * Make sure to set the subnet master_sm_base_lid\r
-                        * to the sm_base_lid value\r
-                        */\r
-                       sm->p_subn->master_sm_base_lid =\r
-                           sm->p_subn->sm_base_lid;\r
-                       break;\r
-               case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED:\r
-                       /*\r
-                        * Finished all discovery actions - move to STANDBY\r
-                        * start the polling\r
-                        */\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;\r
-                       osm_report_sm_state(sm);\r
-                       /*\r
-                        * Since another SM is doing the LFT config - we should not\r
-                        * ignore the results of it\r
-                        */\r
-                       sm->p_subn->ignore_existing_lfts = FALSE;\r
-\r
-                       sm_state_mgr_start_polling(sm);\r
-                       break;\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-                       /*\r
-                        * Do nothing. We will discover it later on. If we already discovered\r
-                        * this SM, and got the HANDOVER - this means the remote SM is of\r
-                        * lower priority. In this case we will stop polling it (since it is\r
-                        * a lower priority SM in STANDBY state).\r
-                        */\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_STANDBY:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_POLLING_TIMEOUT:\r
-               case OSM_SM_SIGNAL_DISCOVER:\r
-                       /*\r
-                        * case 1: Polling timeout occured - this means that the Master SM\r
-                        * is no longer alive.\r
-                        * case 2: Got a signal to move to DISCOVERING\r
-                        * Move to DISCOVERING state and start sweeping\r
-                        */\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;\r
-                       osm_report_sm_state(sm);\r
-                       sm->p_subn->coming_out_of_standby = TRUE;\r
-                       osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-                       break;\r
-               case OSM_SM_SIGNAL_DISABLE:\r
-                       /*\r
-                        * Update the state to NOT_ACTIVE\r
-                        */\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;\r
-                       osm_report_sm_state(sm);\r
-                       osm_vendor_set_sm(sm->mad_ctrl.h_bind, FALSE);\r
-                       break;\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-                       /*\r
-                        * Update the state to MASTER, and start sweeping\r
-                        * OPTIONAL: send ACKNOWLEDGE\r
-                        */\r
-                       /* Turn on the first_time_master_sweep flag */\r
-                       sm->p_subn->first_time_master_sweep = TRUE;\r
-                       /*\r
-                        * Turn on the force_heavy_sweep - we want a\r
-                        * heavy sweep to occur on the first sweep of this SM.\r
-                        */\r
-                       sm->p_subn->force_heavy_sweep = TRUE;\r
-\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_MASTER;\r
-                       osm_report_sm_state(sm);\r
-                       /*\r
-                        * Make sure to set the subnet master_sm_base_lid\r
-                        * to the sm_base_lid value\r
-                        */\r
-                       sm->p_subn->master_sm_base_lid =\r
-                           sm->p_subn->sm_base_lid;\r
-                       sm->p_subn->coming_out_of_standby = TRUE;\r
-                       osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-                       break;\r
-               case OSM_SM_SIGNAL_ACKNOWLEDGE:\r
-                       /*\r
-                        * Do nothing - already moved to STANDBY\r
-                        */\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_NOTACTIVE:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_STANDBY:\r
-                       /*\r
-                        * Update the state to STANDBY\r
-                        * start the polling\r
-                        */\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;\r
-                       osm_report_sm_state(sm);\r
-                       sm_state_mgr_start_polling(sm);\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_MASTER:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_POLLING_TIMEOUT:\r
-                       /*\r
-                        * We received a polling timeout - this means that we\r
-                        * waited for a remote master sm to send us a handover,\r
-                        * but didn't get it, and didn't get a response from\r
-                        * that remote sm.\r
-                        * We want to force a heavy sweep - hopefully this\r
-                        * occurred because the remote sm died, and we'll find\r
-                        * this out and configure the subnet after a heavy sweep.\r
-                        * We also want to clear the p_polling_sm object - since\r
-                        * we are done polling on that remote sm - we are\r
-                        * sweeping again.\r
-                        */\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-                       /*\r
-                        * If we received a handover in a master state - then we\r
-                        * want to force a heavy sweep. This means that either\r
-                        * we are in a sweep currently - in this case - no\r
-                        * change, or we are in idle state - since we\r
-                        * recognized a master SM before - so we want to make a\r
-                        * heavy sweep and reconfigure the new subnet.\r
-                        * We also want to clear the p_polling_sm object - since\r
-                        * we are done polling on that remote sm - we got a\r
-                        * handover from it.\r
-                        */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Forcing heavy sweep. "\r
-                               "Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n");\r
-                       sm->p_polling_sm = NULL;\r
-                       sm->p_subn->force_heavy_sweep = TRUE;\r
-                       osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-                       break;\r
-               case OSM_SM_SIGNAL_HANDOVER_SENT:\r
-                       /*\r
-                        * Just sent a HANDOVER signal - move to STANDBY\r
-                        * start the polling\r
-                        */\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_STANDBY;\r
-                       osm_report_sm_state(sm);\r
-                       sm_state_mgr_start_polling(sm);\r
-                       break;\r
-               case OSM_SM_SIGNAL_WAIT_FOR_HANDOVER:\r
-                       /*\r
-                        * We found a remote master SM, and we are waiting for\r
-                        * it to handover the mastership to us. Need to start\r
-                        * polling that SM, to make sure it is alive, if it\r
-                        * isn't - then we should move back to discovering,\r
-                        * since something must have happened to it.\r
-                        */\r
-                       sm_state_mgr_start_polling(sm);\r
-                       break;\r
-               case OSM_SM_SIGNAL_DISCOVER:\r
-                       sm->p_subn->sm_state = IB_SMINFO_STATE_DISCOVERING;\r
-                       osm_report_sm_state(sm);\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3208: "\r
-                       "Invalid state %s\n",\r
-                       osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-\r
-       }\r
-\r
-       cl_spinlock_release(&sm->state_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm,\r
-                                               IN osm_sm_signal_t signal)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * The state lock prevents many race conditions from screwing\r
-        * up the state transition process.\r
-        */\r
-       cl_spinlock_acquire(&sm->state_lock);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received signal %s in state %s\n",\r
-               osm_get_sm_mgr_signal_str(signal),\r
-               osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-\r
-       switch (sm->p_subn->sm_state) {\r
-       case IB_SMINFO_STATE_DISCOVERING:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_DISCOVERY_COMPLETED:\r
-               case OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED:\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-                       status = IB_SUCCESS;\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_STANDBY:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_POLLING_TIMEOUT:\r
-               case OSM_SM_SIGNAL_DISCOVER:\r
-               case OSM_SM_SIGNAL_DISABLE:\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-               case OSM_SM_SIGNAL_ACKNOWLEDGE:\r
-                       status = IB_SUCCESS;\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_NOTACTIVE:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_STANDBY:\r
-                       status = IB_SUCCESS;\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_MASTER:\r
-               switch (signal) {\r
-               case OSM_SM_SIGNAL_HANDOVER:\r
-               case OSM_SM_SIGNAL_HANDOVER_SENT:\r
-                       status = IB_SUCCESS;\r
-                       break;\r
-               default:\r
-                       sm_state_mgr_signal_error(sm, signal);\r
-                       status = IB_INVALID_PARAMETER;\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3209: "\r
-                       "Invalid state %s\n",\r
-                       osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-               status = IB_INVALID_PARAMETER;\r
-\r
-       }\r
-\r
-       cl_spinlock_release(&sm->state_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sminfo_rcv.c b/branches/opensm_3/user/opensm/osm_sminfo_rcv.c
deleted file mode 100755 (executable)
index 48d801f..0000000
+++ /dev/null
@@ -1,590 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_sminfo_rcv_t.\r
- * This object represents the SMInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-/**********************************************************************\r
- Return TRUE if the remote sm given (by ib_sm_info_t) is higher,\r
- return FALSE otherwise.\r
- By higher - we mean: SM with higher priority or with same priority\r
- and lower GUID.\r
-**********************************************************************/\r
-static boolean_t smi_rcv_remote_sm_is_higher(IN osm_sm_t * sm,\r
-                                            IN const ib_sm_info_t * p_rem_smi)\r
-{\r
-       return osm_sm_is_greater_than(ib_sminfo_get_priority(p_rem_smi),\r
-                                     p_rem_smi->guid,\r
-                                     sm->p_subn->opt.sm_priority,\r
-                                     sm->p_subn->sm_port_guid);\r
-\r
-}\r
-\r
-static void smi_rcv_process_get_request(IN osm_sm_t * sm,\r
-                                       IN const osm_madw_t * p_madw)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_smp_t *p_smp;\r
-       ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;\r
-       ib_api_status_t status;\r
-       ib_sm_info_t *p_remote_smi;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       /* No real need to grab the lock for this function. */\r
-       memset(payload, 0, sizeof(payload));\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       CL_ASSERT(p_smp->method == IB_MAD_METHOD_GET);\r
-\r
-       p_smi->guid = sm->p_subn->sm_port_guid;\r
-       p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);\r
-       p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |\r
-                                     sm->p_subn->opt.sm_priority << 4);\r
-       /*\r
-          p.840 line 20 - Return 0 for the SM key unless we authenticate the\r
-          requester as the master SM.\r
-        */\r
-       p_remote_smi = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(p_madw));\r
-       if (ib_sminfo_get_state(p_remote_smi) == IB_SMINFO_STATE_MASTER) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to master SM with real sm_key\n");\r
-               p_smi->sm_key = sm->p_subn->opt.sm_key;\r
-       } else {\r
-               /* The requester is not authenticated as master - set sm_key to zero. */\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to SM not master with zero sm_key\n");\r
-               p_smi->sm_key = 0;\r
-       }\r
-\r
-       status = osm_resp_send(sm, p_madw, 0, payload);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F02: "\r
-                       "Error sending response (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Check if the p_smp received is legal.\r
- * Current checks:\r
- *   MADHeader:AttributeModifier of ACKNOWLEDGE that was not sent by a\r
- *             Standby SM.\r
- *   MADHeader:AttributeModifiers of HANDOVER/DISABLE/STANDBY/DISCOVER\r
- *             that was not sent by a Master SM.\r
- * FUTURE - TO DO:\r
- *   Check that the SM_Key matches.\r
- **********************************************************************/\r
-static ib_api_status_t smi_rcv_check_set_req_legality(IN const ib_smp_t * p_smp)\r
-{\r
-       ib_sm_info_t *p_smi;\r
-\r
-       p_smi = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_ACKNOWLEDGE) {\r
-               if (ib_sminfo_get_state(p_smi) == IB_SMINFO_STATE_STANDBY)\r
-                       return IB_SUCCESS;\r
-       } else if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_HANDOVER ||\r
-                  p_smp->attr_mod == IB_SMINFO_ATTR_MOD_DISABLE ||\r
-                  p_smp->attr_mod == IB_SMINFO_ATTR_MOD_STANDBY ||\r
-                  p_smp->attr_mod == IB_SMINFO_ATTR_MOD_DISCOVER) {\r
-               if (ib_sminfo_get_state(p_smi) == IB_SMINFO_STATE_MASTER)\r
-                       return IB_SUCCESS;\r
-       }\r
-\r
-       return IB_INVALID_PARAMETER;\r
-}\r
-\r
-static void smi_rcv_process_set_request(IN osm_sm_t * sm,\r
-                                       IN const osm_madw_t * p_madw)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_smp_t *p_smp;\r
-       ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;\r
-       ib_sm_info_t *sm_smi;\r
-       ib_api_status_t status;\r
-       osm_sm_signal_t sm_signal;\r
-       ib_sm_info_t *p_remote_smi;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       memset(payload, 0, sizeof(payload));\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       sm_smi = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       if (p_smp->method != IB_MAD_METHOD_SET) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F03: "\r
-                       "Unsupported method 0x%X\n", p_smp->method);\r
-               goto Exit;\r
-       }\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       p_smi->guid = sm->p_subn->sm_port_guid;\r
-       p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);\r
-       p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |\r
-                                     sm->p_subn->opt.sm_priority << 4);\r
-       /*\r
-          p.840 line 20 - Return 0 for the SM key unless we authenticate the\r
-          requester as the master SM.\r
-        */\r
-       p_remote_smi = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(p_madw));\r
-       if (ib_sminfo_get_state(p_remote_smi) == IB_SMINFO_STATE_MASTER) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to master SM with real sm_key\n");\r
-               p_smi->sm_key = sm->p_subn->opt.sm_key;\r
-       } else {\r
-               /* The requester is not authenticated as master - set sm_key to zero. */\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to SM not master with zero sm_key\n");\r
-               p_smi->sm_key = 0;\r
-       }\r
-\r
-       /* Check the legality of the packet */\r
-       status = smi_rcv_check_set_req_legality(p_smp);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F04: "\r
-                       "Check legality failed. AttributeModifier:0x%X RemoteState:%s\n",\r
-                       p_smp->attr_mod,\r
-                       osm_get_sm_mgr_state_str(ib_sminfo_get_state(sm_smi)));\r
-               status = osm_resp_send(sm, p_madw, 7, payload);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F05: "\r
-                               "Error sending response (%s)\n",\r
-                               ib_get_err_str(status));\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               goto Exit;\r
-       }\r
-\r
-       /* translate from IB_SMINFO_ATTR to OSM_SM_SIGNAL */\r
-       switch (p_smp->attr_mod) {\r
-       case IB_SMINFO_ATTR_MOD_HANDOVER:\r
-               sm_signal = OSM_SM_SIGNAL_HANDOVER;\r
-               break;\r
-       case IB_SMINFO_ATTR_MOD_ACKNOWLEDGE:\r
-               sm_signal = OSM_SM_SIGNAL_ACKNOWLEDGE;\r
-               break;\r
-       case IB_SMINFO_ATTR_MOD_DISABLE:\r
-               sm_signal = OSM_SM_SIGNAL_DISABLE;\r
-               break;\r
-       case IB_SMINFO_ATTR_MOD_STANDBY:\r
-               sm_signal = OSM_SM_SIGNAL_STANDBY;\r
-               break;\r
-       case IB_SMINFO_ATTR_MOD_DISCOVER:\r
-               sm_signal = OSM_SM_SIGNAL_DISCOVER;\r
-               break;\r
-       default:\r
-               /*\r
-                  This code shouldn't be reached - checked in the\r
-                  check legality\r
-                */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F06: "\r
-                       "THIS CODE SHOULD NOT BE REACHED!!\n");\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               goto Exit;\r
-       }\r
-\r
-       /* check legality of the needed transition in the SM state machine */\r
-       status = osm_sm_state_mgr_check_legality(sm, sm_signal);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F07: "\r
-                       "Failed check of legality of needed SM transition. "\r
-                       "AttributeModifier:0x%X RemoteState:%s\n",\r
-                       p_smp->attr_mod,\r
-                       osm_get_sm_mgr_state_str(ib_sminfo_get_state(sm_smi)));\r
-               status = osm_resp_send(sm, p_madw, 7, payload);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F08: "\r
-                               "Error sending response (%s)\n",\r
-                               ib_get_err_str(status));\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               goto Exit;\r
-       }\r
-\r
-       /* the SubnSet(SMInfo) command is ok. Send a response. */\r
-       status = osm_resp_send(sm, p_madw, 0, payload);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F09: "\r
-                       "Error sending response (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-       /* it is a legal packet - act according to it */\r
-\r
-       /* if the AttributeModifier is STANDBY - need to save on the sm in */\r
-       /* the master_sm_guid variable - the guid of the current master. */\r
-       if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_STANDBY) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Received a STANDBY signal. Updating "\r
-                       "sm_state_mgr master_guid: 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(sm_smi->guid));\r
-               sm->master_sm_guid = sm_smi->guid;\r
-       }\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       status = osm_sm_state_mgr_process(sm, sm_signal);\r
-\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F10: "\r
-                       "Error in SM state transition (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static int smi_rcv_process_get_sm(IN osm_sm_t * sm,\r
-                                 IN const osm_remote_sm_t * p_sm,\r
-                                 boolean_t light_sweep)\r
-{\r
-       const ib_sm_info_t *p_smi;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_smi = &p_sm->smi;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Detected SM 0x%016" PRIx64 " in state %u\n",\r
-               cl_ntoh64(p_smi->guid), ib_sminfo_get_state(p_smi));\r
-\r
-       /* Check the state of this SM vs. our own. */\r
-       switch (sm->p_subn->sm_state) {\r
-       case IB_SMINFO_STATE_NOTACTIVE:\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_DISCOVERING:\r
-               switch (ib_sminfo_get_state(p_smi)) {\r
-               case IB_SMINFO_STATE_NOTACTIVE:\r
-                       break;\r
-               case IB_SMINFO_STATE_MASTER:\r
-                       sm->master_sm_found = 1;\r
-                       /* save on the sm the guid of the current master. */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Found master SM. Updating sm_state_mgr master_guid: 0x%016"\r
-                               PRIx64 "\n", cl_ntoh64(p_sm->p_port->guid));\r
-                       sm->master_sm_guid = p_sm->p_port->guid;\r
-                       break;\r
-               case IB_SMINFO_STATE_DISCOVERING:\r
-               case IB_SMINFO_STATE_STANDBY:\r
-                       if (smi_rcv_remote_sm_is_higher(sm, p_smi)) {\r
-                               /* the remote is a higher sm - need to stop sweeping */\r
-                               sm->master_sm_found = 1;\r
-                               /* save on the sm the guid of the higher SM we found - */\r
-                               /* we will poll it - as long as it lives - we should be in Standby. */\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Found higher SM. Updating sm_state_mgr master_guid:"\r
-                                       " 0x%016" PRIx64 "\n",\r
-                                       cl_ntoh64(p_sm->p_port->guid));\r
-                               sm->master_sm_guid = p_sm->p_port->guid;\r
-                       }\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_STANDBY:\r
-               /* if the guid of the SM that sent us this response is equal to the */\r
-               /* p_sm_mgr->master_guid - then this is a signal that the polling */\r
-               switch (ib_sminfo_get_state(p_smi)) {\r
-               case IB_SMINFO_STATE_MASTER:\r
-                       /* This means the master is alive */\r
-                       /* Signal that to the SM state mgr */\r
-                       osm_sm_state_mgr_signal_master_is_alive(sm);\r
-\r
-                       if (!smi_rcv_remote_sm_is_higher(sm, p_smi))\r
-                               osm_send_trap144(sm,\r
-                                                TRAP_144_MASK_SM_PRIORITY_CHANGE);\r
-                       break;\r
-               case IB_SMINFO_STATE_STANDBY:\r
-                       /* This should be the response from the sm we are polling. */\r
-                       /* If it is - then signal master is alive */\r
-                       if (sm->master_sm_guid == p_sm->p_port->guid) {\r
-                               /* Make sure that it is an SM with higher priority than us.\r
-                                  If we started polling it when it was master, and it moved\r
-                                  to standby - then it might be with a lower priority than\r
-                                  us - and then we don't want to continue polling it. */\r
-                               if (smi_rcv_remote_sm_is_higher(sm, p_smi))\r
-                                       osm_sm_state_mgr_signal_master_is_alive\r
-                                           (sm);\r
-                       }\r
-                       break;\r
-               default:\r
-                       /* any other state - do nothing */\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       case IB_SMINFO_STATE_MASTER:\r
-               switch (ib_sminfo_get_state(p_smi)) {\r
-               case IB_SMINFO_STATE_MASTER:\r
-                       /* If this is a response due to our polling, this means that we are\r
-                          waiting for a handover from this SM, and it is still alive -\r
-                          signal that. */\r
-                       if (sm->p_polling_sm)\r
-                               osm_sm_state_mgr_signal_master_is_alive(sm);\r
-                       else {\r
-                               /* This is a response we got while sweeping the subnet.\r
-                                  We will handle a case of handover needed later on, when the sweep\r
-                                  is done and all SMs are recongnized. */\r
-                       }\r
-                       break;\r
-               case IB_SMINFO_STATE_STANDBY:\r
-                       if (light_sweep &&\r
-                           smi_rcv_remote_sm_is_higher(sm, p_smi))\r
-                               sm->p_subn->force_heavy_sweep = TRUE;\r
-                       break;\r
-               default:\r
-                       /* any other state - do nothing */\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       default:\r
-               break;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return 0;\r
-}\r
-\r
-static void smi_rcv_process_get_response(IN osm_sm_t * sm,\r
-                                        IN const osm_madw_t * p_madw)\r
-{\r
-       const ib_smp_t *p_smp;\r
-       const ib_sm_info_t *p_smi;\r
-       cl_qmap_t *p_sm_tbl;\r
-       osm_port_t *p_port;\r
-       ib_net64_t port_guid;\r
-       osm_remote_sm_t *p_sm;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       if (p_smp->method != IB_MAD_METHOD_GET_RESP) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F11: "\r
-                       "Unsupported method 0x%X\n", p_smp->method);\r
-               goto Exit;\r
-       }\r
-\r
-       p_smi = ib_smp_get_payload_ptr(p_smp);\r
-       p_sm_tbl = &sm->p_subn->sm_guid_tbl;\r
-       port_guid = p_smi->guid;\r
-\r
-       osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);\r
-\r
-       /* Check that the sm_key of the found SM is the same as ours,\r
-          or is zero. If not - OpenSM cannot continue with configuration!. */\r
-       if (p_smi->sm_key != 0 && p_smi->sm_key != sm->p_subn->opt.sm_key) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F18: "\r
-                       "Got SM with sm_key that doesn't match our "\r
-                       "local key. Exiting\n");\r
-               osm_log(sm->p_log, OSM_LOG_SYS,\r
-                       "Found remote SM with non-matching sm_key. Exiting\n");\r
-               osm_exit_flag = TRUE;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Determine if we already have another SM object for this SM. */\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F12: "\r
-                       "No port object for this SM\n");\r
-               goto _unlock_and_exit;\r
-       }\r
-\r
-       if (osm_port_get_guid(p_port) != p_smi->guid) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F13: "\r
-                       "Bogus SM port GUID\n\t\t\t\tExpected 0x%016" PRIx64\r
-                       ", Received 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(osm_port_get_guid(p_port)),\r
-                       cl_ntoh64(p_smi->guid));\r
-               goto _unlock_and_exit;\r
-       }\r
-\r
-       if (port_guid == sm->p_subn->sm_port_guid) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Self query response received - SM port 0x%016" PRIx64\r
-                       "\n", cl_ntoh64(port_guid));\r
-               goto _unlock_and_exit;\r
-       }\r
-\r
-       p_sm = (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl, port_guid);\r
-       if (p_sm == (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) {\r
-               p_sm = malloc(sizeof(*p_sm));\r
-               if (p_sm == NULL) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F14: "\r
-                               "Unable to allocate SM object\n");\r
-                       goto _unlock_and_exit;\r
-               }\r
-\r
-               osm_remote_sm_init(p_sm, p_port, p_smi);\r
-\r
-               cl_qmap_insert(p_sm_tbl, port_guid, &p_sm->map_item);\r
-       } else\r
-               /* We already know this SM. Update the SMInfo attribute. */\r
-               p_sm->smi = *p_smi;\r
-\r
-       smi_rcv_process_get_sm(sm, p_sm,\r
-                              osm_madw_get_smi_context_ptr(p_madw)->\r
-                              light_sweep);\r
-\r
-_unlock_and_exit:\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void smi_rcv_process_set_response(IN osm_sm_t * sm,\r
-                                        IN const osm_madw_t * p_madw)\r
-{\r
-       const ib_smp_t *p_smp;\r
-       const ib_sm_info_t *p_smi;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       if (p_smp->method != IB_MAD_METHOD_GET_RESP) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F16: "\r
-                       "Unsupported method 0x%X\n", p_smp->method);\r
-               goto Exit;\r
-       }\r
-\r
-       p_smi = ib_smp_get_payload_ptr(p_smp);\r
-       osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);\r
-\r
-       /* Check the AttributeModifier */\r
-       if (p_smp->attr_mod != IB_SMINFO_ATTR_MOD_HANDOVER) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F17: "\r
-                       "Unsupported attribute modifier 0x%X\n",\r
-                       p_smp->attr_mod);\r
-               goto Exit;\r
-       }\r
-\r
-       /* This is a response on a HANDOVER request - Nothing to do. */\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_sminfo_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_smp_t *p_smp;\r
-       osm_smi_context_t *p_smi_context;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /* Determine if this is a request for our own SMInfo or if\r
-          this is a response to our request for another SM's SMInfo. */\r
-       if (ib_smp_is_response(p_smp)) {\r
-               const ib_sm_info_t *p_smi = ib_smp_get_payload_ptr(p_smp);\r
-\r
-               /* Get the context - to see if this is a response to a Get or Set method */\r
-               p_smi_context = osm_madw_get_smi_context_ptr(p_madw);\r
-\r
-               /* Verify that response is from expected port and there is\r
-                  no port moving issue. */\r
-               if (p_smi_context->port_guid != p_smi->guid) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F19: "\r
-                               "Unexpected SM port GUID in response"\r
-                               "\n\t\t\t\tExpected 0x%016" PRIx64\r
-                               ", Received 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_smi_context->port_guid),\r
-                               cl_ntoh64(p_smi->guid));\r
-                       goto Exit;\r
-               }\r
-\r
-               if (p_smi_context->set_method == FALSE)\r
-                       /* this is a response to a Get method */\r
-                       smi_rcv_process_get_response(sm, p_madw);\r
-               else\r
-                       /* this is a response to a Set method */\r
-                       smi_rcv_process_set_response(sm, p_madw);\r
-       } else if (p_smp->method == IB_MAD_METHOD_GET)\r
-               /* This is a SubnGet request */\r
-               smi_rcv_process_get_request(sm, p_madw);\r
-       else\r
-               /* This should be a SubnSet request */\r
-               smi_rcv_process_set_request(sm, p_madw);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_state_mgr.c b/branches/opensm_3/user/opensm/osm_state_mgr.c
deleted file mode 100644 (file)
index 8eace47..0000000
+++ /dev/null
@@ -1,1438 +0,0 @@
-/*\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_state_mgr_t.\r
- * This file implements the State Manager object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-extern void osm_drop_mgr_process(IN osm_sm_t * sm);\r
-extern int osm_qos_setup(IN osm_opensm_t * p_osm);\r
-extern int osm_pkey_mgr_process(IN osm_opensm_t * p_osm);\r
-extern int osm_mcast_mgr_process(IN osm_sm_t * sm);\r
-extern int osm_mcast_mgr_process_mgroups(IN osm_sm_t * sm);\r
-extern int osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state);\r
-\r
-static void state_mgr_up_msg(IN const osm_sm_t * sm)\r
-{\r
-       /*\r
-        * This message should be written only once - when the\r
-        * SM moves to Master state and the subnet is up for\r
-        * the first time.\r
-        */\r
-       osm_log(sm->p_log, sm->p_subn->first_time_master_sweep ?\r
-               OSM_LOG_SYS : OSM_LOG_INFO, "SUBNET UP\n");\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       sm->p_subn->opt.sweep_interval ?\r
-                       "SUBNET UP" : "SUBNET UP (sweep disabled)");\r
-}\r
-\r
-static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item,\r
-                                      IN void *context)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) p_map_item;\r
-\r
-       p_node->discovery_count = 0;\r
-}\r
-\r
-static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item,\r
-                                      IN void *context)\r
-{\r
-       osm_port_t *p_port = (osm_port_t *) p_map_item;\r
-\r
-       p_port->discovery_count = 0;\r
-}\r
-\r
-static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item,\r
-                                        IN void *context)\r
-{\r
-       osm_switch_t *p_sw = (osm_switch_t *) p_map_item;\r
-\r
-       p_sw->need_update = 1;\r
-}\r
-\r
-static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context)\r
-{\r
-       osm_node_t *p_node;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_madw_context_t mad_context;\r
-       osm_switch_t *const p_sw = (osm_switch_t *) p_object;\r
-       osm_sm_t *sm = context;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_node = p_sw->p_node;\r
-       p_dr_path =\r
-           osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));\r
-\r
-       memset(&mad_context, 0, sizeof(mad_context));\r
-\r
-       mad_context.si_context.node_guid = osm_node_get_node_guid(p_node);\r
-       mad_context.si_context.set_method = FALSE;\r
-       mad_context.si_context.light_sweep = TRUE;\r
-\r
-       status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0,\r
-                            OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3304: "\r
-                       "Request for SwitchInfo failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Initiate a remote port info request for the given physical port\r
- **********************************************************************/\r
-static void state_mgr_get_remote_port_info(IN osm_sm_t * sm,\r
-                                          IN osm_physp_t * p_physp)\r
-{\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_dr_path_t rem_node_dr_path;\r
-       osm_madw_context_t mad_context;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /* generate a dr path leaving on the physp to the remote node */\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-       memcpy(&rem_node_dr_path, p_dr_path, sizeof(osm_dr_path_t));\r
-       if (osm_dr_path_extend(&rem_node_dr_path, osm_physp_get_port_num(p_physp))) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332D: "\r
-                       "DR path with hop count %d couldn't be extended "\r
-                       "so skipping PortInfo query\n",\r
-                       p_dr_path->hop_count);\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&mad_context, 0, sizeof(mad_context));\r
-\r
-       mad_context.pi_context.node_guid =\r
-           osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));\r
-       mad_context.pi_context.port_guid = p_physp->port_guid;\r
-       mad_context.pi_context.set_method = FALSE;\r
-       mad_context.pi_context.light_sweep = TRUE;\r
-       mad_context.pi_context.active_transition = FALSE;\r
-\r
-       /* note that with some negative logic - if the query failed it means\r
-        * that there is no point in going to heavy sweep */\r
-       status = osm_req_get(sm, &rem_node_dr_path, IB_MAD_ATTR_PORT_INFO, 0,\r
-                            CL_DISP_MSGID_NONE, &mad_context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332E: "\r
-                       "Request for PortInfo failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Initiates a thorough sweep of the subnet.\r
- Used when there is suspicion that something on the subnet has changed.\r
-**********************************************************************/\r
-static ib_api_status_t state_mgr_sweep_hop_0(IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status;\r
-       osm_dr_path_t dr_path;\r
-       osm_bind_handle_t h_bind;\r
-       uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       memset(path_array, 0, sizeof(path_array));\r
-\r
-       /*\r
-        * First, get the bind handle.\r
-        */\r
-       h_bind = osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl);\r
-       if (h_bind != OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "INITIATING HEAVY SWEEP");\r
-               /*\r
-                * Start the sweep by clearing the port counts, then\r
-                * get our own NodeInfo at 0 hops.\r
-                */\r
-               CL_PLOCK_ACQUIRE(sm->p_lock);\r
-\r
-               cl_qmap_apply_func(&sm->p_subn->node_guid_tbl,\r
-                                  state_mgr_reset_node_count, sm);\r
-\r
-               cl_qmap_apply_func(&sm->p_subn->port_guid_tbl,\r
-                                  state_mgr_reset_port_count, sm);\r
-\r
-               cl_qmap_apply_func(&sm->p_subn->sw_guid_tbl,\r
-                                  state_mgr_reset_switch_count, sm);\r
-\r
-               /* Set the in_sweep_hop_0 flag in subn to be TRUE.\r
-                * This will indicate the sweeping not to continue beyond the\r
-                * the current node.\r
-                * This is relevant for the case of SM on switch, since in the\r
-                * switch info we need to signal somehow not to continue\r
-                * the sweeping. */\r
-               sm->p_subn->in_sweep_hop_0 = TRUE;\r
-\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-               osm_dr_path_init(&dr_path, h_bind, 0, path_array);\r
-               status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,\r
-                                    CL_DISP_MSGID_NONE, NULL);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3305: "\r
-                               "Request for NodeInfo failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-       } else {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "No bound ports. Deferring sweep...\n");\r
-               status = IB_INVALID_STATE;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Clear out all existing port lid assignments\r
-**********************************************************************/\r
-static ib_api_status_t state_mgr_clean_known_lids(IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl);\r
-       uint32_t i;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /* we need a lock here! */\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-\r
-       for (i = 0; i < cl_ptr_vector_get_size(p_vec); i++)\r
-               cl_ptr_vector_set(p_vec, i, NULL);\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Notifies the transport layer that the local LID has changed,\r
- which give it a chance to update address vectors, etc..\r
-**********************************************************************/\r
-static ib_api_status_t state_mgr_notify_lid_change(IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status;\r
-       osm_bind_handle_t h_bind;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * First, get the bind handle.\r
-        */\r
-       h_bind = osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl);\r
-       if (h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3306: "\r
-                       "No bound ports\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Notify the transport layer that we changed the local LID.\r
-        */\r
-       status = osm_vendor_local_lid_change(h_bind);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3307: "\r
-                       "Vendor LID update failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Returns true if the SM port is down.\r
- The SM's port object must exist in the port_guid table.\r
-**********************************************************************/\r
-static boolean_t state_mgr_is_sm_port_down(IN osm_sm_t * sm)\r
-{\r
-       ib_net64_t port_guid;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       uint8_t state;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       port_guid = sm->p_subn->sm_port_guid;\r
-\r
-       /*\r
-        * If we don't know our own port guid yet, assume the port is down.\r
-        */\r
-       if (port_guid == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3308: "\r
-                       "SM port GUID unknown\n");\r
-               state = IB_LINK_DOWN;\r
-               goto Exit;\r
-       }\r
-\r
-       CL_ASSERT(port_guid);\r
-\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3309: "\r
-                       "SM port with GUID:%016" PRIx64 " is unknown\n",\r
-                       cl_ntoh64(port_guid));\r
-               state = IB_LINK_DOWN;\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               goto Exit;\r
-       }\r
-\r
-       p_physp = p_port->p_physp;\r
-\r
-       CL_ASSERT(p_physp);\r
-\r
-       state = osm_physp_get_port_state(p_physp);\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return (state == IB_LINK_DOWN);\r
-}\r
-\r
-/**********************************************************************\r
- Sweeps the node 1 hop away.\r
- This sets off a "chain reaction" that causes discovery of the subnet.\r
- Used when there is suspicion that something on the subnet has changed.\r
-**********************************************************************/\r
-static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_bind_handle_t h_bind;\r
-       osm_madw_context_t context;\r
-       osm_node_t *p_node;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_dr_path_t hop_1_path;\r
-       ib_net64_t port_guid;\r
-       uint8_t port_num;\r
-       uint8_t path_array[IB_SUBNET_PATH_HOPS_MAX];\r
-       uint8_t num_ports;\r
-       osm_physp_t *p_ext_physp;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * First, get our own port and node objects.\r
-        */\r
-       port_guid = sm->p_subn->sm_port_guid;\r
-\r
-       CL_ASSERT(port_guid);\r
-\r
-       /* Set the in_sweep_hop_0 flag in subn to be FALSE.\r
-        * This will indicate the sweeping to continue beyond the\r
-        * the current node.\r
-        * This is relevant for the case of SM on switch, since in the\r
-        * switch info we need to signal that the sweeping should\r
-        * continue through the switch. */\r
-       sm->p_subn->in_sweep_hop_0 = FALSE;\r
-\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3310: "\r
-                       "No SM port object\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       CL_ASSERT(p_node);\r
-\r
-       port_num = ib_node_info_get_local_port_num(&p_node->node_info);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Probing hop 1 on local port %u\n", port_num);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-       CL_ASSERT(p_physp);\r
-\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-       h_bind = osm_dr_path_get_bind_handle(p_dr_path);\r
-\r
-       CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);\r
-\r
-       memset(path_array, 0, sizeof(path_array));\r
-       /* the hop_1 operations depend on the type of our node.\r
-        * Currently - legal nodes that can host SM are SW and CA */\r
-       switch (osm_node_get_type(p_node)) {\r
-       case IB_NODE_TYPE_CA:\r
-       case IB_NODE_TYPE_ROUTER:\r
-               memset(&context, 0, sizeof(context));\r
-               context.ni_context.node_guid = osm_node_get_node_guid(p_node);\r
-               context.ni_context.port_num = port_num;\r
-\r
-               path_array[1] = port_num;\r
-\r
-               osm_dr_path_init(&hop_1_path, h_bind, 1, path_array);\r
-               status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,\r
-                                    CL_DISP_MSGID_NONE, &context);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3311: "\r
-                               "Request for NodeInfo failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-               break;\r
-\r
-       case IB_NODE_TYPE_SWITCH:\r
-               /* Need to go over all the ports of the switch, and send a\r
-                * node_info from them. This doesn't include the port 0 of the\r
-                * switch, which hosts the SM.\r
-                * Note: We'll send another switchInfo on port 0, since if no\r
-                * ports are connected, we still want to get some response, and\r
-                * have the subnet come up.\r
-                */\r
-               num_ports = osm_node_get_num_physp(p_node);\r
-               for (port_num = 1; port_num < num_ports; port_num++) {\r
-                       /* go through the port only if the port is not DOWN */\r
-                       p_ext_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (p_ext_physp && ib_port_info_get_port_state\r
-                           (&(p_ext_physp->port_info)) > IB_LINK_DOWN) {\r
-                               memset(&context, 0, sizeof(context));\r
-                               context.ni_context.node_guid =\r
-                                   osm_node_get_node_guid(p_node);\r
-                               context.ni_context.port_num = port_num;\r
-\r
-                               path_array[1] = port_num;\r
-                               osm_dr_path_init(&hop_1_path, h_bind, 1,\r
-                                                path_array);\r
-                               status = osm_req_get(sm, &hop_1_path,\r
-                                                    IB_MAD_ATTR_NODE_INFO, 0,\r
-                                                    CL_DISP_MSGID_NONE,\r
-                                                    &context);\r
-                               if (status != IB_SUCCESS)\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 3312: "\r
-                                               "Request for NodeInfo failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                       }\r
-               }\r
-               break;\r
-\r
-       default:\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 3313: Unknown node type %d (%s)\n",\r
-                       osm_node_get_type(p_node), p_node->print_desc);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-static void query_sm_info(cl_map_item_t * item, void *cxt)\r
-{\r
-       osm_madw_context_t context;\r
-#ifndef __WIN__\r
-       osm_remote_sm_t *r_sm = cl_item_obj(item, r_sm, map_item);\r
-#else\r
-       osm_remote_sm_t *r_sm=NULL;\r
-#endif\r
-       osm_sm_t *sm = cxt;\r
-       ib_api_status_t ret;\r
-\r
-#ifdef __WIN__\r
-       r_sm = cl_item_obj(item, r_sm, map_item);\r
-#endif\r
-       context.smi_context.port_guid = r_sm->p_port->guid;\r
-       context.smi_context.set_method = FALSE;\r
-       context.smi_context.light_sweep = TRUE;\r
-\r
-       ret = osm_req_get(sm, osm_physp_get_dr_path_ptr(r_sm->p_port->p_physp),\r
-                         IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE, &context);\r
-       if (ret != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3314: "\r
-                       "Failure requesting SMInfo (%s)\n",\r
-                       ib_get_err_str(ret));\r
-}\r
-\r
-static void state_mgr_update_node_desc(IN cl_map_item_t * obj, IN void *context)\r
-{\r
-       osm_madw_context_t mad_context;\r
-       osm_node_t *p_node = (osm_node_t *) obj;\r
-       osm_sm_t *sm = context;\r
-       osm_physp_t *p_physp = NULL;\r
-       unsigned i, num_ports;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Updating NodeDesc for 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       /* get a physp to request from. */\r
-       num_ports = osm_node_get_num_physp(p_node);\r
-       for (i = 0; i < num_ports; i++)\r
-               if ((p_physp = osm_node_get_physp_ptr(p_node, i)))\r
-                       break;\r
-\r
-       if (!p_physp) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 331C: "\r
-                       "Failed to find any valid physical port object.\n");\r
-               goto exit;\r
-       }\r
-\r
-       mad_context.nd_context.node_guid = osm_node_get_node_guid(p_node);\r
-\r
-       status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),\r
-                            IB_MAD_ATTR_NODE_DESC, 0, CL_DISP_MSGID_NONE,\r
-                            &mad_context);\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "ERR 331B: Failure initiating NodeDescription request "\r
-                       "(%s)\n", ib_get_err_str(status));\r
-\r
-exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_update_node_desc(IN osm_opensm_t *osm)\r
-{\r
-       CL_PLOCK_ACQUIRE(&osm->lock);\r
-       cl_qmap_apply_func(&osm->subn.node_guid_tbl, state_mgr_update_node_desc,\r
-                          &osm->sm);\r
-       CL_PLOCK_RELEASE(&osm->lock);\r
-}\r
-\r
-/**********************************************************************\r
- During a light sweep, check each node to see if the node description\r
- is valid and if not issue a ND query.\r
-**********************************************************************/\r
-static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context)\r
-{\r
-       osm_node_t *p_node = (osm_node_t *) obj;\r
-       osm_sm_t *sm = context;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       if (p_node->print_desc\r
-           && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN))\r
-               /* if ND is valid, do nothing */\r
-               goto exit;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-               "ERR 3319: Unknown node description for node GUID "\r
-               "0x%016" PRIx64 ".  Reissuing ND query\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       state_mgr_update_node_desc(obj, context);\r
-\r
-exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- Initiates a lightweight sweep of the subnet.\r
- Used during normal sweeps after the subnet is up.\r
-**********************************************************************/\r
-static ib_api_status_t state_mgr_light_sweep_start(IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osm_bind_handle_t h_bind;\r
-       cl_qmap_t *p_sw_tbl;\r
-       cl_map_item_t *p_next;\r
-       osm_node_t *p_node;\r
-       osm_physp_t *p_physp;\r
-       uint8_t port_num;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_sw_tbl = &sm->p_subn->sw_guid_tbl;\r
-\r
-       /*\r
-        * First, get the bind handle.\r
-        */\r
-       h_bind = osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl);\r
-       if (h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "No bound ports. Deferring sweep...\n");\r
-               status = IB_INVALID_STATE;\r
-               goto _exit;\r
-       }\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "INITIATING LIGHT SWEEP");\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       cl_qmap_apply_func(p_sw_tbl, state_mgr_get_sw_info, sm);\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       cl_qmap_apply_func(&sm->p_subn->node_guid_tbl, state_mgr_get_node_desc,\r
-                          sm);\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       /* now scan the list of physical ports that were not down but have no remote port */\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       p_next = cl_qmap_head(&sm->p_subn->node_guid_tbl);\r
-       while (p_next != cl_qmap_end(&sm->p_subn->node_guid_tbl)) {\r
-               p_node = (osm_node_t *) p_next;\r
-               p_next = cl_qmap_next(p_next);\r
-\r
-               for (port_num = 1; port_num < osm_node_get_num_physp(p_node);\r
-                    port_num++) {\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (p_physp && (osm_physp_get_port_state(p_physp) !=\r
-                                       IB_LINK_DOWN)\r
-                           && !osm_physp_get_remote(p_physp)) {\r
-                               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3315: "\r
-                                       "Unknown remote side for node 0x%016"\r
-                                       PRIx64\r
-                                       " (%s) port %u. Adding to light sweep sampling list\n",\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_node)),\r
-                                       p_node->print_desc, port_num);\r
-\r
-                               osm_dump_dr_path(sm->p_log,\r
-                                                osm_physp_get_dr_path_ptr\r
-                                                (p_physp), OSM_LOG_ERROR);\r
-\r
-                               state_mgr_get_remote_port_info(sm, p_physp);\r
-                       }\r
-               }\r
-       }\r
-\r
-       cl_qmap_apply_func(&sm->p_subn->sm_guid_tbl, query_sm_info, sm);\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-_exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- * Go over all the remote SMs (as updated in the sm_guid_tbl).\r
- * Find if there is a remote sm that is a master SM.\r
- * If there is a remote master SM - return a pointer to it,\r
- * else - return NULL.\r
- **********************************************************************/\r
-static osm_remote_sm_t *state_mgr_exists_other_master_sm(IN osm_sm_t * sm)\r
-{\r
-       cl_qmap_t *p_sm_tbl;\r
-       osm_remote_sm_t *p_sm;\r
-       osm_remote_sm_t *p_sm_res = NULL;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_sm_tbl = &sm->p_subn->sm_guid_tbl;\r
-\r
-       /* go over all the remote SMs */\r
-       for (p_sm = (osm_remote_sm_t *) cl_qmap_head(p_sm_tbl);\r
-            p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl);\r
-            p_sm = (osm_remote_sm_t *) cl_qmap_next(&p_sm->map_item)) {\r
-               /* If the sm is in MASTER state - return a pointer to it */\r
-               if (ib_sminfo_get_state(&p_sm->smi) == IB_SMINFO_STATE_MASTER) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Found remote master SM with guid:0x%016" PRIx64\r
-                               " (node %s)\n", cl_ntoh64(p_sm->smi.guid),\r
-                               p_sm->p_port->p_node ? p_sm->p_port->p_node->\r
-                               print_desc : "UNKNOWN");\r
-                       p_sm_res = p_sm;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return p_sm_res;\r
-}\r
-\r
-/**********************************************************************\r
- * Go over all remote SMs (as updated in the sm_guid_tbl).\r
- * Find the one with the highest priority and lowest guid.\r
- * Compare this SM to the local SM. If the local SM is higher -\r
- * return NULL, if the remote SM is higher - return a pointer to it.\r
- **********************************************************************/\r
-static osm_remote_sm_t *state_mgr_get_highest_sm(IN osm_sm_t * sm)\r
-{\r
-       cl_qmap_t *p_sm_tbl;\r
-       osm_remote_sm_t *p_sm = NULL;\r
-       osm_remote_sm_t *p_highest_sm;\r
-       uint8_t highest_sm_priority;\r
-       ib_net64_t highest_sm_guid;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       p_sm_tbl = &sm->p_subn->sm_guid_tbl;\r
-\r
-       /* Start with the local sm as the standard */\r
-       p_highest_sm = NULL;\r
-       highest_sm_priority = sm->p_subn->opt.sm_priority;\r
-       highest_sm_guid = sm->p_subn->sm_port_guid;\r
-\r
-       /* go over all the remote SMs */\r
-       for (p_sm = (osm_remote_sm_t *) cl_qmap_head(p_sm_tbl);\r
-            p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl);\r
-            p_sm = (osm_remote_sm_t *) cl_qmap_next(&p_sm->map_item)) {\r
-\r
-               /* If the sm is in NOTACTIVE state - continue */\r
-               if (ib_sminfo_get_state(&p_sm->smi) ==\r
-                   IB_SMINFO_STATE_NOTACTIVE)\r
-                       continue;\r
-\r
-               if (osm_sm_is_greater_than(ib_sminfo_get_priority(&p_sm->smi),\r
-                                          p_sm->smi.guid, highest_sm_priority,\r
-                                          highest_sm_guid)) {\r
-                       /* the new p_sm is with higher priority - update the highest_sm */\r
-                       /* to this sm */\r
-                       p_highest_sm = p_sm;\r
-                       highest_sm_priority =\r
-                           ib_sminfo_get_priority(&p_sm->smi);\r
-                       highest_sm_guid = p_sm->smi.guid;\r
-               }\r
-       }\r
-\r
-       if (p_highest_sm != NULL)\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Found higher SM with guid: %016" PRIx64 " (node %s)\n",\r
-                       cl_ntoh64(p_highest_sm->smi.guid),\r
-                       p_highest_sm->p_port->p_node ?\r
-                       p_highest_sm->p_port->p_node->print_desc : "UNKNOWN");\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return p_highest_sm;\r
-}\r
-\r
-/**********************************************************************\r
- * Send SubnSet(SMInfo) SMP with HANDOVER attribute to the\r
- * remote_sm indicated.\r
- **********************************************************************/\r
-static void state_mgr_send_handover(IN osm_sm_t * sm, IN osm_remote_sm_t * p_sm)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;\r
-       osm_madw_context_t context;\r
-       const osm_port_t *p_port;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       /*\r
-        * Send a query of SubnSet(SMInfo) HANDOVER to the remote sm given.\r
-        */\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       p_port = p_sm->p_port;\r
-       if (p_port == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3316: "\r
-                       "No port object on given remote_sm object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* update the master_guid in the sm_state_mgr object according to */\r
-       /* the guid of the port where the new Master SM should reside. */\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Handing over mastership. Updating sm_state_mgr master_guid: %016"\r
-               PRIx64 " (node %s)\n", cl_ntoh64(p_port->guid),\r
-               p_port->p_node ? p_port->p_node->print_desc : "UNKNOWN");\r
-       sm->master_sm_guid = p_port->guid;\r
-\r
-       context.smi_context.port_guid = p_port->guid;\r
-       context.smi_context.set_method = TRUE;\r
-\r
-       p_smi->guid = sm->p_subn->sm_port_guid;\r
-       p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);\r
-       p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |\r
-                                     sm->p_subn->opt.sm_priority << 4);\r
-       /*\r
-        * Return 0 for the SM key unless we authenticate the requester\r
-        * as the master SM.\r
-        */\r
-       if (ib_sminfo_get_state(&p_sm->smi) == IB_SMINFO_STATE_MASTER) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to master SM with real sm_key\n");\r
-               p_smi->sm_key = sm->p_subn->opt.sm_key;\r
-       } else {\r
-               /* The requester is not authenticated as master - set sm_key to zero */\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Responding to SM not master with zero sm_key\n");\r
-               p_smi->sm_key = 0;\r
-       }\r
-\r
-       status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),\r
-                            payload, sizeof(payload), IB_MAD_ATTR_SM_INFO,\r
-                            IB_SMINFO_ATTR_MOD_HANDOVER, CL_DISP_MSGID_NONE,\r
-                            &context);\r
-\r
-       if (status != IB_SUCCESS)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3317: "\r
-                       "Failure requesting SMInfo (%s)\n",\r
-                       ib_get_err_str(status));\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Send Trap 64 on all new ports.\r
- **********************************************************************/\r
-static void state_mgr_report_new_ports(IN osm_sm_t * sm)\r
-{\r
-       ib_gid_t port_gid;\r
-       ib_mad_notice_attr_t notice;\r
-       ib_api_status_t status;\r
-       ib_net64_t port_guid;\r
-       cl_map_item_t *p_next;\r
-       osm_port_t *p_port;\r
-       uint16_t min_lid_ho;\r
-       uint16_t max_lid_ho;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       p_next = cl_qmap_head(&sm->p_subn->port_guid_tbl);\r
-       while (p_next != cl_qmap_end(&sm->p_subn->port_guid_tbl)) {\r
-               p_port = (osm_port_t *) p_next;\r
-               p_next = cl_qmap_next(p_next);\r
-\r
-               if (!p_port->is_new)\r
-                       continue;\r
-\r
-               port_guid = osm_port_get_guid(p_port);\r
-               /* issue a notice - trap 64 */\r
-\r
-               /* details of the notice */\r
-               notice.generic_type = 0x83;     /* is generic subn mgt type */\r
-               ib_notice_set_prod_type_ho(&notice, 4); /* A Class Manager generator */\r
-               /* endport becomes reachable */\r
-               notice.g_or_v.generic.trap_num = CL_HTON16(64);\r
-               /* The sm_base_lid is saved in network order already. */\r
-               notice.issuer_lid = sm->p_subn->sm_base_lid;\r
-               /* following C14-72.1.1 and table 119 p739 */\r
-               /* we need to provide the GID */\r
-               port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;\r
-               port_gid.unicast.interface_id = port_guid;\r
-               memcpy(&(notice.data_details.ntc_64_67.gid), &(port_gid),\r
-                      sizeof(ib_gid_t));\r
-\r
-               /* According to page 653 - the issuer gid in this case of trap\r
-                * is the SM gid, since the SM is the initiator of this trap. */\r
-               notice.issuer_gid.unicast.prefix =\r
-                   sm->p_subn->opt.subnet_prefix;\r
-               notice.issuer_gid.unicast.interface_id =\r
-                   sm->p_subn->sm_port_guid;\r
-\r
-               status = osm_report_notice(sm->p_log, sm->p_subn, &notice);\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3318: "\r
-                               "Error sending trap reports on GUID:0x%016"\r
-                               PRIx64 " (%s)\n", port_gid.unicast.interface_id,\r
-                               ib_get_err_str(status));\r
-               osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-               OSM_LOG(sm->p_log, OSM_LOG_INFO,\r
-                       "Discovered new port with GUID:0x%016" PRIx64\r
-                       " LID range [%u,%u] of node: %s\n",\r
-                       cl_ntoh64(port_gid.unicast.interface_id),\r
-                       min_lid_ho, max_lid_ho,\r
-                       p_port->p_node ? p_port->p_node->\r
-                       print_desc : "UNKNOWN");\r
-\r
-               p_port->is_new = 0;\r
-       }\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- * Make sure that the lid_port_tbl of the subnet has only the ports\r
- * that are recognized, and in the correct lid place. There could be\r
- * errors if we wanted to assign a certain port with lid X, but that\r
- * request didn't reach the port. In this case port_lid_tbl will have\r
- * the port under lid X, though the port isn't updated with this lid.\r
- * We will run a new heavy sweep (since there were errors in the\r
- * initialization), but here we'll clean the database from incorrect\r
- * information.\r
- **********************************************************************/\r
-static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm)\r
-{\r
-       cl_qmap_t *p_port_guid_tbl;\r
-       osm_port_t *p_port;\r
-       osm_port_t *p_next_port;\r
-       cl_ptr_vector_t *p_port_lid_tbl;\r
-       size_t max_lid, ref_size, curr_size, lid;\r
-       osm_port_t *p_port_ref, *p_port_stored;\r
-       cl_ptr_vector_t ref_port_lid_tbl;\r
-       uint16_t min_lid_ho;\r
-       uint16_t max_lid_ho;\r
-       uint16_t lid_ho;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       cl_ptr_vector_construct(&ref_port_lid_tbl);\r
-       cl_ptr_vector_init(&ref_port_lid_tbl,\r
-                          cl_ptr_vector_get_size(&sm->p_subn->port_lid_tbl),\r
-                          OSM_SUBNET_VECTOR_GROW_SIZE);\r
-\r
-       p_port_guid_tbl = &sm->p_subn->port_guid_tbl;\r
-\r
-       /* Let's go over all the ports according to port_guid_tbl,\r
-        * and add the port to a reference port_lid_tbl. */\r
-       p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);\r
-       while (p_next_port != (osm_port_t *) cl_qmap_end(p_port_guid_tbl)) {\r
-               p_port = p_next_port;\r
-               p_next_port =\r
-                   (osm_port_t *) cl_qmap_next(&p_next_port->map_item);\r
-\r
-               osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-               for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++)\r
-                       cl_ptr_vector_set(&ref_port_lid_tbl, lid_ho, p_port);\r
-       }\r
-\r
-       p_port_lid_tbl = &sm->p_subn->port_lid_tbl;\r
-\r
-       ref_size = cl_ptr_vector_get_size(&ref_port_lid_tbl);\r
-       curr_size = cl_ptr_vector_get_size(p_port_lid_tbl);\r
-       /* They should be the same, but compare it anyway */\r
-       max_lid = (ref_size > curr_size) ? ref_size : curr_size;\r
-\r
-       for (lid = 1; lid < max_lid; lid++) {\r
-               p_port_ref = NULL;\r
-               p_port_stored = NULL;\r
-               cl_ptr_vector_at(p_port_lid_tbl, lid, (void *)&p_port_stored);\r
-               cl_ptr_vector_at(&ref_port_lid_tbl, lid, (void *)&p_port_ref);\r
-\r
-               if (p_port_stored == p_port_ref)\r
-                       /* This is the "good" case - both entries are the\r
-                        * same for this lid. Nothing to do. */\r
-                       continue;\r
-\r
-               if (p_port_ref == NULL)\r
-                       /* There is an object in the subnet database for this\r
-                        * lid, but no such object exists in the reference\r
-                        * port_list_tbl. This can occur if we wanted to assign\r
-                        * a certain port with some lid (different than the one\r
-                        * pre-assigned to it), and the port didn't get the\r
-                        * PortInfo Set request. Due to this, the port is\r
-                        * updated with its original lid in our database, but\r
-                        * with the new lid we wanted to give it in our\r
-                        * port_lid_tbl. */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3322: "\r
-                               "lid %zu is wrongly assigned to port 0x%016"\r
-                               PRIx64 " (\'%s\' port %u) in port_lid_tbl\n",\r
-                               lid,\r
-                               cl_ntoh64(osm_port_get_guid(p_port_stored)),\r
-                               p_port_stored->p_node->print_desc,\r
-                               p_port_stored->p_physp->port_num);\r
-               else if (p_port_stored == NULL)\r
-                       /* There is an object in the new database, but no\r
-                        * object in our subnet database. This is the matching\r
-                        * case of the prior check - the port still has its\r
-                        * original lid. */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3323: "\r
-                               "port 0x%016" PRIx64 " (\'%s\' port %u)"\r
-                               " exists in new port_lid_tbl under lid %zu,"\r
-                               " but missing in subnet port_lid_tbl db\n",\r
-                               cl_ntoh64(osm_port_get_guid(p_port_ref)),\r
-                               p_port_ref->p_node->print_desc,\r
-                               p_port_ref->p_physp->port_num, lid);\r
-               else\r
-                       /* if we reached here then p_port_stored != p_port_ref.\r
-                        * We were trying to set a lid to p_port_stored, but\r
-                        * it didn't reach it, and p_port_ref also didn't get\r
-                        * the lid update. */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3324: "\r
-                               "lid %zu has port 0x%016" PRIx64\r
-                               " (\'%s\' port %u) in new port_lid_tbl db, "\r
-                               "and port 0x%016" PRIx64 " (\'%s\' port %u)"\r
-                               " in subnet port_lid_tbl db\n", lid,\r
-                               cl_ntoh64(osm_port_get_guid(p_port_ref)),\r
-                               p_port_ref->p_node->print_desc,\r
-                               p_port_ref->p_physp->port_num,\r
-                               cl_ntoh64(osm_port_get_guid(p_port_stored)),\r
-                               p_port_ref->p_node->print_desc,\r
-                               p_port_ref->p_physp->port_num);\r
-\r
-               /* In any of these cases we want to set NULL in the\r
-                * port_lid_tbl, since this entry is invalid. Also, make sure\r
-                * we'll do another heavy sweep. */\r
-               cl_ptr_vector_set(p_port_lid_tbl, lid, NULL);\r
-               sm->p_subn->subnet_initialization_error = TRUE;\r
-       }\r
-\r
-       cl_ptr_vector_destroy(&ref_port_lid_tbl);\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void cleanup_switch(cl_map_item_t * item, void *log)\r
-{\r
-       osm_switch_t *sw = (osm_switch_t *) item;\r
-\r
-       if (!sw->new_lft)\r
-               return;\r
-\r
-       if (memcmp(sw->lft, sw->new_lft, sw->max_lid_ho + 1))\r
-               osm_log(log, OSM_LOG_ERROR, "ERR 331D: "\r
-                       "LFT of switch 0x%016" PRIx64 " (%s) is not up to date\n",\r
-                       cl_ntoh64(sw->p_node->node_info.node_guid),\r
-                       sw->p_node->print_desc);\r
-       else {\r
-               free(sw->new_lft);\r
-               sw->new_lft = NULL;\r
-       }\r
-}\r
-\r
-int wait_for_pending_transactions(osm_stats_t * stats)\r
-{\r
-#ifdef HAVE_LIBPTHREAD\r
-       pthread_mutex_lock(&stats->mutex);\r
-       while (stats->qp0_mads_outstanding && !osm_exit_flag)\r
-               pthread_cond_wait(&stats->cond, &stats->mutex);\r
-       pthread_mutex_unlock(&stats->mutex);\r
-#else\r
-       while (1) {\r
-               unsigned count = stats->qp0_mads_outstanding;\r
-               if (!count || osm_exit_flag)\r
-                       break;\r
-               cl_event_wait_on(&stats->event, EVENT_NO_TIMEOUT, TRUE);\r
-       }\r
-#endif\r
-       return osm_exit_flag;\r
-}\r
-\r
-static void do_sweep(osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status;\r
-       osm_remote_sm_t *p_remote_sm;\r
-       unsigned config_parsed = 0;\r
-\r
-       if (sm->p_subn->force_heavy_sweep) {\r
-               if (osm_subn_rescan_conf_files(sm->p_subn) < 0)\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 331A: "\r
-                               "osm_subn_rescan_conf_file failed\n");\r
-               else\r
-                       config_parsed = 1;\r
-       }\r
-\r
-       if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER &&\r
-           sm->p_subn->sm_state != IB_SMINFO_STATE_DISCOVERING)\r
-               return;\r
-\r
-       if (sm->p_subn->coming_out_of_standby)\r
-               /*\r
-                * Need to force re-write of sm_base_lid to all ports\r
-                * to do that we want all the ports to be considered\r
-                * foreign\r
-                */\r
-               state_mgr_clean_known_lids(sm);\r
-\r
-       sm->master_sm_found = 0;\r
-\r
-       /*\r
-        * If we already have switches, then try a light sweep.\r
-        * Otherwise, this is probably our first discovery pass\r
-        * or we are connected in loopback. In both cases do a\r
-        * heavy sweep.\r
-        * Note: If we are connected in loopback we want a heavy\r
-        * sweep, since we will not be getting any traps if there is\r
-        * a lost connection.\r
-        */\r
-       /*  if we are in DISCOVERING state - this means it is either in\r
-        *  initializing or wake up from STANDBY - run the heavy sweep */\r
-       if (cl_qmap_count(&sm->p_subn->sw_guid_tbl)\r
-           && sm->p_subn->sm_state != IB_SMINFO_STATE_DISCOVERING\r
-           && sm->p_subn->opt.force_heavy_sweep == FALSE\r
-           && sm->p_subn->force_heavy_sweep == FALSE\r
-           && sm->p_subn->force_reroute == FALSE\r
-           && sm->p_subn->subnet_initialization_error == FALSE\r
-           && (state_mgr_light_sweep_start(sm) == IB_SUCCESS)) {\r
-               if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-                       return;\r
-               if (!sm->p_subn->force_heavy_sweep) {\r
-                       if (sm->p_subn->opt.sa_db_dump)\r
-                               osm_sa_db_file_dump(sm->p_subn->p_osm);\r
-                       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "LIGHT SWEEP COMPLETE");\r
-                       return;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Unicast cache should be invalidated if there were errors\r
-        * during initialization or if subnet re-route is requested.\r
-        */\r
-       if (sm->p_subn->opt.use_ucast_cache &&\r
-           (sm->p_subn->subnet_initialization_error ||\r
-            sm->p_subn->force_reroute || sm->p_subn->coming_out_of_standby))\r
-               osm_ucast_cache_invalidate(&sm->ucast_mgr);\r
-\r
-       /*\r
-        * If we don't need to do a heavy sweep and we want to do a reroute,\r
-        * just reroute only.\r
-        */\r
-       if (cl_qmap_count(&sm->p_subn->sw_guid_tbl)\r
-           && sm->p_subn->sm_state != IB_SMINFO_STATE_DISCOVERING\r
-           && sm->p_subn->opt.force_heavy_sweep == FALSE\r
-           && sm->p_subn->force_heavy_sweep == FALSE\r
-           && sm->p_subn->force_reroute == TRUE\r
-           && sm->p_subn->subnet_initialization_error == FALSE) {\r
-               /* Reset flag */\r
-               sm->p_subn->force_reroute = FALSE;\r
-\r
-               /* Re-program the switches fully */\r
-               sm->p_subn->ignore_existing_lfts = TRUE;\r
-\r
-               osm_ucast_mgr_process(&sm->ucast_mgr);\r
-\r
-               /* Reset flag */\r
-               sm->p_subn->ignore_existing_lfts = FALSE;\r
-\r
-               if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-                       return;\r
-\r
-               if (!sm->p_subn->subnet_initialization_error) {\r
-                       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "REROUTE COMPLETE");\r
-                       return;\r
-               }\r
-       }\r
-\r
-       /* go to heavy sweep */\r
-repeat_discovery:\r
-\r
-       /* First of all - unset all flags */\r
-       sm->p_subn->force_heavy_sweep = FALSE;\r
-       sm->p_subn->force_reroute = FALSE;\r
-       sm->p_subn->subnet_initialization_error = FALSE;\r
-\r
-       /* rescan configuration updates */\r
-       if (!config_parsed && osm_subn_rescan_conf_files(sm->p_subn) < 0)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 331A: "\r
-                       "osm_subn_rescan_conf_file failed\n");\r
-\r
-       if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER)\r
-               sm->p_subn->need_update = 1;\r
-\r
-       status = state_mgr_sweep_hop_0(sm);\r
-       if (status != IB_SUCCESS ||\r
-           wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       if (state_mgr_is_sm_port_down(sm) == TRUE) {\r
-               osm_log(sm->p_log, OSM_LOG_SYS, "SM port is down\n");\r
-               OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "SM PORT DOWN");\r
-\r
-               /* Run the drop manager - we want to clear all records */\r
-               osm_drop_mgr_process(sm);\r
-\r
-               /* Move to DISCOVERING state */\r
-               osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_DISCOVER);\r
-               return;\r
-       }\r
-\r
-       status = state_mgr_sweep_hop_1(sm);\r
-       if (status != IB_SUCCESS ||\r
-           wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       /* discovery completed - check other sm presence */\r
-       if (sm->master_sm_found) {\r
-               /*\r
-                * Call the sm_state_mgr with signal\r
-                * MASTER_OR_HIGHER_SM_DETECTED_DONE\r
-                */\r
-               osm_sm_state_mgr_process(sm,\r
-                                        OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED);\r
-               OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "ENTERING STANDBY STATE");\r
-               /* notify master SM about us */\r
-               osm_send_trap144(sm, 0);\r
-               return;\r
-       }\r
-\r
-       /* if new sweep requested - don't bother with the rest */\r
-       if (sm->p_subn->force_heavy_sweep)\r
-               goto repeat_discovery;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "HEAVY SWEEP COMPLETE");\r
-\r
-       /* If we are MASTER - get the highest remote_sm, and\r
-        * see if it is higher than our local sm.\r
-        */\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER) {\r
-               p_remote_sm = state_mgr_get_highest_sm(sm);\r
-               if (p_remote_sm != NULL) {\r
-                       /* report new ports (trap 64) before leaving MASTER */\r
-                       state_mgr_report_new_ports(sm);\r
-\r
-                       /* need to handover the mastership\r
-                        * to the remote sm, and move to standby */\r
-                       state_mgr_send_handover(sm, p_remote_sm);\r
-                       osm_sm_state_mgr_process(sm,\r
-                                                OSM_SM_SIGNAL_HANDOVER_SENT);\r
-                       return;\r
-               } else {\r
-                       /* We are the highest sm - check to see if there is\r
-                        * a remote SM that is in master state. */\r
-                       p_remote_sm = state_mgr_exists_other_master_sm(sm);\r
-                       if (p_remote_sm != NULL) {\r
-                               /* There is a remote SM that is master.\r
-                                * need to wait for that SM to relinquish control\r
-                                * of its portion of the subnet. C14-60.2.1.\r
-                                * Also - need to start polling on that SM. */\r
-                               sm->p_polling_sm = p_remote_sm;\r
-                               osm_sm_state_mgr_process(sm,\r
-                                                        OSM_SM_SIGNAL_WAIT_FOR_HANDOVER);\r
-                               return;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Need to continue with lid assignment */\r
-       osm_drop_mgr_process(sm);\r
-\r
-       /*\r
-        * If we are not MASTER already - this means that we are\r
-        * in discovery state. call osm_sm_state_mgr with signal\r
-        * DISCOVERY_COMPLETED\r
-        */\r
-       if (sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING)\r
-               osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_DISCOVERY_COMPLETED);\r
-\r
-       osm_pkey_mgr_process(sm->p_subn->p_osm);\r
-\r
-       osm_qos_setup(sm->p_subn->p_osm);\r
-\r
-       /* try to restore SA DB (this should be before lid_mgr\r
-          because we may want to disable clients reregistration\r
-          when SA DB is restored) */\r
-       osm_sa_db_file_load(sm->p_subn->p_osm);\r
-\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "PKEY and QOS setup completed - STARTING SM LID CONFIG");\r
-\r
-       osm_lid_mgr_process_sm(&sm->lid_mgr);\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "SM LID ASSIGNMENT COMPLETE - STARTING SUBNET LID CONFIG");\r
-       state_mgr_notify_lid_change(sm);\r
-\r
-       osm_lid_mgr_process_subnet(&sm->lid_mgr);\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       /* At this point we need to check the consistency of\r
-        * the port_lid_tbl under the subnet. There might be\r
-        * errors in it if PortInfo Set requests didn't reach\r
-        * their destination. */\r
-       state_mgr_check_tbl_consistency(sm);\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "LID ASSIGNMENT COMPLETE - STARTING SWITCH TABLE CONFIG");\r
-\r
-       /*\r
-        * Proceed with unicast forwarding table configuration.\r
-        */\r
-\r
-       if (!sm->ucast_mgr.cache_valid ||\r
-           osm_ucast_cache_process(&sm->ucast_mgr))\r
-               osm_ucast_mgr_process(&sm->ucast_mgr);\r
-\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       /* cleanup switch lft buffers */\r
-       cl_qmap_apply_func(&sm->p_subn->sw_guid_tbl, cleanup_switch, sm->p_log);\r
-\r
-       /* We are done setting all LFTs so clear the ignore existing.\r
-        * From now on, as long as we are still master, we want to\r
-        * take into account these lfts. */\r
-       sm->p_subn->ignore_existing_lfts = FALSE;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "SWITCHES CONFIGURED FOR UNICAST");\r
-\r
-       if (!sm->p_subn->opt.disable_multicast) {\r
-               osm_mcast_mgr_process(sm);\r
-               if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-                       return;\r
-               OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "SWITCHES CONFIGURED FOR MULTICAST");\r
-       }\r
-\r
-       /*\r
-        * The LINK_PORTS state is required since we cannot count on\r
-        * the port state change MADs to succeed. This is an artifact\r
-        * of the spec defining state change from state X to state X\r
-        * as an error. The hardware then is not required to process\r
-        * other parameters provided by the Set(PortInfo) Packet.\r
-        */\r
-\r
-       osm_link_mgr_process(sm, IB_LINK_NO_CHANGE);\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "LINKS PORTS CONFIGURED - SET LINKS TO ARMED STATE");\r
-\r
-       osm_link_mgr_process(sm, IB_LINK_ARMED);\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "LINKS ARMED - SET LINKS TO ACTIVE STATE");\r
-\r
-       osm_link_mgr_process(sm, IB_LINK_ACTIVE);\r
-       if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
-               return;\r
-\r
-       /*\r
-        * The sweep completed!\r
-        */\r
-\r
-       /*\r
-        * Send trap 64 on newly discovered endports\r
-        */\r
-       state_mgr_report_new_ports(sm);\r
-\r
-       /* in any case we zero this flag */\r
-       sm->p_subn->coming_out_of_standby = FALSE;\r
-\r
-       /* If there were errors - then the subnet is not really up */\r
-       if (sm->p_subn->subnet_initialization_error == TRUE) {\r
-               osm_log(sm->p_log, OSM_LOG_SYS,\r
-                       "Errors during initialization\n");\r
-               OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_ERROR,\r
-                               "ERRORS DURING INITIALIZATION");\r
-       } else {\r
-               sm->p_subn->need_update = 0;\r
-               osm_dump_all(sm->p_subn->p_osm);\r
-               state_mgr_up_msg(sm);\r
-               sm->p_subn->first_time_master_sweep = FALSE;\r
-\r
-               if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE) ||\r
-                   sm->p_subn->opt.sa_db_dump)\r
-                       osm_sa_db_file_dump(sm->p_subn->p_osm);\r
-       }\r
-\r
-       /*\r
-        * Finally signal the subnet up event\r
-        */\r
-       cl_event_signal(&sm->subnet_up_event);\r
-\r
-       osm_opensm_report_event(sm->p_subn->p_osm, OSM_EVENT_ID_SUBNET_UP,\r
-                               NULL);\r
-\r
-       /* if we got a signal to force heavy sweep or errors\r
-        * in the middle of the sweep - try another sweep. */\r
-       if (sm->p_subn->force_heavy_sweep\r
-           || sm->p_subn->subnet_initialization_error)\r
-               osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-}\r
-\r
-static void do_process_mgrp_queue(osm_sm_t * sm)\r
-{\r
-       if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER)\r
-               return;\r
-       if (!sm->p_subn->opt.disable_multicast) {\r
-               osm_mcast_mgr_process_mgroups(sm);\r
-               wait_for_pending_transactions(&sm->p_subn->p_osm->stats);\r
-       }\r
-}\r
-\r
-void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal)\r
-{\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received signal %s in state %s\n",\r
-               osm_get_sm_signal_str(signal),\r
-               osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
-\r
-       switch (signal) {\r
-       case OSM_SIGNAL_SWEEP:\r
-               do_sweep(sm);\r
-               break;\r
-       case OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST:\r
-               do_process_mgrp_queue(sm);\r
-               break;\r
-       default:\r
-               CL_ASSERT(FALSE);\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3320: "\r
-                       "Invalid SM signal %u\n", signal);\r
-               break;\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_subnet.c b/branches/opensm_3/user/opensm/osm_subnet.c
deleted file mode 100644 (file)
index 6461a1b..0000000
+++ /dev/null
@@ -1,1663 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.\r
- * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_subn_t.\r
- * This object represents an IBA subnet.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <stdio.h>\r
-#include <stdarg.h>\r
-#include <limits.h>\r
-#include <errno.h>\r
-#include <ctype.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_log.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_port.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_remote_sm.h>\r
-#include <opensm/osm_partition.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_multicast.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_console.h>\r
-#include <opensm/osm_perfmgr.h>\r
-#include <opensm/osm_event_plugin.h>\r
-#include <opensm/osm_qos_policy.h>\r
-\r
-static const char null_str[] = "(null)";\r
-\r
-#define OPT_OFFSET(opt) offsetof(osm_subn_opt_t, opt)\r
-\r
-typedef struct opt_rec {\r
-       const char *name;\r
-       unsigned long opt_offset;\r
-       void (*parse_fn)(osm_subn_t *p_subn, char *p_key, char *p_val_str,\r
-                        void *p_val1, void *p_val2,\r
-                        void (*)(osm_subn_t *, void *));\r
-       void (*setup_fn)(osm_subn_t *p_subn, void *p_val);\r
-       int  can_update;\r
-} opt_rec_t;\r
-\r
-static void log_report(const char *fmt, ...)\r
-{\r
-       char buf[128];\r
-       va_list args;\r
-       va_start(args, fmt);\r
-       vsnprintf(buf, sizeof(buf), fmt, args);\r
-       va_end(args);\r
-       printf("%s", buf);\r
-       cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);\r
-}\r
-\r
-static void log_config_value(char *name, const char *fmt, ...)\r
-{\r
-       char buf[128];\r
-       va_list args;\r
-       unsigned n;\r
-       va_start(args, fmt);\r
-       n = snprintf(buf, sizeof(buf), " Loading Cached Option:%s = ", name);\r
-       if (n > sizeof(buf))\r
-               n = sizeof(buf);\r
-       n += vsnprintf(buf + n, sizeof(buf) - n, fmt, args);\r
-       if (n > sizeof(buf) - 2)\r
-               n = sizeof(buf) - 2;\r
-       snprintf(buf + n, sizeof(buf) - n, "\n");\r
-       va_end(args);\r
-       printf("%s", buf);\r
-       cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);\r
-}\r
-\r
-static void opts_setup_log_flags(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       p_subn->p_osm->log.level = *((uint8_t *) p_val);\r
-}\r
-\r
-static void opts_setup_force_log_flush(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       p_subn->p_osm->log.flush = *((boolean_t *) p_val);\r
-}\r
-\r
-static void opts_setup_accum_log_file(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       p_subn->p_osm->log.accum_log_file = *((boolean_t *) p_val);\r
-}\r
-\r
-static void opts_setup_log_max_size(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       uint32_t log_max_size = *((uint32_t *) p_val);\r
-\r
-       p_subn->p_osm->log.max_size = log_max_size << 20; /* convert from MB to bytes */\r
-}\r
-\r
-static void opts_setup_sminfo_polling_timeout(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       osm_sm_t *p_sm = &p_subn->p_osm->sm;\r
-       uint32_t sminfo_polling_timeout = *((uint32_t *) p_val);\r
-\r
-       cl_timer_stop(&p_sm->polling_timer);\r
-       cl_timer_start(&p_sm->polling_timer, sminfo_polling_timeout);\r
-}\r
-\r
-static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)\r
-{\r
-       osm_sm_t *p_sm = &p_subn->p_osm->sm;\r
-       uint8_t sm_priority = *((uint8_t *) p_val);\r
-\r
-       osm_set_sm_priority(p_sm, sm_priority);\r
-}\r
-\r
-static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,\r
-                            IN char *p_val_str, void *p_v1, void *p_v2,\r
-                            void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       uint64_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       uint64_t val = strtoull(p_val_str, NULL, 0);\r
-\r
-       if (cl_hton64(val) != *p_val1) {\r
-               log_config_value(p_key, "0x%016" PRIx64, val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = cl_ntoh64(val);\r
-       }\r
-}\r
-\r
-static void opts_parse_uint32(IN osm_subn_t *p_subn, IN char *p_key,\r
-                             IN char *p_val_str, void *p_v1, void *p_v2,\r
-                             void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       uint32_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       uint32_t val = strtoul(p_val_str, NULL, 0);\r
-\r
-       if (val != *p_val1) {\r
-               log_config_value(p_key, "%u", val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = val;\r
-       }\r
-}\r
-\r
-static void opts_parse_int32(IN osm_subn_t *p_subn, IN char *p_key,\r
-                            IN char *p_val_str, void *p_v1, void *p_v2,\r
-                            void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       int32_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       int32_t val = strtol(p_val_str, NULL, 0);\r
-\r
-       if (val != *p_val1) {\r
-               log_config_value(p_key, "%d", val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = val;\r
-       }\r
-}\r
-\r
-static void opts_parse_uint16(IN osm_subn_t *p_subn, IN char *p_key,\r
-                             IN char *p_val_str, void *p_v1, void *p_v2,\r
-                             void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       uint16_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       uint16_t val = (uint16_t) strtoul(p_val_str, NULL, 0);\r
-\r
-       if (val != *p_val1) {\r
-               log_config_value(p_key, "%u", val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = val;\r
-       }\r
-}\r
-\r
-static void opts_parse_net16(IN osm_subn_t *p_subn, IN char *p_key,\r
-                            IN char *p_val_str, void *p_v1, void *p_v2,\r
-                            void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       uint16_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       uint16_t val = strtoul(p_val_str, NULL, 0);\r
-\r
-       if (cl_hton16(val) != *p_val1) {\r
-               log_config_value(p_key, "0x%04x", val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = cl_hton16(val);\r
-       }\r
-}\r
-\r
-static void opts_parse_uint8(IN osm_subn_t *p_subn, IN char *p_key,\r
-                            IN char *p_val_str, void *p_v1, void *p_v2,\r
-                            void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       uint8_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       uint8_t val = strtoul(p_val_str, NULL, 0);\r
-\r
-       if (val != *p_val1) {\r
-               log_config_value(p_key, "%u", val);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = val;\r
-       }\r
-}\r
-\r
-static void opts_parse_boolean(IN osm_subn_t *p_subn, IN char *p_key,\r
-                              IN char *p_val_str, void *p_v1, void *p_v2,\r
-                              void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       boolean_t *p_val1 = p_v1, *p_val2 = p_v2;\r
-       boolean_t val;\r
-\r
-       if (!p_val_str)\r
-               return;\r
-\r
-       if (strcmp("TRUE", p_val_str))\r
-               val = FALSE;\r
-       else\r
-               val = TRUE;\r
-\r
-       if (val != *p_val1) {\r
-               log_config_value(p_key, "%s", p_val_str);\r
-               if (pfn)\r
-                       pfn(p_subn, &val);\r
-               *p_val1 = *p_val2 = val;\r
-       }\r
-}\r
-\r
-static void opts_parse_charp(IN osm_subn_t *p_subn, IN char *p_key,\r
-                            IN char *p_val_str, void *p_v1, void *p_v2,\r
-                            void (*pfn)(osm_subn_t *, void *))\r
-{\r
-       char **p_val1 = p_v1, **p_val2 = p_v2;\r
-       const char *current_str = *p_val1 ? *p_val1 : null_str ;\r
-\r
-       if (p_val_str && strcmp(p_val_str, current_str)) {\r
-               char *new;\r
-               log_config_value(p_key, "%s", p_val_str);\r
-               /* special case the "(null)" string */\r
-               new = strcmp(null_str, p_val_str) ? strdup(p_val_str) : NULL;\r
-               if (pfn)\r
-                       pfn(p_subn, new);\r
-               if (*p_val1 && *p_val1 != *p_val2)\r
-                       free(*p_val1);\r
-               if (*p_val2)\r
-                       free(*p_val2);\r
-               *p_val1 = *p_val2 = new;\r
-       }\r
-}\r
-\r
-static const opt_rec_t opt_tbl[] = {\r
-       { "guid", OPT_OFFSET(guid), opts_parse_net64, NULL, 0 },\r
-       { "m_key", OPT_OFFSET(m_key), opts_parse_net64, NULL, 1 },\r
-       { "sm_key", OPT_OFFSET(sm_key), opts_parse_net64, NULL, 1 },\r
-       { "sa_key", OPT_OFFSET(sa_key), opts_parse_net64, NULL, 1 },\r
-       { "subnet_prefix", OPT_OFFSET(subnet_prefix), opts_parse_net64, NULL, 1 },\r
-       { "m_key_lease_period", OPT_OFFSET(m_key_lease_period), opts_parse_net16, NULL, 1 },\r
-       { "sweep_interval", OPT_OFFSET(sweep_interval), opts_parse_uint32, NULL, 1 },\r
-       { "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 },\r
-       { "console", OPT_OFFSET(console), opts_parse_charp, NULL, 0 },\r
-       { "console_port", OPT_OFFSET(console_port), opts_parse_uint16, NULL, 0 },\r
-       { "transaction_timeout", OPT_OFFSET(transaction_timeout), opts_parse_uint32, NULL, 0 },\r
-       { "transaction_retries", OPT_OFFSET(transaction_retries), opts_parse_uint32, NULL, 0 },\r
-       { "max_msg_fifo_timeout", OPT_OFFSET(max_msg_fifo_timeout), opts_parse_uint32, NULL, 1 },\r
-       { "sm_priority", OPT_OFFSET(sm_priority), opts_parse_uint8, opts_setup_sm_priority, 1 },\r
-       { "lmc", OPT_OFFSET(lmc), opts_parse_uint8, NULL, 1 },\r
-       { "lmc_esp0", OPT_OFFSET(lmc_esp0), opts_parse_boolean, NULL, 1 },\r
-       { "max_op_vls", OPT_OFFSET(max_op_vls), opts_parse_uint8, NULL, 1 },\r
-       { "force_link_speed", OPT_OFFSET(force_link_speed), opts_parse_uint8, NULL, 1 },\r
-       { "reassign_lids", OPT_OFFSET(reassign_lids), opts_parse_boolean, NULL, 1 },\r
-       { "ignore_other_sm", OPT_OFFSET(ignore_other_sm), opts_parse_boolean, NULL, 1 },\r
-       { "single_thread", OPT_OFFSET(single_thread), opts_parse_boolean, NULL, 0 },\r
-       { "disable_multicast", OPT_OFFSET(disable_multicast), opts_parse_boolean, NULL, 1 },\r
-       { "subnet_timeout", OPT_OFFSET(subnet_timeout), opts_parse_uint8, NULL, 1 },\r
-       { "packet_life_time", OPT_OFFSET(packet_life_time), opts_parse_uint8, NULL, 1 },\r
-       { "vl_stall_count", OPT_OFFSET(vl_stall_count), opts_parse_uint8, NULL, 1 },\r
-       { "leaf_vl_stall_count", OPT_OFFSET(leaf_vl_stall_count), opts_parse_uint8, NULL, 1 },\r
-       { "head_of_queue_lifetime", OPT_OFFSET(head_of_queue_lifetime), opts_parse_uint8, NULL, 1 },\r
-       { "leaf_head_of_queue_lifetime", OPT_OFFSET(leaf_head_of_queue_lifetime), opts_parse_uint8, NULL, 1 },\r
-       { "local_phy_errors_threshold", OPT_OFFSET(local_phy_errors_threshold), opts_parse_uint8, NULL, 1 },\r
-       { "overrun_errors_threshold", OPT_OFFSET(overrun_errors_threshold), opts_parse_uint8, NULL, 1 },\r
-       { "sminfo_polling_timeout", OPT_OFFSET(sminfo_polling_timeout), opts_parse_uint32, opts_setup_sminfo_polling_timeout, 1 },\r
-       { "polling_retry_number", OPT_OFFSET(polling_retry_number), opts_parse_uint32, NULL, 1 },\r
-       { "force_heavy_sweep", OPT_OFFSET(force_heavy_sweep), opts_parse_boolean, NULL, 1 },\r
-       { "port_prof_ignore_file", OPT_OFFSET(port_prof_ignore_file), opts_parse_charp, NULL, 0 },\r
-       { "hop_weights_file", OPT_OFFSET(hop_weights_file), opts_parse_charp, NULL, 0 },\r
-       { "dimn_ports_file", OPT_OFFSET(dimn_ports_file), opts_parse_charp, NULL, 0 },\r
-       { "port_profile_switch_nodes", OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },\r
-       { "sweep_on_trap", OPT_OFFSET(sweep_on_trap), opts_parse_boolean, NULL, 1 },\r
-       { "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, NULL, 0 },\r
-       { "connect_roots", OPT_OFFSET(connect_roots), opts_parse_boolean, NULL, 1 },\r
-       { "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 0 },\r
-       { "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },\r
-       { "log_max_size", OPT_OFFSET(log_max_size), opts_parse_uint32, opts_setup_log_max_size, 1 },\r
-       { "log_flags", OPT_OFFSET(log_flags), opts_parse_uint8, opts_setup_log_flags, 1 },\r
-       { "force_log_flush", OPT_OFFSET(force_log_flush), opts_parse_boolean, opts_setup_force_log_flush, 1 },\r
-       { "accum_log_file", OPT_OFFSET(accum_log_file), opts_parse_boolean, opts_setup_accum_log_file, 1 },\r
-       { "partition_config_file", OPT_OFFSET(partition_config_file), opts_parse_charp, NULL, 0 },\r
-       { "no_partition_enforcement", OPT_OFFSET(no_partition_enforcement), opts_parse_boolean, NULL, 1 },\r
-       { "qos", OPT_OFFSET(qos), opts_parse_boolean, NULL, 1 },\r
-       { "qos_policy_file", OPT_OFFSET(qos_policy_file), opts_parse_charp, NULL, 0 },\r
-       { "dump_files_dir", OPT_OFFSET(dump_files_dir), opts_parse_charp, NULL, 0 },\r
-       { "lid_matrix_dump_file", OPT_OFFSET(lid_matrix_dump_file), opts_parse_charp, NULL, 0 },\r
-       { "lfts_file", OPT_OFFSET(lfts_file), opts_parse_charp, NULL, 0 },\r
-       { "root_guid_file", OPT_OFFSET(root_guid_file), opts_parse_charp, NULL, 0 },\r
-       { "cn_guid_file", OPT_OFFSET(cn_guid_file), opts_parse_charp, NULL, 0 },\r
-       { "io_guid_file", OPT_OFFSET(io_guid_file), opts_parse_charp, NULL, 0 },\r
-       { "max_reverse_hops", OPT_OFFSET(max_reverse_hops), opts_parse_uint16, NULL, 0 },\r
-       { "ids_guid_file", OPT_OFFSET(ids_guid_file), opts_parse_charp, NULL, 0 },\r
-       { "guid_routing_order_file", OPT_OFFSET(guid_routing_order_file), opts_parse_charp, NULL, 0 },\r
-       { "sa_db_file", OPT_OFFSET(sa_db_file), opts_parse_charp, NULL, 0 },\r
-       { "sa_db_dump", OPT_OFFSET(sa_db_dump), opts_parse_boolean, NULL, 1 },\r
-       { "do_mesh_analysis", OPT_OFFSET(do_mesh_analysis), opts_parse_boolean, NULL, 1 },\r
-       { "exit_on_fatal", OPT_OFFSET(exit_on_fatal), opts_parse_boolean, NULL, 1 },\r
-       { "honor_guid2lid_file", OPT_OFFSET(honor_guid2lid_file), opts_parse_boolean, NULL, 1 },\r
-       { "daemon", OPT_OFFSET(daemon), opts_parse_boolean, NULL, 0 },\r
-       { "sm_inactive", OPT_OFFSET(sm_inactive), opts_parse_boolean, NULL, 1 },\r
-       { "babbling_port_policy", OPT_OFFSET(babbling_port_policy), opts_parse_boolean, NULL, 1 },\r
-       { "use_optimized_slvl", OPT_OFFSET(use_optimized_slvl), opts_parse_boolean, NULL, 1 },\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       { "perfmgr", OPT_OFFSET(perfmgr), opts_parse_boolean, NULL, 0 },\r
-       { "perfmgr_redir", OPT_OFFSET(perfmgr_redir), opts_parse_boolean, NULL, 0 },\r
-       { "perfmgr_sweep_time_s", OPT_OFFSET(perfmgr_sweep_time_s), opts_parse_uint16, NULL, 0 },\r
-       { "perfmgr_max_outstanding_queries", OPT_OFFSET(perfmgr_max_outstanding_queries), opts_parse_uint32, NULL, 0 },\r
-       { "event_db_dump_file", OPT_OFFSET(event_db_dump_file), opts_parse_charp, NULL, 0 },\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-       { "event_plugin_name", OPT_OFFSET(event_plugin_name), opts_parse_charp, NULL, 0 },\r
-       { "event_plugin_options", OPT_OFFSET(event_plugin_options), opts_parse_charp, NULL, 0 },\r
-       { "node_name_map_name", OPT_OFFSET(node_name_map_name), opts_parse_charp, NULL, 0 },\r
-       { "qos_max_vls", OPT_OFFSET(qos_options.max_vls), opts_parse_uint32, NULL, 1 },\r
-       { "qos_high_limit", OPT_OFFSET(qos_options.high_limit), opts_parse_int32, NULL, 1 },\r
-       { "qos_vlarb_high", OPT_OFFSET(qos_options.vlarb_high), opts_parse_charp, NULL, 1 },\r
-       { "qos_vlarb_low", OPT_OFFSET(qos_options.vlarb_low), opts_parse_charp, NULL, 1 },\r
-       { "qos_sl2vl", OPT_OFFSET(qos_options.sl2vl), opts_parse_charp, NULL, 1 },\r
-       { "qos_ca_max_vls", OPT_OFFSET(qos_ca_options.max_vls), opts_parse_uint32, NULL, 1 },\r
-       { "qos_ca_high_limit", OPT_OFFSET(qos_ca_options.high_limit), opts_parse_int32, NULL, 1 },\r
-       { "qos_ca_vlarb_high", OPT_OFFSET(qos_ca_options.vlarb_high), opts_parse_charp, NULL, 1 },\r
-       { "qos_ca_vlarb_low", OPT_OFFSET(qos_ca_options.vlarb_low), opts_parse_charp, NULL, 1 },\r
-       { "qos_ca_sl2vl", OPT_OFFSET(qos_ca_options.sl2vl), opts_parse_charp, NULL, 1 },\r
-       { "qos_sw0_max_vls", OPT_OFFSET(qos_sw0_options.max_vls), opts_parse_uint32, NULL, 1 },\r
-       { "qos_sw0_high_limit", OPT_OFFSET(qos_sw0_options.high_limit), opts_parse_int32, NULL, 1 },\r
-       { "qos_sw0_vlarb_high", OPT_OFFSET(qos_sw0_options.vlarb_high), opts_parse_charp, NULL, 1 },\r
-       { "qos_sw0_vlarb_low", OPT_OFFSET(qos_sw0_options.vlarb_low), opts_parse_charp, NULL, 1 },\r
-       { "qos_sw0_sl2vl", OPT_OFFSET(qos_sw0_options.sl2vl), opts_parse_charp, NULL, 1 },\r
-       { "qos_swe_max_vls", OPT_OFFSET(qos_swe_options.max_vls), opts_parse_uint32, NULL, 1 },\r
-       { "qos_swe_high_limit", OPT_OFFSET(qos_swe_options.high_limit), opts_parse_int32, NULL, 1 },\r
-       { "qos_swe_vlarb_high", OPT_OFFSET(qos_swe_options.vlarb_high), opts_parse_charp, NULL, 1 },\r
-       { "qos_swe_vlarb_low", OPT_OFFSET(qos_swe_options.vlarb_low), opts_parse_charp, NULL, 1 },\r
-       { "qos_swe_sl2vl", OPT_OFFSET(qos_swe_options.sl2vl), opts_parse_charp, NULL, 1 },\r
-       { "qos_rtr_max_vls", OPT_OFFSET(qos_rtr_options.max_vls), opts_parse_uint32, NULL, 1 },\r
-       { "qos_rtr_high_limit", OPT_OFFSET(qos_rtr_options.high_limit), opts_parse_int32, NULL, 1 },\r
-       { "qos_rtr_vlarb_high", OPT_OFFSET(qos_rtr_options.vlarb_high), opts_parse_charp, NULL, 1 },\r
-       { "qos_rtr_vlarb_low", OPT_OFFSET(qos_rtr_options.vlarb_low), opts_parse_charp, NULL, 1 },\r
-       { "qos_rtr_sl2vl", OPT_OFFSET(qos_rtr_options.sl2vl), opts_parse_charp, NULL, 1 },\r
-       { "enable_quirks", OPT_OFFSET(enable_quirks), opts_parse_boolean, NULL, 1 },\r
-       { "no_clients_rereg", OPT_OFFSET(no_clients_rereg), opts_parse_boolean, NULL, 1 },\r
-       { "prefix_routes_file", OPT_OFFSET(prefix_routes_file), opts_parse_charp, NULL, 0 },\r
-       { "consolidate_ipv6_snm_req", OPT_OFFSET(consolidate_ipv6_snm_req), opts_parse_boolean, NULL, 1 },\r
-       { "lash_start_vl", OPT_OFFSET(lash_start_vl), opts_parse_uint8, NULL, 1 },\r
-       { "sm_sl", OPT_OFFSET(sm_sl), opts_parse_uint8, NULL, 1 },\r
-       { "log_prefix", OPT_OFFSET(log_prefix), opts_parse_charp, NULL, 1 },\r
-       {0}\r
-};\r
-\r
-static int compar_mgids(const void *m1, const void *m2)\r
-{\r
-       return memcmp(m1, m2, sizeof(ib_gid_t));\r
-}\r
-\r
-void osm_subn_construct(IN osm_subn_t * p_subn)\r
-{\r
-       memset(p_subn, 0, sizeof(*p_subn));\r
-       cl_ptr_vector_construct(&p_subn->port_lid_tbl);\r
-       cl_qmap_init(&p_subn->sw_guid_tbl);\r
-       cl_qmap_init(&p_subn->node_guid_tbl);\r
-       cl_qmap_init(&p_subn->port_guid_tbl);\r
-       cl_qmap_init(&p_subn->sm_guid_tbl);\r
-       cl_qlist_init(&p_subn->sa_sr_list);\r
-       cl_qlist_init(&p_subn->sa_infr_list);\r
-       cl_qlist_init(&p_subn->prefix_routes_list);\r
-       cl_qmap_init(&p_subn->rtr_guid_tbl);\r
-       cl_qmap_init(&p_subn->prtn_pkey_tbl);\r
-       cl_fmap_init(&p_subn->mgrp_mgid_tbl, compar_mgids);\r
-}\r
-\r
-void osm_subn_destroy(IN osm_subn_t * p_subn)\r
-{\r
-       int i;\r
-       osm_node_t *p_node, *p_next_node;\r
-       osm_port_t *p_port, *p_next_port;\r
-       osm_switch_t *p_sw, *p_next_sw;\r
-       osm_remote_sm_t *p_rsm, *p_next_rsm;\r
-       osm_prtn_t *p_prtn, *p_next_prtn;\r
-       osm_infr_t *p_infr, *p_next_infr;\r
-\r
-       /* it might be a good idea to de-allocate all known objects */\r
-       p_next_node = (osm_node_t *) cl_qmap_head(&p_subn->node_guid_tbl);\r
-       while (p_next_node !=\r
-              (osm_node_t *) cl_qmap_end(&p_subn->node_guid_tbl)) {\r
-               p_node = p_next_node;\r
-               p_next_node = (osm_node_t *) cl_qmap_next(&p_node->map_item);\r
-               osm_node_delete(&p_node);\r
-       }\r
-\r
-       p_next_port = (osm_port_t *) cl_qmap_head(&p_subn->port_guid_tbl);\r
-       while (p_next_port !=\r
-              (osm_port_t *) cl_qmap_end(&p_subn->port_guid_tbl)) {\r
-               p_port = p_next_port;\r
-               p_next_port = (osm_port_t *) cl_qmap_next(&p_port->map_item);\r
-               osm_port_delete(&p_port);\r
-       }\r
-\r
-       p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-       while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-               osm_switch_delete(&p_sw);\r
-       }\r
-\r
-       p_next_rsm = (osm_remote_sm_t *) cl_qmap_head(&p_subn->sm_guid_tbl);\r
-       while (p_next_rsm !=\r
-              (osm_remote_sm_t *) cl_qmap_end(&p_subn->sm_guid_tbl)) {\r
-               p_rsm = p_next_rsm;\r
-               p_next_rsm = (osm_remote_sm_t *) cl_qmap_next(&p_rsm->map_item);\r
-               free(p_rsm);\r
-       }\r
-\r
-       p_next_prtn = (osm_prtn_t *) cl_qmap_head(&p_subn->prtn_pkey_tbl);\r
-       while (p_next_prtn !=\r
-              (osm_prtn_t *) cl_qmap_end(&p_subn->prtn_pkey_tbl)) {\r
-               p_prtn = p_next_prtn;\r
-               p_next_prtn = (osm_prtn_t *) cl_qmap_next(&p_prtn->map_item);\r
-               osm_prtn_delete(&p_prtn);\r
-       }\r
-\r
-       cl_fmap_remove_all(&p_subn->mgrp_mgid_tbl);\r
-\r
-       for (i = 0; i <= p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;\r
-            i++)\r
-               if (p_subn->mboxes[i])\r
-                       osm_mgrp_box_delete(p_subn->mboxes[i]);\r
-\r
-       p_next_infr = (osm_infr_t *) cl_qlist_head(&p_subn->sa_infr_list);\r
-       while (p_next_infr !=\r
-              (osm_infr_t *) cl_qlist_end(&p_subn->sa_infr_list)) {\r
-               p_infr = p_next_infr;\r
-               p_next_infr = (osm_infr_t *) cl_qlist_next(&p_infr->list_item);\r
-               osm_infr_delete(p_infr);\r
-       }\r
-\r
-       cl_ptr_vector_destroy(&p_subn->port_lid_tbl);\r
-\r
-       osm_qos_policy_destroy(p_subn->p_qos_policy);\r
-\r
-       while (!cl_is_qlist_empty(&p_subn->prefix_routes_list)) {\r
-               cl_list_item_t *item = cl_qlist_remove_head(&p_subn->prefix_routes_list);\r
-               free(item);\r
-       }\r
-}\r
-\r
-ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,\r
-                             IN const osm_subn_opt_t * p_opt)\r
-{\r
-       cl_status_t status;\r
-\r
-       p_subn->p_osm = p_osm;\r
-\r
-       status = cl_ptr_vector_init(&p_subn->port_lid_tbl,\r
-                                   OSM_SUBNET_VECTOR_MIN_SIZE,\r
-                                   OSM_SUBNET_VECTOR_GROW_SIZE);\r
-       if (status != CL_SUCCESS)\r
-               return status;\r
-\r
-       status = cl_ptr_vector_set_capacity(&p_subn->port_lid_tbl,\r
-                                           OSM_SUBNET_VECTOR_CAPACITY);\r
-       if (status != CL_SUCCESS)\r
-               return status;\r
-\r
-       /*\r
-          LID zero is not valid.  NULL out this entry for the\r
-          convenience of other code.\r
-        */\r
-       cl_ptr_vector_set(&p_subn->port_lid_tbl, 0, NULL);\r
-\r
-       p_subn->opt = *p_opt;\r
-       p_subn->max_ucast_lid_ho = IB_LID_UCAST_END_HO;\r
-       p_subn->max_mcast_lid_ho = IB_LID_MCAST_END_HO;\r
-       p_subn->min_ca_mtu = IB_MAX_MTU;\r
-       p_subn->min_ca_rate = IB_MAX_RATE;\r
-       p_subn->ignore_existing_lfts = TRUE;\r
-\r
-       /* we assume master by default - so we only need to set it true if STANDBY */\r
-       p_subn->coming_out_of_standby = FALSE;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-osm_port_t *osm_get_port_by_mad_addr(IN osm_log_t * p_log,\r
-                                    IN const osm_subn_t * p_subn,\r
-                                    IN osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osm_port_t *port = osm_get_port_by_lid(p_subn, p_mad_addr->dest_lid);\r
-       if (!port)\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7504: "\r
-                       "Lid is out of range: %u\n",\r
-                       cl_ntoh16(p_mad_addr->dest_lid));\r
-\r
-       return port;\r
-}\r
-\r
-ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log,\r
-                                       IN const osm_subn_t * p_subn,\r
-                                       IN osm_mad_addr_t * p_mad_addr,\r
-                                       OUT ib_gid_t * p_gid)\r
-{\r
-       const osm_port_t *p_port;\r
-\r
-       if (p_gid == NULL) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7505: "\r
-                       "Provided output GID is NULL\n");\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-\r
-       p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr);\r
-       if (!p_port)\r
-               return IB_INVALID_PARAMETER;\r
-\r
-       p_gid->unicast.interface_id = p_port->p_physp->port_guid;\r
-       p_gid->unicast.prefix = p_subn->opt.subnet_prefix;\r
-\r
-       return IB_SUCCESS;\r
-}\r
-\r
-osm_physp_t *osm_get_physp_by_mad_addr(IN osm_log_t * p_log,\r
-                                      IN const osm_subn_t * p_subn,\r
-                                      IN osm_mad_addr_t * p_mad_addr)\r
-{\r
-       osm_port_t *p_port;\r
-\r
-       p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr);\r
-       if (!p_port)\r
-               return NULL;\r
-\r
-       return p_port->p_physp;\r
-}\r
-\r
-osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,\r
-                                    IN uint64_t guid)\r
-{\r
-       osm_switch_t *p_switch;\r
-\r
-       p_switch = (osm_switch_t *) cl_qmap_get(&(p_subn->sw_guid_tbl), guid);\r
-       if (p_switch == (osm_switch_t *) cl_qmap_end(&(p_subn->sw_guid_tbl)))\r
-               p_switch = NULL;\r
-       return p_switch;\r
-}\r
-\r
-osm_node_t *osm_get_node_by_guid(IN osm_subn_t const *p_subn, IN uint64_t guid)\r
-{\r
-       osm_node_t *p_node;\r
-\r
-       p_node = (osm_node_t *) cl_qmap_get(&(p_subn->node_guid_tbl), guid);\r
-       if (p_node == (osm_node_t *) cl_qmap_end(&(p_subn->node_guid_tbl)))\r
-               p_node = NULL;\r
-       return p_node;\r
-}\r
-\r
-osm_port_t *osm_get_port_by_guid(IN osm_subn_t const *p_subn, IN ib_net64_t guid)\r
-{\r
-       osm_port_t *p_port;\r
-\r
-       p_port = (osm_port_t *) cl_qmap_get(&(p_subn->port_guid_tbl), guid);\r
-       if (p_port == (osm_port_t *) cl_qmap_end(&(p_subn->port_guid_tbl)))\r
-               p_port = NULL;\r
-       return p_port;\r
-}\r
-\r
-osm_port_t *osm_get_port_by_lid_ho(IN osm_subn_t const * subn, IN uint16_t lid)\r
-{\r
-       if (lid < cl_ptr_vector_get_size(&subn->port_lid_tbl))\r
-               return cl_ptr_vector_get(&subn->port_lid_tbl, lid);\r
-       return NULL;\r
-}\r
-\r
-osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid)\r
-{\r
-       osm_mgrp_t *mgrp;\r
-\r
-       mgrp= (osm_mgrp_t *)cl_fmap_get(&subn->mgrp_mgid_tbl, mgid);\r
-       if (mgrp != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))\r
-               return mgrp;\r
-       return NULL;\r
-}\r
-\r
-static void subn_set_default_qos_options(IN osm_qos_options_t * opt)\r
-{\r
-       opt->max_vls = OSM_DEFAULT_QOS_MAX_VLS;\r
-       opt->high_limit = OSM_DEFAULT_QOS_HIGH_LIMIT;\r
-       opt->vlarb_high = OSM_DEFAULT_QOS_VLARB_HIGH;\r
-       opt->vlarb_low = OSM_DEFAULT_QOS_VLARB_LOW;\r
-       opt->sl2vl = OSM_DEFAULT_QOS_SL2VL;\r
-}\r
-\r
-static void subn_init_qos_options(osm_qos_options_t *opt, osm_qos_options_t *f)\r
-{\r
-       opt->max_vls = 0;\r
-       opt->high_limit = -1;\r
-       if (opt->vlarb_high)\r
-               free(opt->vlarb_high);\r
-       opt->vlarb_high = NULL;\r
-       if (opt->vlarb_low)\r
-               free(opt->vlarb_low);\r
-       opt->vlarb_low = NULL;\r
-       if (opt->sl2vl)\r
-               free(opt->sl2vl);\r
-       opt->sl2vl = NULL;\r
-       if (f)\r
-               memcpy(f, opt, sizeof(*f));\r
-}\r
-\r
-void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)\r
-{\r
-       memset(p_opt, 0, sizeof(osm_subn_opt_t));\r
-       p_opt->guid = 0;\r
-       p_opt->m_key = OSM_DEFAULT_M_KEY;\r
-       p_opt->sm_key = OSM_DEFAULT_SM_KEY;\r
-       p_opt->sa_key = OSM_DEFAULT_SA_KEY;\r
-       p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX;\r
-       p_opt->m_key_lease_period = 0;\r
-       p_opt->sweep_interval = OSM_DEFAULT_SWEEP_INTERVAL_SECS;\r
-       p_opt->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;\r
-       p_opt->console = strdup(OSM_DEFAULT_CONSOLE);\r
-       p_opt->console_port = OSM_DEFAULT_CONSOLE_PORT;\r
-       p_opt->transaction_timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;\r
-       p_opt->transaction_retries = OSM_DEFAULT_RETRY_COUNT;\r
-       /* by default we will consider waiting for 50x transaction timeout normal */\r
-       p_opt->max_msg_fifo_timeout = 50 * OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;\r
-       p_opt->sm_priority = OSM_DEFAULT_SM_PRIORITY;\r
-       p_opt->lmc = OSM_DEFAULT_LMC;\r
-       p_opt->lmc_esp0 = FALSE;\r
-       p_opt->max_op_vls = OSM_DEFAULT_MAX_OP_VLS;\r
-       p_opt->force_link_speed = 15;\r
-       p_opt->reassign_lids = FALSE;\r
-       p_opt->ignore_other_sm = FALSE;\r
-       p_opt->single_thread = FALSE;\r
-       p_opt->disable_multicast = FALSE;\r
-       p_opt->force_log_flush = FALSE;\r
-       p_opt->subnet_timeout = OSM_DEFAULT_SUBNET_TIMEOUT;\r
-       p_opt->packet_life_time = OSM_DEFAULT_SWITCH_PACKET_LIFE;\r
-       p_opt->vl_stall_count = OSM_DEFAULT_VL_STALL_COUNT;\r
-       p_opt->leaf_vl_stall_count = OSM_DEFAULT_LEAF_VL_STALL_COUNT;\r
-       p_opt->head_of_queue_lifetime = OSM_DEFAULT_HEAD_OF_QUEUE_LIFE;\r
-       p_opt->leaf_head_of_queue_lifetime =\r
-           OSM_DEFAULT_LEAF_HEAD_OF_QUEUE_LIFE;\r
-       p_opt->local_phy_errors_threshold = OSM_DEFAULT_ERROR_THRESHOLD;\r
-       p_opt->overrun_errors_threshold = OSM_DEFAULT_ERROR_THRESHOLD;\r
-       p_opt->sminfo_polling_timeout =\r
-           OSM_SM_DEFAULT_POLLING_TIMEOUT_MILLISECS;\r
-       p_opt->polling_retry_number = OSM_SM_DEFAULT_POLLING_RETRY_NUMBER;\r
-       p_opt->force_heavy_sweep = FALSE;\r
-       p_opt->log_flags = OSM_LOG_DEFAULT_LEVEL;\r
-       p_opt->honor_guid2lid_file = FALSE;\r
-       p_opt->daemon = FALSE;\r
-       p_opt->sm_inactive = FALSE;\r
-       p_opt->babbling_port_policy = FALSE;\r
-       p_opt->use_optimized_slvl = FALSE;\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       p_opt->perfmgr = FALSE;\r
-       p_opt->perfmgr_redir = TRUE;\r
-       p_opt->perfmgr_sweep_time_s = OSM_PERFMGR_DEFAULT_SWEEP_TIME_S;\r
-       p_opt->perfmgr_max_outstanding_queries =\r
-           OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES;\r
-       p_opt->event_db_dump_file = NULL; /* use default */\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-       p_opt->event_plugin_name = NULL;\r
-       p_opt->event_plugin_options = NULL;\r
-       p_opt->node_name_map_name = NULL;\r
-\r
-       p_opt->dump_files_dir = getenv("OSM_TMP_DIR");\r
-       if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir))\r
-               p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;\r
-       p_opt->dump_files_dir = strdup(p_opt->dump_files_dir);\r
-       p_opt->log_file = strdup(OSM_DEFAULT_LOG_FILE);\r
-       p_opt->log_max_size = 0;\r
-       p_opt->partition_config_file = strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE);\r
-       p_opt->no_partition_enforcement = FALSE;\r
-       p_opt->qos = FALSE;\r
-       p_opt->qos_policy_file = strdup(OSM_DEFAULT_QOS_POLICY_FILE);\r
-       p_opt->accum_log_file = TRUE;\r
-       p_opt->port_prof_ignore_file = NULL;\r
-       p_opt->hop_weights_file = NULL;\r
-       p_opt->dimn_ports_file = NULL;\r
-       p_opt->port_profile_switch_nodes = FALSE;\r
-       p_opt->sweep_on_trap = TRUE;\r
-       p_opt->use_ucast_cache = FALSE;\r
-       p_opt->routing_engine_names = NULL;\r
-       p_opt->connect_roots = FALSE;\r
-       p_opt->lid_matrix_dump_file = NULL;\r
-       p_opt->lfts_file = NULL;\r
-       p_opt->root_guid_file = NULL;\r
-       p_opt->cn_guid_file = NULL;\r
-       p_opt->io_guid_file = NULL;\r
-       p_opt->max_reverse_hops = 0;\r
-       p_opt->ids_guid_file = NULL;\r
-       p_opt->guid_routing_order_file = NULL;\r
-       p_opt->sa_db_file = NULL;\r
-       p_opt->sa_db_dump = FALSE;\r
-       p_opt->do_mesh_analysis = FALSE;\r
-       p_opt->exit_on_fatal = TRUE;\r
-       p_opt->enable_quirks = FALSE;\r
-       p_opt->no_clients_rereg = FALSE;\r
-       p_opt->prefix_routes_file = strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE);\r
-       p_opt->consolidate_ipv6_snm_req = FALSE;\r
-       p_opt->lash_start_vl = 0;\r
-       p_opt->sm_sl = OSM_DEFAULT_SL;\r
-       p_opt->log_prefix = NULL;\r
-       subn_init_qos_options(&p_opt->qos_options, NULL);\r
-       subn_init_qos_options(&p_opt->qos_ca_options, NULL);\r
-       subn_init_qos_options(&p_opt->qos_sw0_options, NULL);\r
-       subn_init_qos_options(&p_opt->qos_swe_options, NULL);\r
-       subn_init_qos_options(&p_opt->qos_rtr_options, NULL);\r
-}\r
-\r
-static char *clean_val(char *val)\r
-{\r
-       char *p = val;\r
-       /* clean leading spaces */\r
-       while (isspace(*p))\r
-               p++;\r
-       val = p;\r
-       if (!*val)\r
-               return val;\r
-       /* clean trailing spaces */\r
-       p = val + strlen(val) - 1;\r
-       while (p > val && isspace(*p))\r
-               p--;\r
-       p[1] = '\0';\r
-       /* clean quotas */\r
-       if ((*val == '\"' && *p == '\"') || (*val == '\'' && *p == '\'')) {\r
-               val++;\r
-               *p-- = '\0';\r
-       }\r
-       return val;\r
-}\r
-\r
-static int subn_dump_qos_options(FILE * file, const char *set_name,\r
-                                const char *prefix, osm_qos_options_t * opt)\r
-{\r
-       return fprintf(file, "# %s\n"\r
-                      "%s_max_vls %u\n"\r
-                      "%s_high_limit %d\n"\r
-                      "%s_vlarb_high %s\n"\r
-                      "%s_vlarb_low %s\n"\r
-                      "%s_sl2vl %s\n",\r
-                      set_name,\r
-                      prefix, opt->max_vls,\r
-                      prefix, opt->high_limit,\r
-                      prefix, opt->vlarb_high,\r
-                      prefix, opt->vlarb_low, prefix, opt->sl2vl);\r
-}\r
-\r
-static ib_api_status_t append_prefix_route(IN osm_subn_t * p_subn,\r
-                                          uint64_t prefix, uint64_t guid)\r
-{\r
-       osm_prefix_route_t *route;\r
-\r
-       route = malloc(sizeof *route);\r
-       if (! route) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "out of memory");\r
-               return IB_ERROR;\r
-       }\r
-\r
-       route->prefix = cl_hton64(prefix);\r
-       route->guid = cl_hton64(guid);\r
-       cl_qlist_insert_tail(&p_subn->prefix_routes_list, &route->list_item);\r
-       return IB_SUCCESS;\r
-}\r
-\r
-static ib_api_status_t parse_prefix_routes_file(IN osm_subn_t * p_subn)\r
-{\r
-       osm_log_t *log = &p_subn->p_osm->log;\r
-       FILE *fp;\r
-       char buf[1024];\r
-       int line = 0;\r
-       int errors = 0;\r
-\r
-       while (!cl_is_qlist_empty(&p_subn->prefix_routes_list)) {\r
-               cl_list_item_t *item = cl_qlist_remove_head(&p_subn->prefix_routes_list);\r
-               free(item);\r
-       }\r
-\r
-       fp = fopen(p_subn->opt.prefix_routes_file, "r");\r
-       if (! fp) {\r
-               if (errno == ENOENT)\r
-                       return IB_SUCCESS;\r
-\r
-               OSM_LOG(log, OSM_LOG_ERROR, "fopen(%s) failed: %s",\r
-                       p_subn->opt.prefix_routes_file, strerror(errno));\r
-               return IB_ERROR;\r
-       }\r
-\r
-       while (fgets(buf, sizeof buf, fp) != NULL) {\r
-               char *p_prefix, *p_guid, *p_extra, *p_last, *p_end;\r
-               uint64_t prefix, guid;\r
-\r
-               line++;\r
-               if (errors > 10)\r
-                       break;\r
-\r
-               p_prefix = strtok_r(buf, " \t\n", &p_last);\r
-               if (! p_prefix)\r
-                       continue; /* ignore blank lines */\r
-\r
-               if (*p_prefix == '#')\r
-                       continue; /* ignore comment lines */\r
-\r
-               p_guid = strtok_r(NULL, " \t\n", &p_last);\r
-               if (! p_guid) {\r
-                       OSM_LOG(log, OSM_LOG_ERROR, "%s:%d: missing GUID\n",\r
-                               p_subn->opt.prefix_routes_file, line);\r
-                       errors++;\r
-                       continue;\r
-               }\r
-\r
-               p_extra = strtok_r(NULL, " \t\n", &p_last);\r
-               if (p_extra && *p_extra != '#') {\r
-                       OSM_LOG(log, OSM_LOG_INFO, "%s:%d: extra tokens ignored\n",\r
-                               p_subn->opt.prefix_routes_file, line);\r
-               }\r
-\r
-               if (strcmp(p_prefix, "*") == 0)\r
-                       prefix = 0;\r
-               else {\r
-                       prefix = strtoull(p_prefix, &p_end, 16);\r
-                       if (*p_end != '\0') {\r
-                               OSM_LOG(log, OSM_LOG_ERROR, "%s:%d: illegal prefix: %s\n",\r
-                                       p_subn->opt.prefix_routes_file, line, p_prefix);\r
-                               errors++;\r
-                               continue;\r
-                       }\r
-               }\r
-\r
-               if (strcmp(p_guid, "*") == 0)\r
-                       guid = 0;\r
-               else {\r
-                       guid = strtoull(p_guid, &p_end, 16);\r
-                       if (*p_end != '\0' && *p_end != '#') {\r
-                               OSM_LOG(log, OSM_LOG_ERROR, "%s:%d: illegal GUID: %s\n",\r
-                                       p_subn->opt.prefix_routes_file, line, p_guid);\r
-                               errors++;\r
-                               continue;\r
-                       }\r
-               }\r
-\r
-               if (append_prefix_route(p_subn, prefix, guid) != IB_SUCCESS) {\r
-                       errors++;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       fclose(fp);\r
-       return (errors == 0) ? IB_SUCCESS : IB_ERROR;\r
-}\r
-\r
-static void subn_verify_max_vls(unsigned *max_vls, const char *prefix, unsigned dflt)\r
-{\r
-       if (!*max_vls || *max_vls > 15) {\r
-               if (*max_vls)\r
-                       log_report(" Invalid Cached Option: %s_max_vls=%u: "\r
-                                  "Using Default = %u\n",\r
-                                  prefix, *max_vls, dflt);\r
-               *max_vls = dflt;\r
-       }\r
-}\r
-\r
-static void subn_verify_high_limit(int *high_limit, const char *prefix, int dflt)\r
-{\r
-       if (*high_limit < 0 || *high_limit > 255) {\r
-               if (*high_limit > 255)\r
-                       log_report(" Invalid Cached Option: %s_high_limit=%d: "\r
-                                  "Using Default: %d\n",\r
-                                  prefix, *high_limit, dflt);\r
-               *high_limit = dflt;\r
-       }\r
-}\r
-\r
-static void subn_verify_vlarb(char **vlarb, const char *prefix,\r
-                             const char *suffix, char *dflt)\r
-{\r
-       char *str, *tok, *end, *ptr;\r
-       int count = 0;\r
-\r
-       if (*vlarb == NULL) {\r
-               *vlarb = strdup(dflt);\r
-               return;\r
-       }\r
-\r
-       str = strdup(*vlarb);\r
-\r
-       tok = strtok_r(str, ",\n", &ptr);\r
-       while (tok) {\r
-               char *vl_str, *weight_str;\r
-\r
-               vl_str = tok;\r
-               weight_str = strchr(tok, ':');\r
-\r
-               if (weight_str) {\r
-                       long vl, weight;\r
-\r
-                       *weight_str = '\0';\r
-                       weight_str++;\r
-\r
-                       vl = strtol(vl_str, &end, 0);\r
-\r
-                       if (*end)\r
-                               log_report(" Warning: Cached Option "\r
-                                          "%s_vlarb_%s:vl=%s"\r
-                                          " improperly formatted\n",\r
-                                          prefix, suffix, vl_str);\r
-                       else if (vl < 0 || vl > 14)\r
-                               log_report(" Warning: Cached Option "\r
-                                          "%s_vlarb_%s:vl=%ld out of range\n",\r
-                                          prefix, suffix, vl);\r
-\r
-                       weight = strtol(weight_str, &end, 0);\r
-\r
-                       if (*end)\r
-                               log_report(" Warning: Cached Option "\r
-                                          "%s_vlarb_%s:weight=%s "\r
-                                          "improperly formatted\n",\r
-                                          prefix, suffix, weight_str);\r
-                       else if (weight < 0 || weight > 255)\r
-                               log_report(" Warning: Cached Option "\r
-                                          "%s_vlarb_%s:weight=%ld "\r
-                                          "out of range\n",\r
-                                          prefix, suffix, weight);\r
-               } else\r
-                       log_report(" Warning: Cached Option "\r
-                                  "%s_vlarb_%s:vl:weight=%s "\r
-                                  "improperly formatted\n",\r
-                                  prefix, suffix, tok);\r
-\r
-               count++;\r
-               tok = strtok_r(NULL, ",\n", &ptr);\r
-       }\r
-\r
-       if (count > 64)\r
-               log_report(" Warning: Cached Option %s_vlarb_%s: > 64 listed:"\r
-                          " excess vl:weight pairs will be dropped\n",\r
-                          prefix, suffix);\r
-\r
-       free(str);\r
-}\r
-\r
-static void subn_verify_sl2vl(char **sl2vl, const char *prefix, char *dflt)\r
-{\r
-       char *str, *tok, *end, *ptr;\r
-       int count = 0;\r
-\r
-       if (*sl2vl == NULL) {\r
-               *sl2vl = strdup(dflt);\r
-               return;\r
-       }\r
-\r
-       str = strdup(*sl2vl);\r
-\r
-       tok = strtok_r(str, ",\n", &ptr);\r
-       while (tok) {\r
-               long vl = strtol(tok, &end, 0);\r
-\r
-               if (*end)\r
-                       log_report(" Warning: Cached Option %s_sl2vl:vl=%s "\r
-                                  "improperly formatted\n", prefix, tok);\r
-               else if (vl < 0 || vl > 15)\r
-                       log_report(" Warning: Cached Option %s_sl2vl:vl=%ld "\r
-                                  "out of range\n", prefix, vl);\r
-\r
-               count++;\r
-               tok = strtok_r(NULL, ",\n", &ptr);\r
-       }\r
-\r
-       if (count < 16)\r
-               log_report(" Warning: Cached Option %s_sl2vl: < 16 VLs "\r
-                          "listed\n", prefix);\r
-\r
-       if (count > 16)\r
-               log_report(" Warning: Cached Option %s_sl2vl: > 16 listed: "\r
-                          "excess VLs will be dropped\n", prefix);\r
-\r
-       free(str);\r
-}\r
-\r
-static void subn_verify_qos_set(osm_qos_options_t *set, const char *prefix,\r
-                               osm_qos_options_t *dflt)\r
-{\r
-       subn_verify_max_vls(&set->max_vls, prefix, dflt->max_vls);\r
-       subn_verify_high_limit(&set->high_limit, prefix, dflt->high_limit);\r
-       subn_verify_vlarb(&set->vlarb_low, prefix, "low", dflt->vlarb_low);\r
-       subn_verify_vlarb(&set->vlarb_high, prefix, "high", dflt->vlarb_high);\r
-       subn_verify_sl2vl(&set->sl2vl, prefix, dflt->sl2vl);\r
-}\r
-\r
-int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)\r
-{\r
-       if (p_opts->lmc > 7) {\r
-               log_report(" Invalid Cached Option Value:lmc = %u:"\r
-                          "Using Default:%u\n", p_opts->lmc, OSM_DEFAULT_LMC);\r
-               p_opts->lmc = OSM_DEFAULT_LMC;\r
-       }\r
-\r
-       if (15 < p_opts->sm_priority) {\r
-               log_report(" Invalid Cached Option Value:sm_priority = %u:"\r
-                          "Using Default:%u\n",\r
-                          p_opts->sm_priority, OSM_DEFAULT_SM_PRIORITY);\r
-               p_opts->sm_priority = OSM_DEFAULT_SM_PRIORITY;\r
-       }\r
-\r
-       if ((15 < p_opts->force_link_speed) ||\r
-           (p_opts->force_link_speed > 7 && p_opts->force_link_speed < 15)) {\r
-               log_report(" Invalid Cached Option Value:force_link_speed = %u:"\r
-                          "Using Default:%u\n", p_opts->force_link_speed,\r
-                          IB_PORT_LINK_SPEED_ENABLED_MASK);\r
-               p_opts->force_link_speed = IB_PORT_LINK_SPEED_ENABLED_MASK;\r
-       }\r
-\r
-       if (p_opts->max_wire_smps == 0)\r
-               p_opts->max_wire_smps = 0x7FFFFFFF;\r
-       else if (p_opts->max_wire_smps > 0x7FFFFFFF) {\r
-               log_report(" Invalid Cached Option Value: max_wire_smps = %u,"\r
-                          " Using Default: %u\n",\r
-                          p_opts->max_wire_smps, OSM_DEFAULT_SMP_MAX_ON_WIRE);\r
-               p_opts->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;\r
-       }\r
-\r
-       if (strcmp(p_opts->console, OSM_DISABLE_CONSOLE)\r
-           && strcmp(p_opts->console, OSM_LOCAL_CONSOLE)\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-           && strcmp(p_opts->console, OSM_LOOPBACK_CONSOLE)\r
-           && strcmp(p_opts->console, OSM_REMOTE_CONSOLE)\r
-#endif\r
-           ) {\r
-               log_report(" Invalid Cached Option Value:console = %s"\r
-                          ", Using Default:%s\n",\r
-                          p_opts->console, OSM_DEFAULT_CONSOLE);\r
-               p_opts->console = OSM_DEFAULT_CONSOLE;\r
-       }\r
-\r
-       if (p_opts->qos) {\r
-               osm_qos_options_t dflt;\r
-\r
-               /* the default options in qos_options must be correct.\r
-                * every other one need not be, b/c those will default\r
-                * back to whatever is in qos_options.\r
-                */\r
-\r
-               subn_set_default_qos_options(&dflt);\r
-\r
-               subn_verify_qos_set(&p_opts->qos_options, "qos", &dflt);\r
-               subn_verify_qos_set(&p_opts->qos_ca_options, "qos_ca",\r
-                                   &p_opts->qos_options);\r
-               subn_verify_qos_set(&p_opts->qos_sw0_options, "qos_sw0",\r
-                                   &p_opts->qos_options);\r
-               subn_verify_qos_set(&p_opts->qos_swe_options, "qos_swe",\r
-                                   &p_opts->qos_options);\r
-               subn_verify_qos_set(&p_opts->qos_rtr_options, "qos_rtr",\r
-                                   &p_opts->qos_options);\r
-       }\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       if (p_opts->perfmgr_sweep_time_s < 1) {\r
-               log_report(" Invalid Cached Option Value:perfmgr_sweep_time_s "\r
-                          "= %u Using Default:%u\n",\r
-                          p_opts->perfmgr_sweep_time_s,\r
-                          OSM_PERFMGR_DEFAULT_SWEEP_TIME_S);\r
-               p_opts->perfmgr_sweep_time_s = OSM_PERFMGR_DEFAULT_SWEEP_TIME_S;\r
-       }\r
-       if (p_opts->perfmgr_max_outstanding_queries < 1) {\r
-               log_report(" Invalid Cached Option Value:"\r
-                          "perfmgr_max_outstanding_queries = %u"\r
-                          " Using Default:%u\n",\r
-                          p_opts->perfmgr_max_outstanding_queries,\r
-                          OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES);\r
-               p_opts->perfmgr_max_outstanding_queries =\r
-                   OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES;\r
-       }\r
-#endif\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts)\r
-{\r
-       char line[1024];\r
-       FILE *opts_file;\r
-       char *p_key, *p_val;\r
-       const opt_rec_t *r;\r
-       void *p_field1, *p_field2;\r
-\r
-       opts_file = fopen(file_name, "r");\r
-       if (!opts_file) {\r
-               if (errno == ENOENT)\r
-                       return 1;\r
-               printf("cannot open file \'%s\': %s\n",\r
-                      file_name, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       printf(" Reading Cached Option File: %s\n", file_name);\r
-       cl_log_event("OpenSM", CL_LOG_INFO, line, NULL, 0);\r
-\r
-       p_opts->config_file = file_name;\r
-       if (!p_opts->file_opts && !(p_opts->file_opts = malloc(sizeof(*p_opts))))\r
-               return -1;\r
-       memcpy(p_opts->file_opts, p_opts, sizeof(*p_opts));\r
-\r
-       while (fgets(line, 1023, opts_file) != NULL) {\r
-               /* get the first token */\r
-               p_key = strtok_r(line, " \t\n", &p_val);\r
-               if (!p_key)\r
-                       continue;\r
-\r
-               p_val = clean_val(p_val);\r
-\r
-               for (r = opt_tbl; r->name; r++) {\r
-                       if (strcmp(r->name, p_key))\r
-                               continue;\r
-\r
-                       p_field1 = (uint8_t *)p_opts->file_opts + r->opt_offset;\r
-                       p_field2 = (uint8_t *)p_opts + r->opt_offset;\r
-                       /* don't call setup function first time */\r
-                       r->parse_fn(NULL, p_key, p_val, p_field1, p_field2,\r
-                                   NULL);\r
-                       break;\r
-               }\r
-       }\r
-       fclose(opts_file);\r
-\r
-       osm_subn_verify_config(p_opts);\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn)\r
-{\r
-       char line[1024];\r
-       osm_subn_opt_t *p_opts = &p_subn->opt;\r
-       const opt_rec_t *r;\r
-       FILE *opts_file;\r
-       char *p_key, *p_val;\r
-       void *p_field1, *p_field2;\r
-\r
-       if (!p_opts->config_file)\r
-               return 0;\r
-\r
-       opts_file = fopen(p_opts->config_file, "r");\r
-       if (!opts_file) {\r
-               if (errno == ENOENT)\r
-                       return 1;\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,\r
-                       "cannot open file \'%s\': %s\n",\r
-                       p_opts->config_file, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       subn_init_qos_options(&p_opts->qos_options,\r
-                             &p_opts->file_opts->qos_options);\r
-       subn_init_qos_options(&p_opts->qos_ca_options,\r
-                             &p_opts->file_opts->qos_ca_options);\r
-       subn_init_qos_options(&p_opts->qos_sw0_options,\r
-                             &p_opts->file_opts->qos_sw0_options);\r
-       subn_init_qos_options(&p_opts->qos_swe_options,\r
-                             &p_opts->file_opts->qos_swe_options);\r
-       subn_init_qos_options(&p_opts->qos_rtr_options,\r
-                             &p_opts->file_opts->qos_rtr_options);\r
-\r
-       while (fgets(line, 1023, opts_file) != NULL) {\r
-               /* get the first token */\r
-               p_key = strtok_r(line, " \t\n", &p_val);\r
-               if (!p_key)\r
-                       continue;\r
-\r
-               p_val = clean_val(p_val);\r
-\r
-               for (r = opt_tbl; r->name; r++) {\r
-                       if (!r->can_update || strcmp(r->name, p_key))\r
-                               continue;\r
-\r
-                       p_field1 = (uint8_t *)p_opts->file_opts + r->opt_offset;\r
-                       p_field2 = (uint8_t *)p_opts + r->opt_offset;\r
-                       r->parse_fn(p_subn, p_key, p_val, p_field1, p_field2,\r
-                                   r->setup_fn);\r
-                       break;\r
-               }\r
-       }\r
-       fclose(opts_file);\r
-\r
-       osm_subn_verify_config(p_opts);\r
-\r
-       parse_prefix_routes_file(p_subn);\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)\r
-{\r
-       fprintf(out,\r
-               "#\n# DEVICE ATTRIBUTES OPTIONS\n#\n"\r
-               "# The port GUID on which the OpenSM is running\n"\r
-               "guid 0x%016" PRIx64 "\n\n"\r
-               "# M_Key value sent to all ports qualifying all Set(PortInfo)\n"\r
-               "m_key 0x%016" PRIx64 "\n\n"\r
-               "# The lease period used for the M_Key on this subnet in [sec]\n"\r
-               "m_key_lease_period %u\n\n"\r
-               "# SM_Key value of the SM used for SM authentication\n"\r
-               "sm_key 0x%016" PRIx64 "\n\n"\r
-               "# SM_Key value to qualify rcv SA queries as 'trusted'\n"\r
-               "sa_key 0x%016" PRIx64 "\n\n"\r
-               "# Note that for both values above (sm_key and sa_key)\n"\r
-               "# OpenSM version 3.2.1 and below used the default value '1'\n"\r
-               "# in a host byte order, it is fixed now but you may need to\n"\r
-               "# change the values to interoperate with old OpenSM running\n"\r
-               "# on a little endian machine.\n\n"\r
-               "# Subnet prefix used on this subnet\n"\r
-               "subnet_prefix 0x%016" PRIx64 "\n\n"\r
-               "# The LMC value used on this subnet\n"\r
-               "lmc %u\n\n"\r
-               "# lmc_esp0 determines whether LMC value used on subnet is used for\n"\r
-               "# enhanced switch port 0. If TRUE, LMC value for subnet is used for\n"\r
-               "# ESP0. Otherwise, LMC value for ESP0s is 0.\n"\r
-               "lmc_esp0 %s\n\n"\r
-               "# sm_sl determines SMSL used for SM/SA communication\n"\r
-               "sm_sl %u\n\n"\r
-               "# The code of maximal time a packet can live in a switch\n"\r
-               "# The actual time is 4.096usec * 2^<packet_life_time>\n"\r
-               "# The value 0x14 disables this mechanism\n"\r
-               "packet_life_time 0x%02x\n\n"\r
-               "# The number of sequential packets dropped that cause the port\n"\r
-               "# to enter the VLStalled state. The result of setting this value to\n"\r
-               "# zero is undefined.\n"\r
-               "vl_stall_count 0x%02x\n\n"\r
-               "# The number of sequential packets dropped that cause the port\n"\r
-               "# to enter the VLStalled state. This value is for switch ports\n"\r
-               "# driving a CA or router port. The result of setting this value\n"\r
-               "# to zero is undefined.\n"\r
-               "leaf_vl_stall_count 0x%02x\n\n"\r
-               "# The code of maximal time a packet can wait at the head of\n"\r
-               "# transmission queue.\n"\r
-               "# The actual time is 4.096usec * 2^<head_of_queue_lifetime>\n"\r
-               "# The value 0x14 disables this mechanism\n"\r
-               "head_of_queue_lifetime 0x%02x\n\n"\r
-               "# The maximal time a packet can wait at the head of queue on\n"\r
-               "# switch port connected to a CA or router port\n"\r
-               "leaf_head_of_queue_lifetime 0x%02x\n\n"\r
-               "# Limit the maximal operational VLs\n"\r
-               "max_op_vls %u\n\n"\r
-               "# Force PortInfo:LinkSpeedEnabled on switch ports\n"\r
-               "# If 0, don't modify PortInfo:LinkSpeedEnabled on switch port\n"\r
-               "# Otherwise, use value for PortInfo:LinkSpeedEnabled on switch port\n"\r
-               "# Values are (IB Spec 1.2.1, 14.2.5.6 Table 146 \"PortInfo\")\n"\r
-               "#    1: 2.5 Gbps\n"\r
-               "#    3: 2.5 or 5.0 Gbps\n"\r
-               "#    5: 2.5 or 10.0 Gbps\n"\r
-               "#    7: 2.5 or 5.0 or 10.0 Gbps\n"\r
-               "#    2,4,6,8-14 Reserved\n"\r
-               "#    Default 15: set to PortInfo:LinkSpeedSupported\n"\r
-               "force_link_speed %u\n\n"\r
-               "# The subnet_timeout code that will be set for all the ports\n"\r
-               "# The actual timeout is 4.096usec * 2^<subnet_timeout>\n"\r
-               "subnet_timeout %u\n\n"\r
-               "# Threshold of local phy errors for sending Trap 129\n"\r
-               "local_phy_errors_threshold 0x%02x\n\n"\r
-               "# Threshold of credit overrun errors for sending Trap 130\n"\r
-               "overrun_errors_threshold 0x%02x\n\n",\r
-               cl_ntoh64(p_opts->guid),\r
-               cl_ntoh64(p_opts->m_key),\r
-               cl_ntoh16(p_opts->m_key_lease_period),\r
-               cl_ntoh64(p_opts->sm_key),\r
-               cl_ntoh64(p_opts->sa_key),\r
-               cl_ntoh64(p_opts->subnet_prefix),\r
-               p_opts->lmc,\r
-               p_opts->lmc_esp0 ? "TRUE" : "FALSE",\r
-               p_opts->sm_sl,\r
-               p_opts->packet_life_time,\r
-               p_opts->vl_stall_count,\r
-               p_opts->leaf_vl_stall_count,\r
-               p_opts->head_of_queue_lifetime,\r
-               p_opts->leaf_head_of_queue_lifetime,\r
-               p_opts->max_op_vls,\r
-               p_opts->force_link_speed,\r
-               p_opts->subnet_timeout,\r
-               p_opts->local_phy_errors_threshold,\r
-               p_opts->overrun_errors_threshold);\r
-\r
-       fprintf(out,\r
-               "#\n# PARTITIONING OPTIONS\n#\n"\r
-               "# Partition configuration file to be used\n"\r
-               "partition_config_file %s\n\n"\r
-               "# Disable partition enforcement by switches\n"\r
-               "no_partition_enforcement %s\n\n",\r
-               p_opts->partition_config_file,\r
-               p_opts->no_partition_enforcement ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "#\n# SWEEP OPTIONS\n#\n"\r
-               "# The number of seconds between subnet sweeps (0 disables it)\n"\r
-               "sweep_interval %u\n\n"\r
-               "# If TRUE cause all lids to be reassigned\n"\r
-               "reassign_lids %s\n\n"\r
-               "# If TRUE forces every sweep to be a heavy sweep\n"\r
-               "force_heavy_sweep %s\n\n"\r
-               "# If TRUE every trap will cause a heavy sweep.\n"\r
-               "# NOTE: successive identical traps (>10) are suppressed\n"\r
-               "sweep_on_trap %s\n\n",\r
-               p_opts->sweep_interval,\r
-               p_opts->reassign_lids ? "TRUE" : "FALSE",\r
-               p_opts->force_heavy_sweep ? "TRUE" : "FALSE",\r
-               p_opts->sweep_on_trap ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "#\n# ROUTING OPTIONS\n#\n"\r
-               "# If TRUE count switches as link subscriptions\n"\r
-               "port_profile_switch_nodes %s\n\n",\r
-               p_opts->port_profile_switch_nodes ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "# Name of file with port guids to be ignored by port profiling\n"\r
-               "port_prof_ignore_file %s\n\n", p_opts->port_prof_ignore_file ?\r
-               p_opts->port_prof_ignore_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding routing weighting factors per output port\n"\r
-               "hop_weights_file %s\n\n",\r
-               p_opts->hop_weights_file ? p_opts->hop_weights_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding non-default port order per switch for DOR routing \n"\r
-               "dimn_ports_file %s\n\n",\r
-               p_opts->dimn_ports_file ? p_opts->dimn_ports_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# Routing engine\n"\r
-               "# Multiple routing engines can be specified separated by\n"\r
-               "# commas so that specific ordering of routing algorithms will\n"\r
-               "# be tried if earlier routing engines fail.\n"\r
-               "# Supported engines: minhop, updn, file, ftree, lash, dor\n"\r
-               "routing_engine %s\n\n", p_opts->routing_engine_names ?\r
-               p_opts->routing_engine_names : null_str);\r
-\r
-       fprintf(out,\r
-               "# Connect roots (use FALSE if unsure)\n"\r
-               "connect_roots %s\n\n",\r
-               p_opts->connect_roots ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "# Use unicast routing cache (use FALSE if unsure)\n"\r
-               "use_ucast_cache %s\n\n",\r
-               p_opts->use_ucast_cache ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "# Lid matrix dump file name\n"\r
-               "lid_matrix_dump_file %s\n\n", p_opts->lid_matrix_dump_file ?\r
-               p_opts->lid_matrix_dump_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# LFTs file name\nlfts_file %s\n\n",\r
-               p_opts->lfts_file ? p_opts->lfts_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding the root node guids (for fat-tree or Up/Down)\n"\r
-               "# One guid in each line\nroot_guid_file %s\n\n",\r
-               p_opts->root_guid_file ? p_opts->root_guid_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding the fat-tree compute node guids\n"\r
-               "# One guid in each line\ncn_guid_file %s\n\n",\r
-               p_opts->cn_guid_file ? p_opts->cn_guid_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding the fat-tree I/O node guids\n"\r
-               "# One guid in each line\nio_guid_file %s\n\n",\r
-               p_opts->io_guid_file ? p_opts->io_guid_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# Number of reverse hops allowed for I/O nodes \n"\r
-               "# Used for connectivity between I/O nodes connected to Top Switches\nmax_reverse_hops %d\n\n",\r
-               p_opts->max_reverse_hops);\r
-\r
-       fprintf(out,\r
-               "# The file holding the node ids which will be used by"\r
-               " Up/Down algorithm instead\n# of GUIDs (one guid and"\r
-               " id in each line)\nids_guid_file %s\n\n",\r
-               p_opts->ids_guid_file ? p_opts->ids_guid_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# The file holding guid routing order guids (for MinHop and Up/Down)\n"\r
-               "guid_routing_order_file %s\n\n",\r
-               p_opts->guid_routing_order_file ? p_opts->guid_routing_order_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# Do mesh topology analysis (for LASH algorithm)\n"\r
-               "do_mesh_analysis %s\n\n",\r
-               p_opts->do_mesh_analysis ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "# Starting VL for LASH algorithm\n"\r
-               "lash_start_vl %u\n\n",\r
-               p_opts->lash_start_vl);\r
-\r
-       fprintf(out,\r
-               "# SA database file name\nsa_db_file %s\n\n",\r
-               p_opts->sa_db_file ? p_opts->sa_db_file : null_str);\r
-\r
-       fprintf(out,\r
-               "# If TRUE causes OpenSM to dump SA database at the end of\n"\r
-               "# every light sweep, regardless of the verbosity level\n"\r
-               "sa_db_dump %s\n\n",\r
-               p_opts->sa_db_dump ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "#\n# HANDOVER - MULTIPLE SMs OPTIONS\n#\n"\r
-               "# SM priority used for deciding who is the master\n"\r
-               "# Range goes from 0 (lowest priority) to 15 (highest).\n"\r
-               "sm_priority %u\n\n"\r
-               "# If TRUE other SMs on the subnet should be ignored\n"\r
-               "ignore_other_sm %s\n\n"\r
-               "# Timeout in [msec] between two polls of active master SM\n"\r
-               "sminfo_polling_timeout %u\n\n"\r
-               "# Number of failing polls of remote SM that declares it dead\n"\r
-               "polling_retry_number %u\n\n"\r
-               "# If TRUE honor the guid2lid file when coming out of standby\n"\r
-               "# state, if such file exists and is valid\n"\r
-               "honor_guid2lid_file %s\n\n",\r
-               p_opts->sm_priority,\r
-               p_opts->ignore_other_sm ? "TRUE" : "FALSE",\r
-               p_opts->sminfo_polling_timeout,\r
-               p_opts->polling_retry_number,\r
-               p_opts->honor_guid2lid_file ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "#\n# TIMING AND THREADING OPTIONS\n#\n"\r
-               "# Maximum number of SMPs sent in parallel\n"\r
-               "max_wire_smps %u\n\n"\r
-               "# The maximum time in [msec] allowed for a transaction to complete\n"\r
-               "transaction_timeout %u\n\n"\r
-               "# The maximum number of retries allowed for a transaction to complete\n"\r
-               "transaction_retries %u\n\n"\r
-               "# Maximal time in [msec] a message can stay in the incoming message queue.\n"\r
-               "# If there is more than one message in the queue and the last message\n"\r
-               "# stayed in the queue more than this value, any SA request will be\n"\r
-               "# immediately returned with a BUSY status.\n"\r
-               "max_msg_fifo_timeout %u\n\n"\r
-               "# Use a single thread for handling SA queries\n"\r
-               "single_thread %s\n\n",\r
-               p_opts->max_wire_smps,\r
-               p_opts->transaction_timeout,\r
-               p_opts->transaction_retries,\r
-               p_opts->max_msg_fifo_timeout,\r
-               p_opts->single_thread ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out,\r
-               "#\n# MISC OPTIONS\n#\n"\r
-               "# Daemon mode\n"\r
-               "daemon %s\n\n"\r
-               "# SM Inactive\n"\r
-               "sm_inactive %s\n\n"\r
-               "# Babbling Port Policy\n"\r
-               "babbling_port_policy %s\n\n"\r
-               "# Use Optimized SLtoVLMapping programming if supported by device\n"\r
-               "use_optimized_slvl %s\n\n",\r
-               p_opts->daemon ? "TRUE" : "FALSE",\r
-               p_opts->sm_inactive ? "TRUE" : "FALSE",\r
-               p_opts->babbling_port_policy ? "TRUE" : "FALSE",\r
-               p_opts->use_optimized_slvl ? "TRUE" : "FALSE");\r
-\r
-#ifdef ENABLE_OSM_PERF_MGR\r
-       fprintf(out,\r
-               "#\n# Performance Manager Options\n#\n"\r
-               "# perfmgr enable\n"\r
-               "perfmgr %s\n\n"\r
-               "# perfmgr redirection enable\n"\r
-               "perfmgr_redir %s\n\n"\r
-               "# sweep time in seconds\n"\r
-               "perfmgr_sweep_time_s %u\n\n"\r
-               "# Max outstanding queries\n"\r
-               "perfmgr_max_outstanding_queries %u\n\n",\r
-               p_opts->perfmgr ? "TRUE" : "FALSE",\r
-               p_opts->perfmgr_redir ? "TRUE" : "FALSE",\r
-               p_opts->perfmgr_sweep_time_s,\r
-               p_opts->perfmgr_max_outstanding_queries);\r
-\r
-       fprintf(out,\r
-               "#\n# Event DB Options\n#\n"\r
-               "# Dump file to dump the events to\n"\r
-               "event_db_dump_file %s\n\n", p_opts->event_db_dump_file ?\r
-               p_opts->event_db_dump_file : null_str);\r
-#endif                         /* ENABLE_OSM_PERF_MGR */\r
-\r
-       fprintf(out,\r
-               "#\n# Event Plugin Options\n#\n"\r
-               "# Event plugin name(s)\n"\r
-               "event_plugin_name %s\n\n"\r
-               "# Options string that would be passed to the plugin(s)\n"\r
-               "event_plugin_options %s\n\n",\r
-               p_opts->event_plugin_name ?\r
-               p_opts->event_plugin_name : null_str,\r
-               p_opts->event_plugin_options ?\r
-               p_opts->event_plugin_options : null_str);\r
-\r
-       fprintf(out,\r
-               "#\n# Node name map for mapping node's to more descriptive node descriptions\n"\r
-               "# (man ibnetdiscover for more information)\n#\n"\r
-               "node_name_map_name %s\n\n", p_opts->node_name_map_name ?\r
-               p_opts->node_name_map_name : null_str);\r
-\r
-       fprintf(out,\r
-               "#\n# DEBUG FEATURES\n#\n"\r
-               "# The log flags used\n"\r
-               "log_flags 0x%02x\n\n"\r
-               "# Force flush of the log file after each log message\n"\r
-               "force_log_flush %s\n\n"\r
-               "# Log file to be used\n"\r
-               "log_file %s\n\n"\r
-               "# Limit the size of the log file in MB. If overrun, log is restarted\n"\r
-               "log_max_size %lu\n\n"\r
-               "# If TRUE will accumulate the log over multiple OpenSM sessions\n"\r
-               "accum_log_file %s\n\n"\r
-               "# The directory to hold the file OpenSM dumps\n"\r
-               "dump_files_dir %s\n\n"\r
-               "# If TRUE enables new high risk options and hardware specific quirks\n"\r
-               "enable_quirks %s\n\n"\r
-               "# If TRUE disables client reregistration\n"\r
-               "no_clients_rereg %s\n\n"\r
-               "# If TRUE OpenSM should disable multicast support and\n"\r
-               "# no multicast routing is performed if TRUE\n"\r
-               "disable_multicast %s\n\n"\r
-               "# If TRUE opensm will exit on fatal initialization issues\n"\r
-               "exit_on_fatal %s\n\n" "# console [off|local"\r
-#ifdef ENABLE_OSM_CONSOLE_SOCKET\r
-               "|loopback|socket]\n"\r
-#else\r
-               "]\n"\r
-#endif\r
-               "console %s\n\n"\r
-               "# Telnet port for console (default %d)\n"\r
-               "console_port %d\n\n",\r
-               p_opts->log_flags,\r
-               p_opts->force_log_flush ? "TRUE" : "FALSE",\r
-               p_opts->log_file,\r
-               p_opts->log_max_size,\r
-               p_opts->accum_log_file ? "TRUE" : "FALSE",\r
-               p_opts->dump_files_dir,\r
-               p_opts->enable_quirks ? "TRUE" : "FALSE",\r
-               p_opts->no_clients_rereg ? "TRUE" : "FALSE",\r
-               p_opts->disable_multicast ? "TRUE" : "FALSE",\r
-               p_opts->exit_on_fatal ? "TRUE" : "FALSE",\r
-               p_opts->console,\r
-               OSM_DEFAULT_CONSOLE_PORT, p_opts->console_port);\r
-\r
-       fprintf(out,\r
-               "#\n# QoS OPTIONS\n#\n"\r
-               "# Enable QoS setup\n"\r
-               "qos %s\n\n"\r
-               "# QoS policy file to be used\n"\r
-               "qos_policy_file %s\n\n",\r
-               p_opts->qos ? "TRUE" : "FALSE", p_opts->qos_policy_file);\r
-\r
-       subn_dump_qos_options(out,\r
-                             "QoS default options", "qos",\r
-                             &p_opts->qos_options);\r
-       fprintf(out, "\n");\r
-       subn_dump_qos_options(out,\r
-                             "QoS CA options", "qos_ca",\r
-                             &p_opts->qos_ca_options);\r
-       fprintf(out, "\n");\r
-       subn_dump_qos_options(out,\r
-                             "QoS Switch Port 0 options", "qos_sw0",\r
-                             &p_opts->qos_sw0_options);\r
-       fprintf(out, "\n");\r
-       subn_dump_qos_options(out,\r
-                             "QoS Switch external ports options", "qos_swe",\r
-                             &p_opts->qos_swe_options);\r
-       fprintf(out, "\n");\r
-       subn_dump_qos_options(out,\r
-                             "QoS Router ports options", "qos_rtr",\r
-                             &p_opts->qos_rtr_options);\r
-       fprintf(out, "\n");\r
-\r
-       fprintf(out,\r
-               "# Prefix routes file name\n"\r
-               "prefix_routes_file %s\n\n",\r
-               p_opts->prefix_routes_file);\r
-\r
-       fprintf(out,\r
-               "#\n# IPv6 Solicited Node Multicast (SNM) Options\n#\n"\r
-               "consolidate_ipv6_snm_req %s\n\n",\r
-               p_opts->consolidate_ipv6_snm_req ? "TRUE" : "FALSE");\r
-\r
-       fprintf(out, "# Log prefix\nlog_prefix %s\n\n", p_opts->log_prefix);\r
-\r
-       /* optional string attributes ... */\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * p_opts)\r
-{\r
-       FILE *opts_file;\r
-\r
-       opts_file = fopen(file_name, "w");\r
-       if (!opts_file) {\r
-               printf("cannot open file \'%s\' for writing: %s\n",\r
-                       file_name, strerror(errno));\r
-               return -1;\r
-       }\r
-\r
-       if (osm_subn_output_conf(opts_file, p_opts) < 0)\r
-               return -1;\r
-\r
-       fclose(opts_file);\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_sw_info_rcv.c b/branches/opensm_3/user/opensm/osm_sw_info_rcv.c
deleted file mode 100644 (file)
index f79aca7..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_si_rcv_t.\r
- * This object represents the SwitchInfo Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-#if 0\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)\r
-{\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       uint32_t block_id_ho;\r
-       uint32_t max_block_id_ho;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);\r
-\r
-       context.lft_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.lft_context.set_method = FALSE;\r
-\r
-       max_block_id_ho = osm_switch_get_max_block_id_in_use(p_sw);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, 0);\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-\r
-       for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Retrieving FT block %u\n", block_id_ho);\r
-\r
-               status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_LIN_FWD_TBL,\r
-                                    cl_hton32(block_id_ho),\r
-                                    CL_DISP_MSGID_NONE, &context);\r
-               if (status != IB_SUCCESS)\r
-                       /* continue the loop despite the error */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3603: "\r
-                               "Failure initiating PortInfo request (%s)\n",\r
-                               ib_get_err_str(status));\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
- The plock must be held before calling this function.\r
-**********************************************************************/\r
-static void si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)\r
-{\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t *p_dr_path;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       osm_mcast_tbl_t *p_tbl;\r
-       uint32_t block_id_ho;\r
-       uint32_t max_block_id_ho;\r
-       uint32_t position;\r
-       uint32_t max_position;\r
-       uint32_t attr_mod_ho;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);\r
-\r
-       if (osm_switch_get_mcast_fwd_tbl_size(p_sw) == 0) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Multicast not supported by switch 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-               goto Exit;\r
-       }\r
-\r
-       context.mft_context.node_guid = osm_node_get_node_guid(p_node);\r
-       context.mft_context.set_method = FALSE;\r
-\r
-       p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);\r
-       max_block_id_ho = osm_mcast_tbl_get_max_block(p_tbl);\r
-\r
-       if (max_block_id_ho > IB_MCAST_MAX_BLOCK_ID) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3609: "\r
-                       "Out-of-range mcast block size = %u on switch 0x%016"\r
-                       PRIx64 "\n", max_block_id_ho,\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-               goto Exit;\r
-       }\r
-\r
-       max_position = osm_mcast_tbl_get_max_position(p_tbl);\r
-\r
-       CL_ASSERT(max_position <= IB_MCAST_POSITION_MAX);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Max MFT block = %u, Max position = %u\n", max_block_id_ho,\r
-               max_position);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_node, 0);\r
-       p_dr_path = osm_physp_get_dr_path_ptr(p_physp);\r
-\r
-       for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Retrieving MFT block %u\n", block_id_ho);\r
-\r
-               for (position = 0; position <= max_position; position++) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                               "Retrieving MFT position %u\n", position);\r
-\r
-                       attr_mod_ho =\r
-                           block_id_ho | position << IB_MCAST_POSITION_SHIFT;\r
-                       status =\r
-                           osm_req_get(sm, p_dr_path,\r
-                                       IB_MAD_ATTR_MCAST_FWD_TBL,\r
-                                       cl_hton32(attr_mod_ho),\r
-                                       CL_DISP_MSGID_NONE, &context);\r
-                       if (status != IB_SUCCESS)\r
-                               /* continue the loop despite the error */\r
-                               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3607: "\r
-                                       "Failure initiating PortInfo request (%s)\n",\r
-                                       ib_get_err_str(status));\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-#endif\r
-\r
-/**********************************************************************\r
-   Lock must be held on entry to this function.\r
-**********************************************************************/\r
-static void si_rcv_process_new(IN osm_sm_t * sm, IN osm_node_t * p_node,\r
-                              IN const osm_madw_t * p_madw)\r
-{\r
-       osm_switch_t *p_sw;\r
-       osm_switch_t *p_check;\r
-       ib_switch_info_t *p_si;\r
-       ib_smp_t *p_smp;\r
-       cl_qmap_t *p_sw_guid_tbl;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_si = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       osm_dump_switch_info(sm->p_log, p_si, OSM_LOG_DEBUG);\r
-\r
-       p_sw = osm_switch_new(p_node, p_madw);\r
-       if (p_sw == NULL) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3608: "\r
-                       "Unable to allocate new switch object\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* set subnet max mlid to the minimum MulticastFDBCap of all switches */\r
-       if (cl_ntoh16(p_si->mcast_cap) + IB_LID_MCAST_START_HO - 1 <\r
-           sm->p_subn->max_mcast_lid_ho) {\r
-               sm->p_subn->max_mcast_lid_ho = cl_ntoh16(p_si->mcast_cap) +\r
-                       IB_LID_MCAST_START_HO - 1;\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Subnet max multicast lid is 0x%X\n",\r
-                       sm->p_subn->max_mcast_lid_ho);\r
-       }\r
-\r
-       /* set subnet max unicast lid to the minimum LinearFDBCap of all switches */\r
-       if (cl_ntoh16(p_si->lin_cap) < sm->p_subn->max_ucast_lid_ho) {\r
-               sm->p_subn->max_ucast_lid_ho = cl_ntoh16(p_si->lin_cap);\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Subnet max unicast lid is 0x%X\n",\r
-                       sm->p_subn->max_ucast_lid_ho);\r
-       }\r
-\r
-       p_check = (osm_switch_t *) cl_qmap_insert(p_sw_guid_tbl,\r
-                                                 osm_node_get_node_guid\r
-                                                 (p_node), &p_sw->map_item);\r
-       if (p_check != p_sw) {\r
-               /* This shouldn't happen since we hold the lock! */\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3605: "\r
-                       "Unable to add new switch object to database\n");\r
-               osm_switch_delete(&p_sw);\r
-               goto Exit;\r
-       }\r
-\r
-       p_node->sw = p_sw;\r
-\r
-       /* Update the switch info according to the info we just received. */\r
-       osm_switch_set_switch_info(p_sw, p_si);\r
-\r
-#if 0\r
-       /* Don't bother retrieving the current unicast and multicast tables\r
-          from the switches.  The current version of SM does\r
-          not support silent take-over of an existing multicast\r
-          configuration.\r
-\r
-          Gathering the multicast tables can also generate large amounts\r
-          of extra subnet-init traffic.\r
-\r
-          The code to retrieve the tables was fully debugged. */\r
-\r
-       si_rcv_get_fwd_tbl(sm, p_sw);\r
-       if (!sm->p_subn->opt.disable_multicast)\r
-               si_rcv_get_mcast_fwd_tbl(sm, p_sw);\r
-#endif\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-/**********************************************************************\r
-   Lock must be held on entry to this function.\r
-   Return 1 if the caller is expected to send a change_detected event.\r
-   this can not be done internally as the event needs the lock...\r
-**********************************************************************/\r
-static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,\r
-                                        IN osm_node_t * p_node,\r
-                                        IN const osm_madw_t * p_madw)\r
-{\r
-       osm_switch_t *p_sw = p_node->sw;\r
-       ib_switch_info_t *p_si;\r
-       osm_si_context_t *p_si_context;\r
-       ib_smp_t *p_smp;\r
-       boolean_t is_change_detected = FALSE;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_si = ib_smp_get_payload_ptr(p_smp);\r
-       p_si_context = osm_madw_get_si_context_ptr(p_madw);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received logical %cetResp()\n",\r
-               p_si_context->set_method ? 'S' : 'G');\r
-\r
-       osm_switch_set_switch_info(p_sw, p_si);\r
-\r
-       if (p_si_context->light_sweep == TRUE && !p_si_context->set_method) {\r
-               /* If state changed bit is on the mad was returned with an\r
-                  error - signal a change to the state manager. */\r
-               if (ib_smp_get_status(p_smp) != 0) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "GetResp() received with error in light sweep. "\r
-                               "Commencing heavy sweep\n");\r
-                       is_change_detected = TRUE;\r
-               } else if (ib_switch_info_get_state_change(p_si)) {\r
-                       osm_dump_switch_info(sm->p_log, p_si, OSM_LOG_DEBUG);\r
-                       is_change_detected = TRUE;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-       return is_change_detected;\r
-}\r
-\r
-void osm_si_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_switch_info_t *p_si;\r
-       ib_smp_t *p_smp;\r
-       osm_node_t *p_node;\r
-       ib_net64_t node_guid;\r
-       osm_si_context_t *p_context;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_si = ib_smp_get_payload_ptr(p_smp);\r
-       p_context = osm_madw_get_si_context_ptr(p_madw);\r
-       node_guid = p_context->node_guid;\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-               "Switch GUID 0x%016" PRIx64 ", TID 0x%" PRIx64 "\n",\r
-               cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);\r
-\r
-       p_node = osm_get_node_by_guid(sm->p_subn, node_guid);\r
-       if (!p_node) {\r
-               CL_PLOCK_RELEASE(sm->p_lock);\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3606: "\r
-                       "SwitchInfo received for nonexistent node "\r
-                       "with GUID 0x%" PRIx64 "\n", cl_ntoh64(node_guid));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Hack for bad value in Mellanox switch */\r
-       if (cl_ntoh16(p_si->lin_top) > IB_LID_UCAST_END_HO) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3610: "\r
-                       "\n\t\t\t\tBad LinearFDBTop value = 0x%X "\r
-                       "on switch 0x%" PRIx64\r
-                       "\n\t\t\t\tForcing internal correction to 0x%X\n",\r
-                       cl_ntoh16(p_si->lin_top),\r
-                       cl_ntoh64(osm_node_get_node_guid(p_node)), 0);\r
-               p_si->lin_top = 0;\r
-       }\r
-\r
-       /* Acquire the switch object for this switch. */\r
-       if (!p_node->sw) {\r
-               si_rcv_process_new(sm, p_node, p_madw);\r
-               /* A new switch was found during the sweep so we need\r
-                  to ignore the current LFT settings. */\r
-               sm->p_subn->ignore_existing_lfts = TRUE;\r
-       } else if (si_rcv_process_existing(sm, p_node, p_madw))\r
-               /* we might get back a request for signaling change was detected */\r
-               sm->p_subn->force_heavy_sweep = TRUE;\r
-\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_switch.c b/branches/opensm_3/user/opensm/osm_switch.c
deleted file mode 100644 (file)
index 9581c4c..0000000
+++ /dev/null
@@ -1,638 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_switch_t.\r
- * This object represents an Infiniband switch.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_math.h>\r
-#include <iba/ib_types.h>\r
-#include <opensm/osm_switch.h>\r
-\r
-cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho,\r
-                               IN uint8_t port_num, IN uint8_t num_hops)\r
-{\r
-       if (lid_ho > p_sw->max_lid_ho)\r
-               return -1;\r
-       if (!p_sw->hops[lid_ho]) {\r
-               p_sw->hops[lid_ho] = malloc(p_sw->num_ports);\r
-               if (!p_sw->hops[lid_ho])\r
-                       return -1;\r
-               memset(p_sw->hops[lid_ho], OSM_NO_PATH, p_sw->num_ports);\r
-       }\r
-\r
-       p_sw->hops[lid_ho][port_num] = num_hops;\r
-       if (p_sw->hops[lid_ho][0] > num_hops)\r
-               p_sw->hops[lid_ho][0] = num_hops;\r
-\r
-       return 0;\r
-}\r
-\r
-void osm_switch_delete(IN OUT osm_switch_t ** pp_sw)\r
-{\r
-       osm_switch_t *p_sw = *pp_sw;\r
-       unsigned i;\r
-\r
-       osm_mcast_tbl_destroy(&p_sw->mcast_tbl);\r
-       if (p_sw->p_prof)\r
-               free(p_sw->p_prof);\r
-       if (p_sw->dimn_ports)\r
-               free(p_sw->dimn_ports);\r
-       if (p_sw->lft)\r
-               free(p_sw->lft);\r
-       if (p_sw->new_lft)\r
-               free(p_sw->new_lft);\r
-       if (p_sw->hops) {\r
-               for (i = 0; i < p_sw->num_hops; i++)\r
-                       if (p_sw->hops[i])\r
-                               free(p_sw->hops[i]);\r
-               free(p_sw->hops);\r
-       }\r
-       free(*pp_sw);\r
-       *pp_sw = NULL;\r
-}\r
-\r
-osm_switch_t *osm_switch_new(IN osm_node_t * p_node,\r
-                            IN const osm_madw_t * p_madw)\r
-{\r
-       osm_switch_t *p_sw;\r
-       ib_switch_info_t *p_si;\r
-       ib_smp_t *p_smp;\r
-       uint8_t num_ports;\r
-       uint32_t port_num;\r
-\r
-       CL_ASSERT(p_madw);\r
-       CL_ASSERT(p_node);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-       p_si = ib_smp_get_payload_ptr(p_smp);\r
-       num_ports = osm_node_get_num_physp(p_node);\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO);\r
-\r
-       if (!p_si->lin_cap) /* The switch doesn't support LFT */\r
-               return NULL;\r
-\r
-       p_sw = malloc(sizeof(*p_sw));\r
-       if (!p_sw)\r
-               return NULL;\r
-\r
-       memset(p_sw, 0, sizeof(*p_sw));\r
-\r
-       p_sw->p_node = p_node;\r
-       p_sw->switch_info = *p_si;\r
-       p_sw->num_ports = num_ports;\r
-       p_sw->need_update = 2;\r
-\r
-       p_sw->p_prof = malloc(sizeof(*p_sw->p_prof) * num_ports);\r
-       if (!p_sw->p_prof)\r
-               goto err;\r
-\r
-       memset(p_sw->p_prof, 0, sizeof(*p_sw->p_prof) * num_ports);\r
-\r
-       osm_mcast_tbl_init(&p_sw->mcast_tbl, osm_node_get_num_physp(p_node),\r
-                          cl_ntoh16(p_si->mcast_cap));\r
-\r
-       for (port_num = 0; port_num < num_ports; port_num++)\r
-               osm_port_prof_construct(&p_sw->p_prof[port_num]);\r
-\r
-       return p_sw;\r
-\r
-err:\r
-       osm_switch_delete(&p_sw);\r
-       return NULL;\r
-}\r
-\r
-boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,\r
-                                  IN uint16_t block_id, OUT uint8_t * p_block)\r
-{\r
-       uint16_t base_lid_ho = block_id * IB_SMP_DATA_SIZE;\r
-\r
-       CL_ASSERT(p_sw);\r
-       CL_ASSERT(p_block);\r
-\r
-       if (base_lid_ho > p_sw->max_lid_ho)\r
-               return FALSE;\r
-\r
-       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE <= IB_LID_UCAST_END_HO);\r
-       memcpy(p_block, &(p_sw->lft[base_lid_ho]), IB_SMP_DATA_SIZE);\r
-       return TRUE;\r
-}\r
-\r
-static struct osm_remote_node *\r
-switch_find_guid_common(IN const osm_switch_t * p_sw,\r
-                       IN struct osm_remote_guids_count *r,\r
-                       IN uint8_t port_num, IN int find_sys_guid,\r
-                       IN int find_node_guid)\r
-{\r
-       struct osm_remote_node *p_remote_guid = NULL;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_rem_physp;\r
-       osm_node_t *p_rem_node;\r
-       uint64_t sys_guid;\r
-       uint64_t node_guid;\r
-       unsigned int i;\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-       p_rem_physp = osm_physp_get_remote(p_physp);\r
-       p_rem_node = osm_physp_get_node_ptr(p_rem_physp);\r
-       sys_guid = p_rem_node->node_info.sys_guid;\r
-       node_guid = p_rem_node->node_info.node_guid;\r
-\r
-       for (i = 0; i < r->count; i++) {\r
-               if ((!find_sys_guid\r
-                    || r->guids[i].node->node_info.sys_guid == sys_guid)\r
-                   && (!find_node_guid\r
-                       || r->guids[i].node->node_info.node_guid == node_guid)) {\r
-                       p_remote_guid = &r->guids[i];\r
-                       break;\r
-               }\r
-       }\r
-\r
-       return p_remote_guid;\r
-}\r
-\r
-static struct osm_remote_node *\r
-switch_find_sys_guid_count(IN const osm_switch_t * p_sw,\r
-                          IN struct osm_remote_guids_count *r,\r
-                          IN uint8_t port_num)\r
-{\r
-       return switch_find_guid_common(p_sw, r, port_num, 1, 0);\r
-}\r
-\r
-static struct osm_remote_node *\r
-switch_find_node_guid_count(IN const osm_switch_t * p_sw,\r
-                           IN struct osm_remote_guids_count *r,\r
-                           IN uint8_t port_num)\r
-{\r
-       return switch_find_guid_common(p_sw, r, port_num, 0, 1);\r
-}\r
-\r
-uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,\r
-                                 IN osm_port_t * p_port, IN uint16_t lid_ho,\r
-                                 IN unsigned start_from,\r
-                                 IN boolean_t ignore_existing,\r
-                                 IN boolean_t dor)\r
-{\r
-       /*\r
-          We support an enhanced LMC aware routing mode:\r
-          In the case of LMC > 0, we can track the remote side\r
-          system and node for all of the lids of the target\r
-          and try and avoid routing again through the same\r
-          system / node.\r
-\r
-          If this procedure is provided with the tracking array\r
-          and counter we can conduct this algorithm.\r
-        */\r
-       boolean_t routing_for_lmc = (p_port->priv != NULL);\r
-       uint16_t base_lid;\r
-       uint8_t hops;\r
-       uint8_t least_hops;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       uint32_t least_paths = 0xFFFFFFFF;\r
-       unsigned i;\r
-       /*\r
-          The follwing will track the least paths if the\r
-          route should go through a new system/node\r
-        */\r
-       uint32_t least_paths_other_sys = 0xFFFFFFFF;\r
-       uint32_t least_paths_other_nodes = 0xFFFFFFFF;\r
-       uint32_t least_forwarded_to = 0xFFFFFFFF;\r
-       uint32_t check_count;\r
-       uint8_t best_port = 0;\r
-       /*\r
-          These vars track the best port if it connects to\r
-          not used system/node.\r
-        */\r
-       uint8_t best_port_other_sys = 0;\r
-       uint8_t best_port_other_node = 0;\r
-       boolean_t port_found = FALSE;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_rem_physp;\r
-       osm_node_t *p_rem_node;\r
-       osm_node_t *p_rem_node_first = NULL;\r
-       struct osm_remote_node *p_remote_guid = NULL;\r
-       struct osm_remote_node null_remote_node = {NULL, 0, 0};\r
-\r
-       CL_ASSERT(lid_ho > 0);\r
-\r
-       if (p_port->p_node->sw) {\r
-               if (p_port->p_node->sw == p_sw)\r
-                       return 0;\r
-               base_lid = osm_port_get_base_lid(p_port);\r
-       } else {\r
-               p_physp = p_port->p_physp;\r
-               if (!p_physp || !p_physp->p_remote_physp ||\r
-                   !p_physp->p_remote_physp->p_node->sw)\r
-                       return OSM_NO_PATH;\r
-\r
-               if (p_physp->p_remote_physp->p_node->sw == p_sw)\r
-                       return p_physp->p_remote_physp->port_num;\r
-               base_lid =\r
-                   osm_node_get_base_lid(p_physp->p_remote_physp->p_node, 0);\r
-       }\r
-       base_lid = cl_ntoh16(base_lid);\r
-\r
-       num_ports = p_sw->num_ports;\r
-\r
-       least_hops = osm_switch_get_least_hops(p_sw, base_lid);\r
-       if (least_hops == OSM_NO_PATH)\r
-               return OSM_NO_PATH;\r
-\r
-       /*\r
-          First, inquire with the forwarding table for an existing\r
-          route.  If one is found, honor it unless:\r
-          1. the ignore existing flag is set.\r
-          2. the physical port is not a valid one or not healthy\r
-          3. the physical port has a remote port (the link is up)\r
-          4. the port has min-hops to the target (avoid loops)\r
-        */\r
-       if (!ignore_existing) {\r
-               port_num = osm_switch_get_port_by_lid(p_sw, lid_ho);\r
-\r
-               if (port_num != OSM_NO_PATH) {\r
-                       CL_ASSERT(port_num < num_ports);\r
-\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-                       /*\r
-                          Don't be too trusting of the current forwarding table!\r
-                          Verify that the port number is legal and that the\r
-                          LID is reachable through this port.\r
-                        */\r
-                       if (p_physp && osm_physp_is_healthy(p_physp) &&\r
-                           osm_physp_get_remote(p_physp)) {\r
-                               hops =\r
-                                   osm_switch_get_hop_count(p_sw, base_lid,\r
-                                                            port_num);\r
-                               /*\r
-                                  If we aren't using pre-defined user routes\r
-                                  function, then we need to make sure that the\r
-                                  current path is the minimum one. In case of\r
-                                  having such a user function - this check will\r
-                                  not be done, and the old routing will be used.\r
-                                  Note: This means that it is the user's job to\r
-                                  clean all data in the forwarding tables that\r
-                                  he wants to be overridden by the minimum\r
-                                  hop function.\r
-                                */\r
-                               if (hops == least_hops)\r
-                                       return port_num;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-          This algorithm selects a port based on a static load balanced\r
-          selection across equal hop-count ports.\r
-          There is lots of room for improved sophistication here,\r
-          possibly guided by user configuration info.\r
-        */\r
-\r
-       /*\r
-          OpenSM routing is "local" - not considering a full lid to lid\r
-          path. As such we can not guarantee a path will not loop if we\r
-          do not always follow least hops.\r
-          So we must abort if not least hops.\r
-        */\r
-\r
-       /* port number starts with one and num_ports is 1 + num phys ports */\r
-       for (i = start_from; i < start_from + num_ports; i++) {\r
-               port_num = osm_switch_get_dimn_port(p_sw, i % num_ports);\r
-               if (!port_num ||\r
-                   osm_switch_get_hop_count(p_sw, base_lid, port_num) !=\r
-                   least_hops)\r
-                       continue;\r
-\r
-               /* let us make sure it is not down or unhealthy */\r
-               p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-               if (!p_physp || !osm_physp_is_healthy(p_physp) ||\r
-                   /*\r
-                      we require all - non sma ports to be linked\r
-                      to be routed through\r
-                    */\r
-                   !osm_physp_get_remote(p_physp))\r
-                       continue;\r
-\r
-               /*\r
-                  We located a least-hop port, possibly one of many.\r
-                  For this port, check the running total count of\r
-                  the number of paths through this port.  Select\r
-                  the port routing the least number of paths.\r
-                */\r
-               check_count =\r
-                   osm_port_prof_path_count_get(&p_sw->p_prof[port_num]);\r
-\r
-               if (dor) {\r
-                       /* Get the Remote Node */\r
-                       p_rem_physp = osm_physp_get_remote(p_physp);\r
-                       p_rem_node = osm_physp_get_node_ptr(p_rem_physp);\r
-                       /* use the first dimension, but spread traffic\r
-                        * out among the group of ports representing\r
-                        * that dimension */\r
-                       if (!p_rem_node_first)\r
-                               p_rem_node_first = p_rem_node;\r
-                       else if (p_rem_node != p_rem_node_first)\r
-                               continue;\r
-                       if (routing_for_lmc) {\r
-                               struct osm_remote_guids_count *r = p_port->priv;\r
-                               uint8_t rem_port = osm_physp_get_port_num(p_rem_physp);\r
-                               unsigned int j;\r
-\r
-                               for (j = 0; j < r->count; j++) {\r
-                                       p_remote_guid = &r->guids[j];\r
-                                       if ((p_remote_guid->node == p_rem_node)\r
-                                           && (p_remote_guid->port == rem_port))\r
-                                               break;\r
-                               }\r
-                               if (j == r->count)\r
-                                       p_remote_guid = &null_remote_node;\r
-                       }\r
-               /*\r
-                  Advanced LMC routing requires tracking of the\r
-                  best port by the node connected to the other side of\r
-                  it.\r
-                */\r
-               } else if (routing_for_lmc) {\r
-                       /* Is the sys guid already used ? */\r
-                       p_remote_guid = switch_find_sys_guid_count(p_sw,\r
-                                                                  p_port->priv,\r
-                                                                  port_num);\r
-\r
-                       /* If not update the least hops for this case */\r
-                       if (!p_remote_guid) {\r
-                               if (check_count < least_paths_other_sys) {\r
-                                       least_paths_other_sys = check_count;\r
-                                       best_port_other_sys = port_num;\r
-                                       least_forwarded_to = 0;\r
-                               }\r
-                       } else {        /* same sys found - try node */\r
-                               /* Else is the node guid already used ? */\r
-                               p_remote_guid = switch_find_node_guid_count(p_sw,\r
-                                                                           p_port->priv,\r
-                                                                           port_num);\r
-\r
-                               /* If not update the least hops for this case */\r
-                               if (!p_remote_guid\r
-                                   && check_count < least_paths_other_nodes) {\r
-                                       least_paths_other_nodes = check_count;\r
-                                       best_port_other_node = port_num;\r
-                                       least_forwarded_to = 0;\r
-                               }\r
-                               /* else prior sys and node guid already used */\r
-\r
-                       }       /* same sys found */\r
-               }\r
-\r
-               /* routing for LMC mode */\r
-               /*\r
-                  the count is min but also lower then the max subscribed\r
-                */\r
-               if (check_count < least_paths) {\r
-                       port_found = TRUE;\r
-                       best_port = port_num;\r
-                       least_paths = check_count;\r
-                       if (routing_for_lmc\r
-                           && p_remote_guid\r
-                           && p_remote_guid->forwarded_to < least_forwarded_to)\r
-                               least_forwarded_to = p_remote_guid->forwarded_to;\r
-               } else if (routing_for_lmc\r
-                          && p_remote_guid\r
-                          && check_count == least_paths\r
-                          && p_remote_guid->forwarded_to < least_forwarded_to) {\r
-                       least_forwarded_to = p_remote_guid->forwarded_to;\r
-                       best_port = port_num;\r
-               }\r
-       }\r
-\r
-       if (port_found == FALSE)\r
-               return OSM_NO_PATH;\r
-\r
-       /*\r
-          if we are in enhanced routing mode and the best port is not\r
-          the local port 0\r
-        */\r
-       if (routing_for_lmc && best_port) {\r
-               /* Select the least hop port of the non used sys first */\r
-               if (best_port_other_sys)\r
-                       best_port = best_port_other_sys;\r
-               else if (best_port_other_node)\r
-                       best_port = best_port_other_node;\r
-       }\r
-\r
-       return best_port;\r
-}\r
-\r
-void osm_switch_clear_hops(IN osm_switch_t * p_sw)\r
-{\r
-       unsigned i;\r
-\r
-       for (i = 0; i < p_sw->num_hops; i++)\r
-               if (p_sw->hops[i])\r
-                       memset(p_sw->hops[i], OSM_NO_PATH, p_sw->num_ports);\r
-}\r
-\r
-static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids)\r
-{\r
-       uint16_t lft_size;\r
-\r
-       /* Ensure LFT is in units of LFT block size */\r
-       lft_size = (lids / IB_SMP_DATA_SIZE + 1) * IB_SMP_DATA_SIZE;\r
-       if (lft_size > p_sw->lft_size) {\r
-               uint8_t *new_lft = realloc(p_sw->lft, lft_size);\r
-               if (!new_lft)\r
-                       return -1;\r
-               memset(new_lft + p_sw->lft_size, OSM_NO_PATH,\r
-                      lft_size - p_sw->lft_size);\r
-               p_sw->lft = new_lft;\r
-               p_sw->lft_size = lft_size;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids)\r
-{\r
-       uint8_t **hops;\r
-       unsigned i;\r
-\r
-       if (alloc_lft(p_sw, max_lids))\r
-               return -1;\r
-\r
-       for (i = 0; i < p_sw->num_ports; i++)\r
-               osm_port_prof_construct(&p_sw->p_prof[i]);\r
-\r
-       osm_switch_clear_hops(p_sw);\r
-\r
-       if (!(p_sw->new_lft = realloc(p_sw->new_lft, p_sw->lft_size)))\r
-               return -1;\r
-\r
-       memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);\r
-\r
-       if (!p_sw->hops) {\r
-               hops = malloc((max_lids + 1) * sizeof(hops[0]));\r
-               if (!hops)\r
-                       return -1;\r
-               memset(hops, 0, (max_lids + 1) * sizeof(hops[0]));\r
-               p_sw->hops = hops;\r
-               p_sw->num_hops = max_lids + 1;\r
-       } else if (max_lids + 1 > p_sw->num_hops) {\r
-               hops = realloc(p_sw->hops, (max_lids + 1) * sizeof(hops[0]));\r
-               if (!hops)\r
-                       return -1;\r
-               memset(hops + p_sw->num_hops, 0,\r
-                      (max_lids + 1 - p_sw->num_hops) * sizeof(hops[0]));\r
-               p_sw->hops = hops;\r
-               p_sw->num_hops = max_lids + 1;\r
-       }\r
-       p_sw->max_lid_ho = max_lids;\r
-\r
-       return 0;\r
-}\r
-\r
-uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,\r
-                                      IN const osm_port_t * p_port)\r
-{\r
-       uint16_t lid;\r
-\r
-       if (p_port->p_node->sw) {\r
-               if (p_port->p_node->sw == p_sw)\r
-                       return 0;\r
-               lid = osm_node_get_base_lid(p_port->p_node, 0);\r
-               return osm_switch_get_least_hops(p_sw, cl_ntoh16(lid));\r
-       } else {\r
-               osm_physp_t *p = p_port->p_physp;\r
-               uint8_t hops;\r
-\r
-               if (!p || !p->p_remote_physp || !p->p_remote_physp->p_node->sw)\r
-                       return OSM_NO_PATH;\r
-               if (p->p_remote_physp->p_node->sw == p_sw)\r
-                       return 1;\r
-               lid = osm_node_get_base_lid(p->p_remote_physp->p_node, 0);\r
-               hops = osm_switch_get_least_hops(p_sw, cl_ntoh16(lid));\r
-               return hops != OSM_NO_PATH ? hops + 1 : OSM_NO_PATH;\r
-       }\r
-}\r
-\r
-uint8_t osm_switch_recommend_mcast_path(IN osm_switch_t * p_sw,\r
-                                       IN osm_port_t * p_port,\r
-                                       IN uint16_t mlid_ho,\r
-                                       IN boolean_t ignore_existing)\r
-{\r
-       uint16_t base_lid;\r
-       uint8_t hops;\r
-       uint8_t port_num;\r
-       uint8_t num_ports;\r
-       uint8_t least_hops;\r
-\r
-       CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO);\r
-\r
-       if (p_port->p_node->sw) {\r
-               if (p_port->p_node->sw == p_sw)\r
-                       return 0;\r
-               base_lid = osm_port_get_base_lid(p_port);\r
-       } else {\r
-               osm_physp_t *p_physp = p_port->p_physp;\r
-               if (!p_physp || !p_physp->p_remote_physp ||\r
-                   !p_physp->p_remote_physp->p_node->sw)\r
-                       return OSM_NO_PATH;\r
-               if (p_physp->p_remote_physp->p_node->sw == p_sw)\r
-                       return p_physp->p_remote_physp->port_num;\r
-               base_lid =\r
-                   osm_node_get_base_lid(p_physp->p_remote_physp->p_node, 0);\r
-       }\r
-       base_lid = cl_ntoh16(base_lid);\r
-       num_ports = p_sw->num_ports;\r
-\r
-       /*\r
-          If the user wants us to ignore existing multicast routes,\r
-          then simply return the shortest hop count path to the\r
-          target port.\r
-\r
-          Otherwise, return the first port that has a path to the target,\r
-          picking from the ports that are already in the multicast group.\r
-        */\r
-       if (!ignore_existing) {\r
-               for (port_num = 1; port_num < num_ports; port_num++) {\r
-                       if (!osm_mcast_tbl_is_port\r
-                           (&p_sw->mcast_tbl, mlid_ho, port_num))\r
-                               continue;\r
-                       /*\r
-                          Don't be too trusting of the current forwarding table!\r
-                          Verify that the LID is reachable through this port.\r
-                        */\r
-                       hops =\r
-                           osm_switch_get_hop_count(p_sw, base_lid, port_num);\r
-                       if (hops != OSM_NO_PATH)\r
-                               return port_num;\r
-               }\r
-       }\r
-\r
-       /*\r
-          Either no existing mcast paths reach this port or we are\r
-          ignoring existing paths.\r
-\r
-          Determine the best multicast path to the target.  Note that this\r
-          algorithm is slightly different from the one used for unicast route\r
-          recommendation.  In this case (multicast), we must NOT\r
-          perform any sort of load balancing.  We MUST take the FIRST\r
-          port found that has <= the lowest hop count path.  This prevents\r
-          more than one multicast path to the same remote switch which\r
-          prevents a multicast loop.  Multicast loops are bad since the same\r
-          multicast packet will go around and around, inevitably creating\r
-          a black hole that will destroy the Earth in a firey conflagration.\r
-        */\r
-       least_hops = osm_switch_get_least_hops(p_sw, base_lid);\r
-       for (port_num = 1; port_num < num_ports; port_num++)\r
-               if (osm_switch_get_hop_count(p_sw, base_lid, port_num) ==\r
-                   least_hops)\r
-                       break;\r
-\r
-       CL_ASSERT(port_num < num_ports);\r
-       return port_num;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_trap_rcv.c b/branches/opensm_3/user/opensm/osm_trap_rcv.c
deleted file mode 100644 (file)
index 3a78e37..0000000
+++ /dev/null
@@ -1,622 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_trap_rcv_t.\r
- * This object represents the Trap Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_inform.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp);\r
-\r
-/**********************************************************************\r
- *\r
- * TRAP HANDLING:\r
- *\r
- * Assuming traps can be caused by bad hardware we should provide\r
- * a mechanism for filtering their propagation into the actual logic\r
- * of OpenSM such that it is not overloaded by them.\r
- *\r
- * We will provide a trap filtering mechanism with "Aging" capability.\r
- * This mechanism will track incoming traps, clasify them by their\r
- * source and content and provide back their age.\r
- *\r
- * A timer running in the background will toggle a timer counter\r
- * that should be referenced by the aging algorithm.\r
- * To provide an efficient handling of aging, we also track all traps\r
- * in a sorted list by their aging.\r
- *\r
- * The generic Aging Tracker mechanism is implemented in the\r
- * cl_aging_tracker object.\r
- *\r
- **********************************************************************/\r
-\r
-static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,\r
-                                            IN ib_net16_t lid, IN uint8_t num)\r
-{\r
-       osm_port_t *p_port = osm_get_port_by_lid(sm->p_subn, lid);\r
-       if (!p_port)\r
-               return NULL;\r
-\r
-       if (osm_node_get_num_physp(p_port->p_node) < num)\r
-               return NULL;\r
-\r
-       return osm_node_get_physp_ptr(p_port->p_node, num);\r
-}\r
-\r
-static uint64_t aging_tracker_callback(IN uint64_t key, IN uint32_t num_regs,\r
-                                      IN void *context)\r
-{\r
-       osm_sm_t *sm = context;\r
-       ib_net16_t lid;\r
-       uint8_t port_num;\r
-       osm_physp_t *p_physp;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       if (osm_exit_flag)\r
-               /* We got an exit flag - do nothing */\r
-               return 0;\r
-\r
-       lid = (ib_net16_t) ((key & 0x0000FFFF00000000ULL) >> 32);\r
-       port_num = (uint8_t) ((key & 0x00FF000000000000ULL) >> 48);\r
-\r
-       p_physp = get_physp_by_lid_and_num(sm, lid, port_num);\r
-       if (!p_physp)\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Cannot find port num:%u with lid:%u\n",\r
-                       port_num, cl_ntoh16(lid));\r
-       /* make sure the physp is still valid */\r
-       /* If the health port was false - set it to true */\r
-       else if (!osm_physp_is_healthy(p_physp)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Clearing health bit of port num:%u with lid:%u\n",\r
-                       port_num, cl_ntoh16(lid));\r
-\r
-               /* Clear its health bit */\r
-               osm_physp_set_health(p_physp, TRUE);\r
-       }\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-\r
-       /* We want to remove the event from the tracker - so\r
-          need to return zero. */\r
-       return 0;\r
-}\r
-\r
-/**********************************************************************\r
- * CRC calculation for notice identification\r
- **********************************************************************/\r
-\r
-#define CRC32_POLYNOMIAL   0xEDB88320L\r
-\r
-/* calculate the crc for a given buffer */\r
-static uint32_t trap_calc_crc32(void *buffer, uint32_t count)\r
-{\r
-       uint32_t temp1, temp2;\r
-       uint32_t crc = -1L;\r
-       unsigned char *p = (unsigned char *)buffer;\r
-       /* precalculated table for faster crc calculation */\r
-       static uint32_t crc_table[256];\r
-       static boolean_t first = TRUE;\r
-       int i, j;\r
-\r
-       /* if we need to initialize the lookup table */\r
-       if (first) {\r
-               /* calc the CRC table */\r
-               for (i = 0; i <= 255; i++) {\r
-                       crc = i;\r
-                       for (j = 8; j > 0; j--)\r
-                               if (crc & 1)\r
-                                       crc = (crc >> 1) ^ CRC32_POLYNOMIAL;\r
-                               else\r
-                                       crc >>= 1;\r
-                       crc_table[i] = crc;\r
-               }\r
-               first = FALSE;\r
-       }\r
-\r
-       crc = -1L;\r
-       /* do the calculation */\r
-       while (count-- != 0) {\r
-               temp1 = (crc >> 8) & 0x00FFFFFFL;\r
-               temp2 = crc_table[((int)crc ^ *p++) & 0xFF];\r
-               crc = temp1 ^ temp2;\r
-       }\r
-       return crc;\r
-}\r
-\r
-/* The key is created in the following manner:\r
-   port_num  lid   crc\r
-   \______/ \___/ \___/\r
-     16b     16b   32b\r
-*/\r
-static uint64_t trap_get_key(IN uint16_t lid, IN uint8_t port_num,\r
-                            IN ib_mad_notice_attr_t * p_ntci)\r
-{\r
-       uint32_t crc = trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t));\r
-       return ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc;\r
-}\r
-\r
-static int print_num_received(IN uint32_t num_received)\r
-{\r
-       uint32_t i;\r
-\r
-       /* Series is 10, 20, 50, 100, 200, 500, ... */\r
-       i = num_received;\r
-       while (i >= 10) {\r
-               if (i % 10)\r
-                       break;\r
-               i = i / 10;\r
-       }\r
-\r
-       if (i == 1 || i == 2 || i == 5)\r
-               return 1;\r
-       else\r
-               return 0;\r
-}\r
-\r
-static int disable_port(osm_sm_t *sm, osm_physp_t *p)\r
-{\r
-       uint8_t payload[IB_SMP_DATA_SIZE];\r
-       osm_madw_context_t context;\r
-       ib_port_info_t *pi = (ib_port_info_t *)payload;\r
-\r
-       /* select the nearest port to master opensm */\r
-       if (p->p_remote_physp &&\r
-           p->dr_path.hop_count > p->p_remote_physp->dr_path.hop_count)\r
-               p = p->p_remote_physp;\r
-\r
-       /* If trap 131, might want to disable peer port if available */\r
-       /* but peer port has been observed not to respond to SM requests */\r
-\r
-       memcpy(payload, &p->port_info, sizeof(ib_port_info_t));\r
-\r
-       /* Set port to disabled/down */\r
-       ib_port_info_set_port_state(pi, IB_LINK_DOWN);\r
-       ib_port_info_set_port_phys_state(IB_PORT_PHYS_STATE_DISABLED, pi);\r
-\r
-       /* Issue set of PortInfo */\r
-       context.pi_context.node_guid = osm_node_get_node_guid(p->p_node);\r
-       context.pi_context.port_guid = osm_physp_get_port_guid(p);\r
-       context.pi_context.set_method = TRUE;\r
-       context.pi_context.light_sweep = FALSE;\r
-       context.pi_context.active_transition = FALSE;\r
-\r
-       return osm_req_set(sm, osm_physp_get_dr_path_ptr(p),\r
-                          payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,\r
-                          cl_hton32(osm_physp_get_port_num(p)),\r
-                          CL_DISP_MSGID_NONE, &context);\r
-}\r
-\r
-static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci,\r
-                         ib_net16_t source_lid, ib_net64_t trans_id)\r
-{\r
-       if (!osm_log_is_active(p_log, OSM_LOG_ERROR))\r
-               return;\r
-\r
-       if (ib_notice_is_generic(p_ntci)) {\r
-               char str[32];\r
-\r
-               if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) ||\r
-                   (p_ntci->g_or_v.generic.trap_num == CL_HTON16(130)) ||\r
-                   (p_ntci->g_or_v.generic.trap_num == CL_HTON16(131)))\r
-                       snprintf(str, sizeof(str), " Port %u",\r
-                                p_ntci->data_details.ntc_129_131.port_num);\r
-               else\r
-                       str[0] = '\0';\r
-\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Received Generic Notice type:%u "\r
-                       "num:%u (%s) Producer:%u (%s) "\r
-                       "from LID:%u%s TID:0x%016" PRIx64 "\n",\r
-                       ib_notice_get_type(p_ntci),\r
-                       cl_ntoh16(p_ntci->g_or_v.generic.trap_num),\r
-                       ib_get_trap_str(p_ntci->g_or_v.generic.trap_num),\r
-                       cl_ntoh32(ib_notice_get_prod_type(p_ntci)),\r
-                       ib_get_producer_type_str(ib_notice_get_prod_type(p_ntci)),\r
-                       cl_hton16(source_lid), str, cl_ntoh64(trans_id));\r
-       } else\r
-               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                       "Received Vendor Notice type:%u vend:0x%06X "\r
-                       "dev:%u from LID:%u TID:0x%016" PRIx64 "\n",\r
-                       ib_notice_get_type(p_ntci),\r
-                       cl_ntoh32(ib_notice_get_vend_id(p_ntci)),\r
-                       cl_ntoh16(p_ntci->g_or_v.vend.dev_id),\r
-                       cl_ntoh16(source_lid), cl_ntoh64(trans_id));\r
-}\r
-\r
-static int shutup_noisy_port(osm_sm_t *sm, ib_net16_t lid, uint8_t port,\r
-                            unsigned num)\r
-{\r
-       osm_physp_t *p = get_physp_by_lid_and_num(sm, lid, port);\r
-       if (!p) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3805: "\r
-                       "Failed to find physical port by lid:%u num:%u\n",\r
-                       cl_ntoh16(lid), port);\r
-               return -1;\r
-       }\r
-\r
-       /* When babbling port policy option is enabled and\r
-          Threshold for disabling a "babbling" port is exceeded */\r
-       if (sm->p_subn->opt.babbling_port_policy && num >= 250) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Disabling noisy physical port 0x%016" PRIx64\r
-                       ": lid %u, num %u\n",\r
-                       cl_ntoh64(osm_physp_get_port_guid(p)),\r
-                       cl_ntoh16(lid), port);\r
-               if (disable_port(sm, p))\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: "\r
-                               "Failed to disable.\n");\r
-               else\r
-                       return 1;\r
-       }\r
-\r
-       /* check if the current state of the p_physp is healthy. If\r
-          it is - then this is a first change of state. Run a heavy sweep. */\r
-       if (osm_physp_is_healthy(p)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Marking unhealthy physical port by lid:%u num:%u\n",\r
-                       cl_ntoh16(lid), port);\r
-               osm_physp_set_health(p, FALSE);\r
-               return 2;\r
-       }\r
-       return 0;\r
-}\r
-\r
-static void trap_rcv_process_request(IN osm_sm_t * sm,\r
-                                    IN const osm_madw_t * p_madw)\r
-{\r
-       uint8_t payload[sizeof(ib_mad_notice_attr_t)];\r
-       ib_smp_t *p_smp;\r
-       ib_mad_notice_attr_t *p_ntci = (ib_mad_notice_attr_t *) payload;\r
-       ib_api_status_t status;\r
-       osm_madw_t tmp_madw;    /* we need a copy to last after repress */\r
-       uint64_t trap_key;\r
-       uint32_t num_received;\r
-       osm_physp_t *p_physp;\r
-       osm_port_t *p_port;\r
-       ib_net16_t source_lid = 0;\r
-       boolean_t is_gsi = TRUE;\r
-       uint8_t port_num = 0;\r
-       boolean_t physp_change_trap = FALSE;\r
-       uint64_t event_wheel_timeout = OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT;\r
-       boolean_t run_heavy_sweep = FALSE;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       if (osm_exit_flag)\r
-               /*\r
-                  We got an exit flag - do nothing\r
-                  Otherwise we start a sweep on the trap 144 caused by\r
-                  cleaning up SM Cap bit...\r
-                */\r
-               goto Exit;\r
-\r
-       /* update the is_gsi flag according to the mgmt_class field */\r
-       if (p_madw->p_mad->mgmt_class == IB_MCLASS_SUBN_LID ||\r
-           p_madw->p_mad->mgmt_class == IB_MCLASS_SUBN_DIR)\r
-               is_gsi = FALSE;\r
-\r
-       /* No real need to grab the lock for this function. */\r
-       memset(payload, 0, sizeof(payload));\r
-       memset(&tmp_madw, 0, sizeof(tmp_madw));\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       if (p_smp->method != IB_MAD_METHOD_TRAP) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3801: "\r
-                       "Unsupported method 0x%X\n", p_smp->method);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * The NOTICE Attribute is part of the SMP CLASS attributes\r
-        * As such the actual attribute data resides inside the SMP\r
-        * payload.\r
-        */\r
-\r
-       memcpy(payload, &p_smp->data, IB_SMP_DATA_SIZE);\r
-       memcpy(&tmp_madw, p_madw, sizeof(tmp_madw));\r
-\r
-       if (is_gsi == FALSE) {\r
-               /* We are in smi flow */\r
-               /*\r
-                * When we receive a TRAP with dlid = 0 - it means it\r
-                * came from our own node. So we need to fix it.\r
-                */\r
-\r
-               if (p_madw->mad_addr.addr_type.smi.source_lid == 0) {\r
-                       /* Check if the sm_base_lid is 0. If yes - this means\r
-                          that the local lid wasn't configured yet. Don't send\r
-                          a response to the trap. */\r
-                       if (sm->p_subn->sm_base_lid == 0) {\r
-                               OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                                       "Received SLID=0 Trap with local LID=0. Ignoring MAD\n");\r
-                               goto Exit;\r
-                       }\r
-                       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                               "Received SLID=0 Trap. Using local LID:%u instead\n",\r
-                               cl_ntoh16(sm->p_subn->sm_base_lid));\r
-                       tmp_madw.mad_addr.addr_type.smi.source_lid =\r
-                           sm->p_subn->sm_base_lid;\r
-               }\r
-\r
-               source_lid = tmp_madw.mad_addr.addr_type.smi.source_lid;\r
-\r
-               /* Print some info about the incoming Trap */\r
-               log_trap_info(sm->p_log, p_ntci, source_lid, p_smp->trans_id);\r
-       }\r
-\r
-       osm_dump_notice(sm->p_log, p_ntci, OSM_LOG_VERBOSE);\r
-\r
-       p_physp = osm_get_physp_by_mad_addr(sm->p_log, sm->p_subn,\r
-                                           &tmp_madw.mad_addr);\r
-       if (p_physp)\r
-               p_smp->m_key = p_physp->port_info.m_key;\r
-       else\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3809: "\r
-                       "Failed to find source physical port for trap\n");\r
-\r
-       status = osm_resp_send(sm, &tmp_madw, 0, payload);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3802: "\r
-                       "Error sending response (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * We would like to filter out recurring Traps so we track them by\r
-        * their source lid and content. If the same trap was already\r
-        * received within the aging time window more than 10 times,\r
-        * we simply ignore it. This is done only if we are in smi mode\r
-        */\r
-\r
-       if (is_gsi == FALSE) {\r
-               if (ib_notice_is_generic(p_ntci) &&\r
-                   (p_ntci->g_or_v.generic.trap_num == CL_HTON16(129) ||\r
-                    p_ntci->g_or_v.generic.trap_num == CL_HTON16(130) ||\r
-                    p_ntci->g_or_v.generic.trap_num == CL_HTON16(131))) {\r
-                       /* If this is a trap 129, 130, or 131 - then this is a\r
-                        * trap signaling a change on a physical port.\r
-                        * Mark the physp_change_trap flag as TRUE.\r
-                        */\r
-                       physp_change_trap = TRUE;\r
-                       /* The source_lid should be based on the source_lid from the trap */\r
-                       source_lid = p_ntci->data_details.ntc_129_131.lid;\r
-                       port_num = p_ntci->data_details.ntc_129_131.port_num;\r
-               }\r
-\r
-               /* try to find it in the aging tracker */\r
-               trap_key = trap_get_key(source_lid, port_num, p_ntci);\r
-               num_received = cl_event_wheel_num_regs(&sm->trap_aging_tracker,\r
-                                                      trap_key);\r
-\r
-               /* Now we know how many times it provided this trap */\r
-               if (num_received > 10) {\r
-                       if (print_num_received(num_received))\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Received trap %u times consecutively\n",\r
-                                       num_received);\r
-                       /*\r
-                        * If the trap provides info about a bad port\r
-                        * we mark it as unhealthy.\r
-                        */\r
-                       if (physp_change_trap == TRUE) {\r
-                               int ret = shutup_noisy_port(sm, source_lid,\r
-                                                           port_num,\r
-                                                           num_received);\r
-                               if (ret == 1) /* port disabled */\r
-                                       goto Exit;\r
-                               else if (ret == 2) /* unhealthy - run sweep */\r
-                                       run_heavy_sweep = TRUE;\r
-                               /* in any case increase timeout interval */\r
-                               event_wheel_timeout =\r
-                                   OSM_DEFAULT_UNHEALTHY_TIMEOUT;\r
-                       }\r
-               }\r
-\r
-               /* restart the aging anyway */\r
-               /* If physp_change_trap is TRUE - then use a callback to unset\r
-                  the healthy bit. If not - no need to use a callback. */\r
-               if (physp_change_trap == TRUE)\r
-                       cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key,\r
-                                          cl_get_time_stamp() + event_wheel_timeout,\r
-                                          aging_tracker_callback, sm);\r
-               else\r
-                       cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key,\r
-                                          cl_get_time_stamp() + event_wheel_timeout,\r
-                                          NULL, NULL);\r
-\r
-               /* If was already registered do nothing more */\r
-               if (num_received > 10 && run_heavy_sweep == FALSE) {\r
-                       if (print_num_received(num_received))\r
-                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                       "Ignoring noisy traps.\n");\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* Check for node description update. IB Spec v1.2.1 pg 823 */\r
-       if (!ib_notice_is_generic(p_ntci))\r
-               goto check_sweep;\r
-       if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 &&\r
-           p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES &&\r
-           p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node description update\n");\r
-\r
-               if (p_physp) {\r
-                       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-                       osm_req_get_node_desc(sm, p_physp);\r
-                       CL_PLOCK_RELEASE(sm->p_lock);\r
-               } else\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                               "ERR 3812: No physical port found for "\r
-                               "trap 144: \"node description update\"\n");\r
-               goto check_sweep;\r
-       } else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145)\r
-               /* this assumes that trap 145 content is not broken? */\r
-               p_physp->p_node->node_info.sys_guid =\r
-                       p_ntci->data_details.ntc_145.new_sys_guid;\r
-\r
-check_sweep:\r
-       /* do a sweep if we received a trap */\r
-       if (sm->p_subn->opt.sweep_on_trap) {\r
-               /* if this is trap number 128 or run_heavy_sweep is TRUE -\r
-                  update the force_heavy_sweep flag of the subnet.\r
-                  Sweep also on traps 144 - these traps signal a change of\r
-                  certain port capabilities.\r
-                  TODO: In the future this can be changed to just getting\r
-                  PortInfo on this port instead of sweeping the entire subnet. */\r
-               if (ib_notice_is_generic(p_ntci) &&\r
-                   (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 ||\r
-                    cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 ||\r
-                    run_heavy_sweep)) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Forcing heavy sweep. Received trap:%u\n",\r
-                               cl_ntoh16(p_ntci->g_or_v.generic.trap_num));\r
-\r
-                       sm->p_subn->force_heavy_sweep = TRUE;\r
-               }\r
-               osm_sm_signal(sm, OSM_SIGNAL_SWEEP);\r
-       }\r
-\r
-       /* If we reached here due to trap 129/130/131 - do not need to do\r
-          the notice report. Just goto exit. We know this is the case\r
-          if physp_change_trap is TRUE. */\r
-       if (physp_change_trap == TRUE)\r
-               goto Exit;\r
-\r
-       /* Add a call to osm_report_notice */\r
-       /* We are going to report the notice - so need to fix the IssuerGID\r
-          accordingly. See IBA 1.2 p.739 or IBA 1.1 p.653 for details. */\r
-       if (is_gsi) {\r
-               if (!tmp_madw.mad_addr.addr_type.gsi.global_route) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3806: "\r
-                               "Received gsi trap with global_route FALSE. "\r
-                               "Cannot update issuer_gid!\n");\r
-                       goto Exit;\r
-               }\r
-               memcpy(&p_ntci->issuer_gid,\r
-                      &tmp_madw.mad_addr.addr_type.gsi.grh_info.src_gid,\r
-                      sizeof(ib_gid_t));\r
-       } else {\r
-               /* Need to use the IssuerLID */\r
-               p_port = osm_get_port_by_lid(sm->p_subn, source_lid);\r
-               if (!p_port) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "Cannot find port corresponding to lid:%u\n",\r
-                               cl_ntoh16(source_lid));\r
-\r
-                       goto Exit;\r
-               }\r
-\r
-               p_ntci->issuer_gid.unicast.prefix =\r
-                   sm->p_subn->opt.subnet_prefix;\r
-               p_ntci->issuer_gid.unicast.interface_id = p_port->guid;\r
-       }\r
-\r
-       /* we need a lock here as the InformInfo DB must be stable */\r
-       CL_PLOCK_ACQUIRE(sm->p_lock);\r
-       status = osm_report_notice(sm->p_log, sm->p_subn, p_ntci);\r
-       CL_PLOCK_RELEASE(sm->p_lock);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3803: "\r
-                       "Error sending trap reports (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-static void trap_rcv_process_response(IN osm_sm_t * sm,\r
-                                     IN const osm_madw_t * p_madw)\r
-{\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3808: "\r
-               "This function is not supported yet\n");\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
-\r
-void osm_trap_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_smp_t *p_smp;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       /*\r
-          Determine if this is a request for our own Trap\r
-          or if this is a response to our request for another\r
-          SM's Trap.\r
-        */\r
-       if (ib_smp_is_response(p_smp))\r
-               trap_rcv_process_response(sm, p_madw);\r
-       else\r
-               trap_rcv_process_request(sm, p_madw);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_cache.c b/branches/opensm_3/user/opensm/osm_ucast_cache.c
deleted file mode 100644 (file)
index c84e066..0000000
+++ /dev/null
@@ -1,1028 +0,0 @@
-/*\r
- * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008-2009 Mellanox Technologies LTD. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of OpenSM Cached Unicast Routing\r
- *\r
- * Environment:\r
- *    Linux User Mode\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_pool.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-#include <opensm/osm_ucast_cache.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_port.h>\r
-\r
-typedef struct cache_port {\r
-       boolean_t is_leaf;\r
-       uint16_t remote_lid_ho;\r
-} cache_port_t;\r
-\r
-typedef struct cache_switch {\r
-       cl_map_item_t map_item;\r
-       boolean_t dropped;\r
-       uint16_t max_lid_ho;\r
-       uint16_t num_hops;\r
-       uint8_t **hops;\r
-       uint8_t *lft;\r
-       uint8_t num_ports;\r
-       cache_port_t ports[0];\r
-} cache_switch_t;\r
-\r
-static uint16_t cache_sw_get_base_lid_ho(cache_switch_t * p_sw)\r
-{\r
-       return p_sw->ports[0].remote_lid_ho;\r
-}\r
-\r
-static boolean_t cache_sw_is_leaf(cache_switch_t * p_sw)\r
-{\r
-       return p_sw->ports[0].is_leaf;\r
-}\r
-\r
-static void cache_sw_set_leaf(cache_switch_t * p_sw)\r
-{\r
-       p_sw->ports[0].is_leaf = TRUE;\r
-}\r
-\r
-static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports)\r
-{\r
-       cache_switch_t *p_cache_sw = malloc(sizeof(cache_switch_t) +\r
-                                           num_ports * sizeof(cache_port_t));\r
-       if (!p_cache_sw)\r
-               return NULL;\r
-\r
-       memset(p_cache_sw, 0,\r
-              sizeof(*p_cache_sw) + num_ports * sizeof(cache_port_t));\r
-\r
-       p_cache_sw->num_ports = num_ports;\r
-\r
-       /* port[0] fields represent this switch details - lid and type */\r
-       p_cache_sw->ports[0].remote_lid_ho = lid_ho;\r
-       p_cache_sw->ports[0].is_leaf = FALSE;\r
-\r
-       return p_cache_sw;\r
-}\r
-\r
-static void cache_sw_destroy(cache_switch_t * p_sw)\r
-{\r
-       if (!p_sw)\r
-               return;\r
-\r
-       if (p_sw->lft)\r
-               free(p_sw->lft);\r
-       if (p_sw->hops)\r
-               free(p_sw->hops);\r
-       free(p_sw);\r
-}\r
-\r
-static cache_switch_t *cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho)\r
-{\r
-       cache_switch_t *p_cache_sw = (cache_switch_t *)\r
-           cl_qmap_get(&p_mgr->cache_sw_tbl, lid_ho);\r
-       if (p_cache_sw == (cache_switch_t *)\r
-           cl_qmap_end(&p_mgr->cache_sw_tbl))\r
-               p_cache_sw = NULL;\r
-\r
-       return p_cache_sw;\r
-}\r
-\r
-static void cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p,\r
-                             uint16_t remote_lid_ho, boolean_t is_ca)\r
-{\r
-       cache_switch_t *p_cache_sw;\r
-       uint16_t lid_ho = cl_ntoh16(osm_node_get_base_lid(p->p_node, 0));\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!lid_ho || !remote_lid_ho || !p->port_num)\r
-               goto Exit;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Caching switch port: lid %u [port %u] -> lid %u (%s)\n",\r
-               lid_ho, p->port_num, remote_lid_ho, (is_ca) ? "CA/RTR" : "SW");\r
-\r
-       p_cache_sw = cache_get_sw(p_mgr, lid_ho);\r
-       if (!p_cache_sw) {\r
-               p_cache_sw = cache_sw_new(lid_ho, p->p_node->sw->num_ports);\r
-               if (!p_cache_sw) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                               "ERR AD01: Out of memory - cache is invalid\n");\r
-                       osm_ucast_cache_invalidate(p_mgr);\r
-                       goto Exit;\r
-               }\r
-               cl_qmap_insert(&p_mgr->cache_sw_tbl, lid_ho,\r
-                              &p_cache_sw->map_item);\r
-       }\r
-\r
-       if (p->port_num >= p_cache_sw->num_ports) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                       "ERR AD02: Wrong switch? - cache is invalid\n");\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       if (is_ca)\r
-               cache_sw_set_leaf(p_cache_sw);\r
-\r
-       if (p_cache_sw->ports[p->port_num].remote_lid_ho == 0) {\r
-               /* cache this link only if it hasn't been already cached */\r
-               p_cache_sw->ports[p->port_num].remote_lid_ho = remote_lid_ho;\r
-               p_cache_sw->ports[p->port_num].is_leaf = is_ca;\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cache_switch_t *p_sw;\r
-       cache_switch_t *p_next_sw;\r
-       unsigned port_num;\r
-       boolean_t found_port;\r
-\r
-       if (!p_mgr->cache_valid)\r
-               return;\r
-\r
-       p_next_sw = (cache_switch_t *) cl_qmap_head(&p_mgr->cache_sw_tbl);\r
-       while (p_next_sw !=\r
-              (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (cache_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               found_port = FALSE;\r
-               for (port_num = 1; port_num < p_sw->num_ports; port_num++)\r
-                       if (p_sw->ports[port_num].remote_lid_ho)\r
-                               found_port = TRUE;\r
-\r
-               if (!found_port) {\r
-                       cl_qmap_remove_item(&p_mgr->cache_sw_tbl,\r
-                                           &p_sw->map_item);\r
-                       cache_sw_destroy(p_sw);\r
-               }\r
-       }\r
-}\r
-\r
-static void\r
-cache_check_link_change(osm_ucast_mgr_t * p_mgr,\r
-                       osm_physp_t * p_physp_1, osm_physp_t * p_physp_2)\r
-{\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-       CL_ASSERT(p_physp_1 && p_physp_2);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       if (!p_physp_1->p_remote_physp && !p_physp_2->p_remote_physp)\r
-               /* both ports were down - new link */\r
-               goto Exit;\r
-\r
-       /* unicast cache cannot tolerate any link location change */\r
-\r
-       if ((p_physp_1->p_remote_physp &&\r
-            p_physp_1->p_remote_physp->p_remote_physp) ||\r
-           (p_physp_2->p_remote_physp &&\r
-            p_physp_2->p_remote_physp->p_remote_physp)) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Link location change discovered\n");\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static void cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho,\r
-                             uint8_t port_num, uint16_t remote_lid_ho,\r
-                             boolean_t is_ca)\r
-{\r
-       cache_switch_t *p_cache_sw;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       p_cache_sw = cache_get_sw(p_mgr, lid_ho);\r
-       if (!p_cache_sw) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Found uncached switch/link (lid %u, port %u)\n",\r
-                       lid_ho, port_num);\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       if (port_num >= p_cache_sw->num_ports ||\r
-           !p_cache_sw->ports[port_num].remote_lid_ho) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Found uncached switch link (lid %u, port %u)\n",\r
-                       lid_ho, port_num);\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_cache_sw->ports[port_num].remote_lid_ho != remote_lid_ho) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Remote lid change on switch lid %u, port %u "\r
-                       "(was %u, now %u)\n", lid_ho, port_num,\r
-                       p_cache_sw->ports[port_num].remote_lid_ho,\r
-                       remote_lid_ho);\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_cache_sw->ports[port_num].is_leaf && !is_ca) ||\r
-           (!p_cache_sw->ports[port_num].is_leaf && is_ca)) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Remote node type change on switch lid %u, port %u\n",\r
-                       lid_ho, port_num);\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "New link from lid %u, port %u to lid %u - "\r
-               "found in cache\n", lid_ho, port_num, remote_lid_ho);\r
-\r
-       /* the new link was cached - clean it from the cache */\r
-\r
-       p_cache_sw->ports[port_num].remote_lid_ho = 0;\r
-       p_cache_sw->ports[port_num].is_leaf = FALSE;\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}                              /* cache_remove_port() */\r
-\r
-static void\r
-cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,\r
-                        cache_switch_t * p_cache_sw, osm_switch_t * p_sw)\r
-{\r
-       if (!p_mgr->cache_valid)\r
-               return;\r
-\r
-       /* when seting unicast info, the cached port\r
-          should have all the required info */\r
-       CL_ASSERT(p_cache_sw->max_lid_ho && p_cache_sw->lft &&\r
-                 p_cache_sw->num_hops && p_cache_sw->hops);\r
-\r
-       p_sw->max_lid_ho = p_cache_sw->max_lid_ho;\r
-\r
-       if (p_sw->new_lft)\r
-               free(p_sw->new_lft);\r
-       p_sw->new_lft = p_cache_sw->lft;\r
-       p_cache_sw->lft = NULL;\r
-\r
-       p_sw->num_hops = p_cache_sw->num_hops;\r
-       p_cache_sw->num_hops = 0;\r
-       if (p_sw->hops)\r
-               free(p_sw->hops);\r
-       p_sw->hops = p_cache_sw->hops;\r
-       p_cache_sw->hops = NULL;\r
-}\r
-\r
-static void ucast_cache_dump(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cache_switch_t *p_sw;\r
-       unsigned i;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG))\r
-               goto Exit;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Dumping missing nodes/links as logged by unicast cache:\n");\r
-       for (p_sw = (cache_switch_t *) cl_qmap_head(&p_mgr->cache_sw_tbl);\r
-            p_sw != (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl);\r
-            p_sw = (cache_switch_t *) cl_qmap_next(&p_sw->map_item)) {\r
-\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "\t Switch lid %u %s%s\n",\r
-                       cache_sw_get_base_lid_ho(p_sw),\r
-                       (cache_sw_is_leaf(p_sw)) ? "[leaf switch] " : "",\r
-                       (p_sw->dropped) ? "[whole switch missing]" : "");\r
-\r
-               for (i = 1; i < p_sw->num_ports; i++)\r
-                       if (p_sw->ports[i].remote_lid_ho > 0)\r
-                               OSM_LOG(p_mgr->p_log,\r
-                                       OSM_LOG_DEBUG,\r
-                                       "\t     - port %u -> lid %u %s\n",\r
-                                       i, p_sw->ports[i].remote_lid_ho,\r
-                                       (p_sw->ports[i].is_leaf) ?\r
-                                       "[remote node is leaf]" : "");\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cache_switch_t *p_sw;\r
-       cache_switch_t *p_next_sw;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       p_mgr->cache_valid = FALSE;\r
-\r
-       p_next_sw = (cache_switch_t *) cl_qmap_head(&p_mgr->cache_sw_tbl);\r
-       while (p_next_sw !=\r
-              (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (cache_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-               cache_sw_destroy(p_sw);\r
-       }\r
-       cl_qmap_remove_all(&p_mgr->cache_sw_tbl);\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE, "Unicast Cache invalidated\n");\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cache_switch_t *p_cache_sw;\r
-       cache_switch_t *p_remote_cache_sw;\r
-       unsigned port_num;\r
-       unsigned max_ports;\r
-       uint8_t remote_node_type;\r
-       uint16_t lid_ho;\r
-       uint16_t remote_lid_ho;\r
-       osm_switch_t *p_sw;\r
-       osm_switch_t *p_remote_sw;\r
-       osm_node_t *p_node;\r
-       osm_physp_t *p_physp;\r
-       osm_physp_t *p_remote_physp;\r
-       osm_port_t *p_remote_port;\r
-       cl_qmap_t *p_sw_tbl;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       /* If there are no switches in the subnet, we are done */\r
-       p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;\r
-       if (cl_qmap_count(p_sw_tbl) == 0) {\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Scan all the physical switch ports in the subnet.\r
-        * If the port need_update flag is on, check whether\r
-        * it's just some node/port reset or a cached topology\r
-        * change. Otherwise the cache is invalid.\r
-        */\r
-       for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);\r
-            p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl);\r
-            p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {\r
-\r
-               p_node = p_sw->p_node;\r
-\r
-               lid_ho = cl_ntoh16(osm_node_get_base_lid(p_node, 0));\r
-               p_cache_sw = cache_get_sw(p_mgr, lid_ho);\r
-\r
-               max_ports = osm_node_get_num_physp(p_node);\r
-\r
-               /* skip port 0 */\r
-               for (port_num = 1; port_num < max_ports; port_num++) {\r
-\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-\r
-                       if (!p_physp || !p_physp->p_remote_physp ||\r
-                           !osm_physp_link_exists(p_physp,\r
-                                                  p_physp->p_remote_physp))\r
-                               /* no valid link */\r
-                               continue;\r
-\r
-                       /*\r
-                        * While scanning all the physical ports in the subnet,\r
-                        * mark corresponding leaf switches in the cache.\r
-                        */\r
-                       if (p_cache_sw &&\r
-                           !p_cache_sw->dropped &&\r
-                           !cache_sw_is_leaf(p_cache_sw) &&\r
-                           p_physp->p_remote_physp->p_node &&\r
-                           osm_node_get_type(p_physp->p_remote_physp->\r
-                                             p_node) != IB_NODE_TYPE_SWITCH)\r
-                               cache_sw_set_leaf(p_cache_sw);\r
-\r
-                       if (!p_physp->need_update)\r
-                               continue;\r
-\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Checking switch lid %u, port %u\n",\r
-                               lid_ho, port_num);\r
-\r
-                       p_remote_physp = osm_physp_get_remote(p_physp);\r
-                       remote_node_type =\r
-                           osm_node_get_type(p_remote_physp->p_node);\r
-\r
-                       if (remote_node_type == IB_NODE_TYPE_SWITCH)\r
-                               remote_lid_ho =\r
-                                   cl_ntoh16(osm_node_get_base_lid\r
-                                             (p_remote_physp->p_node, 0));\r
-                       else\r
-                               remote_lid_ho =\r
-                                   cl_ntoh16(osm_node_get_base_lid\r
-                                             (p_remote_physp->p_node,\r
-                                              osm_physp_get_port_num\r
-                                              (p_remote_physp)));\r
-\r
-                       if (!p_cache_sw ||\r
-                           port_num >= p_cache_sw->num_ports ||\r
-                           !p_cache_sw->ports[port_num].remote_lid_ho) {\r
-                               /*\r
-                                * There is some uncached change on the port.\r
-                                * In general, the reasons might be as follows:\r
-                                *  - switch reset\r
-                                *  - port reset (or port down/up)\r
-                                *  - quick connection location change\r
-                                *  - new link (or new switch)\r
-                                *\r
-                                * First two reasons allow cache usage, while\r
-                                * the last two reasons should invalidate cache.\r
-                                *\r
-                                * In case of quick connection location change,\r
-                                * cache would have been invalidated by\r
-                                * osm_ucast_cache_check_new_link() function.\r
-                                *\r
-                                * In case of new link between two known nodes,\r
-                                * cache also would have been invalidated by\r
-                                * osm_ucast_cache_check_new_link() function.\r
-                                *\r
-                                * Another reason is cached link between two\r
-                                * known switches went back. In this case the\r
-                                * osm_ucast_cache_check_new_link() function would\r
-                                * clear both sides of the link from the cache\r
-                                * during the discovery process, so effectively\r
-                                * this would be equivalent to port reset.\r
-                                *\r
-                                * So three possible reasons remain:\r
-                                *  - switch reset\r
-                                *  - port reset (or port down/up)\r
-                                *  - link of a new switch\r
-                                *\r
-                                * To validate cache, we need to check only the\r
-                                * third reason - link of a new node/switch:\r
-                                *  - If this is the local switch that is new,\r
-                                *    then it should have (p_sw->need_update == 2).\r
-                                *  - If the remote node is switch and it's new,\r
-                                *    then it also should have\r
-                                *    (p_sw->need_update == 2).\r
-                                *  - If the remote node is CA/RTR and it's new,\r
-                                *    then its port should have is_new flag on.\r
-                                */\r
-                               if (p_sw->need_update == 2) {\r
-                                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                               "New switch found (lid %u)\n",\r
-                                               lid_ho);\r
-                                       osm_ucast_cache_invalidate(p_mgr);\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               if (remote_node_type == IB_NODE_TYPE_SWITCH) {\r
-\r
-                                       p_remote_sw =\r
-                                           p_remote_physp->p_node->sw;\r
-                                       if (p_remote_sw->need_update == 2) {\r
-                                               /* this could also be case of\r
-                                                  switch coming back with an\r
-                                                  additional link that it\r
-                                                  didn't have before */\r
-                                               OSM_LOG(p_mgr->p_log,\r
-                                                       OSM_LOG_DEBUG,\r
-                                                       "New switch/link found (lid %u)\n",\r
-                                                       remote_lid_ho);\r
-                                               osm_ucast_cache_invalidate\r
-                                                   (p_mgr);\r
-                                               goto Exit;\r
-                                       }\r
-                               } else {\r
-                                       /*\r
-                                        * Remote node is CA/RTR.\r
-                                        * Get p_port of the remote node and\r
-                                        * check its p_port->is_new flag.\r
-                                        */\r
-                                       p_remote_port =\r
-                                           osm_get_port_by_guid(p_mgr->p_subn,\r
-                                                                osm_physp_get_port_guid\r
-                                                                (p_remote_physp));\r
-                                       if (p_remote_port->is_new) {\r
-                                               OSM_LOG(p_mgr->p_log,\r
-                                                       OSM_LOG_DEBUG,\r
-                                                       "New CA/RTR found (lid %u)\n",\r
-                                                       remote_lid_ho);\r
-                                               osm_ucast_cache_invalidate\r
-                                                   (p_mgr);\r
-                                               goto Exit;\r
-                                       }\r
-                               }\r
-                       } else {\r
-                               /*\r
-                                * The change on the port is cached.\r
-                                * In general, the reasons might be as follows:\r
-                                *  - link between two known nodes went back\r
-                                *  - one or more nodes went back, causing all\r
-                                *    the links to reappear\r
-                                *\r
-                                * If it was link that went back, then this case\r
-                                * would have been taken care of during the\r
-                                * discovery by osm_ucast_cache_check_new_link(),\r
-                                * so it's some node that went back.\r
-                                */\r
-                               if ((p_cache_sw->ports[port_num].is_leaf &&\r
-                                    remote_node_type == IB_NODE_TYPE_SWITCH) ||\r
-                                   (!p_cache_sw->ports[port_num].is_leaf &&\r
-                                    remote_node_type != IB_NODE_TYPE_SWITCH)) {\r
-                                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                               "Remote node type change on switch lid %u, port %u\n",\r
-                                               lid_ho, port_num);\r
-                                       osm_ucast_cache_invalidate(p_mgr);\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               if (p_cache_sw->ports[port_num].remote_lid_ho !=\r
-                                   remote_lid_ho) {\r
-                                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                               "Remote lid change on switch lid %u, port %u"\r
-                                               "(was %u, now %u)\n",\r
-                                               lid_ho, port_num,\r
-                                               p_cache_sw->ports[port_num].\r
-                                               remote_lid_ho, remote_lid_ho);\r
-                                       osm_ucast_cache_invalidate(p_mgr);\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               /*\r
-                                * We don't care who is the node that has\r
-                                * reappeared in the subnet (local or remote).\r
-                                * What's important that the cached link matches\r
-                                * the real fabrics link.\r
-                                * Just clean it from cache.\r
-                                */\r
-\r
-                               p_cache_sw->ports[port_num].remote_lid_ho = 0;\r
-                               p_cache_sw->ports[port_num].is_leaf = FALSE;\r
-                               if (p_cache_sw->dropped) {\r
-                                       cache_restore_ucast_info(p_mgr,\r
-                                                                p_cache_sw,\r
-                                                                p_sw);\r
-                                       p_cache_sw->dropped = FALSE;\r
-                               }\r
-\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Restored link from cache: lid %u, port %u to lid %u\n",\r
-                                       lid_ho, port_num, remote_lid_ho);\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Remove all the cached switches that\r
-          have all their ports restored */\r
-       cache_cleanup_switches(p_mgr);\r
-\r
-       /*\r
-        * Done scanning all the physical switch ports in the subnet.\r
-        * Now we need to check the other side:\r
-        * Scan all the cached switches and their ports:\r
-        *  - If the cached switch is missing in the subnet\r
-        *    (dropped flag is on), check that it's a leaf switch.\r
-        *    If it's not a leaf, the cache is invalid, because\r
-        *    cache can tolerate only leaf switch removal.\r
-        *  - If the cached switch exists in fabric, check all\r
-        *    its cached ports. These cached ports represent\r
-        *    missing link in the fabric.\r
-        *    The missing links that can be tolerated are:\r
-        *      + link to missing CA/RTR\r
-        *      + link to missing leaf switch\r
-        */\r
-       for (p_cache_sw = (cache_switch_t *) cl_qmap_head(&p_mgr->cache_sw_tbl);\r
-            p_cache_sw != (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl);\r
-            p_cache_sw =\r
-            (cache_switch_t *) cl_qmap_next(&p_cache_sw->map_item)) {\r
-\r
-               if (p_cache_sw->dropped) {\r
-                       if (!cache_sw_is_leaf(p_cache_sw)) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Missing non-leaf switch (lid %u)\n",\r
-                                       cache_sw_get_base_lid_ho(p_cache_sw));\r
-                               osm_ucast_cache_invalidate(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Missing leaf switch (lid %u) - "\r
-                               "continuing validation\n",\r
-                               cache_sw_get_base_lid_ho(p_cache_sw));\r
-                       continue;\r
-               }\r
-\r
-               for (port_num = 1; port_num < p_cache_sw->num_ports; port_num++) {\r
-                       if (!p_cache_sw->ports[port_num].remote_lid_ho)\r
-                               continue;\r
-\r
-                       if (p_cache_sw->ports[port_num].is_leaf) {\r
-                               CL_ASSERT(cache_sw_is_leaf(p_cache_sw));\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Switch lid %u, port %u: missing link to CA/RTR - "\r
-                                       "continuing validation\n",\r
-                                       cache_sw_get_base_lid_ho(p_cache_sw),\r
-                                       port_num);\r
-                               continue;\r
-                       }\r
-\r
-                       p_remote_cache_sw = cache_get_sw(p_mgr,\r
-                                                        p_cache_sw->\r
-                                                        ports[port_num].\r
-                                                        remote_lid_ho);\r
-\r
-                       if (!p_remote_cache_sw || !p_remote_cache_sw->dropped) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Switch lid %u, port %u: missing link to existing switch\n",\r
-                                       cache_sw_get_base_lid_ho(p_cache_sw),\r
-                                       port_num);\r
-                               osm_ucast_cache_invalidate(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       if (!cache_sw_is_leaf(p_remote_cache_sw)) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Switch lid %u, port %u: missing link to non-leaf switch\n",\r
-                                       cache_sw_get_base_lid_ho(p_cache_sw),\r
-                                       port_num);\r
-                               osm_ucast_cache_invalidate(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       /*\r
-                        * At this point we know that the missing link is to\r
-                        * a leaf switch. However, one case deserves a special\r
-                        * treatment. If there was a link between two leaf\r
-                        * switches, then missing leaf switch might break\r
-                        * routing. It is possible that there are routes\r
-                        * that use leaf switches to get from switch to switch\r
-                        * and not just to get to the CAs behind the leaf switch.\r
-                        */\r
-                       if (cache_sw_is_leaf(p_cache_sw) &&\r
-                           cache_sw_is_leaf(p_remote_cache_sw)) {\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                                       "Switch lid %u, port %u: missing leaf-2-leaf link\n",\r
-                                       cache_sw_get_base_lid_ho(p_cache_sw),\r
-                                       port_num);\r
-                               osm_ucast_cache_invalidate(p_mgr);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Switch lid %u, port %u: missing remote leaf switch - "\r
-                               "continuing validation\n",\r
-                               cache_sw_get_base_lid_ho(p_cache_sw),\r
-                               port_num);\r
-               }\r
-       }\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Unicast cache is valid\n");\r
-       ucast_cache_dump(p_mgr);\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}                              /* osm_ucast_cache_validate() */\r
-\r
-void osm_ucast_cache_check_new_link(osm_ucast_mgr_t * p_mgr,\r
-                                   osm_node_t * p_node_1, uint8_t port_num_1,\r
-                                   osm_node_t * p_node_2, uint8_t port_num_2)\r
-{\r
-       uint16_t lid_ho_1;\r
-       uint16_t lid_ho_2;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       cache_check_link_change(p_mgr,\r
-                               osm_node_get_physp_ptr(p_node_1, port_num_1),\r
-                               osm_node_get_physp_ptr(p_node_2, port_num_2));\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH &&\r
-           osm_node_get_type(p_node_2) != IB_NODE_TYPE_SWITCH) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Found CA-2-CA link\n");\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       /* for code simplicity, we want the first node to be switch */\r
-       if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH) {\r
-               osm_node_t *tmp_node = p_node_1;\r
-               uint8_t tmp_port_num = port_num_1;\r
-               p_node_1 = p_node_2;\r
-               port_num_1 = port_num_2;\r
-               p_node_2 = tmp_node;\r
-               port_num_2 = tmp_port_num;\r
-       }\r
-\r
-       lid_ho_1 = cl_ntoh16(osm_node_get_base_lid(p_node_1, 0));\r
-\r
-       if (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH)\r
-               lid_ho_2 = cl_ntoh16(osm_node_get_base_lid(p_node_2, 0));\r
-       else\r
-               lid_ho_2 =\r
-                   cl_ntoh16(osm_node_get_base_lid(p_node_2, port_num_2));\r
-\r
-       if (!lid_ho_1 || !lid_ho_2) {\r
-               /*\r
-                * No lid assigned, which means that one of the nodes is new.\r
-                * Need to wait for lid manager to process this node.\r
-                * The switches and their links will be checked later when\r
-                * the whole cache validity will be verified.\r
-                */\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Link port %u <-> %u reveals new node - cache will "\r
-                       "be validated later\n", port_num_1, port_num_2);\r
-               goto Exit;\r
-       }\r
-\r
-       cache_remove_port(p_mgr, lid_ho_1, port_num_1, lid_ho_2,\r
-                         (osm_node_get_type(p_node_2) !=\r
-                         IB_NODE_TYPE_SWITCH));\r
-\r
-       /* if node_2 is a switch, the link should be cleaned from its cache */\r
-\r
-       if (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH)\r
-               cache_remove_port(p_mgr, lid_ho_2,\r
-                                 port_num_2, lid_ho_1, FALSE);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}                              /* osm_ucast_cache_check_new_link() */\r
-\r
-void osm_ucast_cache_add_link(osm_ucast_mgr_t * p_mgr,\r
-                             osm_physp_t * p_physp1, osm_physp_t * p_physp2)\r
-{\r
-       osm_node_t *p_node_1 = p_physp1->p_node, *p_node_2 = p_physp2->p_node;\r
-       uint16_t lid_ho_1, lid_ho_2;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH &&\r
-           osm_node_get_type(p_node_2) != IB_NODE_TYPE_SWITCH) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Dropping CA-2-CA link\n");\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       if ((osm_node_get_type(p_node_1) == IB_NODE_TYPE_SWITCH &&\r
-            !osm_node_get_physp_ptr(p_node_1, 0)) ||\r
-           (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH &&\r
-            !osm_node_get_physp_ptr(p_node_2, 0))) {\r
-               /* we're caching a link when one of the nodes\r
-                  has already been dropped and cached */\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Port %u <-> port %u: port0 on one of the nodes "\r
-                       "has already been dropped and cached\n",\r
-                       p_physp1->port_num, p_physp2->port_num);\r
-               goto Exit;\r
-       }\r
-\r
-       /* One of the nodes is switch. Just for code\r
-          simplicity, make sure that it's the first node. */\r
-\r
-       if (osm_node_get_type(p_node_1) != IB_NODE_TYPE_SWITCH) {\r
-               osm_physp_t *tmp = p_physp1;\r
-               p_physp1 = p_physp2;\r
-               p_physp2 = tmp;\r
-               p_node_1 = p_physp1->p_node;\r
-               p_node_2 = p_physp2->p_node;\r
-       }\r
-\r
-       if (!p_node_1->sw) {\r
-               /* something is wrong - we'd better not use cache */\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-               goto Exit;\r
-       }\r
-\r
-       lid_ho_1 = cl_ntoh16(osm_node_get_base_lid(p_node_1, 0));\r
-\r
-       if (osm_node_get_type(p_node_2) == IB_NODE_TYPE_SWITCH) {\r
-\r
-               if (!p_node_2->sw) {\r
-                       /* something is wrong - we'd better not use cache */\r
-                       osm_ucast_cache_invalidate(p_mgr);\r
-                       goto Exit;\r
-               }\r
-\r
-               lid_ho_2 = cl_ntoh16(osm_node_get_base_lid(p_node_2, 0));\r
-\r
-               /* lost switch-2-switch link - cache both sides */\r
-               cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, FALSE);\r
-               cache_add_sw_link(p_mgr, p_physp2, lid_ho_1, FALSE);\r
-       } else {\r
-               lid_ho_2 = cl_ntoh16(osm_physp_get_base_lid(p_physp2));\r
-\r
-               /* lost link to CA/RTR - cache only switch side */\r
-               cache_add_sw_link(p_mgr, p_physp1, lid_ho_2, TRUE);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}                              /* osm_ucast_cache_add_link() */\r
-\r
-void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node)\r
-{\r
-       uint16_t lid_ho;\r
-       uint8_t max_ports;\r
-       uint8_t port_num;\r
-       osm_physp_t *p_physp;\r
-       cache_switch_t *p_cache_sw;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (!p_mgr->cache_valid)\r
-               goto Exit;\r
-\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {\r
-\r
-               lid_ho = cl_ntoh16(osm_node_get_base_lid(p_node, 0));\r
-\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Caching dropped switch lid %u\n", lid_ho);\r
-\r
-               if (!p_node->sw) {\r
-                       /* something is wrong - forget about cache */\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,\r
-                               "ERR AD03: no switch info for node lid %u - "\r
-                               "clearing cache\n", lid_ho);\r
-                       osm_ucast_cache_invalidate(p_mgr);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* unlink (add to cache) all the ports of this switch */\r
-               max_ports = osm_node_get_num_physp(p_node);\r
-               for (port_num = 1; port_num < max_ports; port_num++) {\r
-\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (!p_physp || !p_physp->p_remote_physp)\r
-                               continue;\r
-\r
-                       osm_ucast_cache_add_link(p_mgr, p_physp,\r
-                                                p_physp->p_remote_physp);\r
-               }\r
-\r
-               /*\r
-                * All the ports have been dropped (cached).\r
-                * If one of the ports was connected to CA/RTR,\r
-                * then the cached switch would be marked as leaf.\r
-                * If it isn't, then the dropped switch isn't a leaf,\r
-                * and cache can't handle it.\r
-                */\r
-\r
-               p_cache_sw = cache_get_sw(p_mgr, lid_ho);\r
-               CL_ASSERT(p_cache_sw);\r
-\r
-               if (!cache_sw_is_leaf(p_cache_sw)) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "Dropped non-leaf switch (lid %u)\n", lid_ho);\r
-                       osm_ucast_cache_invalidate(p_mgr);\r
-                       goto Exit;\r
-               }\r
-\r
-               p_cache_sw->dropped = TRUE;\r
-\r
-               if (!p_node->sw->num_hops || !p_node->sw->hops) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                               "No LID matrices for switch lid %u\n", lid_ho);\r
-                       osm_ucast_cache_invalidate(p_mgr);\r
-                       goto Exit;\r
-               }\r
-\r
-               /* lid matrices */\r
-\r
-               p_cache_sw->num_hops = p_node->sw->num_hops;\r
-               p_node->sw->num_hops = 0;\r
-               p_cache_sw->hops = p_node->sw->hops;\r
-               p_node->sw->hops = NULL;\r
-\r
-               /* linear forwarding table */\r
-\r
-               if (p_node->sw->new_lft) {\r
-                       /* LFT buffer exists - we use it, because\r
-                          it is more updated than the switch's LFT */\r
-                       p_cache_sw->lft = p_node->sw->new_lft;\r
-                       p_node->sw->new_lft = NULL;\r
-               } else {\r
-                       /* no LFT buffer, so we use the switch's LFT */\r
-                       p_cache_sw->lft = p_node->sw->lft;\r
-                       p_node->sw->lft = NULL;\r
-               }\r
-               p_cache_sw->max_lid_ho = p_node->sw->max_lid_ho;\r
-       } else {\r
-               /* dropping CA/RTR: add to cache all the ports of this node */\r
-               max_ports = osm_node_get_num_physp(p_node);\r
-               for (port_num = 1; port_num < max_ports; port_num++) {\r
-\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (!p_physp || !p_physp->p_remote_physp)\r
-                               continue;\r
-\r
-                       CL_ASSERT(osm_node_get_type\r
-                                 (p_physp->p_remote_physp->p_node) ==\r
-                                 IB_NODE_TYPE_SWITCH);\r
-\r
-                       osm_ucast_cache_add_link(p_mgr,\r
-                                                p_physp->p_remote_physp,\r
-                                                p_physp);\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}                              /* osm_ucast_cache_add_node() */\r
-\r
-int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cl_qmap_t *tbl = &p_mgr->p_subn->sw_guid_tbl;\r
-       cl_map_item_t *item;\r
-       osm_switch_t *p_sw;\r
-\r
-       if (!p_mgr->p_subn->opt.use_ucast_cache)\r
-               return 1;\r
-\r
-       ucast_cache_validate(p_mgr);\r
-       if (!p_mgr->cache_valid)\r
-               return 1;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,\r
-               "Configuring switch tables using cached routing\n");\r
-\r
-       for (item = cl_qmap_head(tbl); item != cl_qmap_end(tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *) item;\r
-\r
-               if (p_sw->need_update && !p_sw->new_lft) {\r
-                       /* no new routing was recently calculated for this\r
-                          switch, but the LFT needs to be updated anyway */\r
-                       p_sw->new_lft = p_sw->lft;\r
-                       p_sw->lft = malloc(p_sw->lft_size);\r
-                       if (!p_sw->lft)\r
-                               return IB_INSUFFICIENT_MEMORY;\r
-                       memset(p_sw->lft, OSM_NO_PATH, p_sw->lft_size);\r
-               }\r
-\r
-       }\r
-\r
-       osm_ucast_mgr_set_fwd_tables(p_mgr);\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_file.c b/branches/opensm_3/user/opensm/osm_ucast_file.c
deleted file mode 100644 (file)
index f1cd597..0000000
+++ /dev/null
@@ -1,389 +0,0 @@
-/*\r
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2006,2008-2009 Mellanox Technologies LTD. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of OpenSM unicast routing module which loads\r
- *    routes from the dump file\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_log.h>\r
-\r
-static uint16_t remap_lid(osm_opensm_t * p_osm, uint16_t lid, ib_net64_t guid)\r
-{\r
-       osm_port_t *p_port;\r
-       uint16_t min_lid, max_lid;\r
-       uint8_t lmc;\r
-\r
-       p_port = osm_get_port_by_guid(&p_osm->subn, guid);\r
-       if (!p_port) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "cannot find port guid 0x%016" PRIx64\r
-                       " , will use the same lid\n", cl_ntoh64(guid));\r
-               return lid;\r
-       }\r
-\r
-       osm_port_get_lid_range_ho(p_port, &min_lid, &max_lid);\r
-       if (min_lid <= lid && lid <= max_lid)\r
-               return lid;\r
-\r
-       lmc = osm_port_get_lmc(p_port);\r
-       return min_lid + (lid & ((1 << lmc) - 1));\r
-}\r
-\r
-static void add_path(osm_opensm_t * p_osm,\r
-                    osm_switch_t * p_sw, uint16_t lid, uint8_t port_num,\r
-                    ib_net64_t port_guid)\r
-{\r
-       uint16_t new_lid;\r
-       uint8_t old_port;\r
-\r
-       new_lid = port_guid ? remap_lid(p_osm, lid, port_guid) : lid;\r
-       old_port = osm_switch_get_port_by_lid(p_sw, new_lid);\r
-       if (old_port != OSM_NO_PATH && old_port != port_num) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "LID collision is detected on switch "\r
-                       "0x016%" PRIx64 ", will overwrite LID %u entry\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),\r
-                       new_lid);\r
-       }\r
-\r
-       p_sw->new_lft[new_lid] = port_num;\r
-       if (!(p_osm->subn.opt.port_profile_switch_nodes && port_guid &&\r
-             osm_get_switch_by_guid(&p_osm->subn, port_guid)))\r
-               osm_switch_count_path(p_sw, port_num);\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,\r
-               "route 0x%04x(was 0x%04x) %u 0x%016" PRIx64\r
-               " is added to switch 0x%016" PRIx64 "\n",\r
-               new_lid, lid, port_num, cl_ntoh64(port_guid),\r
-               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));\r
-}\r
-\r
-static void add_lid_hops(osm_opensm_t * p_osm, osm_switch_t * p_sw,\r
-                        uint16_t lid, ib_net64_t guid,\r
-                        uint8_t hops[], unsigned len)\r
-{\r
-       uint16_t new_lid;\r
-       uint8_t i;\r
-\r
-       new_lid = guid ? remap_lid(p_osm, lid, guid) : lid;\r
-       if (len > p_sw->num_ports)\r
-               len = p_sw->num_ports;\r
-\r
-       for (i = 0; i < len; i++)\r
-               osm_switch_set_hops(p_sw, lid, i, hops[i]);\r
-}\r
-\r
-static int do_ucast_file_load(void *context)\r
-{\r
-       char line[1024];\r
-       char *file_name;\r
-       FILE *file;\r
-       ib_net64_t sw_guid, port_guid;\r
-       osm_opensm_t *p_osm = context;\r
-       osm_switch_t *p_sw;\r
-       uint16_t lid;\r
-       uint8_t port_num;\r
-       unsigned lineno;\r
-\r
-       file_name = p_osm->subn.opt.lfts_file;\r
-       if (!file_name) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "LFTs file name is not given; "\r
-                       "using default routing algorithm\n");\r
-               return 1;\r
-       }\r
-\r
-       file = fopen(file_name, "r");\r
-       if (!file) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6302: "\r
-                       "cannot open ucast dump file \'%s\': %m\n", file_name);\r
-               return -1;\r
-       }\r
-\r
-       lineno = 0;\r
-       p_sw = NULL;\r
-\r
-       while (fgets(line, sizeof(line) - 1, file) != NULL) {\r
-               char *p, *q;\r
-               lineno++;\r
-\r
-               p = line;\r
-               while (isspace(*p))\r
-                       p++;\r
-\r
-               if (*p == '#')\r
-                       continue;\r
-\r
-               if (!strncmp(p, "Multicast mlids", 15)) {\r
-                       OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,\r
-                               "ERR 6303: "\r
-                               "Multicast dump file detected; "\r
-                               "skipping parsing. Using default "\r
-                               "routing algorithm\n");\r
-               } else if (!strncmp(p, "Unicast lids", 12)) {\r
-                       q = strstr(p, " guid 0x");\r
-                       if (!q) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse switch definition\n",\r
-                                       file_name, lineno);\r
-                               return -1;\r
-                       }\r
-                       p = q + 8;\r
-                       sw_guid = strtoull(p, &q, 16);\r
-                       if (q == p || !isspace(*q)) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse switch guid: \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               return -1;\r
-                       }\r
-                       sw_guid = cl_hton64(sw_guid);\r
-\r
-                       p_sw = osm_get_switch_by_guid(&p_osm->subn, sw_guid);\r
-                       if (!p_sw) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                       "cannot find switch %016" PRIx64 "\n",\r
-                                       cl_ntoh64(sw_guid));\r
-                               continue;\r
-                       }\r
-                       memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);\r
-               } else if (p_sw && !strncmp(p, "0x", 2)) {\r
-                       p += 2;\r
-                       lid = (uint16_t) strtoul(p, &q, 16);\r
-                       if (q == p || !isspace(*q)) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse lid: \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               return -1;\r
-                       }\r
-                       p = q;\r
-                       while (isspace(*p))\r
-                               p++;\r
-                       port_num = (uint8_t) strtoul(p, &q, 10);\r
-                       if (q == p || !isspace(*q)) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse port: \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               return -1;\r
-                       }\r
-                       p = q;\r
-                       /* additionally try to extract guid */\r
-                       q = strstr(p, " portguid 0x");\r
-                       if (!q) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                       "PARSE WARNING: %s:%u: "\r
-                                       "cannot find port guid "\r
-                                       "(maybe broken dump): \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               port_guid = 0;\r
-                       } else {\r
-                               p = q + 12;\r
-                               port_guid = strtoull(p, &q, 16);\r
-                               if (q == p || (!isspace(*q) && *q != ':')) {\r
-                                       OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                               "PARSE WARNING: %s:%u: "\r
-                                               "cannot parse port guid "\r
-                                               "(maybe broken dump): \'%s\'\n",\r
-                                               file_name, lineno, p);\r
-                                       port_guid = 0;\r
-                               }\r
-                       }\r
-                       port_guid = cl_hton64(port_guid);\r
-                       add_path(p_osm, p_sw, lid, port_num, port_guid);\r
-               }\r
-       }\r
-\r
-       fclose(file);\r
-       return 0;\r
-}\r
-\r
-static int do_lid_matrix_file_load(void *context)\r
-{\r
-       char line[1024];\r
-       uint8_t hops[256];\r
-       char *file_name;\r
-       FILE *file;\r
-       ib_net64_t guid;\r
-       osm_opensm_t *p_osm = context;\r
-       osm_switch_t *p_sw;\r
-       unsigned lineno;\r
-       uint16_t lid;\r
-\r
-       file_name = p_osm->subn.opt.lid_matrix_dump_file;\r
-       if (!file_name) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                       "lid matrix file name is not given; "\r
-                       "using default lid matrix generation algorithm\n");\r
-               return 1;\r
-       }\r
-\r
-       file = fopen(file_name, "r");\r
-       if (!file) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6305: "\r
-                       "cannot open lid matrix file \'%s\': %m\n", file_name);\r
-               return -1;\r
-       }\r
-\r
-       lineno = 0;\r
-       p_sw = NULL;\r
-\r
-       while (fgets(line, sizeof(line) - 1, file) != NULL) {\r
-               char *p, *q;\r
-               lineno++;\r
-\r
-               p = line;\r
-               while (isspace(*p))\r
-                       p++;\r
-\r
-               if (*p == '#')\r
-                       continue;\r
-\r
-               if (!strncmp(p, "Switch", 6)) {\r
-                       q = strstr(p, " guid 0x");\r
-                       if (!q) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse switch definition\n",\r
-                                       file_name, lineno);\r
-                               return -1;\r
-                       }\r
-                       p = q + 8;\r
-                       guid = strtoull(p, &q, 16);\r
-                       if (q == p || !isspace(*q)) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse switch guid: \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               return -1;\r
-                       }\r
-                       guid = cl_hton64(guid);\r
-\r
-                       p_sw = osm_get_switch_by_guid(&p_osm->subn, guid);\r
-                       if (!p_sw) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                       "cannot find switch %016" PRIx64 "\n",\r
-                                       cl_ntoh64(guid));\r
-                               continue;\r
-                       }\r
-               } else if (p_sw && !strncmp(p, "0x", 2)) {\r
-                       unsigned long num;\r
-                       unsigned len = 0;\r
-\r
-                       memset(hops, 0xff, sizeof(hops));\r
-\r
-                       p += 2;\r
-                       num = strtoul(p, &q, 16);\r
-                       if (num > 0xffff || q == p ||\r
-                           (*q != ':' && !isspace(*q))) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                       "PARSE ERROR: %s:%u: "\r
-                                       "cannot parse lid: \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               return -1;\r
-                       }\r
-                       /* Just checked the range, so casting is safe */\r
-                       lid = (uint16_t) num;\r
-                       p = q;\r
-                       while (isspace(*p) || *p == ':')\r
-                               p++;\r
-                       while (len < 256 && *p && *p != '#') {\r
-                               num = strtoul(p, &q, 16);\r
-                               if (num > 0xff || q == p) {\r
-                                       OSM_LOG(&p_osm->log, OSM_LOG_ERROR,\r
-                                               "PARSE ERROR: %s:%u: "\r
-                                               "cannot parse hops number: \'%s\'\n",\r
-                                               file_name, lineno, p);\r
-                                       return -1;\r
-                               }\r
-                               /* Just checked the range, so casting is safe */\r
-                               hops[len++] = (uint8_t) num;\r
-                               p = q;\r
-                               while (isspace(*p))\r
-                                       p++;\r
-                       }\r
-                       /* additionally try to extract guid */\r
-                       q = strstr(p, " portguid 0x");\r
-                       if (!q) {\r
-                               OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                       "PARSE WARNING: %s:%u: "\r
-                                       "cannot find port guid "\r
-                                       "(maybe broken dump): \'%s\'\n",\r
-                                       file_name, lineno, p);\r
-                               guid = 0;\r
-                       } else {\r
-                               p = q + 12;\r
-                               guid = strtoull(p, &q, 16);\r
-                               if (q == p || !isspace(*q)) {\r
-                                       OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-                                               "PARSE WARNING: %s:%u: "\r
-                                               "cannot parse port guid "\r
-                                               "(maybe broken dump): \'%s\'\n",\r
-                                               file_name, lineno, p);\r
-                                       guid = 0;\r
-                               }\r
-                       }\r
-                       guid = cl_hton64(guid);\r
-                       add_lid_hops(p_osm, p_sw, lid, guid, hops, len);\r
-               }\r
-       }\r
-\r
-       fclose(file);\r
-       return 0;\r
-}\r
-\r
-int osm_ucast_file_setup(struct osm_routing_engine *r, osm_opensm_t *osm)\r
-{\r
-       r->context = osm;\r
-       r->build_lid_matrices = do_lid_matrix_file_load;\r
-       r->ucast_build_fwd_tables = do_ucast_file_load;\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_ftree.c b/branches/opensm_3/user/opensm/osm_ucast_ftree.c
deleted file mode 100644 (file)
index a66be41..0000000
+++ /dev/null
@@ -1,4112 +0,0 @@
-/*\r
- * Copyright (c) 2009 Simula Research Laboratory. All rights reserved.\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of OpenSM FatTree routing\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif\r
-\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_switch.h>\r
-\r
-/*\r
- * FatTree rank is bounded between 2 and 8:\r
- *  - Tree of rank 1 has only trivial routing paths,\r
- *    so no need to use FatTree routing.\r
- *  - Why maximum rank is 8:\r
- *    Each node (switch) is assigned a unique tuple.\r
- *    Switches are stored in two cl_qmaps - one is\r
- *    ordered by guid, and the other by a key that is\r
- *    generated from tuple. Since cl_qmap supports only\r
- *    a 64-bit key, the maximal tuple lenght is 8 bytes.\r
- *    which means that maximal tree rank is 8.\r
- * Note that the above also implies that each switch\r
- * can have at max 255 up/down ports.\r
- */\r
-\r
-#define FAT_TREE_MIN_RANK 2\r
-#define FAT_TREE_MAX_RANK 8\r
-\r
-typedef enum {\r
-       FTREE_DIRECTION_DOWN = -1,\r
-       FTREE_DIRECTION_SAME,\r
-       FTREE_DIRECTION_UP\r
-} ftree_direction_t;\r
-\r
-/***************************************************\r
- **\r
- **  Forward references\r
- **\r
- ***************************************************/\r
-struct ftree_sw_t_;\r
-struct ftree_hca_t_;\r
-struct ftree_port_t_;\r
-struct ftree_port_group_t_;\r
-struct ftree_fabric_t_;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_tuple_t definition\r
- **\r
- ***************************************************/\r
-\r
-#define FTREE_TUPLE_BUFF_LEN 1024\r
-#define FTREE_TUPLE_LEN 8\r
-\r
-typedef uint8_t ftree_tuple_t[FTREE_TUPLE_LEN];\r
-typedef uint64_t ftree_tuple_key_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_sw_table_element_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef struct {\r
-       cl_map_item_t map_item;\r
-       struct ftree_sw_t_ *p_sw;\r
-} ftree_sw_tbl_element_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_port_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef struct ftree_port_t_ {\r
-       cl_map_item_t map_item;\r
-       uint8_t port_num;       /* port number on the current node */\r
-       uint8_t remote_port_num;        /* port number on the remote node */\r
-       uint32_t counter_up;    /* number of allocated routes upwards */\r
-       uint32_t counter_down;  /* number of allocated routes downwards */\r
-} ftree_port_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_port_group_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef union ftree_hca_or_sw_ {\r
-       struct ftree_hca_t_ *p_hca;\r
-       struct ftree_sw_t_ *p_sw;\r
-} ftree_hca_or_sw;\r
-\r
-typedef struct ftree_port_group_t_ {\r
-       cl_map_item_t map_item;\r
-       uint16_t base_lid;      /* base lid of the current node */\r
-       uint16_t remote_base_lid;       /* base lid of the remote node */\r
-       ib_net64_t port_guid;   /* port guid of this port */\r
-       ib_net64_t node_guid;   /* this node's guid */\r
-       uint8_t node_type;      /* this node's type */\r
-       ib_net64_t remote_port_guid;    /* port guid of the remote port */\r
-       ib_net64_t remote_node_guid;    /* node guid of the remote node */\r
-       uint8_t remote_node_type;       /* IB_NODE_TYPE_{CA,SWITCH,ROUTER,...} */\r
-       ftree_hca_or_sw hca_or_sw;      /* pointer to this hca/switch */\r
-       ftree_hca_or_sw remote_hca_or_sw;       /* pointer to remote hca/switch */\r
-       cl_ptr_vector_t ports;  /* vector of ports to the same lid */\r
-       boolean_t is_cn;        /* whether this port is a compute node */\r
-       boolean_t is_io;        /* whether this port is an I/O node */\r
-       uint32_t counter_down;  /* number of allocated routes downwards */\r
-       uint32_t counter_up;    /* number of allocated routes upwards */\r
-} ftree_port_group_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_sw_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef struct ftree_sw_t_ {\r
-       cl_map_item_t map_item;\r
-       osm_switch_t *p_osm_sw;\r
-       uint32_t rank;\r
-       ftree_tuple_t tuple;\r
-       uint16_t base_lid;\r
-       ftree_port_group_t **down_port_groups;\r
-       uint8_t down_port_groups_num;\r
-       ftree_port_group_t **sibling_port_groups;\r
-       uint8_t sibling_port_groups_num;\r
-       ftree_port_group_t **up_port_groups;\r
-       uint8_t up_port_groups_num;\r
-       boolean_t is_leaf;\r
-       unsigned down_port_groups_idx;\r
-       uint8_t *hops;\r
-       uint32_t min_counter_down;\r
-       boolean_t counter_up_changed;\r
-} ftree_sw_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_hca_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef struct ftree_hca_t_ {\r
-       cl_map_item_t map_item;\r
-       osm_node_t *p_osm_node;\r
-       ftree_port_group_t **up_port_groups;\r
-       uint16_t up_port_groups_num;\r
-       unsigned cn_num;\r
-} ftree_hca_t;\r
-\r
-/***************************************************\r
- **\r
- **  ftree_fabric_t definition\r
- **\r
- ***************************************************/\r
-\r
-typedef struct ftree_fabric_t_ {\r
-       osm_opensm_t *p_osm;\r
-       cl_qmap_t hca_tbl;\r
-       cl_qmap_t sw_tbl;\r
-       cl_qmap_t sw_by_tuple_tbl;\r
-       cl_qmap_t cn_guid_tbl;\r
-       cl_qmap_t io_guid_tbl;\r
-       unsigned cn_num;\r
-       unsigned ca_ports;\r
-       uint8_t leaf_switch_rank;\r
-       uint8_t max_switch_rank;\r
-       ftree_sw_t **leaf_switches;\r
-       uint32_t leaf_switches_num;\r
-       uint16_t max_cn_per_leaf;\r
-       uint16_t lft_max_lid;\r
-       boolean_t fabric_built;\r
-} ftree_fabric_t;\r
-\r
-/***************************************************\r
- **\r
- ** comparators\r
- **\r
- ***************************************************/\r
-\r
-static int OSM_CDECL compare_switches_by_index(IN const void *p1, IN const void *p2)\r
-{\r
-       ftree_sw_t **pp_sw1 = (ftree_sw_t **) p1;\r
-       ftree_sw_t **pp_sw2 = (ftree_sw_t **) p2;\r
-\r
-       uint16_t i;\r
-       for (i = 0; i < FTREE_TUPLE_LEN; i++) {\r
-               if ((*pp_sw1)->tuple[i] > (*pp_sw2)->tuple[i])\r
-                       return 1;\r
-               if ((*pp_sw1)->tuple[i] < (*pp_sw2)->tuple[i])\r
-                       return -1;\r
-       }\r
-       return 0;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static int OSM_CDECL\r
-compare_port_groups_by_remote_switch_index(IN const void *p1, IN const void *p2)\r
-{\r
-       ftree_port_group_t **pp_g1 = (ftree_port_group_t **) p1;\r
-       ftree_port_group_t **pp_g2 = (ftree_port_group_t **) p2;\r
-\r
-       return\r
-           compare_switches_by_index(&((*pp_g1)->remote_hca_or_sw.p_sw),\r
-                                     &((*pp_g2)->remote_hca_or_sw.p_sw));\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_tuple_t functions\r
- **\r
- ***************************************************/\r
-\r
-static void tuple_init(IN ftree_tuple_t tuple)\r
-{\r
-       memset(tuple, 0xFF, FTREE_TUPLE_LEN);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static inline boolean_t tuple_assigned(IN ftree_tuple_t tuple)\r
-{\r
-       return (tuple[0] != 0xFF);\r
-}\r
-\r
-/***************************************************/\r
-\r
-#define FTREE_TUPLE_BUFFERS_NUM 6\r
-\r
-static char *tuple_to_str(IN ftree_tuple_t tuple)\r
-{\r
-       static char buffer[FTREE_TUPLE_BUFFERS_NUM][FTREE_TUPLE_BUFF_LEN];\r
-       static uint8_t ind = 0;\r
-       char *ret_buffer;\r
-       uint32_t i;\r
-\r
-       if (!tuple_assigned(tuple))\r
-               return "INDEX.NOT.ASSIGNED";\r
-\r
-       buffer[ind][0] = '\0';\r
-\r
-       for (i = 0; (i < FTREE_TUPLE_LEN) && (tuple[i] != 0xFF); i++) {\r
-               if ((strlen(buffer[ind]) + 10) > FTREE_TUPLE_BUFF_LEN)\r
-                       return "INDEX.TOO.LONG";\r
-               if (i != 0)\r
-                       strcat(buffer[ind], ".");\r
-               sprintf(&buffer[ind][strlen(buffer[ind])], "%u", tuple[i]);\r
-       }\r
-\r
-       ret_buffer = buffer[ind];\r
-       ind = (ind + 1) % FTREE_TUPLE_BUFFERS_NUM;\r
-       return ret_buffer;\r
-}                              /* tuple_to_str() */\r
-\r
-/***************************************************/\r
-\r
-static inline ftree_tuple_key_t tuple_to_key(IN ftree_tuple_t tuple)\r
-{\r
-       ftree_tuple_key_t key;\r
-       memcpy(&key, tuple, FTREE_TUPLE_LEN);\r
-       return key;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static inline void tuple_from_key(IN ftree_tuple_t tuple,\r
-                                 IN ftree_tuple_key_t key)\r
-{\r
-       memcpy(tuple, &key, FTREE_TUPLE_LEN);\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_sw_tbl_element_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_sw_tbl_element_t *sw_tbl_element_create(IN ftree_sw_t * p_sw)\r
-{\r
-       ftree_sw_tbl_element_t *p_element =\r
-           (ftree_sw_tbl_element_t *) malloc(sizeof(ftree_sw_tbl_element_t));\r
-       if (!p_element)\r
-               return NULL;\r
-       memset(p_element, 0, sizeof(ftree_sw_tbl_element_t));\r
-\r
-       p_element->p_sw = p_sw;\r
-       return p_element;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void sw_tbl_element_destroy(IN ftree_sw_tbl_element_t * p_element)\r
-{\r
-       if (!p_element)\r
-               return;\r
-       free(p_element);\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_port_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_port_t *port_create(IN uint8_t port_num,\r
-                                IN uint8_t remote_port_num)\r
-{\r
-       ftree_port_t *p_port = (ftree_port_t *) malloc(sizeof(ftree_port_t));\r
-       if (!p_port)\r
-               return NULL;\r
-       memset(p_port, 0, sizeof(ftree_port_t));\r
-\r
-       p_port->port_num = port_num;\r
-       p_port->remote_port_num = remote_port_num;\r
-\r
-       return p_port;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void port_destroy(IN ftree_port_t * p_port)\r
-{\r
-       if (p_port)\r
-               free(p_port);\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_port_group_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_port_group_t *port_group_create(IN uint16_t base_lid,\r
-                                            IN uint16_t remote_base_lid,\r
-                                            IN ib_net64_t port_guid,\r
-                                            IN ib_net64_t node_guid,\r
-                                            IN uint8_t node_type,\r
-                                            IN void *p_hca_or_sw,\r
-                                            IN ib_net64_t remote_port_guid,\r
-                                            IN ib_net64_t remote_node_guid,\r
-                                            IN uint8_t remote_node_type,\r
-                                            IN void *p_remote_hca_or_sw,\r
-                                            IN boolean_t is_cn,\r
-                                            IN boolean_t is_io)\r
-{\r
-       ftree_port_group_t *p_group =\r
-           (ftree_port_group_t *) malloc(sizeof(ftree_port_group_t));\r
-       if (p_group == NULL)\r
-               return NULL;\r
-       memset(p_group, 0, sizeof(ftree_port_group_t));\r
-\r
-       p_group->base_lid = base_lid;\r
-       p_group->remote_base_lid = remote_base_lid;\r
-       memcpy(&p_group->port_guid, &port_guid, sizeof(ib_net64_t));\r
-       memcpy(&p_group->node_guid, &node_guid, sizeof(ib_net64_t));\r
-       memcpy(&p_group->remote_port_guid, &remote_port_guid,\r
-              sizeof(ib_net64_t));\r
-       memcpy(&p_group->remote_node_guid, &remote_node_guid,\r
-              sizeof(ib_net64_t));\r
-\r
-       p_group->node_type = node_type;\r
-       switch (node_type) {\r
-       case IB_NODE_TYPE_CA:\r
-               p_group->hca_or_sw.p_hca = (ftree_hca_t *) p_hca_or_sw;\r
-               break;\r
-       case IB_NODE_TYPE_SWITCH:\r
-               p_group->hca_or_sw.p_sw = (ftree_sw_t *) p_hca_or_sw;\r
-               break;\r
-       default:\r
-               /* we shouldn't get here - port is created only in hca or switch */\r
-               CL_ASSERT(0);\r
-       }\r
-\r
-       p_group->remote_node_type = remote_node_type;\r
-       switch (remote_node_type) {\r
-       case IB_NODE_TYPE_CA:\r
-               p_group->remote_hca_or_sw.p_hca =\r
-                   (ftree_hca_t *) p_remote_hca_or_sw;\r
-               break;\r
-       case IB_NODE_TYPE_SWITCH:\r
-               p_group->remote_hca_or_sw.p_sw =\r
-                   (ftree_sw_t *) p_remote_hca_or_sw;\r
-               break;\r
-       default:\r
-               /* we shouldn't get here - port is created only in hca or switch */\r
-               CL_ASSERT(0);\r
-       }\r
-\r
-       cl_ptr_vector_init(&p_group->ports, 0,  /* min size */\r
-                          8);  /* grow size */\r
-       p_group->is_cn = is_cn;\r
-       p_group->is_io = is_io;\r
-       return p_group;\r
-}                              /* port_group_create() */\r
-\r
-/***************************************************/\r
-\r
-static void port_group_destroy(IN ftree_port_group_t * p_group)\r
-{\r
-       uint32_t i;\r
-       uint32_t size;\r
-       ftree_port_t *p_port;\r
-\r
-       if (!p_group)\r
-               return;\r
-\r
-       /* remove all the elements of p_group->ports vector */\r
-       size = cl_ptr_vector_get_size(&p_group->ports);\r
-       for (i = 0; i < size; i++) {\r
-               cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);\r
-               port_destroy(p_port);\r
-       }\r
-       cl_ptr_vector_destroy(&p_group->ports);\r
-       free(p_group);\r
-}                              /* port_group_destroy() */\r
-\r
-/***************************************************/\r
-\r
-static void port_group_dump(IN ftree_fabric_t * p_ftree,\r
-                           IN ftree_port_group_t * p_group,\r
-                           IN ftree_direction_t direction)\r
-{\r
-       ftree_port_t *p_port;\r
-       uint32_t size;\r
-       uint32_t i;\r
-       char buff[10 * 1024];\r
-\r
-       if (!p_group)\r
-               return;\r
-\r
-       if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       size = cl_ptr_vector_get_size(&p_group->ports);\r
-       buff[0] = '\0';\r
-\r
-       for (i = 0; i < size; i++) {\r
-               cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);\r
-               CL_ASSERT(p_port);\r
-\r
-               if (i != 0)\r
-                       strcat(buff, ", ");\r
-               sprintf(buff + strlen(buff), "%u", p_port->port_num);\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "    Port Group of size %u, port(s): %s, direction: %s\n"\r
-               "                  Local <--> Remote GUID (LID):"\r
-               "0x%016" PRIx64 " (0x%04x) <--> 0x%016" PRIx64 " (0x%04x)\n",\r
-               size, buff,\r
-               (direction == FTREE_DIRECTION_DOWN) ? "DOWN" : (direction ==\r
-                                                               FTREE_DIRECTION_SAME)\r
-               ? "SIBLING" : "UP", cl_ntoh64(p_group->port_guid),\r
-               p_group->base_lid, cl_ntoh64(p_group->remote_port_guid),\r
-               p_group->remote_base_lid);\r
-\r
-}                              /* port_group_dump() */\r
-\r
-/***************************************************/\r
-\r
-static void port_group_add_port(IN ftree_port_group_t * p_group,\r
-                               IN uint8_t port_num, IN uint8_t remote_port_num)\r
-{\r
-       uint16_t i;\r
-       ftree_port_t *p_port;\r
-\r
-       for (i = 0; i < cl_ptr_vector_get_size(&p_group->ports); i++) {\r
-               cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);\r
-               if (p_port->port_num == port_num)\r
-                       return;\r
-       }\r
-\r
-       p_port = port_create(port_num, remote_port_num);\r
-       cl_ptr_vector_insert(&p_group->ports, p_port, NULL);\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_sw_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_sw_t *sw_create(IN ftree_fabric_t * p_ftree,\r
-                            IN osm_switch_t * p_osm_sw)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       uint8_t ports_num;\r
-\r
-       /* make sure that the switch has ports */\r
-       if (p_osm_sw->num_ports == 1)\r
-               return NULL;\r
-\r
-       p_sw = (ftree_sw_t *) malloc(sizeof(ftree_sw_t));\r
-       if (p_sw == NULL)\r
-               return NULL;\r
-       memset(p_sw, 0, sizeof(ftree_sw_t));\r
-\r
-       p_sw->p_osm_sw = p_osm_sw;\r
-       p_sw->rank = 0xFFFFFFFF;\r
-       tuple_init(p_sw->tuple);\r
-\r
-       p_sw->base_lid =\r
-           cl_ntoh16(osm_node_get_base_lid(p_sw->p_osm_sw->p_node, 0));\r
-\r
-       ports_num = osm_node_get_num_physp(p_sw->p_osm_sw->p_node);\r
-       p_sw->down_port_groups =\r
-           (ftree_port_group_t **) malloc(ports_num *\r
-                                          sizeof(ftree_port_group_t *));\r
-       p_sw->up_port_groups =\r
-           (ftree_port_group_t **) malloc(ports_num *\r
-                                          sizeof(ftree_port_group_t *));\r
-       p_sw->sibling_port_groups =\r
-           (ftree_port_group_t **) malloc(ports_num *\r
-                                          sizeof(ftree_port_group_t *));\r
-\r
-       if (!p_sw->down_port_groups || !p_sw->up_port_groups\r
-           || !p_sw->sibling_port_groups)\r
-               return NULL;\r
-\r
-       /* initialize lft buffer */\r
-       memset(p_osm_sw->new_lft, OSM_NO_PATH, p_osm_sw->lft_size);\r
-       p_sw->hops = malloc((p_osm_sw->max_lid_ho + 1) * sizeof(*(p_sw->hops)));\r
-       if (p_sw->hops == NULL)\r
-               return NULL;\r
-       memset(p_sw->hops, OSM_NO_PATH, p_osm_sw->max_lid_ho + 1);\r
-\r
-       return p_sw;\r
-}                              /* sw_create() */\r
-\r
-/***************************************************/\r
-\r
-static void sw_destroy(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)\r
-{\r
-       uint8_t i;\r
-\r
-       if (!p_sw)\r
-               return;\r
-       free(p_sw->hops);\r
-\r
-       for (i = 0; i < p_sw->down_port_groups_num; i++)\r
-               port_group_destroy(p_sw->down_port_groups[i]);\r
-       for (i = 0; i < p_sw->sibling_port_groups_num; i++)\r
-               port_group_destroy(p_sw->sibling_port_groups[i]);\r
-       for (i = 0; i < p_sw->up_port_groups_num; i++)\r
-               port_group_destroy(p_sw->up_port_groups[i]);\r
-       if (p_sw->down_port_groups)\r
-               free(p_sw->down_port_groups);\r
-       if (p_sw->sibling_port_groups)\r
-               free(p_sw->sibling_port_groups);\r
-       if (p_sw->up_port_groups)\r
-               free(p_sw->up_port_groups);\r
-\r
-       free(p_sw);\r
-}                              /* sw_destroy() */\r
-\r
-/***************************************************/\r
-\r
-static uint64_t sw_get_guid_no(IN ftree_sw_t * p_sw)\r
-{\r
-       if (!p_sw)\r
-               return 0;\r
-       return osm_node_get_node_guid(p_sw->p_osm_sw->p_node);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static uint64_t sw_get_guid_ho(IN ftree_sw_t * p_sw)\r
-{\r
-       return cl_ntoh64(sw_get_guid_no(p_sw));\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void sw_dump(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)\r
-{\r
-       uint32_t i;\r
-\r
-       if (!p_sw)\r
-               return;\r
-\r
-       if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "Switch index: %s, GUID: 0x%016" PRIx64\r
-               ", Ports: %u DOWN, %u SIBLINGS, %u UP\n",\r
-               tuple_to_str(p_sw->tuple), sw_get_guid_ho(p_sw),\r
-               p_sw->down_port_groups_num, p_sw->sibling_port_groups_num,\r
-               p_sw->up_port_groups_num);\r
-\r
-       for (i = 0; i < p_sw->down_port_groups_num; i++)\r
-               port_group_dump(p_ftree, p_sw->down_port_groups[i],\r
-                               FTREE_DIRECTION_DOWN);\r
-       for (i = 0; i < p_sw->sibling_port_groups_num; i++)\r
-               port_group_dump(p_ftree, p_sw->sibling_port_groups[i],\r
-                               FTREE_DIRECTION_SAME);\r
-       for (i = 0; i < p_sw->up_port_groups_num; i++)\r
-               port_group_dump(p_ftree, p_sw->up_port_groups[i],\r
-                               FTREE_DIRECTION_UP);\r
-\r
-}                              /* sw_dump() */\r
-\r
-/***************************************************/\r
-\r
-static boolean_t sw_ranked(IN ftree_sw_t * p_sw)\r
-{\r
-       return (p_sw->rank != 0xFFFFFFFF);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static ftree_port_group_t *sw_get_port_group_by_remote_lid(IN ftree_sw_t * p_sw,\r
-                                                          IN uint16_t\r
-                                                          remote_base_lid,\r
-                                                          IN ftree_direction_t\r
-                                                          direction)\r
-{\r
-       uint32_t i;\r
-       uint32_t size;\r
-       ftree_port_group_t **port_groups;\r
-\r
-       if (direction == FTREE_DIRECTION_UP) {\r
-               port_groups = p_sw->up_port_groups;\r
-               size = p_sw->up_port_groups_num;\r
-       } else if (direction == FTREE_DIRECTION_SAME) {\r
-               port_groups = p_sw->sibling_port_groups;\r
-               size = p_sw->sibling_port_groups_num;\r
-       } else {\r
-               port_groups = p_sw->down_port_groups;\r
-               size = p_sw->down_port_groups_num;\r
-       }\r
-\r
-       for (i = 0; i < size; i++)\r
-               if (remote_base_lid == port_groups[i]->remote_base_lid)\r
-                       return port_groups[i];\r
-\r
-       return NULL;\r
-}                              /* sw_get_port_group_by_remote_lid() */\r
-\r
-/***************************************************/\r
-\r
-static void sw_add_port(IN ftree_sw_t * p_sw, IN uint8_t port_num,\r
-                       IN uint8_t remote_port_num, IN uint16_t base_lid,\r
-                       IN uint16_t remote_base_lid, IN ib_net64_t port_guid,\r
-                       IN ib_net64_t remote_port_guid,\r
-                       IN ib_net64_t remote_node_guid,\r
-                       IN uint8_t remote_node_type,\r
-                       IN void *p_remote_hca_or_sw,\r
-                       IN ftree_direction_t direction)\r
-{\r
-       ftree_port_group_t *p_group =\r
-           sw_get_port_group_by_remote_lid(p_sw, remote_base_lid, direction);\r
-\r
-       if (!p_group) {\r
-               p_group = port_group_create(base_lid, remote_base_lid,\r
-                                           port_guid, sw_get_guid_no(p_sw),\r
-                                           IB_NODE_TYPE_SWITCH, p_sw,\r
-                                           remote_port_guid, remote_node_guid,\r
-                                           remote_node_type,\r
-                                           p_remote_hca_or_sw, FALSE, FALSE);\r
-               CL_ASSERT(p_group);\r
-\r
-               if (direction == FTREE_DIRECTION_UP) {\r
-                       p_sw->up_port_groups[p_sw->up_port_groups_num++] =\r
-                           p_group;\r
-               } else if (direction == FTREE_DIRECTION_SAME) {\r
-                       p_sw->\r
-                           sibling_port_groups[p_sw->sibling_port_groups_num++]\r
-                           = p_group;\r
-               } else\r
-                       p_sw->down_port_groups[p_sw->down_port_groups_num++] =\r
-                           p_group;\r
-       }\r
-       port_group_add_port(p_group, port_num, remote_port_num);\r
-\r
-}                              /* sw_add_port() */\r
-\r
-/***************************************************/\r
-\r
-static inline cl_status_t sw_set_hops(IN ftree_sw_t * p_sw, IN uint16_t lid,\r
-                                     IN uint8_t port_num, IN uint8_t hops,\r
-                                     IN boolean_t is_target_sw)\r
-{\r
-       /* set local min hop table(LID) */\r
-       p_sw->hops[lid] = hops;\r
-       if (is_target_sw)\r
-               return osm_switch_set_hops(p_sw->p_osm_sw, lid, port_num, hops);\r
-       return 0;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static int set_hops_on_remote_sw(IN ftree_port_group_t * p_group,\r
-                                IN uint16_t target_lid, IN uint8_t hops,\r
-                                IN boolean_t is_target_sw)\r
-{\r
-       ftree_port_t *p_port;\r
-       uint8_t i, ports_num;\r
-       ftree_sw_t *p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-\r
-       /* if lid is a switch, we set the min hop table in the osm_switch struct */\r
-       CL_ASSERT(p_group->remote_node_type == IB_NODE_TYPE_SWITCH);\r
-       p_remote_sw->hops[target_lid] = hops;\r
-\r
-       /* If taget lid is a switch we set the min hop table values\r
-        * for each port on the associated osm_sw struct */\r
-       if (!is_target_sw)\r
-               return 0;\r
-\r
-       ports_num = (uint8_t) cl_ptr_vector_get_size(&p_group->ports);\r
-       for (i = 0; i < ports_num; i++) {\r
-               cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);\r
-               if (sw_set_hops(p_remote_sw, target_lid,\r
-                               p_port->remote_port_num, hops, is_target_sw))\r
-                       return -1;\r
-       }\r
-       return 0;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static inline uint8_t\r
-sw_get_least_hops(IN ftree_sw_t * p_sw, IN uint16_t target_lid)\r
-{\r
-       CL_ASSERT(p_sw->hops != NULL);\r
-       return p_sw->hops[target_lid];\r
-}\r
-\r
-/***************************************************\r
- **\r
- ** ftree_hca_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_hca_t *hca_create(IN osm_node_t * p_osm_node)\r
-{\r
-       ftree_hca_t *p_hca = (ftree_hca_t *) malloc(sizeof(ftree_hca_t));\r
-       if (p_hca == NULL)\r
-               return NULL;\r
-       memset(p_hca, 0, sizeof(ftree_hca_t));\r
-\r
-       p_hca->p_osm_node = p_osm_node;\r
-       p_hca->up_port_groups = (ftree_port_group_t **)\r
-           malloc(osm_node_get_num_physp(p_hca->p_osm_node) *\r
-                  sizeof(ftree_port_group_t *));\r
-       if (!p_hca->up_port_groups)\r
-               return NULL;\r
-       p_hca->up_port_groups_num = 0;\r
-       return p_hca;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void hca_destroy(IN ftree_hca_t * p_hca)\r
-{\r
-       uint32_t i;\r
-\r
-       if (!p_hca)\r
-               return;\r
-\r
-       for (i = 0; i < p_hca->up_port_groups_num; i++)\r
-               port_group_destroy(p_hca->up_port_groups[i]);\r
-\r
-       if (p_hca->up_port_groups)\r
-               free(p_hca->up_port_groups);\r
-\r
-       free(p_hca);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static uint64_t hca_get_guid_no(IN ftree_hca_t * p_hca)\r
-{\r
-       if (!p_hca)\r
-               return 0;\r
-       return osm_node_get_node_guid(p_hca->p_osm_node);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static uint64_t hca_get_guid_ho(IN ftree_hca_t * p_hca)\r
-{\r
-       return cl_ntoh64(hca_get_guid_no(p_hca));\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void hca_dump(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)\r
-{\r
-       uint32_t i;\r
-\r
-       if (!p_hca)\r
-               return;\r
-\r
-       if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "CA GUID: 0x%016" PRIx64 ", Ports: %u UP\n",\r
-               hca_get_guid_ho(p_hca), p_hca->up_port_groups_num);\r
-\r
-       for (i = 0; i < p_hca->up_port_groups_num; i++)\r
-               port_group_dump(p_ftree, p_hca->up_port_groups[i],\r
-                               FTREE_DIRECTION_UP);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static ftree_port_group_t *hca_get_port_group_by_remote_lid(IN ftree_hca_t *\r
-                                                           p_hca,\r
-                                                           IN uint16_t\r
-                                                           remote_base_lid)\r
-{\r
-       uint32_t i;\r
-       for (i = 0; i < p_hca->up_port_groups_num; i++)\r
-               if (remote_base_lid ==\r
-                   p_hca->up_port_groups[i]->remote_base_lid)\r
-                       return p_hca->up_port_groups[i];\r
-\r
-       return NULL;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void hca_add_port(IN ftree_hca_t * p_hca, IN uint8_t port_num,\r
-                        IN uint8_t remote_port_num, IN uint16_t base_lid,\r
-                        IN uint16_t remote_base_lid, IN ib_net64_t port_guid,\r
-                        IN ib_net64_t remote_port_guid,\r
-                        IN ib_net64_t remote_node_guid,\r
-                        IN uint8_t remote_node_type,\r
-                        IN void *p_remote_hca_or_sw, IN boolean_t is_cn,\r
-                        IN boolean_t is_io)\r
-{\r
-       ftree_port_group_t *p_group;\r
-\r
-       /* this function is supposed to be called only for adding ports\r
-          in hca's that lead to switches */\r
-       CL_ASSERT(remote_node_type == IB_NODE_TYPE_SWITCH);\r
-\r
-       p_group = hca_get_port_group_by_remote_lid(p_hca, remote_base_lid);\r
-\r
-       if (!p_group) {\r
-               p_group = port_group_create(base_lid, remote_base_lid,\r
-                                           port_guid, hca_get_guid_no(p_hca),\r
-                                           IB_NODE_TYPE_CA, p_hca,\r
-                                           remote_port_guid, remote_node_guid,\r
-                                           remote_node_type,\r
-                                           p_remote_hca_or_sw, is_cn, is_io);\r
-               p_hca->up_port_groups[p_hca->up_port_groups_num++] = p_group;\r
-       }\r
-       port_group_add_port(p_group, port_num, remote_port_num);\r
-\r
-}                              /* hca_add_port() */\r
-\r
-/***************************************************\r
- **\r
- ** ftree_fabric_t functions\r
- **\r
- ***************************************************/\r
-\r
-static ftree_fabric_t *fabric_create()\r
-{\r
-       ftree_fabric_t *p_ftree =\r
-           (ftree_fabric_t *) malloc(sizeof(ftree_fabric_t));\r
-       if (p_ftree == NULL)\r
-               return NULL;\r
-\r
-       memset(p_ftree, 0, sizeof(ftree_fabric_t));\r
-\r
-       cl_qmap_init(&p_ftree->hca_tbl);\r
-       cl_qmap_init(&p_ftree->sw_tbl);\r
-       cl_qmap_init(&p_ftree->sw_by_tuple_tbl);\r
-       cl_qmap_init(&p_ftree->cn_guid_tbl);\r
-       cl_qmap_init(&p_ftree->io_guid_tbl);\r
-\r
-       return p_ftree;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_clear(ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_hca_t *p_hca;\r
-       ftree_hca_t *p_next_hca;\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_next_sw;\r
-       ftree_sw_tbl_element_t *p_element;\r
-       ftree_sw_tbl_element_t *p_next_element;\r
-       name_map_item_t *p_guid_element, *p_next_guid_element;\r
-\r
-       if (!p_ftree)\r
-               return;\r
-\r
-       /* remove all the elements of hca_tbl */\r
-\r
-       p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-       while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-               p_hca = p_next_hca;\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-               hca_destroy(p_hca);\r
-       }\r
-       cl_qmap_remove_all(&p_ftree->hca_tbl);\r
-\r
-       /* remove all the elements of sw_tbl */\r
-\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-               sw_destroy(p_ftree, p_sw);\r
-       }\r
-       cl_qmap_remove_all(&p_ftree->sw_tbl);\r
-\r
-       /* remove all the elements of sw_by_tuple_tbl */\r
-\r
-       p_next_element =\r
-           (ftree_sw_tbl_element_t *) cl_qmap_head(&p_ftree->sw_by_tuple_tbl);\r
-       while (p_next_element != (ftree_sw_tbl_element_t *)\r
-              cl_qmap_end(&p_ftree->sw_by_tuple_tbl)) {\r
-               p_element = p_next_element;\r
-               p_next_element = (ftree_sw_tbl_element_t *)\r
-                   cl_qmap_next(&p_element->map_item);\r
-               sw_tbl_element_destroy(p_element);\r
-       }\r
-       cl_qmap_remove_all(&p_ftree->sw_by_tuple_tbl);\r
-\r
-       /* remove all the elements of cn_guid_tbl */\r
-       p_next_guid_element =\r
-           (name_map_item_t *) cl_qmap_head(&p_ftree->cn_guid_tbl);\r
-       while (p_next_guid_element !=\r
-              (name_map_item_t *) cl_qmap_end(&p_ftree->cn_guid_tbl)) {\r
-               p_guid_element = p_next_guid_element;\r
-               p_next_guid_element =\r
-                   (name_map_item_t *) cl_qmap_next(&p_guid_element->item);\r
-               free(p_guid_element);\r
-       }\r
-       cl_qmap_remove_all(&p_ftree->cn_guid_tbl);\r
-\r
-       /* remove all the elements of io_guid_tbl */\r
-       p_next_guid_element =\r
-           (name_map_item_t *) cl_qmap_head(&p_ftree->io_guid_tbl);\r
-       while (p_next_guid_element !=\r
-              (name_map_item_t *) cl_qmap_end(&p_ftree->io_guid_tbl)) {\r
-               p_guid_element = p_next_guid_element;\r
-               p_next_guid_element =\r
-                   (name_map_item_t *) cl_qmap_next(&p_guid_element->item);\r
-               free(p_guid_element);\r
-       }\r
-       cl_qmap_remove_all(&p_ftree->io_guid_tbl);\r
-\r
-       /* free the leaf switches array */\r
-       if ((p_ftree->leaf_switches_num > 0) && (p_ftree->leaf_switches))\r
-               free(p_ftree->leaf_switches);\r
-\r
-       p_ftree->leaf_switches_num = 0;\r
-       p_ftree->cn_num = 0;\r
-       p_ftree->ca_ports = 0;\r
-       p_ftree->leaf_switch_rank = 0;\r
-       p_ftree->max_switch_rank = 0;\r
-       p_ftree->max_cn_per_leaf = 0;\r
-       p_ftree->lft_max_lid = 0;\r
-       p_ftree->leaf_switches = NULL;\r
-       p_ftree->fabric_built = FALSE;\r
-\r
-}                              /* fabric_destroy() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_destroy(ftree_fabric_t * p_ftree)\r
-{\r
-       if (!p_ftree)\r
-               return;\r
-       fabric_clear(p_ftree);\r
-       free(p_ftree);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static uint8_t fabric_get_rank(ftree_fabric_t * p_ftree)\r
-{\r
-       return p_ftree->leaf_switch_rank + 1;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_add_hca(ftree_fabric_t * p_ftree, osm_node_t * p_osm_node)\r
-{\r
-       ftree_hca_t *p_hca = hca_create(p_osm_node);\r
-\r
-       CL_ASSERT(osm_node_get_type(p_osm_node) == IB_NODE_TYPE_CA);\r
-\r
-       cl_qmap_insert(&p_ftree->hca_tbl, p_osm_node->node_info.node_guid,\r
-                      &p_hca->map_item);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_add_sw(ftree_fabric_t * p_ftree, osm_switch_t * p_osm_sw)\r
-{\r
-       ftree_sw_t *p_sw = sw_create(p_ftree, p_osm_sw);\r
-\r
-       CL_ASSERT(osm_node_get_type(p_osm_sw->p_node) == IB_NODE_TYPE_SWITCH);\r
-\r
-       cl_qmap_insert(&p_ftree->sw_tbl, p_osm_sw->p_node->node_info.node_guid,\r
-                      &p_sw->map_item);\r
-\r
-       /* track the max lid (in host order) that exists in the fabric */\r
-       if (p_sw->base_lid > p_ftree->lft_max_lid)\r
-               p_ftree->lft_max_lid = p_sw->base_lid;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_add_sw_by_tuple(IN ftree_fabric_t * p_ftree,\r
-                                  IN ftree_sw_t * p_sw)\r
-{\r
-       CL_ASSERT(tuple_assigned(p_sw->tuple));\r
-\r
-       cl_qmap_insert(&p_ftree->sw_by_tuple_tbl, tuple_to_key(p_sw->tuple),\r
-                      &sw_tbl_element_create(p_sw)->map_item);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static ftree_sw_t *fabric_get_sw_by_tuple(IN ftree_fabric_t * p_ftree,\r
-                                         IN ftree_tuple_t tuple)\r
-{\r
-       ftree_sw_tbl_element_t *p_element;\r
-\r
-       CL_ASSERT(tuple_assigned(tuple));\r
-\r
-       tuple_to_key(tuple);\r
-\r
-       p_element =\r
-           (ftree_sw_tbl_element_t *) cl_qmap_get(&p_ftree->sw_by_tuple_tbl,\r
-                                                  tuple_to_key(tuple));\r
-       if (p_element ==\r
-           (ftree_sw_tbl_element_t *) cl_qmap_end(&p_ftree->sw_by_tuple_tbl))\r
-               return NULL;\r
-\r
-       return p_element->p_sw;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static ftree_sw_t *fabric_get_sw_by_guid(IN ftree_fabric_t * p_ftree,\r
-                                        IN uint64_t guid)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       p_sw = (ftree_sw_t *) cl_qmap_get(&p_ftree->sw_tbl, guid);\r
-       if (p_sw == (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl))\r
-               return NULL;\r
-       return p_sw;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static ftree_hca_t *fabric_get_hca_by_guid(IN ftree_fabric_t * p_ftree,\r
-                                          IN uint64_t guid)\r
-{\r
-       ftree_hca_t *p_hca;\r
-       p_hca = (ftree_hca_t *) cl_qmap_get(&p_ftree->hca_tbl, guid);\r
-       if (p_hca == (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl))\r
-               return NULL;\r
-       return p_hca;\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_dump(ftree_fabric_t * p_ftree)\r
-{\r
-       uint32_t i;\r
-       ftree_hca_t *p_hca;\r
-       ftree_sw_t *p_sw;\r
-\r
-       if (!osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))\r
-               return;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "\n"\r
-               "                       |-------------------------------|\n"\r
-               "                       |-  Full fabric topology dump  -|\n"\r
-               "                       |-------------------------------|\n\n");\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "-- CAs:\n");\r
-\r
-       for (p_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-            p_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl);\r
-            p_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item)) {\r
-               hca_dump(p_ftree, p_hca);\r
-       }\r
-\r
-       for (i = 0; i <= p_ftree->max_switch_rank; i++) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "-- Rank %u switches\n", i);\r
-               for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-                    p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);\r
-                    p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {\r
-                       if (p_sw->rank == i)\r
-                               sw_dump(p_ftree, p_sw);\r
-               }\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, "\n"\r
-               "                       |---------------------------------------|\n"\r
-               "                       |- Full fabric topology dump completed -|\n"\r
-               "                       |---------------------------------------|\n\n");\r
-}                              /* fabric_dump() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_dump_general_info(IN ftree_fabric_t * p_ftree)\r
-{\r
-       uint32_t i, j;\r
-       ftree_sw_t *p_sw;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-               "General fabric topology info\n");\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-               "============================\n");\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-               "  - FatTree rank (roots to leaf switches): %u\n",\r
-               p_ftree->leaf_switch_rank + 1);\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-               "  - FatTree max switch rank: %u\n", p_ftree->max_switch_rank);\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-               "  - Fabric has %u CAs, %u CA ports (%u of them CNs), %u switches\n",\r
-               cl_qmap_count(&p_ftree->hca_tbl), p_ftree->ca_ports,\r
-               p_ftree->cn_num, cl_qmap_count(&p_ftree->sw_tbl));\r
-\r
-       CL_ASSERT(p_ftree->ca_ports >= p_ftree->cn_num);\r
-\r
-       for (i = 0; i <= p_ftree->max_switch_rank; i++) {\r
-               j = 0;\r
-               for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-                    p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);\r
-                    p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {\r
-                       if (p_sw->rank == i)\r
-                               j++;\r
-               }\r
-               if (i == 0)\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                               "  - Fabric has %u switches at rank %u (roots)\n",\r
-                               j, i);\r
-               else if (i == p_ftree->leaf_switch_rank)\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                               "  - Fabric has %u switches at rank %u (%u of them leafs)\n",\r
-                               j, i, p_ftree->leaf_switches_num);\r
-               else\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                               "  - Fabric has %u switches at rank %u\n", j,\r
-                               i);\r
-       }\r
-\r
-       if (osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "  - Root switches:\n");\r
-               for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-                    p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);\r
-                    p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {\r
-                       if (p_sw->rank == 0)\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                                       "      GUID: 0x%016" PRIx64\r
-                                       ", LID: %u, Index %s\n",\r
-                                       sw_get_guid_ho(p_sw),\r
-                                       p_sw->base_lid,\r
-                                       tuple_to_str(p_sw->tuple));\r
-               }\r
-\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "  - Leaf switches (sorted by index):\n");\r
-               for (i = 0; i < p_ftree->leaf_switches_num; i++) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                               "      GUID: 0x%016" PRIx64\r
-                               ", LID: %u, Index %s\n",\r
-                               sw_get_guid_ho(p_ftree->leaf_switches[i]),\r
-                               p_ftree->leaf_switches[i]->base_lid,\r
-                               tuple_to_str(p_ftree->leaf_switches[i]->tuple));\r
-               }\r
-       }\r
-}                              /* fabric_dump_general_info() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_hca_t *p_hca;\r
-       ftree_sw_t *p_sw;\r
-       ftree_port_group_t *p_group_on_sw;\r
-       ftree_port_group_t *p_group_on_hca;\r
-       uint32_t i;\r
-       uint32_t j;\r
-       unsigned printed_hcas_on_leaf;\r
-\r
-       char path[1024];\r
-       FILE *p_hca_ordering_file;\r
-       char *filename = "opensm-ftree-ca-order.dump";\r
-\r
-       snprintf(path, sizeof(path), "%s/%s",\r
-                p_ftree->p_osm->subn.opt.dump_files_dir, filename);\r
-       p_hca_ordering_file = fopen(path, "w");\r
-       if (!p_hca_ordering_file) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB01: "\r
-                       "cannot open file \'%s\': %s\n", filename,\r
-                       strerror(errno));\r
-               return;\r
-       }\r
-\r
-       /* for each leaf switch (in indexing order) */\r
-       for (i = 0; i < p_ftree->leaf_switches_num; i++) {\r
-               p_sw = p_ftree->leaf_switches[i];\r
-               printed_hcas_on_leaf = 0;\r
-\r
-               /* for each real CA (CNs and not) connected to this switch */\r
-               for (j = 0; j < p_sw->down_port_groups_num; j++) {\r
-                       p_group_on_sw = p_sw->down_port_groups[j];\r
-\r
-                       if (p_group_on_sw->remote_node_type != IB_NODE_TYPE_CA)\r
-                               continue;\r
-\r
-                       p_hca = p_group_on_sw->remote_hca_or_sw.p_hca;\r
-                       p_group_on_hca =\r
-                           hca_get_port_group_by_remote_lid(p_hca,\r
-                                                            p_group_on_sw->\r
-                                                            base_lid);\r
-\r
-                       /* treat non-compute nodes as dummies */\r
-                       if (!p_group_on_hca->is_cn)\r
-                               continue;\r
-\r
-                       fprintf(p_hca_ordering_file, "0x%04x\t%s\n",\r
-                               p_group_on_hca->base_lid,\r
-                               p_hca->p_osm_node->print_desc);\r
-\r
-                       printed_hcas_on_leaf++;\r
-               }\r
-\r
-               /* now print missing HCAs */\r
-               for (j = 0;\r
-                    j < (p_ftree->max_cn_per_leaf - printed_hcas_on_leaf); j++)\r
-                       fprintf(p_hca_ordering_file, "0xFFFF\tDUMMY\n");\r
-\r
-       }\r
-       /* done going through all the leaf switches */\r
-\r
-       fclose(p_hca_ordering_file);\r
-}                              /* fabric_dump_hca_ordering() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_assign_tuple(IN ftree_fabric_t * p_ftree,\r
-                               IN ftree_sw_t * p_sw,\r
-                               IN ftree_tuple_t new_tuple)\r
-{\r
-       memcpy(p_sw->tuple, new_tuple, FTREE_TUPLE_LEN);\r
-       fabric_add_sw_by_tuple(p_ftree, p_sw);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_assign_first_tuple(IN ftree_fabric_t * p_ftree,\r
-                                     IN ftree_sw_t * p_sw)\r
-{\r
-       uint8_t i;\r
-       ftree_tuple_t new_tuple;\r
-\r
-       tuple_init(new_tuple);\r
-       new_tuple[0] = (uint8_t) p_sw->rank;\r
-       for (i = 1; i <= p_sw->rank; i++)\r
-               new_tuple[i] = 0;\r
-\r
-       fabric_assign_tuple(p_ftree, p_sw, new_tuple);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void fabric_get_new_tuple(IN ftree_fabric_t * p_ftree,\r
-                                OUT ftree_tuple_t new_tuple,\r
-                                IN ftree_tuple_t from_tuple,\r
-                                IN ftree_direction_t direction)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_tuple_t temp_tuple;\r
-       uint8_t var_index;\r
-       uint8_t i;\r
-\r
-       tuple_init(new_tuple);\r
-       memcpy(temp_tuple, from_tuple, FTREE_TUPLE_LEN);\r
-\r
-       if (direction == FTREE_DIRECTION_DOWN) {\r
-               temp_tuple[0]++;\r
-               var_index = from_tuple[0] + 1;\r
-       } else {\r
-               temp_tuple[0]--;\r
-               var_index = from_tuple[0];\r
-       }\r
-\r
-       for (i = 0; i < 0xFF; i++) {\r
-               temp_tuple[var_index] = i;\r
-               p_sw = fabric_get_sw_by_tuple(p_ftree, temp_tuple);\r
-               if (p_sw == NULL)       /* found free tuple */\r
-                       break;\r
-       }\r
-\r
-       if (i == 0xFF) {\r
-               /* new tuple not found - there are more than 255 ports in one direction */\r
-               return;\r
-       }\r
-       memcpy(new_tuple, temp_tuple, FTREE_TUPLE_LEN);\r
-\r
-}                              /* fabric_get_new_tuple() */\r
-\r
-/***************************************************/\r
-\r
-static inline boolean_t fabric_roots_provided(IN ftree_fabric_t * p_ftree)\r
-{\r
-       return (p_ftree->p_osm->subn.opt.root_guid_file != NULL);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static inline boolean_t fabric_cns_provided(IN ftree_fabric_t * p_ftree)\r
-{\r
-       return (p_ftree->p_osm->subn.opt.cn_guid_file != NULL);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static inline boolean_t fabric_ios_provided(IN ftree_fabric_t * p_ftree)\r
-{\r
-       return (p_ftree->p_osm->subn.opt.io_guid_file != NULL);\r
-}\r
-\r
-/***************************************************/\r
-\r
-static int fabric_mark_leaf_switches(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_hca_t *p_hca;\r
-       ftree_hca_t *p_next_hca;\r
-       unsigned i;\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Marking leaf switches in fabric\n");\r
-\r
-       /* Scan all the CAs, if they have CNs - find CN port and mark switch\r
-          that is connected to this port as leaf switch.\r
-          Also, ensure that this marked leaf has rank of p_ftree->leaf_switch_rank. */\r
-       p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-       while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-               p_hca = p_next_hca;\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-               if (!p_hca->cn_num)\r
-                       continue;\r
-\r
-               for (i = 0; i < p_hca->up_port_groups_num; i++) {\r
-                       if (!p_hca->up_port_groups[i]->is_cn)\r
-                               continue;\r
-\r
-                       /* In CAs, port group alway has one port, and since this\r
-                          port group is CN, we know that this port is compute node */\r
-                       CL_ASSERT(p_hca->up_port_groups[i]->remote_node_type ==\r
-                                 IB_NODE_TYPE_SWITCH);\r
-                       p_sw = p_hca->up_port_groups[i]->remote_hca_or_sw.p_sw;\r
-\r
-                       /* check if this switch was already processed */\r
-                       if (p_sw->is_leaf)\r
-                               continue;\r
-                       p_sw->is_leaf = TRUE;\r
-\r
-                       /* ensure that this leaf switch is at the correct tree level */\r
-                       if (p_sw->rank != p_ftree->leaf_switch_rank) {\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                                       "ERR AB26: CN port 0x%" PRIx64\r
-                                       " is connected to switch 0x%" PRIx64\r
-                                       " with rank %u, "\r
-                                       "while FatTree leaf rank is %u\n",\r
-                                       cl_ntoh64(p_hca->\r
-                                                 up_port_groups[i]->port_guid),\r
-                                       sw_get_guid_ho(p_sw), p_sw->rank,\r
-                                       p_ftree->leaf_switch_rank);\r
-                               res = -1;\r
-                               goto Exit;\r
-\r
-                       }\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_mark_leaf_switches() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_make_indexing(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_remote_sw;\r
-       ftree_sw_t *p_sw = NULL;\r
-       ftree_sw_t *p_next_sw;\r
-       ftree_tuple_t new_tuple;\r
-       uint32_t i;\r
-       cl_list_t bfs_list;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Starting FatTree indexing\n");\r
-\r
-       /* using the first leaf switch as a starting point for indexing algorithm. */\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               if (p_sw->is_leaf)\r
-                       break;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-       }\r
-\r
-       CL_ASSERT(p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl));\r
-\r
-       /* Assign the first tuple to the switch that is used as BFS starting point.\r
-          The tuple will be as follows: [rank].0.0.0...\r
-          This fuction also adds the switch it into the switch_by_tuple table. */\r
-       fabric_assign_first_tuple(p_ftree, p_sw);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Indexing starting point:\n"\r
-               "                                            - Switch rank  : %u\n"\r
-               "                                            - Switch index : %s\n"\r
-               "                                            - Node LID     : %u\n"\r
-               "                                            - Node GUID    : 0x%016"\r
-               PRIx64 "\n", p_sw->rank, tuple_to_str(p_sw->tuple),\r
-               p_sw->base_lid, sw_get_guid_ho(p_sw));\r
-\r
-       /*\r
-        * Now run BFS and assign indexes to all switches\r
-        * Pseudo code of the algorithm is as follows:\r
-        *\r
-        *  * Add first switch to BFS queue\r
-        *  * While (BFS queue not empty)\r
-        *      - Pop the switch from the head of the queue\r
-        *      - Scan all the downward and upward ports\r
-        *      - For each port\r
-        *          + Get the remote switch\r
-        *          + Assign index to the remote switch\r
-        *          + Add remote switch to the BFS queue\r
-        */\r
-\r
-       cl_list_init(&bfs_list, cl_qmap_count(&p_ftree->sw_tbl));\r
-       cl_list_insert_tail(&bfs_list, p_sw);\r
-\r
-       while (!cl_is_list_empty(&bfs_list)) {\r
-               p_sw = (ftree_sw_t *) cl_list_remove_head(&bfs_list);\r
-\r
-               /* Discover all the nodes from ports that are pointing down */\r
-\r
-               if (p_sw->rank >= p_ftree->leaf_switch_rank) {\r
-                       /* whether downward ports are pointing to CAs or switches,\r
-                          we don't assign indexes to switches that are located\r
-                          lower than leaf switches */\r
-               } else {\r
-                       /* This is not the leaf switch */\r
-                       for (i = 0; i < p_sw->down_port_groups_num; i++) {\r
-                               /* Work with port groups that are pointing to switches only.\r
-                                  No need to assign indexing to HCAs */\r
-                               if (p_sw->\r
-                                   down_port_groups[i]->remote_node_type !=\r
-                                   IB_NODE_TYPE_SWITCH)\r
-                                       continue;\r
-\r
-                               p_remote_sw =\r
-                                   p_sw->down_port_groups[i]->\r
-                                   remote_hca_or_sw.p_sw;\r
-                               if (tuple_assigned(p_remote_sw->tuple)) {\r
-                                       /* this switch has been already indexed */\r
-                                       continue;\r
-                               }\r
-                               /* allocate new tuple */\r
-                               fabric_get_new_tuple(p_ftree, new_tuple,\r
-                                                    p_sw->tuple,\r
-                                                    FTREE_DIRECTION_DOWN);\r
-                               /* Assign the new tuple to the remote switch.\r
-                                  This fuction also adds the switch into the switch_by_tuple table. */\r
-                               fabric_assign_tuple(p_ftree, p_remote_sw,\r
-                                                   new_tuple);\r
-\r
-                               /* add the newly discovered switch to the BFS queue */\r
-                               cl_list_insert_tail(&bfs_list, p_remote_sw);\r
-                       }\r
-                       /* Done assigning indexes to all the remote switches\r
-                          that are pointed by the downgoing ports.\r
-                          Now sort port groups according to remote index. */\r
-                       qsort(p_sw->down_port_groups,   /* array */\r
-                             p_sw->down_port_groups_num,       /* number of elements */\r
-                             sizeof(ftree_port_group_t *),     /* size of each element */\r
-                             compare_port_groups_by_remote_switch_index);      /* comparator */\r
-               }\r
-\r
-               /* Done indexing switches from ports that go down.\r
-                  Now do the same with ports that are pointing up. */\r
-\r
-               if (p_sw->rank != 0) {\r
-                       /* This is not the root switch, which means that all the ports\r
-                          that are pointing up are taking us to another switches. */\r
-                       for (i = 0; i < p_sw->up_port_groups_num; i++) {\r
-                               p_remote_sw =\r
-                                   p_sw->up_port_groups[i]->\r
-                                   remote_hca_or_sw.p_sw;\r
-                               if (tuple_assigned(p_remote_sw->tuple))\r
-                                       continue;\r
-                               /* allocate new tuple */\r
-                               fabric_get_new_tuple(p_ftree, new_tuple,\r
-                                                    p_sw->tuple,\r
-                                                    FTREE_DIRECTION_UP);\r
-                               /* Assign the new tuple to the remote switch.\r
-                                  This fuction also adds the switch to the\r
-                                  switch_by_tuple table. */\r
-                               fabric_assign_tuple(p_ftree,\r
-                                                   p_remote_sw, new_tuple);\r
-                               /* add the newly discovered switch to the BFS queue */\r
-                               cl_list_insert_tail(&bfs_list, p_remote_sw);\r
-                       }\r
-                       /* Done assigning indexes to all the remote switches\r
-                          that are pointed by the upgoing ports.\r
-                          Now sort port groups according to remote index. */\r
-                       qsort(p_sw->up_port_groups,     /* array */\r
-                             p_sw->up_port_groups_num, /* number of elements */\r
-                             sizeof(ftree_port_group_t *),     /* size of each element */\r
-                             compare_port_groups_by_remote_switch_index);      /* comparator */\r
-               }\r
-               /* Done assigning indexes to all the switches that are directly connected\r
-                  to the current switch - go to the next switch in the BFS queue */\r
-       }\r
-       cl_list_destroy(&bfs_list);\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_make_indexing() */\r
-\r
-/***************************************************/\r
-\r
-static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_next_sw;\r
-       ftree_sw_t **all_switches_at_leaf_level;\r
-       unsigned i;\r
-       unsigned all_leaf_idx = 0;\r
-       unsigned first_leaf_idx;\r
-       unsigned last_leaf_idx;\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       /* create array of ALL the switches that have leaf rank */\r
-       all_switches_at_leaf_level = (ftree_sw_t **)\r
-           malloc(cl_qmap_count(&p_ftree->sw_tbl) * sizeof(ftree_sw_t *));\r
-       if (!all_switches_at_leaf_level) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,\r
-                       "Fat-tree routing: Memory allocation failed\n");\r
-               res = -1;\r
-               goto Exit;\r
-       }\r
-       memset(all_switches_at_leaf_level, 0,\r
-              cl_qmap_count(&p_ftree->sw_tbl) * sizeof(ftree_sw_t *));\r
-\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-               if (p_sw->rank == p_ftree->leaf_switch_rank) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Adding switch 0x%" PRIx64\r
-                               " to full leaf switch array\n",\r
-                               sw_get_guid_ho(p_sw));\r
-                       all_switches_at_leaf_level[all_leaf_idx++] = p_sw;\r
-               }\r
-       }\r
-\r
-       /* quick-sort array of leaf switches by index */\r
-       qsort(all_switches_at_leaf_level,       /* array */\r
-             all_leaf_idx,     /* number of elements */\r
-             sizeof(ftree_sw_t *),     /* size of each element */\r
-             compare_switches_by_index);       /* comparator */\r
-\r
-       /* check the first and the last REAL leaf (the one\r
-          that has CNs) in the array of all the leafs */\r
-\r
-       first_leaf_idx = all_leaf_idx;\r
-       last_leaf_idx = 0;\r
-       for (i = 0; i < all_leaf_idx; i++) {\r
-               if (all_switches_at_leaf_level[i]->is_leaf) {\r
-                       if (i < first_leaf_idx)\r
-                               first_leaf_idx = i;\r
-                       last_leaf_idx = i;\r
-               }\r
-       }\r
-       CL_ASSERT(first_leaf_idx < last_leaf_idx);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "Full leaf array info: first_leaf_idx = %u, last_leaf_idx = %u\n",\r
-               first_leaf_idx, last_leaf_idx);\r
-\r
-       /* Create array of REAL leaf switches, sorted by index.\r
-          This array may contain switches at the same rank w/o CNs,\r
-          in case this is the order of indexing. */\r
-       p_ftree->leaf_switches_num = last_leaf_idx - first_leaf_idx + 1;\r
-       p_ftree->leaf_switches = (ftree_sw_t **)\r
-           malloc(p_ftree->leaf_switches_num * sizeof(ftree_sw_t *));\r
-       if (!p_ftree->leaf_switches) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,\r
-                       "Fat-tree routing: Memory allocation failed\n");\r
-               res = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       memcpy(p_ftree->leaf_switches,\r
-              &(all_switches_at_leaf_level[first_leaf_idx]),\r
-              p_ftree->leaf_switches_num * sizeof(ftree_sw_t *));\r
-\r
-       free(all_switches_at_leaf_level);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "Created array of %u leaf switches\n",\r
-               p_ftree->leaf_switches_num);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_create_leaf_switch_array() */\r
-\r
-/***************************************************/\r
-\r
-static void fabric_set_max_cn_per_leaf(IN ftree_fabric_t * p_ftree)\r
-{\r
-       unsigned i;\r
-       unsigned j;\r
-       unsigned cns_on_this_leaf;\r
-       ftree_sw_t *p_sw;\r
-       ftree_port_group_t *p_group;\r
-\r
-       for (i = 0; i < p_ftree->leaf_switches_num; i++) {\r
-               p_sw = p_ftree->leaf_switches[i];\r
-               cns_on_this_leaf = 0;\r
-               for (j = 0; j < p_sw->down_port_groups_num; j++) {\r
-                       p_group = p_sw->down_port_groups[j];\r
-                       if (p_group->remote_node_type != IB_NODE_TYPE_CA)\r
-                               continue;\r
-                       cns_on_this_leaf +=\r
-                           p_group->remote_hca_or_sw.p_hca->cn_num;\r
-               }\r
-               if (cns_on_this_leaf > p_ftree->max_cn_per_leaf)\r
-                       p_ftree->max_cn_per_leaf = cns_on_this_leaf;\r
-       }\r
-}                              /* fabric_set_max_cn_per_leaf() */\r
-\r
-/***************************************************/\r
-\r
-static boolean_t fabric_validate_topology(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_port_group_t *p_group;\r
-       ftree_port_group_t *p_ref_group;\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_next_sw;\r
-       ftree_sw_t **reference_sw_arr;\r
-       uint16_t tree_rank = fabric_get_rank(p_ftree);\r
-       boolean_t res = TRUE;\r
-       uint8_t i;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Validating fabric topology\n");\r
-\r
-       reference_sw_arr =\r
-           (ftree_sw_t **) malloc(tree_rank * sizeof(ftree_sw_t *));\r
-       if (reference_sw_arr == NULL) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,\r
-                       "Fat-tree routing: Memory allocation failed\n");\r
-               return FALSE;\r
-       }\r
-       memset(reference_sw_arr, 0, tree_rank * sizeof(ftree_sw_t *));\r
-\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (res && p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               if (!reference_sw_arr[p_sw->rank]) {\r
-                       /* This is the first switch in the current level that\r
-                          we're checking - use it as a reference */\r
-                       reference_sw_arr[p_sw->rank] = p_sw;\r
-               } else {\r
-                       /* compare this switch properties to the reference switch */\r
-\r
-                       if (reference_sw_arr[p_sw->rank]->up_port_groups_num !=\r
-                           p_sw->up_port_groups_num) {\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                                       "ERR AB09: Different number of upward port groups on switches:\n"\r
-                                       "       GUID 0x%016" PRIx64\r
-                                       ", LID %u, Index %s - %u groups\n"\r
-                                       "       GUID 0x%016" PRIx64\r
-                                       ", LID %u, Index %s - %u groups\n",\r
-                                       sw_get_guid_ho\r
-                                       (reference_sw_arr[p_sw->rank]),\r
-                                       reference_sw_arr[p_sw->rank]->base_lid,\r
-                                       tuple_to_str\r
-                                       (reference_sw_arr[p_sw->rank]->tuple),\r
-                                       reference_sw_arr[p_sw->\r
-                                                        rank]->\r
-                                       up_port_groups_num,\r
-                                       sw_get_guid_ho(p_sw), p_sw->base_lid,\r
-                                       tuple_to_str(p_sw->tuple),\r
-                                       p_sw->up_port_groups_num);\r
-                               res = FALSE;\r
-                               break;\r
-                       }\r
-\r
-                       if (p_sw->rank != (tree_rank - 1) &&\r
-                           reference_sw_arr[p_sw->\r
-                                            rank]->down_port_groups_num !=\r
-                           p_sw->down_port_groups_num) {\r
-                               /* we're allowing some hca's to be missing */\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                                       "ERR AB0A: Different number of downward port groups on switches:\n"\r
-                                       "       GUID 0x%016" PRIx64\r
-                                       ", LID %u, Index %s - %u port groups\n"\r
-                                       "       GUID 0x%016" PRIx64\r
-                                       ", LID %u, Index %s - %u port groups\n",\r
-                                       sw_get_guid_ho\r
-                                       (reference_sw_arr[p_sw->rank]),\r
-                                       reference_sw_arr[p_sw->rank]->base_lid,\r
-                                       tuple_to_str\r
-                                       (reference_sw_arr[p_sw->rank]->tuple),\r
-                                       reference_sw_arr[p_sw->\r
-                                                        rank]->\r
-                                       down_port_groups_num,\r
-                                       sw_get_guid_ho(p_sw), p_sw->base_lid,\r
-                                       tuple_to_str(p_sw->tuple),\r
-                                       p_sw->down_port_groups_num);\r
-                               res = FALSE;\r
-                               break;\r
-                       }\r
-\r
-                       if (reference_sw_arr[p_sw->rank]->up_port_groups_num !=\r
-                           0) {\r
-                               p_ref_group =\r
-                                   reference_sw_arr[p_sw->\r
-                                                    rank]->up_port_groups[0];\r
-                               for (i = 0; i < p_sw->up_port_groups_num; i++) {\r
-                                       p_group = p_sw->up_port_groups[i];\r
-                                       if (cl_ptr_vector_get_size\r
-                                           (&p_ref_group->ports) !=\r
-                                           cl_ptr_vector_get_size\r
-                                           (&p_group->ports)) {\r
-                                               OSM_LOG(&p_ftree->p_osm->log,\r
-                                                       OSM_LOG_ERROR,\r
-                                                       "ERR AB0B: Different number of ports in an upward port group on switches:\n"\r
-                                                       "       GUID 0x%016"\r
-                                                       PRIx64\r
-                                                       ", LID %u, Index %s - %u ports\n"\r
-                                                       "       GUID 0x%016"\r
-                                                       PRIx64\r
-                                                       ", LID %u, Index %s - %u ports\n",\r
-                                                       sw_get_guid_ho\r
-                                                       (reference_sw_arr\r
-                                                        [p_sw->rank]),\r
-                                                       reference_sw_arr[p_sw->\r
-                                                                        rank]->\r
-                                                       base_lid,\r
-                                                       tuple_to_str\r
-                                                       (reference_sw_arr\r
-                                                        [p_sw->rank]->tuple),\r
-                                                       cl_ptr_vector_get_size\r
-                                                       (&p_ref_group->ports),\r
-                                                       sw_get_guid_ho(p_sw),\r
-                                                       p_sw->base_lid,\r
-                                                       tuple_to_str(p_sw->\r
-                                                                    tuple),\r
-                                                       cl_ptr_vector_get_size\r
-                                                       (&p_group->ports));\r
-                                               res = FALSE;\r
-                                               break;\r
-                                       }\r
-                               }\r
-                       }\r
-                       if (reference_sw_arr[p_sw->rank]->down_port_groups_num\r
-                           != 0 && p_sw->rank != (tree_rank - 1)) {\r
-                               /* we're allowing some hca's to be missing */\r
-                               p_ref_group =\r
-                                   reference_sw_arr[p_sw->\r
-                                                    rank]->down_port_groups[0];\r
-                               for (i = 0; i < p_sw->down_port_groups_num; i++) {\r
-                                       p_group = p_sw->down_port_groups[0];\r
-                                       if (cl_ptr_vector_get_size\r
-                                           (&p_ref_group->ports) !=\r
-                                           cl_ptr_vector_get_size\r
-                                           (&p_group->ports)) {\r
-                                               OSM_LOG(&p_ftree->p_osm->log,\r
-                                                       OSM_LOG_ERROR,\r
-                                                       "ERR AB0C: Different number of ports in an downward port group on switches:\n"\r
-                                                       "       GUID 0x%016"\r
-                                                       PRIx64\r
-                                                       ", LID %u, Index %s - %u ports\n"\r
-                                                       "       GUID 0x%016"\r
-                                                       PRIx64\r
-                                                       ", LID %u, Index %s - %u ports\n",\r
-                                                       sw_get_guid_ho\r
-                                                       (reference_sw_arr\r
-                                                        [p_sw->rank]),\r
-                                                       reference_sw_arr[p_sw->\r
-                                                                        rank]->\r
-                                                       base_lid,\r
-                                                       tuple_to_str\r
-                                                       (reference_sw_arr\r
-                                                        [p_sw->rank]->tuple),\r
-                                                       cl_ptr_vector_get_size\r
-                                                       (&p_ref_group->ports),\r
-                                                       sw_get_guid_ho(p_sw),\r
-                                                       p_sw->base_lid,\r
-                                                       tuple_to_str(p_sw->\r
-                                                                    tuple),\r
-                                                       cl_ptr_vector_get_size\r
-                                                       (&p_group->ports));\r
-                                               res = FALSE;\r
-                                               break;\r
-                                       }\r
-                               }\r
-                       }\r
-               }               /* end of else */\r
-       }                       /* end of while */\r
-\r
-       if (res == TRUE)\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "Fabric topology has been identified as FatTree\n");\r
-       else\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                       "ERR AB0D: Fabric topology hasn't been identified as FatTree\n");\r
-\r
-       free(reference_sw_arr);\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_validate_topology() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void set_sw_fwd_table(IN cl_map_item_t * const p_map_item,\r
-                            IN void *context)\r
-{\r
-       ftree_sw_t *p_sw = (ftree_sw_t * const)p_map_item;\r
-       ftree_fabric_t *p_ftree = (ftree_fabric_t *) context;\r
-\r
-       p_sw->p_osm_sw->max_lid_ho = p_ftree->lft_max_lid;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-/*\r
- * Function: Finds the least loaded port group and stores its counter\r
- * Given   : A switch\r
- */\r
-static inline void recalculate_min_counter_down(ftree_sw_t * p_sw)\r
-{\r
-       uint32_t min = (1 << 30);\r
-       uint32_t i;\r
-       for (i = 0; i < p_sw->down_port_groups_num; i++) {\r
-               if (p_sw->down_port_groups[i]->counter_down < min) {\r
-                       min = p_sw->down_port_groups[i]->counter_down;\r
-               }\r
-       }\r
-       p_sw->min_counter_down = min;\r
-       return;\r
-}\r
-\r
-/*\r
- * Function: Return the counter value of the least loaded down port group\r
- * Given   : A switch\r
- */\r
-static inline uint32_t find_lowest_loaded_group_on_sw(ftree_sw_t * p_sw)\r
-{\r
-       return p_sw->min_counter_down;\r
-}\r
-\r
-/*\r
- * Function: Compare the load of two port groups and return which is the least loaded\r
- * Given   : Two port groups with remote switch\r
- * When both port groups are equally loaded, it picks the one whom\r
- * remote switch down ports are least loaded.\r
- * This way, it prefers the switch from where it will be easier to go down (creating upward routes).\r
- * If both are equal, it picks the bigger GUID to be deterministic.\r
- */\r
-static inline int port_group_compare_load_down(const ftree_port_group_t * p1,\r
-                                              const ftree_port_group_t * p2)\r
-{\r
-       int temp = p1->counter_down - p2->counter_down;\r
-       if (temp > 0)\r
-               return 1;\r
-       if (temp < 0)\r
-               return -1;\r
-\r
-       /* Find the less loaded remote sw and choose this one */\r
-       do {\r
-               uint32_t load1 =\r
-                   find_lowest_loaded_group_on_sw(p1->remote_hca_or_sw.p_sw);\r
-               uint32_t load2 =\r
-                   find_lowest_loaded_group_on_sw(p2->remote_hca_or_sw.p_sw);\r
-               temp = load1 - load2;\r
-               if (temp > 0)\r
-                       return 1;\r
-       } while (0);\r
-       /* If they are both equal, choose the biggest GUID */\r
-       if (p1->remote_port_guid > p2->remote_port_guid)\r
-               return 1;\r
-\r
-       return -1;\r
-\r
-}\r
-\r
-/*\r
- * Function: Sorts an array of port group by up load order\r
- * Given   : A port group array and its length\r
- * As the list is mostly sorted, we used a bubble sort instead of qsort\r
- * as it is much faster.\r
- *\r
- * Important note:\r
- * This function and bubble_sort_down must NOT be factorized.\r
- * Although most of the code is the same and a function pointer could be used\r
- * for the compareason function, it would prevent the compareason function to be inlined\r
- * and cost a great deal to performances.\r
- */\r
-static inline void\r
-bubble_sort_up(ftree_port_group_t ** p_group_array, uint32_t nmemb)\r
-{\r
-       uint32_t i = 0;\r
-       uint32_t j = 0;\r
-       ftree_port_group_t *tmp = p_group_array[0];\r
-\r
-       /* As this function is a great number of times, we only go into the loop\r
-        * if one of the port counters has changed, thus saving some tests */\r
-       if (tmp->hca_or_sw.p_sw->counter_up_changed == FALSE) {\r
-               return;\r
-       }\r
-       /* While we did modifications on the array order */\r
-       /* i may grew above array length but next loop will fail and tmp will be null for the next time\r
-        * this way we save a test i < nmemb for each pass through the loop */\r
-       for (i = 0; tmp; i++) {\r
-               /* Assume the array is orderd */\r
-               tmp = NULL;\r
-               /* Comparing elements j and j-1 */\r
-               for (j = 1; j < (nmemb - i); j++) {\r
-                       /* If they are the wrong way around */\r
-                       if (p_group_array[j]->counter_up <\r
-                           p_group_array[j - 1]->counter_up) {\r
-                               /* We invert them */\r
-                               tmp = p_group_array[j - 1];\r
-                               p_group_array[j - 1] = p_group_array[j];\r
-                               p_group_array[j] = tmp;\r
-                               /* This sets tmp != NULL so the main loop will make another pass */\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* We have reordered the array so as long noone changes the counter\r
-        * it's not necessary to do it again */\r
-       p_group_array[0]->hca_or_sw.p_sw->counter_up_changed = FALSE;\r
-}\r
-\r
-static inline void\r
-bubble_sort_siblings(ftree_port_group_t ** p_group_array, uint32_t nmemb)\r
-{\r
-       uint32_t i = 0;\r
-       uint32_t j = 0;\r
-       ftree_port_group_t *tmp = p_group_array[0];\r
-\r
-       /* While we did modifications on the array order */\r
-       /* i may grew above array length but next loop will fail and tmp will be null for the next time\r
-        * this way we save a test i < nmemb for each pass through the loop */\r
-       for (i = 0; tmp != NULL; i++) {\r
-               /* Assume the array is orderd */\r
-               tmp = NULL;\r
-               /* Comparing elements j and j-1 */\r
-               for (j = 1; j < (nmemb - i); j++) {\r
-                       /* If they are the wrong way around */\r
-                       if (p_group_array[j]->counter_up <\r
-                           p_group_array[j - 1]->counter_up) {\r
-                               /* We invert them */\r
-                               tmp = p_group_array[j - 1];\r
-                               p_group_array[j - 1] = p_group_array[j];\r
-                               p_group_array[j] = tmp;\r
-\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-/*\r
- * Function: Sorts an array of port group. Order is decide through\r
- * port_group_compare_load_down ( up counters, least load remote switch, biggest GUID)\r
- * Given   : A port group array and its length. Each port group points to a remote switch (not a HCA)\r
- * As the list is mostly sorted, we used a bubble sort instead of qsort\r
- * as it is much faster.\r
- *\r
- * Important note:\r
- * This function and bubble_sort_up must NOT be factorized.\r
- * Although most of the code is the same and a function pointer could be used\r
- * for the compareason function, it would prevent the compareason function to be inlined\r
- * and cost a great deal to performances.\r
- */\r
-static inline void\r
-bubble_sort_down(ftree_port_group_t ** p_group_array, uint32_t nmemb)\r
-{\r
-       uint32_t i = 0;\r
-       uint32_t j = 0;\r
-       ftree_port_group_t *tmp = p_group_array[0];\r
-\r
-       /* While we did modifications on the array order */\r
-       /* i may grew above array length but next loop will fail and tmp will be null for the next time\r
-        * this way we save a test i < nmemb for each pass through the loop */\r
-       for (i = 0; tmp; i++) {\r
-               /* Assume the array is orderd */\r
-               tmp = NULL;\r
-               /* Comparing elements j and j-1 */\r
-               for (j = 1; j < (nmemb - i); j++) {\r
-                       /* If they are the wrong way around */\r
-                       if (port_group_compare_load_down\r
-                           (p_group_array[j], p_group_array[j - 1]) < 0) {\r
-                               /* We invert them */\r
-                               tmp = p_group_array[j - 1];\r
-                               p_group_array[j - 1] = p_group_array[j];\r
-                               p_group_array[j] = tmp;\r
-\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-/*\r
- * Function: assign-up-going-port-by-descending-down\r
- * Given   : a switch and a LID\r
- * Pseudo code:\r
- *    foreach down-going-port-group (in indexing order)\r
- *        skip this group if the LFT(LID) port is part of this group\r
- *        find the least loaded port of the group (scan in indexing order)\r
- *        r-port is the remote port connected to it\r
- *        assign the remote switch node LFT(LID) to r-port\r
- *        increase r-port usage counter\r
- *        assign-up-going-port-by-descending-down to r-port node (recursion)\r
- */\r
-\r
-static boolean_t\r
-fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,\r
-                                  IN ftree_sw_t * p_sw,\r
-                                  IN ftree_sw_t * p_prev_sw,\r
-                                  IN uint16_t target_lid,\r
-                                  IN boolean_t is_real_lid,\r
-                                  IN boolean_t is_main_path,\r
-                                  IN boolean_t is_target_a_sw,\r
-                                  IN uint8_t current_hops)\r
-{\r
-       ftree_sw_t *p_remote_sw;\r
-       uint16_t ports_num;\r
-       ftree_port_group_t *p_group;\r
-       ftree_port_t *p_port;\r
-       ftree_port_t *p_min_port;\r
-       uint16_t j;\r
-       uint16_t k;\r
-       boolean_t created_route = FALSE;\r
-       boolean_t routed = 0;\r
-       uint8_t least_hops;\r
-\r
-       /* we shouldn't enter here if both real_lid and main_path are false */\r
-       CL_ASSERT(is_real_lid || is_main_path);\r
-\r
-       /* if there is no down-going ports */\r
-       if (p_sw->down_port_groups_num == 0)\r
-               return FALSE;\r
-\r
-       /* foreach down-going port group (in load order) */\r
-       bubble_sort_up(p_sw->down_port_groups, p_sw->down_port_groups_num);\r
-\r
-       if (p_sw->sibling_port_groups_num > 0)\r
-               bubble_sort_siblings(p_sw->sibling_port_groups,\r
-                                    p_sw->sibling_port_groups_num);\r
-\r
-       for (k = 0;\r
-            k <\r
-            (p_sw->down_port_groups_num +\r
-             (is_real_lid ? p_sw->sibling_port_groups_num : 0)); k++) {\r
-\r
-               if (k < p_sw->down_port_groups_num) {\r
-                       p_group = p_sw->down_port_groups[k];\r
-               } else {\r
-                       p_group =\r
-                           p_sw->sibling_port_groups[k -\r
-                                                     p_sw->\r
-                                                     down_port_groups_num];\r
-               }\r
-\r
-               /* If this port group doesn't point to a switch, mark\r
-                  that the route was created and skip to the next group */\r
-               if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH) {\r
-                       created_route = TRUE;\r
-                       continue;\r
-               }\r
-\r
-               if (p_prev_sw\r
-                   && p_group->remote_base_lid == p_prev_sw->base_lid) {\r
-                       /* This port group has a port that was used when we entered this switch,\r
-                          which means that the current group points to the switch where we were\r
-                          at the previous step of the algorithm (before going up).\r
-                          Skipping this group. */\r
-                       continue;\r
-               }\r
-\r
-               /* find the least loaded port of the group (in indexing order) */\r
-               p_min_port = NULL;\r
-               ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);\r
-\r
-               for (j = 0; j < ports_num; j++) {\r
-                       cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);\r
-                       /* first port that we're checking - set as port with the lowest load */\r
-                       /* or this port is less loaded - use it as min */\r
-                       if (!p_min_port ||\r
-                           p_port->counter_up < p_min_port->counter_up)\r
-                               p_min_port = p_port;\r
-               }\r
-               /* At this point we have selected a port in this group with the\r
-                  lowest load of upgoing routes.\r
-                  Set on the remote switch how to get to the target_lid -\r
-                  set LFT(target_lid) on the remote switch to the remote port */\r
-               p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-               least_hops = sw_get_least_hops(p_remote_sw, target_lid);\r
-\r
-               if (least_hops != OSM_NO_PATH) {\r
-                       /* Loop in the fabric - we already routed the remote switch\r
-                          on our way UP, and now we see it again on our way DOWN */\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Loop of lenght %d in the fabric:\n                             "\r
-                               "Switch %s (LID %u) closes loop through switch %s (LID %u)\n",\r
-                               current_hops,\r
-                               tuple_to_str(p_remote_sw->tuple),\r
-                               p_group->base_lid,\r
-                               tuple_to_str(p_sw->tuple),\r
-                               p_group->remote_base_lid);\r
-                       /* We skip only if we have come through a longer path */\r
-                       if (current_hops + 1 >= least_hops)\r
-                               continue;\r
-               }\r
-\r
-               /* Four possible cases:\r
-                *\r
-                *  1. is_real_lid == TRUE && is_main_path == TRUE:\r
-                *      - going DOWN(TRUE,TRUE) through ALL the groups\r
-                *         + promoting port counter\r
-                *         + setting path in remote switch fwd tbl\r
-                *         + setting hops in remote switch on all the ports of each group\r
-                *\r
-                *  2. is_real_lid == TRUE && is_main_path == FALSE:\r
-                *      - going DOWN(TRUE,FALSE) through ALL the groups but only if\r
-                *        the remote (lower) switch hasn't been already configured\r
-                *        for this target LID (or with a longer path)\r
-                *         + promoting port counter\r
-                *         + setting path in remote switch fwd tbl if it hasn't been set yet\r
-                *         + setting hops in remote switch on all the ports of each group\r
-                *           if it hasn't been set yet\r
-                *\r
-                *  3. is_real_lid == FALSE && is_main_path == TRUE:\r
-                *      - going DOWN(FALSE,TRUE) through ALL the groups\r
-                *         + promoting port counter\r
-                *         + NOT setting path in remote switch fwd tbl\r
-                *         + NOT setting hops in remote switch\r
-                *\r
-                *  4. is_real_lid == FALSE && is_main_path == FALSE:\r
-                *      - illegal state - we shouldn't get here\r
-                */\r
-\r
-               /* setting fwd tbl port only if this is real LID */\r
-               if (is_real_lid) {\r
-                       p_remote_sw->p_osm_sw->new_lft[target_lid] =\r
-                           p_min_port->remote_port_num;\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Switch %s: set path to CA LID %u through port %u\n",\r
-                               tuple_to_str(p_remote_sw->tuple),\r
-                               target_lid, p_min_port->remote_port_num);\r
-\r
-                       /* On the remote switch that is pointed by the p_group,\r
-                          set hops for ALL the ports in the remote group. */\r
-\r
-                       set_hops_on_remote_sw(p_group, target_lid,\r
-                                             current_hops + 1, is_target_a_sw);\r
-               }\r
-\r
-               /* Recursion step:\r
-                  Assign upgoing ports by stepping down, starting on REMOTE switch */\r
-               routed = fabric_route_upgoing_by_going_down(p_ftree, p_remote_sw,       /* remote switch - used as a route-upgoing alg. start point */\r
-                                                           NULL,       /* prev. position - NULL to mark that we went down and not up */\r
-                                                           target_lid, /* LID that we're routing to */\r
-                                                           is_real_lid,        /* whether the target LID is real or dummy */\r
-                                                           is_main_path,       /* whether this is path to HCA that should by tracked by counters */\r
-                                                           is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                           current_hops + 1);  /* Number of hops done to this point */\r
-               created_route |= routed;\r
-               /* Counters are promoted only if a route toward a node is created */\r
-               if (routed) {\r
-                       p_min_port->counter_up++;\r
-                       p_group->counter_up++;\r
-                       p_group->hca_or_sw.p_sw->counter_up_changed = TRUE;\r
-               }\r
-       }\r
-       /* done scanning all the down-going port groups */\r
-\r
-       /* if the route was created, promote the index that\r
-          indicates which group should we start with when\r
-          going through all the downgoing groups */\r
-       if (created_route)\r
-               p_sw->down_port_groups_idx = (p_sw->down_port_groups_idx + 1)\r
-                   % p_sw->down_port_groups_num;\r
-\r
-       return created_route;\r
-}                              /* fabric_route_upgoing_by_going_down() */\r
-\r
-/***************************************************/\r
-\r
-/*\r
- * Function: assign-down-going-port-by-ascending-up\r
- * Given   : a switch and a LID\r
- * Pseudo code:\r
- *    find the least loaded port of all the upgoing groups (scan in indexing order)\r
- *    assign the LFT(LID) of remote switch to that port\r
- *    track that port usage\r
- *    assign-up-going-port-by-descending-down on CURRENT switch\r
- *    assign-down-going-port-by-ascending-up on REMOTE switch (recursion)\r
- */\r
-\r
-static boolean_t\r
-fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,\r
-                                  IN ftree_sw_t * p_sw,\r
-                                  IN ftree_sw_t * p_prev_sw,\r
-                                  IN uint16_t target_lid,\r
-                                  IN boolean_t is_real_lid,\r
-                                  IN boolean_t is_main_path,\r
-                                  IN boolean_t is_target_a_sw,\r
-                                  IN uint16_t reverse_hop_credit,\r
-                                  IN uint16_t reverse_hops,\r
-                                  IN uint8_t current_hops)\r
-{\r
-       ftree_sw_t *p_remote_sw;\r
-       uint16_t ports_num;\r
-       ftree_port_group_t *p_group;\r
-       ftree_port_t *p_port;\r
-       ftree_port_group_t *p_min_group;\r
-       ftree_port_t *p_min_port;\r
-       uint16_t i;\r
-       uint16_t j;\r
-       boolean_t created_route = FALSE;\r
-       boolean_t routed = FALSE;\r
-\r
-       /* we shouldn't enter here if both real_lid and main_path are false */\r
-       CL_ASSERT(is_real_lid || is_main_path);\r
-\r
-       /* Assign upgoing ports by stepping down, starting on THIS switch */\r
-       created_route = fabric_route_upgoing_by_going_down(p_ftree, p_sw,       /* local switch - used as a route-upgoing alg. start point */\r
-                                                          p_prev_sw,   /* switch that we went up from (NULL means that we went down) */\r
-                                                          target_lid,  /* LID that we're routing to */\r
-                                                          is_real_lid, /* whether this target LID is real or dummy */\r
-                                                          is_main_path,        /* whether this path to HCA should by tracked by counters */\r
-                                                          is_target_a_sw,      /* Wheter target lid is a switch or not */\r
-                                                          current_hops);       /* Number of hops done up to this point */\r
-\r
-       /* recursion stop condition - if it's a root switch, */\r
-       if (p_sw->rank == 0) {\r
-               if (reverse_hop_credit > 0) {\r
-                       /* We go up by going down as we have some reverse_hop_credit left */\r
-                       /* We use the index to scatter a bit the reverse up routes */\r
-                       p_sw->down_port_groups_idx =\r
-                           (p_sw->down_port_groups_idx +\r
-                            1) % p_sw->down_port_groups_num;\r
-                       i = p_sw->down_port_groups_idx;\r
-                       for (j = 0; j < p_sw->down_port_groups_num; j++) {\r
-\r
-                               p_group = p_sw->down_port_groups[i];\r
-                               i = (i + 1) % p_sw->down_port_groups_num;\r
-\r
-                               /* Skip this port group unless it points to a switch */\r
-                               if (p_group->remote_node_type !=\r
-                                   IB_NODE_TYPE_SWITCH)\r
-                                       continue;\r
-                               p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-\r
-                               created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,       /* remote switch - used as a route-downgoing alg. next step point */\r
-                                                                                   p_sw,       /* this switch - prev. position switch for the function */\r
-                                                                                   target_lid, /* LID that we're routing to */\r
-                                                                                   is_real_lid,        /* whether this target LID is real or dummy */\r
-                                                                                   is_main_path,       /* whether this is path to HCA that should by tracked by counters */\r
-                                                                                   is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                                                   reverse_hop_credit - 1,     /* Remaining reverse_hops allowed */\r
-                                                                                   reverse_hops + 1,   /* Number of reverse_hops done up to this point */\r
-                                                                                   current_hops\r
-                                                                                   +\r
-                                                                                   1);\r
-                       }\r
-\r
-               }\r
-               return created_route;\r
-       }\r
-\r
-       /* We should generate a list of port sorted by load so we can find easily the least\r
-        * going port and explore the other pots on secondary routes more easily (and quickly) */\r
-       bubble_sort_down(p_sw->up_port_groups, p_sw->up_port_groups_num);\r
-\r
-       p_min_group = p_sw->up_port_groups[0];\r
-       /* Find the least loaded upgoing port in the selected group */\r
-       p_min_port = NULL;\r
-       ports_num = (uint16_t) cl_ptr_vector_get_size(&p_min_group->ports);\r
-       for (j = 0; j < ports_num; j++) {\r
-               cl_ptr_vector_at(&p_min_group->ports, j, (void *)&p_port);\r
-               if (!p_min_port) {\r
-                       /* first port that we're checking - use\r
-                          it as a port with the lowest load */\r
-                       p_min_port = p_port;\r
-               } else if (p_port->counter_down < p_min_port->counter_down) {\r
-                       /* this port is less loaded - use it as min */\r
-                       p_min_port = p_port;\r
-               }\r
-       }\r
-\r
-       /* At this point we have selected a group and port with the\r
-          lowest load of downgoing routes.\r
-          Set on the remote switch how to get to the target_lid -\r
-          set LFT(target_lid) on the remote switch to the remote port */\r
-       p_remote_sw = p_min_group->remote_hca_or_sw.p_sw;\r
-\r
-       /* Four possible cases:\r
-        *\r
-        *  1. is_real_lid == TRUE && is_main_path == TRUE:\r
-        *      - going UP(TRUE,TRUE) on selected min_group and min_port\r
-        *         + promoting port counter\r
-        *         + setting path in remote switch fwd tbl\r
-        *         + setting hops in remote switch on all the ports of selected group\r
-        *      - going UP(TRUE,FALSE) on rest of the groups, each time on port 0\r
-        *         + NOT promoting port counter\r
-        *         + setting path in remote switch fwd tbl if it hasn't been set yet\r
-        *         + setting hops in remote switch on all the ports of each group\r
-        *           if it hasn't been set yet\r
-        *\r
-        *  2. is_real_lid == TRUE && is_main_path == FALSE:\r
-        *      - going UP(TRUE,FALSE) on ALL the groups, each time on port 0,\r
-        *        but only if the remote (upper) switch hasn't been already\r
-        *        configured for this target LID\r
-        *         + NOT promoting port counter\r
-        *         + setting path in remote switch fwd tbl if it hasn't been set yet\r
-        *         + setting hops in remote switch on all the ports of each group\r
-        *           if it hasn't been set yet\r
-        *\r
-        *  3. is_real_lid == FALSE && is_main_path == TRUE:\r
-        *      - going UP(FALSE,TRUE) ONLY on selected min_group and min_port\r
-        *         + promoting port counter\r
-        *         + NOT setting path in remote switch fwd tbl\r
-        *         + NOT setting hops in remote switch\r
-        *\r
-        *  4. is_real_lid == FALSE && is_main_path == FALSE:\r
-        *      - illegal state - we shouldn't get here\r
-        */\r
-\r
-       /* covering first half of case 1, and case 3 */\r
-       if (is_main_path) {\r
-               if (p_sw->is_leaf) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               " - Routing MAIN path for %s CA LID %u: %s --> %s\n",\r
-                               (is_real_lid) ? "real" : "DUMMY",\r
-                               target_lid,\r
-                               tuple_to_str(p_sw->tuple),\r
-                               tuple_to_str(p_remote_sw->tuple));\r
-               }\r
-               /* The number of downgoing routes is tracked in the\r
-                  p_group->counter_down p_port->counter_down counters of the\r
-                  group and port that belong to the lower side of the link\r
-                  (on switch with higher rank) */\r
-               p_min_group->counter_down++;\r
-               p_min_port->counter_down++;\r
-               if (p_min_group->counter_down ==\r
-                   (p_min_group->remote_hca_or_sw.p_sw->min_counter_down +\r
-                    1)) {\r
-                       recalculate_min_counter_down\r
-                           (p_min_group->remote_hca_or_sw.p_sw);\r
-               }\r
-\r
-               if (is_real_lid) {\r
-                       /* This LID may already be in the LFT in the reverse_hop feature is used */\r
-                       /* We update the LFT only if this LID isn't already present. */\r
-\r
-                       /* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */\r
-                       if ((p_remote_sw->p_osm_sw->new_lft[target_lid] ==\r
-                            OSM_NO_PATH)\r
-                           ||\r
-                           ((p_remote_sw->p_osm_sw->new_lft[target_lid] !=\r
-                             OSM_NO_PATH)\r
-                            &&\r
-                            (current_hops + 1 <\r
-                             sw_get_least_hops(p_remote_sw, target_lid)))) {\r
-\r
-                               p_remote_sw->p_osm_sw->new_lft[target_lid] =\r
-                                   p_min_port->remote_port_num;\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                                       "Switch %s: set path to CA LID %u through port %u\n",\r
-                                       tuple_to_str(p_remote_sw->tuple),\r
-                                       target_lid,\r
-                                       p_min_port->remote_port_num);\r
-\r
-                               /* On the remote switch that is pointed by the min_group,\r
-                                  set hops for ALL the ports in the remote group. */\r
-\r
-                               set_hops_on_remote_sw(p_min_group, target_lid,\r
-                                                     current_hops + 1,\r
-                                                     is_target_a_sw);\r
-\r
-                               /* Recursion step:\r
-                                  Assign downgoing ports by stepping up, starting on REMOTE switch. */\r
-                               created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,       /* remote switch - used as a route-downgoing alg. next step point */\r
-                                                                                   p_sw,       /* this switch - prev. position switch for the function */\r
-                                                                                   target_lid, /* LID that we're routing to */\r
-                                                                                   is_real_lid,        /* whether this target LID is real or dummy */\r
-                                                                                   is_main_path,       /* whether this is path to HCA that should by tracked by counters */\r
-                                                                                   is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                                                   reverse_hop_credit, /* Remaining reverse_hops allowed */\r
-                                                                                   reverse_hops,       /* Number of reverse_hops done up to this point */\r
-                                                                                   current_hops\r
-                                                                                   +\r
-                                                                                   1);\r
-                       }\r
-               }\r
-       }\r
-       /* we're done for the third case */\r
-       if (!is_real_lid)\r
-               return created_route;\r
-\r
-       /* What's left to do at this point:\r
-        *\r
-        *  1. is_real_lid == TRUE && is_main_path == TRUE:\r
-        *      - going UP(TRUE,FALSE) on rest of the groups, each time on port 0,\r
-        *        but only if the remote (upper) switch hasn't been already\r
-        *        configured for this target LID\r
-        *         + NOT promoting port counter\r
-        *         + setting path in remote switch fwd tbl if it hasn't been set yet\r
-        *         + setting hops in remote switch on all the ports of each group\r
-        *           if it hasn't been set yet\r
-        *\r
-        *  2. is_real_lid == TRUE && is_main_path == FALSE:\r
-        *      - going UP(TRUE,FALSE) on ALL the groups, each time on port 0,\r
-        *        but only if the remote (upper) switch hasn't been already\r
-        *        configured for this target LID\r
-        *         + NOT promoting port counter\r
-        *         + setting path in remote switch fwd tbl if it hasn't been set yet\r
-        *         + setting hops in remote switch on all the ports of each group\r
-        *           if it hasn't been set yet\r
-        *\r
-        *  These two rules can be rephrased this way:\r
-        *   - foreach UP port group\r
-        *      + if remote switch has been set with the target LID\r
-        *         - skip this port group\r
-        *      + else\r
-        *         - select port 0\r
-        *         - do NOT promote port counter\r
-        *         - set path in remote switch fwd tbl\r
-        *         - set hops in remote switch on all the ports of this group\r
-        *         - go UP(TRUE,FALSE) to the remote switch\r
-        */\r
-\r
-       for (i = is_main_path ? 1 : 0; i < p_sw->up_port_groups_num; i++) {\r
-               p_group = p_sw->up_port_groups[i];\r
-               p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-\r
-               /* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */\r
-               if (p_remote_sw->p_osm_sw->new_lft[target_lid] != OSM_NO_PATH)\r
-                       if (current_hops + 1 >=\r
-                           sw_get_least_hops(p_remote_sw, target_lid))\r
-                               continue;\r
-\r
-               if (p_sw->is_leaf) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               " - Routing SECONDARY path for LID %u: %s --> %s\n",\r
-                               target_lid,\r
-                               tuple_to_str(p_sw->tuple),\r
-                               tuple_to_str(p_remote_sw->tuple));\r
-               }\r
-\r
-               /* Routing REAL lids on SECONDARY path means routing\r
-                  switch-to-switch or switch-to-CA paths.\r
-                  We can safely assume that switch will initiate very\r
-                  few traffic, so there's no point waisting runtime on\r
-                  trying to balance these routes - always pick port 0. */\r
-               p_min_port = NULL;\r
-               ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);\r
-               for (j = 0; j < ports_num; j++) {\r
-                       cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);\r
-                       if (!p_min_port) {\r
-                               /* first port that we're checking - use\r
-                                  it as a port with the lowest load */\r
-                               p_min_port = p_port;\r
-                       } else if (p_port->counter_down <\r
-                                  p_min_port->counter_down) {\r
-                               /* this port is less loaded - use it as min */\r
-                               p_min_port = p_port;\r
-                       }\r
-               }\r
-\r
-               p_port = p_min_port;\r
-               p_remote_sw->p_osm_sw->new_lft[target_lid] =\r
-                   p_port->remote_port_num;\r
-\r
-               /* On the remote switch that is pointed by the p_group,\r
-                  set hops for ALL the ports in the remote group. */\r
-\r
-               set_hops_on_remote_sw(p_group, target_lid,\r
-                                     current_hops + 1, is_target_a_sw);\r
-\r
-               /* Recursion step:\r
-                  Assign downgoing ports by stepping up, starting on REMOTE switch. */\r
-               routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,       /* remote switch - used as a route-downgoing alg. next step point */\r
-                                                           p_sw,       /* this switch - prev. position switch for the function */\r
-                                                           target_lid, /* LID that we're routing to */\r
-                                                           TRUE,       /* whether the target LID is real or dummy */\r
-                                                           FALSE,      /* whether this is path to HCA that should by tracked by counters */\r
-                                                           is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                           reverse_hop_credit, /* Remaining reverse_hops allowed */\r
-                                                           reverse_hops,       /* Number of reverse_hops done up to this point */\r
-                                                           current_hops + 1);\r
-               created_route |= routed;\r
-       }\r
-\r
-       /* Now doing the same thing with horizontal links */\r
-       if (p_sw->sibling_port_groups_num > 0)\r
-               bubble_sort_down(p_sw->sibling_port_groups,\r
-                                p_sw->sibling_port_groups_num);\r
-\r
-       for (i = 0; i < p_sw->sibling_port_groups_num; i++) {\r
-               p_group = p_sw->sibling_port_groups[i];\r
-               p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-\r
-               /* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */\r
-               if (p_remote_sw->p_osm_sw->new_lft[target_lid] != OSM_NO_PATH)\r
-                       if (current_hops + 1 >=\r
-                           sw_get_least_hops(p_remote_sw, target_lid))\r
-                               continue;\r
-\r
-               if (p_sw->is_leaf) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               " - Routing SECONDARY path for LID %u: %s --> %s\n",\r
-                               target_lid,\r
-                               tuple_to_str(p_sw->tuple),\r
-                               tuple_to_str(p_remote_sw->tuple));\r
-               }\r
-\r
-               /* Routing REAL lids on SECONDARY path means routing\r
-                  switch-to-switch or switch-to-CA paths.\r
-                  We can safely assume that switch will initiate very\r
-                  few traffic, so there's no point waisting runtime on\r
-                  trying to balance these routes - always pick port 0. */\r
-\r
-               p_min_port = NULL;\r
-               ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);\r
-               for (j = 0; j < ports_num; j++) {\r
-                       cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);\r
-                       if (!p_min_port) {\r
-                               /* first port that we're checking - use\r
-                                  it as a port with the lowest load */\r
-                               p_min_port = p_port;\r
-                       } else if (p_port->counter_down <\r
-                                  p_min_port->counter_down) {\r
-                               /* this port is less loaded - use it as min */\r
-                               p_min_port = p_port;\r
-                       }\r
-               }\r
-\r
-               p_port = p_min_port;\r
-               p_remote_sw->p_osm_sw->new_lft[target_lid] =\r
-                   p_port->remote_port_num;\r
-\r
-               /* On the remote switch that is pointed by the p_group,\r
-                  set hops for ALL the ports in the remote group. */\r
-\r
-               set_hops_on_remote_sw(p_group, target_lid,\r
-                                     current_hops + 1, is_target_a_sw);\r
-\r
-               /* Recursion step:\r
-                  Assign downgoing ports by stepping up, starting on REMOTE switch. */\r
-               routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,       /* remote switch - used as a route-downgoing alg. next step point */\r
-                                                           p_sw,       /* this switch - prev. position switch for the function */\r
-                                                           target_lid, /* LID that we're routing to */\r
-                                                           TRUE,       /* whether the target LID is real or dummy */\r
-                                                           FALSE,      /* whether this is path to HCA that should by tracked by counters */\r
-                                                           is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                           reverse_hop_credit, /* Remaining reverse_hops allowed */\r
-                                                           reverse_hops,       /* Number of reverse_hops done up to this point */\r
-                                                           current_hops + 1);\r
-               created_route |= routed;\r
-               if (routed) {\r
-                       p_min_group->counter_down++;\r
-                       p_min_port->counter_down++;\r
-               }\r
-       }\r
-\r
-       /* If we don't have any reverse hop credits, we are done */\r
-       if (reverse_hop_credit == 0)\r
-               return created_route;\r
-\r
-       if (p_sw->is_leaf)\r
-               return created_route;\r
-\r
-       /* We explore all the down group ports */\r
-       /* We try to reverse jump for each of them */\r
-       /* They already have a route to us from the upgoing_by_going_down started earlier */\r
-       /* This is only so it'll continue exploring up, after this step backwards */\r
-       for (i = 0; i < p_sw->down_port_groups_num; i++) {\r
-               p_group = p_sw->down_port_groups[i];\r
-               p_remote_sw = p_group->remote_hca_or_sw.p_sw;\r
-\r
-               /* Skip this port group unless it points to a switch */\r
-               if (p_group->remote_node_type != IB_NODE_TYPE_SWITCH)\r
-                       continue;\r
-\r
-               /* Recursion step:\r
-                  Assign downgoing ports by stepping up, fter doing one step down starting on REMOTE switch. */\r
-               created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,       /* remote switch - used as a route-downgoing alg. next step point */\r
-                                                                   p_sw,       /* this switch - prev. position switch for the function */\r
-                                                                   target_lid, /* LID that we're routing to */\r
-                                                                   TRUE,       /* whether the target LID is real or dummy */\r
-                                                                   TRUE,       /* whether this is path to HCA that should by tracked by counters */\r
-                                                                   is_target_a_sw,     /* Wheter target lid is a switch or not */\r
-                                                                   reverse_hop_credit - 1,     /* Remaining reverse_hops allowed */\r
-                                                                   reverse_hops + 1,   /* Number of reverse_hops done up to this point */\r
-                                                                   current_hops\r
-                                                                   + 1);\r
-       }\r
-       return created_route;\r
-\r
-}                              /* ftree_fabric_route_downgoing_by_going_up() */\r
-\r
-/***************************************************/\r
-\r
-/*\r
- * Pseudo code:\r
- *    foreach leaf switch (in indexing order)\r
- *       for each compute node (in indexing order)\r
- *          obtain the LID of the compute node\r
- *          set local LFT(LID) of the port connecting to compute node\r
- *          call assign-down-going-port-by-ascending-up(TRUE,TRUE) on CURRENT switch\r
- *       for each MISSING compute node\r
- *          call assign-down-going-port-by-ascending-up(FALSE,TRUE) on CURRENT switch\r
- */\r
-\r
-static void fabric_route_to_cns(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_hca_t *p_hca;\r
-       ftree_port_group_t *p_leaf_port_group;\r
-       ftree_port_group_t *p_hca_port_group;\r
-       ftree_port_t *p_port;\r
-       unsigned int i, j;\r
-       uint16_t hca_lid;\r
-       unsigned routed_targets_on_leaf;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       /* for each leaf switch (in indexing order) */\r
-       for (i = 0; i < p_ftree->leaf_switches_num; i++) {\r
-               p_sw = p_ftree->leaf_switches[i];\r
-               routed_targets_on_leaf = 0;\r
-\r
-               /* for each HCA connected to this switch */\r
-               for (j = 0; j < p_sw->down_port_groups_num; j++) {\r
-                       p_leaf_port_group = p_sw->down_port_groups[j];\r
-\r
-                       /* work with this port group only if the remote node is CA */\r
-                       if (p_leaf_port_group->remote_node_type !=\r
-                           IB_NODE_TYPE_CA)\r
-                               continue;\r
-\r
-                       p_hca = p_leaf_port_group->remote_hca_or_sw.p_hca;\r
-\r
-                       /* work with this port group only if remote HCA has CNs */\r
-                       if (!p_hca->cn_num)\r
-                               continue;\r
-\r
-                       p_hca_port_group =\r
-                           hca_get_port_group_by_remote_lid(p_hca,\r
-                                                            p_leaf_port_group->\r
-                                                            base_lid);\r
-                       CL_ASSERT(p_hca_port_group);\r
-\r
-                       /* work with this port group only if remote port is CN */\r
-                       if (!p_hca_port_group->is_cn)\r
-                               continue;\r
-\r
-                       /* obtain the LID of HCA port */\r
-                       hca_lid = p_leaf_port_group->remote_base_lid;\r
-\r
-                       /* set local LFT(LID) to the port that is connected to HCA */\r
-                       cl_ptr_vector_at(&p_leaf_port_group->ports, 0,\r
-                                        (void *)&p_port);\r
-                       p_sw->p_osm_sw->new_lft[hca_lid] = p_port->port_num;\r
-\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Switch %s: set path to CN LID %u through port %u\n",\r
-                               tuple_to_str(p_sw->tuple),\r
-                               hca_lid, p_port->port_num);\r
-\r
-                       /* set local min hop table(LID) to route to the CA */\r
-                       sw_set_hops(p_sw, hca_lid, p_port->port_num, 1, FALSE);\r
-\r
-                       /* Assign downgoing ports by stepping up.\r
-                          Since we're routing here only CNs, we're routing it as REAL\r
-                          LID and updating fat-tree balancing counters. */\r
-                       fabric_route_downgoing_by_going_up(p_ftree, p_sw,       /* local switch - used as a route-downgoing alg. start point */\r
-                                                          NULL,        /* prev. position switch */\r
-                                                          hca_lid,     /* LID that we're routing to */\r
-                                                          TRUE,        /* whether this HCA LID is real or dummy */\r
-                                                          TRUE,        /* whether this path to HCA should by tracked by counters */\r
-                                                          FALSE,       /* wheter target lid is a switch or not */\r
-                                                          0,   /* Number of reverse hops allowed */\r
-                                                          0,   /* Number of reverse hops done yet */\r
-                                                          1);  /* Number of hops done yet */\r
-\r
-                       /* count how many real targets have been routed from this leaf switch */\r
-                       routed_targets_on_leaf++;\r
-               }\r
-\r
-               /* We're done with the real targets (all CNs) of this leaf switch.\r
-                  Now route the dummy HCAs that are missing or that are non-CNs.\r
-                  When routing to dummy HCAs we don't fill lid matrices. */\r
-               if (p_ftree->max_cn_per_leaf > routed_targets_on_leaf) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Routing %u dummy CAs\n",\r
-                               p_ftree->max_cn_per_leaf -\r
-                               p_sw->down_port_groups_num);\r
-                       for (j = 0; j <\r
-                            p_ftree->max_cn_per_leaf - routed_targets_on_leaf;\r
-                            j++) {\r
-                               /* assign downgoing ports by stepping up */\r
-                               fabric_route_downgoing_by_going_up(p_ftree, p_sw,       /* local switch - used as a route-downgoing alg. start point */\r
-                                                                  NULL,        /* prev. position switch */\r
-                                                                  0,   /* LID that we're routing to - ignored for dummy HCA */\r
-                                                                  FALSE,       /* whether this HCA LID is real or dummy */\r
-                                                                  TRUE,        /* whether this path to HCA should by tracked by counters */\r
-                                                                  FALSE,       /* Wheter the target LID is a switch or not */\r
-                                                                  0,   /* Number of reverse hops allowed */\r
-                                                                  0,   /* Number of reverse hops done yet */\r
-                                                                  1);  /* Number of hops done yet */\r
-                       }\r
-               }\r
-       }\r
-       /* done going through all the leaf switches */\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_route_to_cns() */\r
-\r
-/***************************************************/\r
-\r
-/*\r
- * Pseudo code:\r
- *    foreach HCA non-CN port in fabric\r
- *       obtain the LID of the HCA port\r
- *       get switch that is connected to this HCA port\r
- *       set switch LFT(LID) to the port connected to the HCA port\r
- *       call assign-down-going-port-by-ascending-up(TRUE,TRUE) on the switch\r
- *\r
- * Routing to these HCAs is routing a REAL hca lid on MAIN path.\r
- * We want to allow load-leveling of the traffic to the non-CNs,\r
- * because such nodes may include IO nodes with heavy usage\r
- *   - we should set fwd tables\r
- *   - we should update port counters\r
- * Routing to non-CNs is done after routing to CNs, so updated port\r
- * counters will not affect CN-to-CN routing.\r
- */\r
-\r
-static void fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_hca_t *p_hca;\r
-       ftree_hca_t *p_next_hca;\r
-       ftree_port_t *p_hca_port;\r
-       ftree_port_group_t *p_hca_port_group;\r
-       uint16_t hca_lid;\r
-       unsigned port_num_on_switch;\r
-       unsigned i;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-       while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-               p_hca = p_next_hca;\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-\r
-               for (i = 0; i < p_hca->up_port_groups_num; i++) {\r
-                       p_hca_port_group = p_hca->up_port_groups[i];\r
-\r
-                       /* skip this port if it's CN, in which case it has been already routed */\r
-                       if (p_hca_port_group->is_cn)\r
-                               continue;\r
-\r
-                       /* skip this port if it is not connected to switch */\r
-                       if (p_hca_port_group->remote_node_type !=\r
-                           IB_NODE_TYPE_SWITCH)\r
-                               continue;\r
-\r
-                       p_sw = p_hca_port_group->remote_hca_or_sw.p_sw;\r
-                       hca_lid = p_hca_port_group->base_lid;\r
-\r
-                       /* set switches  LFT(LID) to the port that is connected to HCA */\r
-                       cl_ptr_vector_at(&p_hca_port_group->ports, 0,\r
-                                        (void *)&p_hca_port);\r
-                       port_num_on_switch = p_hca_port->remote_port_num;\r
-                       p_sw->p_osm_sw->new_lft[hca_lid] = port_num_on_switch;\r
-\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Switch %s: set path to non-CN HCA LID %u through port %u\n",\r
-                               tuple_to_str(p_sw->tuple),\r
-                               hca_lid, port_num_on_switch);\r
-\r
-                       /* set local min hop table(LID) to route to the CA */\r
-                       sw_set_hops(p_sw, hca_lid, port_num_on_switch,  /* port num */\r
-                                   1, FALSE);  /* hops */\r
-\r
-                       /* Assign downgoing ports by stepping up.\r
-                          We're routing REAL targets. They are not CNs and not included\r
-                          in the leafs array, but we treat them as MAIN path to allow load\r
-                          leveling, which means that the counters will be updated. */\r
-                       fabric_route_downgoing_by_going_up(p_ftree, p_sw,       /* local switch - used as a route-downgoing alg. start point */\r
-                                                          NULL,        /* prev. position switch */\r
-                                                          hca_lid,     /* LID that we're routing to */\r
-                                                          TRUE,        /* whether this HCA LID is real or dummy */\r
-                                                          TRUE,        /* whether this path to HCA should by tracked by counters */\r
-                                                          FALSE,       /* Wheter the target LID is a switch or not */\r
-                                                          p_hca_port_group->is_io ? p_ftree->p_osm->subn.opt.max_reverse_hops : 0,     /* Number or reverse hops allowed */\r
-                                                          0,   /* Number or reverse hops done yet */\r
-                                                          1);  /* Number of hops done yet */\r
-               }\r
-               /* done with all the port groups of this HCA - go to next HCA */\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_route_to_non_cns() */\r
-\r
-/***************************************************/\r
-\r
-/*\r
- * Pseudo code:\r
- *    foreach switch in fabric\r
- *       obtain its LID\r
- *       set local LFT(LID) to port 0\r
- *       call assign-down-going-port-by-ascending-up(TRUE,FALSE) on CURRENT switch\r
- *\r
- * Routing to switch is similar to routing a REAL hca lid on SECONDARY path:\r
- *   - we should set fwd tables\r
- *   - we should NOT update port counters\r
- */\r
-\r
-static void fabric_route_to_switches(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_next_sw;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               /* set local LFT(LID) to 0 (route to itself) */\r
-               p_sw->p_osm_sw->new_lft[p_sw->base_lid] = 0;\r
-\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Switch %s (LID %u): routing switch-to-switch paths\n",\r
-                       tuple_to_str(p_sw->tuple), p_sw->base_lid);\r
-\r
-               /* set min hop table of the switch to itself */\r
-               sw_set_hops(p_sw, p_sw->base_lid, 0,    /* port_num */\r
-                           0, TRUE);   /* hops     */\r
-\r
-               fabric_route_downgoing_by_going_up(p_ftree, p_sw,       /* local switch - used as a route-downgoing alg. start point */\r
-                                                  NULL,        /* prev. position switch */\r
-                                                  p_sw->base_lid,      /* LID that we're routing to */\r
-                                                  TRUE,        /* whether the target LID is a real or dummy */\r
-                                                  FALSE,       /* whether this path to HCA should by tracked by counters */\r
-                                                  TRUE,        /* Wheter the target LID is a switch or not */\r
-                                                  0,   /* Number of reverse hops allowed */\r
-                                                  0,   /* Number of reverse hops done yet */\r
-                                                  0);  /* Number of hops done yet */\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_route_to_switches() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void fabric_route_roots(IN ftree_fabric_t * p_ftree)\r
-{\r
-       uint16_t lid;\r
-       uint8_t port_num;\r
-       osm_port_t *p_port;\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_leaf_sw;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       /*\r
-        * We need a switch that will accomodate all the down/up turns in\r
-        * the fabric. Having these turn in a single place in the fabric\r
-        * will not create credit loops.\r
-        * So we need to select this switch.\r
-        * The idea here is to chose leaf with the highest index. I don't\r
-        * have any theory to back me up on this. It's just a general thought\r
-        * that this way the switch that might be a bottleneck for many mcast\r
-        * groups will be far away from the OpenSM, so it will draw the\r
-        * multicast traffic away from the SM.\r
-        */\r
-\r
-       p_leaf_sw = p_ftree->leaf_switches[p_ftree->leaf_switches_num-1];\r
-\r
-       /*\r
-        * Now go over all the switches in the fabric that\r
-        * have lower rank, and route the missing LIDs to\r
-        * the selected leaf switch.\r
-        * In short, this leaf switch now poses a target\r
-        * for all those missing LIDs.\r
-        */\r
-\r
-       for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-            p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl);\r
-            p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) {\r
-\r
-               if (p_sw->rank >= p_ftree->leaf_switch_rank)\r
-                       continue;\r
-\r
-               for (lid = 1; lid <= p_leaf_sw->p_osm_sw->max_lid_ho; lid ++) {\r
-\r
-                       if (p_sw->p_osm_sw->new_lft[lid] != OSM_NO_PATH ||\r
-                           p_leaf_sw->hops[lid] == OSM_NO_PATH)\r
-                               continue;\r
-\r
-                       p_port = osm_get_port_by_lid_ho(&p_ftree->p_osm->subn,\r
-                                                       lid);\r
-\r
-                       /* we're interested only in switches */\r
-                       if (!p_port || !p_port->p_node->sw)\r
-                               continue;\r
-\r
-                       /*\r
-                        * the missing LID will be routed through the same\r
-                        * port that routes to the selected leaf switch\r
-                        */\r
-                       port_num = p_sw->p_osm_sw->new_lft[p_leaf_sw->base_lid];\r
-\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Switch %s: setting path to LID %u "\r
-                               "through port %u\n",\r
-                               tuple_to_str(p_sw->tuple), lid, port_num);\r
-\r
-                       /* set local lft */\r
-                       p_sw->p_osm_sw->new_lft[lid] = port_num;\r
-\r
-                       /*\r
-                        * Set local min hop table.\r
-                        * The distance to the target LID is a distance\r
-                        * to the selected leaf switch plus the distance\r
-                        * from the leaf to the target LID.\r
-                        */\r
-                       sw_set_hops(p_sw, lid, port_num,\r
-                               p_sw->hops[p_leaf_sw->base_lid] +\r
-                               p_leaf_sw->hops[lid], TRUE);\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_route_roots() */\r
-\r
-/***************************************************/\r
-\r
-static int fabric_populate_nodes(IN ftree_fabric_t * p_ftree)\r
-{\r
-       osm_node_t *p_osm_node;\r
-       osm_node_t *p_next_osm_node;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       p_next_osm_node =\r
-           (osm_node_t *) cl_qmap_head(&p_ftree->p_osm->subn.node_guid_tbl);\r
-       while (p_next_osm_node !=\r
-              (osm_node_t *) cl_qmap_end(&p_ftree->p_osm->\r
-                                         subn.node_guid_tbl)) {\r
-               p_osm_node = p_next_osm_node;\r
-               p_next_osm_node =\r
-                   (osm_node_t *) cl_qmap_next(&p_osm_node->map_item);\r
-               switch (osm_node_get_type(p_osm_node)) {\r
-               case IB_NODE_TYPE_CA:\r
-                       fabric_add_hca(p_ftree, p_osm_node);\r
-                       break;\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       break;\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       fabric_add_sw(p_ftree, p_osm_node->sw);\r
-                       break;\r
-               default:\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB0E: " "Node GUID 0x%016" PRIx64\r
-                               " - Unknown node type: %s\n",\r
-                               cl_ntoh64(osm_node_get_node_guid(p_osm_node)),\r
-                               ib_get_node_type_str(osm_node_get_type\r
-                                                    (p_osm_node)));\r
-                       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-                       return -1;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return 0;\r
-}                              /* fabric_populate_nodes() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static boolean_t sw_update_rank(IN ftree_sw_t * p_sw, IN uint32_t new_rank)\r
-{\r
-       if (sw_ranked(p_sw) && p_sw->rank <= new_rank)\r
-               return FALSE;\r
-       p_sw->rank = new_rank;\r
-       return TRUE;\r
-\r
-}\r
-\r
-/***************************************************/\r
-\r
-static void rank_switches_from_leafs(IN ftree_fabric_t * p_ftree,\r
-                                    IN cl_list_t * p_ranking_bfs_list)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_remote_sw;\r
-       osm_node_t *p_node;\r
-       osm_node_t *p_remote_node;\r
-       osm_physp_t *p_osm_port;\r
-       uint8_t i;\r
-       unsigned max_rank = 0;\r
-\r
-       while (!cl_is_list_empty(p_ranking_bfs_list)) {\r
-               p_sw = (ftree_sw_t *) cl_list_remove_head(p_ranking_bfs_list);\r
-               p_node = p_sw->p_osm_sw->p_node;\r
-\r
-               /* note: skipping port 0 on switches */\r
-               for (i = 1; i < osm_node_get_num_physp(p_node); i++) {\r
-                       p_osm_port = osm_node_get_physp_ptr(p_node, i);\r
-                       if (!p_osm_port || !osm_link_is_healthy(p_osm_port))\r
-                               continue;\r
-\r
-                       p_remote_node =\r
-                           osm_node_get_remote_node(p_node, i, NULL);\r
-                       if (!p_remote_node)\r
-                               continue;\r
-                       if (osm_node_get_type(p_remote_node) !=\r
-                           IB_NODE_TYPE_SWITCH)\r
-                               continue;\r
-\r
-                       p_remote_sw = fabric_get_sw_by_guid(p_ftree,\r
-                                                           osm_node_get_node_guid\r
-                                                           (p_remote_node));\r
-                       if (!p_remote_sw) {\r
-                               /* remote node is not a switch */\r
-                               continue;\r
-                       }\r
-\r
-                       /* if needed, rank the remote switch and add it to the BFS list */\r
-                       if (sw_update_rank(p_remote_sw, p_sw->rank + 1)) {\r
-                               max_rank = p_remote_sw->rank;\r
-                               cl_list_insert_tail(p_ranking_bfs_list,\r
-                                                   p_remote_sw);\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* set FatTree maximal switch rank */\r
-       p_ftree->max_switch_rank = max_rank;\r
-\r
-}                              /* rank_switches_from_leafs() */\r
-\r
-/***************************************************/\r
-\r
-static int rank_leaf_switches(IN ftree_fabric_t * p_ftree,\r
-                             IN ftree_hca_t * p_hca,\r
-                             IN cl_list_t * p_ranking_bfs_list)\r
-{\r
-       ftree_sw_t *p_sw;\r
-       osm_node_t *p_osm_node = p_hca->p_osm_node;\r
-       osm_node_t *p_remote_osm_node;\r
-       osm_physp_t *p_osm_port;\r
-       static uint8_t i = 0;\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       for (i = 0; i < osm_node_get_num_physp(p_osm_node); i++) {\r
-               p_osm_port = osm_node_get_physp_ptr(p_osm_node, i);\r
-               if (!p_osm_port || !osm_link_is_healthy(p_osm_port))\r
-                       continue;\r
-\r
-               p_remote_osm_node =\r
-                   osm_node_get_remote_node(p_osm_node, i, NULL);\r
-               if (!p_remote_osm_node)\r
-                       continue;\r
-\r
-               switch (osm_node_get_type(p_remote_osm_node)) {\r
-               case IB_NODE_TYPE_CA:\r
-                       /* HCA connected directly to another HCA - not FatTree */\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB0F: "\r
-                               "CA conected directly to another CA: " "0x%016"\r
-                               PRIx64 " <---> 0x%016" PRIx64 "\n",\r
-                               hca_get_guid_ho(p_hca),\r
-                               cl_ntoh64(osm_node_get_node_guid\r
-                                         (p_remote_osm_node)));\r
-                       res = -1;\r
-                       goto Exit;\r
-\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       /* leaving this port - proceeding to the next one */\r
-                       continue;\r
-\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       /* continue with this port */\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB10: Node GUID 0x%016" PRIx64\r
-                               " - Unknown node type: %s\n",\r
-                               cl_ntoh64(osm_node_get_node_guid\r
-                                         (p_remote_osm_node)),\r
-                               ib_get_node_type_str(osm_node_get_type\r
-                                                    (p_remote_osm_node)));\r
-                       res = -1;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* remote node is switch */\r
-\r
-               p_sw = fabric_get_sw_by_guid(p_ftree,\r
-                                            osm_node_get_node_guid\r
-                                            (p_osm_port->p_remote_physp->\r
-                                             p_node));\r
-               CL_ASSERT(p_sw);\r
-\r
-               /* if needed, rank the remote switch and add it to the BFS list */\r
-\r
-               if (!sw_update_rank(p_sw, 0))\r
-                       continue;\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Marking rank of switch that is directly connected to CA:\n"\r
-                       "                                            - CA guid    : 0x%016"\r
-                       PRIx64 "\n"\r
-                       "                                            - Switch guid: 0x%016"\r
-                       PRIx64 "\n"\r
-                       "                                            - Switch LID : %u\n",\r
-                       hca_get_guid_ho(p_hca),\r
-                       sw_get_guid_ho(p_sw), p_sw->base_lid);\r
-               cl_list_insert_tail(p_ranking_bfs_list, p_sw);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* rank_leaf_switches() */\r
-\r
-/***************************************************/\r
-\r
-static void sw_reverse_rank(IN cl_map_item_t * const p_map_item,\r
-                           IN void *context)\r
-{\r
-       ftree_fabric_t *p_ftree = (ftree_fabric_t *) context;\r
-       ftree_sw_t *p_sw = (ftree_sw_t * const)p_map_item;\r
-       p_sw->rank = p_ftree->max_switch_rank - p_sw->rank;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int\r
-fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)\r
-{\r
-       ftree_sw_t *p_remote_sw;\r
-       osm_node_t *p_node = p_hca->p_osm_node;\r
-       osm_node_t *p_remote_node;\r
-       uint8_t remote_node_type;\r
-       ib_net64_t remote_node_guid;\r
-       osm_physp_t *p_remote_osm_port;\r
-       uint8_t i;\r
-       uint8_t remote_port_num;\r
-       boolean_t is_cn = FALSE;\r
-       boolean_t is_io = FALSE;\r
-       int res = 0;\r
-\r
-       for (i = 0; i < osm_node_get_num_physp(p_node); i++) {\r
-               osm_physp_t *p_osm_port = osm_node_get_physp_ptr(p_node, i);\r
-               if (!p_osm_port || !osm_link_is_healthy(p_osm_port))\r
-                       continue;\r
-\r
-               p_remote_osm_port = osm_physp_get_remote(p_osm_port);\r
-               p_remote_node =\r
-                   osm_node_get_remote_node(p_node, i, &remote_port_num);\r
-\r
-               if (!p_remote_osm_port)\r
-                       continue;\r
-\r
-               remote_node_type = osm_node_get_type(p_remote_node);\r
-               remote_node_guid = osm_node_get_node_guid(p_remote_node);\r
-\r
-               switch (remote_node_type) {\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       /* leaving this port - proceeding to the next one */\r
-                       continue;\r
-\r
-               case IB_NODE_TYPE_CA:\r
-                       /* HCA connected directly to another HCA - not FatTree */\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB11: "\r
-                               "CA conected directly to another CA: " "0x%016"\r
-                               PRIx64 " <---> 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                               cl_ntoh64(remote_node_guid));\r
-                       res = -1;\r
-                       goto Exit;\r
-\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       /* continue with this port */\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB12: Node GUID 0x%016" PRIx64\r
-                               " - Unknown node type: %s\n",\r
-                               cl_ntoh64(remote_node_guid),\r
-                               ib_get_node_type_str(remote_node_type));\r
-                       res = -1;\r
-                       goto Exit;\r
-               }\r
-\r
-               /* remote node is switch */\r
-\r
-               p_remote_sw = fabric_get_sw_by_guid(p_ftree, remote_node_guid);\r
-               CL_ASSERT(p_remote_sw);\r
-\r
-               /* If CN file is not supplied, then all the CAs considered as Compute Nodes.\r
-                  Otherwise all the CAs are not CNs, and only guids that are present in the\r
-                  CN file will be marked as compute nodes. */\r
-               if (!fabric_cns_provided(p_ftree)) {\r
-                       is_cn = TRUE;\r
-               } else {\r
-                       name_map_item_t *p_elem = (name_map_item_t *)\r
-                           cl_qmap_get(&p_ftree->cn_guid_tbl,\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_osm_port)));\r
-                       if (p_elem != (name_map_item_t *)\r
-                           cl_qmap_end(&p_ftree->cn_guid_tbl))\r
-                               is_cn = TRUE;\r
-               }\r
-\r
-               if (is_cn) {\r
-                       p_ftree->cn_num++;\r
-                       p_hca->cn_num++;\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Marking CN port GUID 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(osm_physp_get_port_guid(p_osm_port)));\r
-               } else {\r
-                       if (fabric_ios_provided(p_ftree)) {\r
-                               name_map_item_t *p_elem = (name_map_item_t *)\r
-                                   cl_qmap_get(&p_ftree->io_guid_tbl,\r
-                                               cl_ntoh64\r
-                                               (osm_physp_get_port_guid\r
-                                                (p_osm_port)));\r
-                               if (p_elem != (name_map_item_t *)\r
-                                   cl_qmap_end(&p_ftree->io_guid_tbl))\r
-                                       is_io = TRUE;\r
-\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                                       "Marking I/O port GUID 0x%016" PRIx64\r
-                                       "\n",\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_osm_port)));\r
-\r
-                       } else {\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                                       "Marking non-CN port GUID 0x%016" PRIx64\r
-                                       "\n",\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_osm_port)));\r
-                       }\r
-               }\r
-               p_ftree->ca_ports++;\r
-\r
-               hca_add_port(p_hca,     /* local ftree_hca object */\r
-                            i, /* local port number */\r
-                            remote_port_num,   /* remote port number */\r
-                            cl_ntoh16(osm_node_get_base_lid(p_node, i)),       /* local lid */\r
-                            cl_ntoh16(osm_node_get_base_lid(p_remote_node, 0)),        /* remote lid */\r
-                            osm_physp_get_port_guid(p_osm_port),       /* local port guid */\r
-                            osm_physp_get_port_guid(p_remote_osm_port),        /* remote port guid */\r
-                            remote_node_guid,  /* remote node guid */\r
-                            remote_node_type,  /* remote node type */\r
-                            (void *)p_remote_sw,       /* remote ftree_hca/sw object */\r
-                            is_cn, is_io);     /* whether this port is compute node */\r
-       }\r
-\r
-Exit:\r
-       return res;\r
-}                              /* fabric_construct_hca_ports() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int fabric_construct_sw_ports(IN ftree_fabric_t * p_ftree,\r
-                                    IN ftree_sw_t * p_sw)\r
-{\r
-       ftree_hca_t *p_remote_hca;\r
-       ftree_sw_t *p_remote_sw;\r
-       osm_node_t *p_node = p_sw->p_osm_sw->p_node;\r
-       osm_node_t *p_remote_node;\r
-       uint16_t remote_base_lid;\r
-       uint8_t remote_node_type;\r
-       ib_net64_t remote_node_guid;\r
-       osm_physp_t *p_remote_osm_port;\r
-       ftree_direction_t direction;\r
-       void *p_remote_hca_or_sw;\r
-       uint8_t i;\r
-       uint8_t remote_port_num;\r
-       int res = 0;\r
-\r
-       CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);\r
-\r
-       for (i = 1; i < osm_node_get_num_physp(p_node); i++) {\r
-               osm_physp_t *p_osm_port = osm_node_get_physp_ptr(p_node, i);\r
-               if (!p_osm_port || !osm_link_is_healthy(p_osm_port))\r
-                       continue;\r
-\r
-               p_remote_osm_port = osm_physp_get_remote(p_osm_port);\r
-               if (!p_remote_osm_port)\r
-                       continue;\r
-\r
-               p_remote_node =\r
-                   osm_node_get_remote_node(p_node, i, &remote_port_num);\r
-\r
-               /* ignore any loopback connection on switch */\r
-               if (p_node == p_remote_node) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                               "Ignoring loopback on switch GUID 0x%016" PRIx64\r
-                               ", LID %u, rank %u\n",\r
-                               sw_get_guid_ho(p_sw),\r
-                               p_sw->base_lid, p_sw->rank);\r
-                       continue;\r
-               }\r
-\r
-               remote_node_type = osm_node_get_type(p_remote_node);\r
-               remote_node_guid = osm_node_get_node_guid(p_remote_node);\r
-\r
-               switch (remote_node_type) {\r
-               case IB_NODE_TYPE_ROUTER:\r
-                       /* leaving this port - proceeding to the next one */\r
-                       continue;\r
-\r
-               case IB_NODE_TYPE_CA:\r
-                       /* switch connected to hca */\r
-\r
-                       p_remote_hca =\r
-                           fabric_get_hca_by_guid(p_ftree, remote_node_guid);\r
-                       CL_ASSERT(p_remote_hca);\r
-\r
-                       p_remote_hca_or_sw = (void *)p_remote_hca;\r
-                       direction = FTREE_DIRECTION_DOWN;\r
-\r
-                       remote_base_lid =\r
-                           cl_ntoh16(osm_physp_get_base_lid\r
-                                     (p_remote_osm_port));\r
-                       break;\r
-\r
-               case IB_NODE_TYPE_SWITCH:\r
-                       /* switch connected to another switch */\r
-\r
-                       p_remote_sw =\r
-                           fabric_get_sw_by_guid(p_ftree, remote_node_guid);\r
-                       CL_ASSERT(p_remote_sw);\r
-\r
-                       p_remote_hca_or_sw = (void *)p_remote_sw;\r
-\r
-                       if (p_sw->rank > p_remote_sw->rank) {\r
-                               direction = FTREE_DIRECTION_UP;\r
-                       } else if (p_sw->rank == p_remote_sw->rank) {\r
-                               direction = FTREE_DIRECTION_SAME;\r
-                       } else\r
-                               direction = FTREE_DIRECTION_DOWN;\r
-\r
-                       /* switch LID is only in port 0 port_info structure */\r
-                       remote_base_lid =\r
-                           cl_ntoh16(osm_node_get_base_lid(p_remote_node, 0));\r
-\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB13: Node GUID 0x%016" PRIx64\r
-                               " - Unknown node type: %s\n",\r
-                               cl_ntoh64(remote_node_guid),\r
-                               ib_get_node_type_str(remote_node_type));\r
-                       res = -1;\r
-                       goto Exit;\r
-               }\r
-               sw_add_port(p_sw,       /* local ftree_sw object */\r
-                           i,  /* local port number */\r
-                           remote_port_num,    /* remote port number */\r
-                           p_sw->base_lid,     /* local lid */\r
-                           remote_base_lid,    /* remote lid */\r
-                           osm_physp_get_port_guid(p_osm_port),        /* local port guid */\r
-                           osm_physp_get_port_guid(p_remote_osm_port), /* remote port guid */\r
-                           remote_node_guid,   /* remote node guid */\r
-                           remote_node_type,   /* remote node type */\r
-                           p_remote_hca_or_sw, /* remote ftree_hca/sw object */\r
-                           direction); /* port direction (up or down) */\r
-\r
-               /* Track the max lid (in host order) that exists in the fabric */\r
-               if (remote_base_lid > p_ftree->lft_max_lid)\r
-                       p_ftree->lft_max_lid = remote_base_lid;\r
-       }\r
-\r
-Exit:\r
-       return res;\r
-}                              /* fabric_construct_sw_ports() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-struct rank_root_cxt {\r
-       ftree_fabric_t *fabric;\r
-       cl_list_t *list;\r
-};\r
-\r
-static int rank_root_sw_by_guid(void *cxt, uint64_t guid, char *p)\r
-{\r
-       struct rank_root_cxt *c = cxt;\r
-       ftree_sw_t *sw;\r
-\r
-       sw = fabric_get_sw_by_guid(c->fabric, cl_hton64(guid));\r
-       if (!sw) {\r
-               /* the specified root guid wasn't found in the fabric */\r
-               OSM_LOG(&c->fabric->p_osm->log, OSM_LOG_ERROR, "ERR AB24: "\r
-                       "Root switch GUID 0x%" PRIx64 " not found\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       OSM_LOG(&c->fabric->p_osm->log, OSM_LOG_DEBUG,\r
-               "Ranking root switch with GUID 0x%" PRIx64 "\n", guid);\r
-       sw->rank = 0;\r
-       cl_list_insert_tail(c->list, sw);\r
-\r
-       return 0;\r
-}\r
-\r
-static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)\r
-{\r
-       struct rank_root_cxt context;\r
-       osm_node_t *p_osm_node;\r
-       osm_node_t *p_remote_osm_node;\r
-       osm_physp_t *p_osm_physp;\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_remote_sw;\r
-       cl_list_t ranking_bfs_list;\r
-       int res = 0;\r
-       unsigned num_roots;\r
-       unsigned max_rank = 0;\r
-       unsigned i;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-       cl_list_init(&ranking_bfs_list, 10);\r
-\r
-       /* Rank all the roots and add them to list */\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-               "Fetching root nodes from file %s\n",\r
-               p_ftree->p_osm->subn.opt.root_guid_file);\r
-\r
-       context.fabric = p_ftree;\r
-       context.list = &ranking_bfs_list;\r
-       if (parse_node_map(p_ftree->p_osm->subn.opt.root_guid_file,\r
-                          rank_root_sw_by_guid, &context)) {\r
-               res = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       num_roots = cl_list_count(&ranking_bfs_list);\r
-       if (!num_roots) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB25: "\r
-                       "No valid roots supplied\n");\r
-               res = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Ranked %u valid root switches\n", num_roots);\r
-\r
-       /* Now the list has all the roots.\r
-          BFS the subnet and update rank on all the switches. */\r
-\r
-       while (!cl_is_list_empty(&ranking_bfs_list)) {\r
-               p_sw = (ftree_sw_t *) cl_list_remove_head(&ranking_bfs_list);\r
-               p_osm_node = p_sw->p_osm_sw->p_node;\r
-\r
-               /* note: skipping port 0 on switches */\r
-               for (i = 1; i < osm_node_get_num_physp(p_osm_node); i++) {\r
-                       p_osm_physp = osm_node_get_physp_ptr(p_osm_node, i);\r
-                       if (!p_osm_physp || !osm_link_is_healthy(p_osm_physp))\r
-                               continue;\r
-\r
-                       p_remote_osm_node =\r
-                           osm_node_get_remote_node(p_osm_node, i, NULL);\r
-                       if (!p_remote_osm_node)\r
-                               continue;\r
-\r
-                       if (osm_node_get_type(p_remote_osm_node) !=\r
-                           IB_NODE_TYPE_SWITCH)\r
-                               continue;\r
-\r
-                       p_remote_sw = fabric_get_sw_by_guid(p_ftree,\r
-                                                           osm_node_get_node_guid\r
-                                                           (p_remote_osm_node));\r
-                       CL_ASSERT(p_remote_sw);\r
-\r
-                       /* if needed, rank the remote switch and add it to the BFS list */\r
-                       if (sw_update_rank(p_remote_sw, p_sw->rank + 1)) {\r
-                               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                                       "Ranking switch 0x%" PRIx64\r
-                                       " with rank %u\n",\r
-                                       sw_get_guid_ho(p_remote_sw),\r
-                                       p_remote_sw->rank);\r
-                               max_rank = p_remote_sw->rank;\r
-                               cl_list_insert_tail(&ranking_bfs_list,\r
-                                                   p_remote_sw);\r
-                       }\r
-               }\r
-               /* done with ports of this switch - go to the next switch in the list */\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Subnet ranking completed. Max Node Rank = %u\n", max_rank);\r
-\r
-       /* set FatTree maximal switch rank */\r
-       p_ftree->max_switch_rank = max_rank;\r
-\r
-Exit:\r
-       cl_list_destroy(&ranking_bfs_list);\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_rank_from_roots() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int fabric_rank_from_hcas(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_hca_t *p_hca;\r
-       ftree_hca_t *p_next_hca;\r
-       cl_list_t ranking_bfs_list;\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       cl_list_init(&ranking_bfs_list, 10);\r
-\r
-       /* Mark REVERSED rank of all the switches in the subnet.\r
-          Start from switches that are connected to hca's, and\r
-          scan all the switches in the subnet. */\r
-       p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-       while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-               p_hca = p_next_hca;\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-               if (rank_leaf_switches(p_ftree, p_hca, &ranking_bfs_list) != 0) {\r
-                       res = -1;\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB14: "\r
-                               "Subnet ranking failed - subnet is not FatTree");\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* Now rank rest of the switches in the fabric, while the\r
-          list already contains all the ranked leaf switches */\r
-       rank_switches_from_leafs(p_ftree, &ranking_bfs_list);\r
-\r
-       /* fix ranking of the switches by reversing the ranking direction */\r
-       cl_qmap_apply_func(&p_ftree->sw_tbl, sw_reverse_rank, (void *)p_ftree);\r
-\r
-Exit:\r
-       cl_list_destroy(&ranking_bfs_list);\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_rank_from_hcas() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int fabric_rank(IN ftree_fabric_t * p_ftree)\r
-{\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       if (fabric_roots_provided(p_ftree))\r
-               res = fabric_rank_from_roots(p_ftree);\r
-       else\r
-               res = fabric_rank_from_hcas(p_ftree);\r
-\r
-       if (res)\r
-               goto Exit;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "FatTree max switch rank is %u\n", p_ftree->max_switch_rank);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_rank() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)\r
-{\r
-       unsigned i;\r
-       ftree_sw_t *p_sw;\r
-       ftree_hca_t *p_hca = NULL;\r
-       ftree_hca_t *p_next_hca;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       if (!fabric_roots_provided(p_ftree)) {\r
-               /* If root file is not provided, the fabric has to be pure fat-tree\r
-                  in terms of ranking. Thus, leaf switches rank is the max rank. */\r
-               p_ftree->leaf_switch_rank = p_ftree->max_switch_rank;\r
-       } else {\r
-               /* Find the first CN and set the leaf_switch_rank to the rank\r
-                  of the switch that is connected to this CN. Later we will\r
-                  ensure that all the leaf switches have the same rank. */\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-               while (p_next_hca !=\r
-                      (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-                       p_hca = p_next_hca;\r
-                       if (p_hca->cn_num)\r
-                               break;\r
-                       p_next_hca =\r
-                           (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-               }\r
-               /* we know that there are CNs in the fabric, so just to be sure... */\r
-               CL_ASSERT(p_next_hca !=\r
-                         (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl));\r
-\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Selected CN port GUID 0x%" PRIx64 "\n",\r
-                       hca_get_guid_ho(p_hca));\r
-\r
-               for (i = 0; (i < p_hca->up_port_groups_num)\r
-                    && (!p_hca->up_port_groups[i]->is_cn); i++) ;\r
-               CL_ASSERT(i < p_hca->up_port_groups_num);\r
-               CL_ASSERT(p_hca->up_port_groups[i]->remote_node_type ==\r
-                         IB_NODE_TYPE_SWITCH);\r
-\r
-               p_sw = p_hca->up_port_groups[i]->remote_hca_or_sw.p_sw;\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Selected leaf switch GUID 0x%" PRIx64 ", rank %u\n",\r
-                       sw_get_guid_ho(p_sw), p_sw->rank);\r
-               p_ftree->leaf_switch_rank = p_sw->rank;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "FatTree leaf switch rank is %u\n", p_ftree->leaf_switch_rank);\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-}                              /* fabric_set_leaf_rank() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int fabric_populate_ports(IN ftree_fabric_t * p_ftree)\r
-{\r
-       ftree_hca_t *p_hca;\r
-       ftree_hca_t *p_next_hca;\r
-       ftree_sw_t *p_sw;\r
-       ftree_sw_t *p_next_sw;\r
-       int res = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       p_next_hca = (ftree_hca_t *) cl_qmap_head(&p_ftree->hca_tbl);\r
-       while (p_next_hca != (ftree_hca_t *) cl_qmap_end(&p_ftree->hca_tbl)) {\r
-               p_hca = p_next_hca;\r
-               p_next_hca = (ftree_hca_t *) cl_qmap_next(&p_hca->map_item);\r
-               if (fabric_construct_hca_ports(p_ftree, p_hca) != 0) {\r
-                       res = -1;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);\r
-       while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);\r
-               if (fabric_construct_sw_ports(p_ftree, p_sw) != 0) {\r
-                       res = -1;\r
-                       goto Exit;\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return res;\r
-}                              /* fabric_populate_ports() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-static int add_guid_item_to_map(void *cxt, uint64_t guid, char *p)\r
-{\r
-       cl_qmap_t *map = cxt;\r
-       name_map_item_t *item;\r
-\r
-       item = malloc(sizeof(*item));\r
-       if (!item)\r
-               return -1;\r
-\r
-       item->guid = guid;\r
-       cl_qmap_insert(map, guid, &item->item);\r
-\r
-       return 0;\r
-}\r
-\r
-static int fabric_read_guid_files(IN ftree_fabric_t * p_ftree)\r
-{\r
-       int status = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       if (fabric_cns_provided(p_ftree)) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Fetching compute nodes from file %s\n",\r
-                       p_ftree->p_osm->subn.opt.cn_guid_file);\r
-\r
-               if (parse_node_map(p_ftree->p_osm->subn.opt.cn_guid_file,\r
-                                  add_guid_item_to_map,\r
-                                  &p_ftree->cn_guid_tbl)) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB23: " "Problem parsing CN guid file\n");\r
-                       status = -1;\r
-                       goto Exit;\r
-               }\r
-\r
-               if (!cl_qmap_count(&p_ftree->cn_guid_tbl)) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB27: "\r
-                               "Compute node guids file has no valid guids\n");\r
-                       status = -1;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (fabric_ios_provided(p_ftree)) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Fetching I/O nodes from file %s\n",\r
-                       p_ftree->p_osm->subn.opt.io_guid_file);\r
-\r
-               if (parse_node_map(p_ftree->p_osm->subn.opt.io_guid_file,\r
-                                  add_guid_item_to_map,\r
-                                  &p_ftree->io_guid_tbl)) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB28: Problem parsing I/O guid file\n");\r
-                       status = -1;\r
-                       goto Exit;\r
-               }\r
-\r
-               if (!cl_qmap_count(&p_ftree->io_guid_tbl)) {\r
-                       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,\r
-                               "ERR AB29: "\r
-                               "I/O node guids file has no valid guids\n");\r
-                       status = -1;\r
-                       goto Exit;\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return status;\r
-}                              /*fabric_read_guid_files() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int construct_fabric(IN void *context)\r
-{\r
-       ftree_fabric_t *p_ftree = context;\r
-       int status = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       fabric_clear(p_ftree);\r
-\r
-       if (p_ftree->p_osm->subn.opt.lmc > 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "LMC > 0 is not supported by fat-tree routing.\n"\r
-                       "Falling back to default routing\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       if (cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl) < 2) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric has %u switches - topology is not fat-tree.\n"\r
-                       "Falling back to default routing\n",\r
-                       cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl) -\r
-            cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl)) < 2) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric has %u nodes (%u switches) - topology is not fat-tree.\n"\r
-                       "Falling back to default routing\n",\r
-                       cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl),\r
-                       cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl));\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "\n"\r
-               "                       |----------------------------------------|\n"\r
-               "                       |- Starting FatTree fabric construction -|\n"\r
-               "                       |----------------------------------------|\n\n");\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Populating FatTree Switch and CA tables\n");\r
-       if (fabric_populate_nodes(p_ftree) != 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric topology is not fat-tree - "\r
-                       "falling back to default routing\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Reading guid files provided by user\n");\r
-       if (fabric_read_guid_files(p_ftree) != 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Failed reading guid files - "\r
-                       "falling back to default routing\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       if (cl_qmap_count(&p_ftree->hca_tbl) < 2) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric has %u CAs - topology is not fat-tree.\n"\r
-                       "Falling back to default routing\n",\r
-                       cl_qmap_count(&p_ftree->hca_tbl));\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Rank all the switches in the fabric.\r
-          After that we will know only fabric max switch rank.\r
-          We will be able to check leaf switches rank and the\r
-          whole tree rank after filling ports and marking CNs. */\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Ranking FatTree\n");\r
-       if (fabric_rank(p_ftree) != 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Failed ranking the tree\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* For each hca and switch, construct array of ports.\r
-          This is done after the whole FatTree data structure is ready,\r
-          because we want the ports to have pointers to ftree_{sw,hca}_t\r
-          objects, and we need the switches to be already ranked because\r
-          that's how the port direction is determined. */\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Populating CA & switch ports\n");\r
-       if (fabric_populate_ports(p_ftree) != 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric topology is not a fat-tree\n");\r
-               status = -1;\r
-               goto Exit;\r
-       } else if (p_ftree->cn_num == 0) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric has no valid compute nodes\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Now that the CA ports have been created and CNs were marked,\r
-          we can complete the fabric ranking - set leaf switches rank. */\r
-       fabric_set_leaf_rank(p_ftree);\r
-\r
-       if (fabric_get_rank(p_ftree) > FAT_TREE_MAX_RANK ||\r
-           fabric_get_rank(p_ftree) < FAT_TREE_MIN_RANK) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric rank is %u (should be between %u and %u)\n",\r
-                       fabric_get_rank(p_ftree), FAT_TREE_MIN_RANK,\r
-                       FAT_TREE_MAX_RANK);\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Mark all the switches in the fabric with rank equal to\r
-          p_ftree->leaf_switch_rank and that are also connected to CNs.\r
-          As a by-product, this function also runs basic topology\r
-          validation - it checks that all the CNs are at the same rank. */\r
-       if (fabric_mark_leaf_switches(p_ftree)) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric topology is not a fat-tree\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Assign index to all the switches in the fabric.\r
-          This function also sorts leaf switch array by the switch index,\r
-          sorts all the port arrays of the indexed switches by remote\r
-          switch index, and creates switch-by-tuple table (sw_by_tuple_tbl) */\r
-       fabric_make_indexing(p_ftree);\r
-\r
-       /* Create leaf switch array sorted by index.\r
-          This array contains switches with rank equal to p_ftree->leaf_switch_rank\r
-          and that are also connected to CNs (REAL leafs), and it may contain\r
-          switches at the same leaf rank w/o CNs, if this is the order of indexing.\r
-          In any case, the first and the last switches in the array are REAL leafs. */\r
-       if (fabric_create_leaf_switch_array(p_ftree)) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric topology is not a fat-tree\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       /* calculate and set ftree.max_cn_per_leaf field */\r
-       fabric_set_max_cn_per_leaf(p_ftree);\r
-\r
-       /* print general info about fabric topology */\r
-       fabric_dump_general_info(p_ftree);\r
-\r
-       /* dump full tree topology */\r
-       if (osm_log_is_active(&p_ftree->p_osm->log, OSM_LOG_DEBUG))\r
-               fabric_dump(p_ftree);\r
-\r
-       /* the fabric is required to be PURE fat-tree only if the root\r
-          guid file hasn't been provided by user */\r
-       if (!fabric_roots_provided(p_ftree) &&\r
-           !fabric_validate_topology(p_ftree)) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
-                       "Fabric topology is not a fat-tree\n");\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Max LID in switch LFTs: %u\n", p_ftree->lft_max_lid);\r
-\r
-Exit:\r
-       if (status != 0) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "Clearing FatTree Fabric data structures\n");\r
-               fabric_clear(p_ftree);\r
-       } else\r
-               p_ftree->fabric_built = TRUE;\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "\n"\r
-               "                       |--------------------------------------------------|\n"\r
-               "                       |- Done constructing FatTree fabric (status = %d) -|\n"\r
-               "                       |--------------------------------------------------|\n\n",\r
-               status);\r
-\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return status;\r
-}                              /* construct_fabric() */\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static int do_routing(IN void *context)\r
-{\r
-       ftree_fabric_t *p_ftree = context;\r
-       int status = 0;\r
-\r
-       OSM_LOG_ENTER(&p_ftree->p_osm->log);\r
-\r
-       if (!p_ftree->fabric_built) {\r
-               status = -1;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Starting FatTree routing\n");\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Filling switch forwarding tables for Compute Nodes\n");\r
-       fabric_route_to_cns(p_ftree);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Filling switch forwarding tables for non-CN targets\n");\r
-       fabric_route_to_non_cns(p_ftree);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Filling switch forwarding tables for switch-to-switch paths\n");\r
-       fabric_route_to_switches(p_ftree);\r
-\r
-       if (p_ftree->p_osm->subn.opt.connect_roots) {\r
-               OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "Connecting switches that are unreachable within "\r
-                       "Up/Down rules\n");\r
-               fabric_route_roots(p_ftree);\r
-       }\r
-\r
-       /* for each switch, set its fwd table */\r
-       cl_qmap_apply_func(&p_ftree->sw_tbl, set_sw_fwd_table, (void *)p_ftree);\r
-\r
-       /* write out hca ordering file */\r
-       fabric_dump_hca_ordering(p_ftree);\r
-\r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,\r
-               "FatTree routing is done\n");\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_ftree->p_osm->log);\r
-       return status;\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-static void delete(IN void *context)\r
-{\r
-       if (!context)\r
-               return;\r
-       fabric_destroy((ftree_fabric_t *) context);\r
-}\r
-\r
-/***************************************************\r
- ***************************************************/\r
-\r
-int osm_ucast_ftree_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)\r
-{\r
-       ftree_fabric_t *p_ftree = fabric_create();\r
-       if (!p_ftree)\r
-               return -1;\r
-\r
-       p_ftree->p_osm = p_osm;\r
-\r
-       r->context = (void *)p_ftree;\r
-       r->build_lid_matrices = construct_fabric;\r
-       r->ucast_build_fwd_tables = do_routing;\r
-       r->delete = delete;\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_lash.c b/branches/opensm_3/user/opensm/osm_ucast_lash.c
deleted file mode 100644 (file)
index f635cfc..0000000
+++ /dev/null
@@ -1,1317 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2007      Simula Research Laboratory. All rights reserved.\r
- * Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.\r
- * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.\r
- * Copyright (c) 2009      HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *      Implementation of LASH algorithm Calculation functions\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <errno.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_mesh.h>\r
-#include <opensm/osm_ucast_lash.h>\r
-\r
-typedef struct _reachable_dest {\r
-       int switch_id;\r
-       struct _reachable_dest *next;\r
-} reachable_dest_t;\r
-\r
-static void connect_switches(lash_t * p_lash, int sw1, int sw2, int phy_port_1)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       unsigned num = p_lash->switches[sw1]->node->num_links;\r
-       switch_t *s1 = p_lash->switches[sw1];\r
-       mesh_node_t *node = s1->node;\r
-       switch_t *s2;\r
-       link_t *l;\r
-       unsigned int i;\r
-\r
-       /*\r
-        * if doing mesh analysis:\r
-        *  - do not consider connections to self\r
-        *  - collapse multiple connections between\r
-        *    pair of switches to a single locical link\r
-        */\r
-       if (p_lash->p_osm->subn.opt.do_mesh_analysis) {\r
-               if (sw1 == sw2)\r
-                       return;\r
-\r
-               /* see if we are already linked to sw2 */\r
-               for (i = 0; i < num; i++) {\r
-                       l = node->links[i];\r
-\r
-                       if (node->links[i]->switch_id == sw2) {\r
-                               l->ports[l->num_ports++] = phy_port_1;\r
-                               return;\r
-                       }\r
-               }\r
-       }\r
-\r
-       l = node->links[num];\r
-       l->switch_id = sw2;\r
-       l->link_id = -1;\r
-       l->ports[l->num_ports++] = phy_port_1;\r
-\r
-       s2 = p_lash->switches[sw2];\r
-       for (i = 0; i < s2->node->num_links; i++) {\r
-               if (s2->node->links[i]->switch_id == sw1) {\r
-                       s2->node->links[i]->link_id = num;\r
-                       l->link_id = i;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       node->num_links++;\r
-\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "LASH connect: %d, %d, %d\n", sw1, sw2, phy_port_1);\r
-}\r
-\r
-static osm_switch_t *get_osm_switch_from_port(const osm_port_t * port)\r
-{\r
-       osm_physp_t *p = port->p_physp;\r
-       if (p->p_node->sw)\r
-               return p->p_node->sw;\r
-       else if (p->p_remote_physp->p_node->sw)\r
-               return p->p_remote_physp->p_node->sw;\r
-       return NULL;\r
-}\r
-\r
-static int cycle_exists(cdg_vertex_t * start, cdg_vertex_t * current,\r
-                       cdg_vertex_t * prev, int visit_num)\r
-{\r
-       cdg_vertex_t *h;\r
-       int i, new_visit_num;\r
-       int cycle_found = 0;\r
-\r
-       if (current != NULL && current->visiting_number > 0) {\r
-               if (visit_num > current->visiting_number && current->seen == 0) {\r
-                       h = start;\r
-                       cycle_found = 1;\r
-               }\r
-       } else {\r
-               if (current == NULL) {\r
-                       current = start;\r
-                       CL_ASSERT(prev == NULL);\r
-               }\r
-\r
-               current->visiting_number = visit_num;\r
-\r
-               if (prev != NULL) {\r
-                       prev->next = current;\r
-                       CL_ASSERT(prev->to == current->from);\r
-                       CL_ASSERT(prev->visiting_number > 0);\r
-               }\r
-\r
-               new_visit_num = visit_num + 1;\r
-\r
-               for (i = 0; i < current->num_deps; i++) {\r
-                       cycle_found =\r
-                           cycle_exists(start, current->deps[i].v, current,\r
-                                        new_visit_num);\r
-                       if (cycle_found == 1)\r
-                               i = current->num_deps;\r
-               }\r
-\r
-               current->seen = 1;\r
-               if (prev != NULL)\r
-                       prev->next = NULL;\r
-       }\r
-\r
-       return cycle_found;\r
-}\r
-\r
-static inline int get_next_switch(lash_t *p_lash, int sw, int link)\r
-{\r
-       return p_lash->switches[sw]->node->links[link]->switch_id;\r
-}\r
-\r
-static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,\r
-                                              int dest_switch, int lane)\r
-{\r
-       switch_t **switches = p_lash->switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;\r
-       int i_next_switch, output_link, i, next_link, i_next_next_switch,\r
-           depend = 0;\r
-       cdg_vertex_t *v;\r
-       int found;\r
-\r
-       output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-       i_next_switch = get_next_switch(p_lash, sw, output_link);\r
-\r
-       while (sw != dest_switch) {\r
-               v = cdg_vertex_matrix[lane][sw][i_next_switch];\r
-               CL_ASSERT(v != NULL);\r
-\r
-               if (v->num_using_vertex == 1) {\r
-\r
-                       cdg_vertex_matrix[lane][sw][i_next_switch] = NULL;\r
-\r
-                       free(v);\r
-               } else {\r
-                       v->num_using_vertex--;\r
-                       if (i_next_switch != dest_switch) {\r
-                               next_link =\r
-                                   switches[i_next_switch]->routing_table[dest_switch].out_link;\r
-                               i_next_next_switch = get_next_switch(p_lash, i_next_switch, next_link);\r
-                               found = 0;\r
-\r
-                               for (i = 0; i < v->num_deps; i++)\r
-                                       if (v->deps[i].v ==\r
-                                           cdg_vertex_matrix[lane][i_next_switch]\r
-                                           [i_next_next_switch]) {\r
-                                               found = 1;\r
-                                               depend = i;\r
-                                       }\r
-\r
-                               CL_ASSERT(found);\r
-\r
-                               if (v->deps[depend].num_used == 1) {\r
-                                       for (i = depend;\r
-                                            i < v->num_deps - 1; i++) {\r
-                                               v->deps[i].v = v->deps[i + 1].v;\r
-                                               v->deps[i].num_used =\r
-                                                   v->deps[i + 1].num_used;\r
-                                       }\r
-\r
-                                       v->num_deps--;\r
-                               } else\r
-                                       v->deps[depend].num_used--;\r
-                       }\r
-               }\r
-\r
-               sw = i_next_switch;\r
-               output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-\r
-               if (sw != dest_switch)\r
-                       i_next_switch = get_next_switch(p_lash, sw, output_link);\r
-       }\r
-}\r
-\r
-inline static void enqueue(cl_list_t * bfsq, switch_t * sw)\r
-{\r
-       CL_ASSERT(sw->q_state == UNQUEUED);\r
-       sw->q_state = Q_MEMBER;\r
-       cl_list_insert_tail(bfsq, sw);\r
-}\r
-\r
-inline static void dequeue(cl_list_t * bfsq, switch_t ** sw)\r
-{\r
-       *sw = (switch_t *) cl_list_remove_head(bfsq);\r
-       CL_ASSERT((*sw)->q_state == Q_MEMBER);\r
-       (*sw)->q_state = MST_MEMBER;\r
-}\r
-\r
-static int get_phys_connection(switch_t *sw, int switch_to)\r
-{\r
-       unsigned int i;\r
-\r
-       for (i = 0; i < sw->node->num_links; i++)\r
-               if (sw->node->links[i]->switch_id == switch_to)\r
-                       return i;\r
-       return i;\r
-}\r
-\r
-static void shortest_path(lash_t * p_lash, int ir)\r
-{\r
-       switch_t **switches = p_lash->switches, *sw, *swi;\r
-       unsigned int i;\r
-       cl_list_t bfsq;\r
-\r
-       cl_list_construct(&bfsq);\r
-       cl_list_init(&bfsq, 20);\r
-\r
-       enqueue(&bfsq, switches[ir]);\r
-\r
-       while (!cl_is_list_empty(&bfsq)) {\r
-               dequeue(&bfsq, &sw);\r
-               for (i = 0; i < sw->node->num_links; i++) {\r
-                       swi = switches[sw->node->links[i]->switch_id];\r
-                       if (swi->q_state == UNQUEUED) {\r
-                               enqueue(&bfsq, swi);\r
-                               sw->dij_channels[sw->used_channels++] = swi->id;\r
-                       }\r
-               }\r
-       }\r
-\r
-       cl_list_destroy(&bfsq);\r
-}\r
-\r
-static int generate_routing_func_for_mst(lash_t * p_lash, int sw_id,\r
-                                        reachable_dest_t ** destinations)\r
-{\r
-       int i, next_switch;\r
-       switch_t *sw = p_lash->switches[sw_id];\r
-       int num_channels = sw->used_channels;\r
-       reachable_dest_t *dest, *i_dest, *concat_dest = NULL, *prev;\r
-\r
-       for (i = 0; i < num_channels; i++) {\r
-               next_switch = sw->dij_channels[i];\r
-               if (generate_routing_func_for_mst(p_lash, next_switch, &dest))\r
-                       return -1;\r
-\r
-               i_dest = dest;\r
-               prev = i_dest;\r
-\r
-               while (i_dest != NULL) {\r
-                       if (sw->routing_table[i_dest->switch_id].out_link ==\r
-                           NONE)\r
-                               sw->routing_table[i_dest->switch_id].out_link =\r
-                                   get_phys_connection(sw, next_switch);\r
-\r
-                       prev = i_dest;\r
-                       i_dest = i_dest->next;\r
-               }\r
-\r
-               CL_ASSERT(prev->next == NULL);\r
-               prev->next = concat_dest;\r
-               concat_dest = dest;\r
-       }\r
-\r
-       i_dest = (reachable_dest_t *) malloc(sizeof(reachable_dest_t));\r
-       if (!i_dest)\r
-               return -1;\r
-       i_dest->switch_id = sw->id;\r
-       i_dest->next = concat_dest;\r
-       *destinations = i_dest;\r
-       return 0;\r
-}\r
-\r
-static int generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,\r
-                              int lane)\r
-{\r
-       unsigned num_switches = p_lash->num_switches;\r
-       switch_t **switches = p_lash->switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;\r
-       int next_switch, output_link, j, exists;\r
-       cdg_vertex_t *v, *prev = NULL;\r
-\r
-       output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-       next_switch = get_next_switch(p_lash, sw, output_link);\r
-\r
-       while (sw != dest_switch) {\r
-\r
-               if (cdg_vertex_matrix[lane][sw][next_switch] == NULL) {\r
-                       v = calloc(1, sizeof(*v) + (num_switches - 1) * sizeof(v->deps[0]));\r
-                       if (!v)\r
-                               return -1;\r
-                       v->from = sw;\r
-                       v->to = next_switch;\r
-                       v->temp = 1;\r
-                       cdg_vertex_matrix[lane][sw][next_switch] = v;\r
-               } else\r
-                       v = cdg_vertex_matrix[lane][sw][next_switch];\r
-\r
-               v->num_using_vertex++;\r
-\r
-               if (prev != NULL) {\r
-                       exists = 0;\r
-\r
-                       for (j = 0; j < prev->num_deps; j++)\r
-                               if (prev->deps[j].v == v) {\r
-                                       exists = 1;\r
-                                       prev->deps[j].num_used++;\r
-                               }\r
-\r
-                       if (exists == 0) {\r
-                               prev->deps[prev->num_deps].v = v;\r
-                               prev->deps[prev->num_deps].num_used++;\r
-                               prev->num_deps++;\r
-\r
-                               CL_ASSERT(prev->num_deps < (int)num_switches);\r
-\r
-                               if (prev->temp == 0)\r
-                                       prev->num_temp_depend++;\r
-\r
-                       }\r
-               }\r
-\r
-               sw = next_switch;\r
-               output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-\r
-               if (sw != dest_switch) {\r
-                       CL_ASSERT(output_link != NONE);\r
-                       next_switch = get_next_switch(p_lash, sw, output_link);\r
-               }\r
-\r
-               prev = v;\r
-       }\r
-       return 0;\r
-}\r
-\r
-static void set_temp_depend_to_permanent_for_sp(lash_t * p_lash, int sw,\r
-                                               int dest_switch, int lane)\r
-{\r
-       switch_t **switches = p_lash->switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;\r
-       int next_switch, output_link;\r
-       cdg_vertex_t *v;\r
-\r
-       output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-       next_switch = get_next_switch(p_lash, sw, output_link);\r
-\r
-       while (sw != dest_switch) {\r
-               v = cdg_vertex_matrix[lane][sw][next_switch];\r
-               CL_ASSERT(v != NULL);\r
-\r
-               if (v->temp == 1)\r
-                       v->temp = 0;\r
-               else\r
-                       v->num_temp_depend = 0;\r
-\r
-               sw = next_switch;\r
-               output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-\r
-               if (sw != dest_switch)\r
-                       next_switch = get_next_switch(p_lash, sw, output_link);\r
-       }\r
-\r
-}\r
-\r
-static void remove_temp_depend_for_sp(lash_t * p_lash, int sw, int dest_switch,\r
-                                     int lane)\r
-{\r
-       switch_t **switches = p_lash->switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;\r
-       int next_switch, output_link, i;\r
-       cdg_vertex_t *v;\r
-\r
-       output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-       next_switch = get_next_switch(p_lash, sw, output_link);\r
-\r
-       while (sw != dest_switch) {\r
-               v = cdg_vertex_matrix[lane][sw][next_switch];\r
-               CL_ASSERT(v != NULL);\r
-\r
-               if (v->temp == 1) {\r
-                       cdg_vertex_matrix[lane][sw][next_switch] = NULL;\r
-                       free(v);\r
-               } else {\r
-                       CL_ASSERT(v->num_temp_depend <= v->num_deps);\r
-                       v->num_deps = v->num_deps - v->num_temp_depend;\r
-                       v->num_temp_depend = 0;\r
-                       v->num_using_vertex--;\r
-\r
-                       for (i = v->num_deps; i < p_lash->num_switches - 1; i++)\r
-                               v->deps[i].num_used = 0;\r
-               }\r
-\r
-               sw = next_switch;\r
-               output_link = switches[sw]->routing_table[dest_switch].out_link;\r
-\r
-               if (sw != dest_switch)\r
-                       next_switch = get_next_switch(p_lash, sw, output_link);\r
-\r
-       }\r
-}\r
-\r
-static int balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)\r
-{\r
-       unsigned num_switches = p_lash->num_switches;\r
-       cdg_vertex_t ****cdg_vertex_matrix = p_lash->cdg_vertex_matrix;\r
-       int *num_mst_in_lane = p_lash->num_mst_in_lane;\r
-       int ***virtual_location = p_lash->virtual_location;\r
-       int min_filled_lane, max_filled_lane, trials;\r
-       int old_min_filled_lane, old_max_filled_lane, new_num_min_lane,\r
-           new_num_max_lane;\r
-       unsigned int i, j;\r
-       int src, dest, start, next_switch, output_link;\r
-       int next_switch2, output_link2;\r
-       int stop = 0, cycle_found;\r
-       int cycle_found2;\r
-       unsigned start_vl = p_lash->p_osm->subn.opt.lash_start_vl;\r
-\r
-       max_filled_lane = 0;\r
-       min_filled_lane = lanes_needed - 1;\r
-\r
-       trials = num_mst_in_lane[max_filled_lane];\r
-       if (lanes_needed == 1)\r
-               stop = 1;\r
-\r
-       while (stop == 0) {\r
-               src = abs(rand()) % (num_switches);\r
-               dest = abs(rand()) % (num_switches);\r
-\r
-               while (virtual_location[src][dest][max_filled_lane] != 1) {\r
-                       start = dest;\r
-                       if (dest == num_switches - 1)\r
-                               dest = 0;\r
-                       else\r
-                               dest++;\r
-\r
-                       while (dest != start\r
-                              && virtual_location[src][dest][max_filled_lane]\r
-                              != 1) {\r
-                               if (dest == num_switches - 1)\r
-                                       dest = 0;\r
-                               else\r
-                                       dest++;\r
-                       }\r
-\r
-                       if (virtual_location[src][dest][max_filled_lane] != 1) {\r
-                               if (src == num_switches - 1)\r
-                                       src = 0;\r
-                               else\r
-                                       src++;\r
-                       }\r
-               }\r
-\r
-               if (generate_cdg_for_sp(p_lash, src, dest, min_filled_lane) ||\r
-                   generate_cdg_for_sp(p_lash, dest, src, min_filled_lane))\r
-                       return -1;\r
-\r
-               output_link = p_lash->switches[src]->routing_table[dest].out_link;\r
-               next_switch = get_next_switch(p_lash, src, output_link);\r
-\r
-               output_link2 = p_lash->switches[dest]->routing_table[src].out_link;\r
-               next_switch2 = get_next_switch(p_lash, dest, output_link2);\r
-\r
-               CL_ASSERT(cdg_vertex_matrix[min_filled_lane][src][next_switch] != NULL);\r
-               CL_ASSERT(cdg_vertex_matrix[min_filled_lane][dest][next_switch2] != NULL);\r
-\r
-               cycle_found =\r
-                   cycle_exists(cdg_vertex_matrix[min_filled_lane][src][next_switch], NULL, NULL,\r
-                                1);\r
-               cycle_found2 =\r
-                   cycle_exists(cdg_vertex_matrix[min_filled_lane][dest][next_switch2], NULL, NULL,\r
-                                1);\r
-\r
-               for (i = 0; i < num_switches; i++)\r
-                       for (j = 0; j < num_switches; j++)\r
-                               if (cdg_vertex_matrix[min_filled_lane][i][j] != NULL) {\r
-                                       cdg_vertex_matrix[min_filled_lane][i][j]->visiting_number =\r
-                                           0;\r
-                                       cdg_vertex_matrix[min_filled_lane][i][j]->seen = 0;\r
-                               }\r
-\r
-               if (cycle_found == 1 || cycle_found2 == 1) {\r
-                       remove_temp_depend_for_sp(p_lash, src, dest, min_filled_lane);\r
-                       remove_temp_depend_for_sp(p_lash, dest, src, min_filled_lane);\r
-\r
-                       virtual_location[src][dest][max_filled_lane] = 2;\r
-                       virtual_location[dest][src][max_filled_lane] = 2;\r
-                       trials--;\r
-                       trials--;\r
-               } else {\r
-                       set_temp_depend_to_permanent_for_sp(p_lash, src, dest, min_filled_lane);\r
-                       set_temp_depend_to_permanent_for_sp(p_lash, dest, src, min_filled_lane);\r
-\r
-                       num_mst_in_lane[max_filled_lane]--;\r
-                       num_mst_in_lane[max_filled_lane]--;\r
-                       num_mst_in_lane[min_filled_lane]++;\r
-                       num_mst_in_lane[min_filled_lane]++;\r
-\r
-                       remove_semipermanent_depend_for_sp(p_lash, src, dest, max_filled_lane);\r
-                       remove_semipermanent_depend_for_sp(p_lash, dest, src, max_filled_lane);\r
-                       virtual_location[src][dest][max_filled_lane] = 0;\r
-                       virtual_location[dest][src][max_filled_lane] = 0;\r
-                       virtual_location[src][dest][min_filled_lane] = 1;\r
-                       virtual_location[dest][src][min_filled_lane] = 1;\r
-                       p_lash->switches[src]->routing_table[dest].lane = min_filled_lane + start_vl;\r
-                       p_lash->switches[dest]->routing_table[src].lane = min_filled_lane + start_vl;\r
-               }\r
-\r
-               if (trials == 0)\r
-                       stop = 1;\r
-               else {\r
-                       if (num_mst_in_lane[max_filled_lane] - num_mst_in_lane[min_filled_lane] <\r
-                           p_lash->balance_limit)\r
-                               stop = 1;\r
-               }\r
-\r
-               old_min_filled_lane = min_filled_lane;\r
-               old_max_filled_lane = max_filled_lane;\r
-\r
-               new_num_min_lane = MAX_INT;\r
-               new_num_max_lane = 0;\r
-\r
-               for (i = 0; i < lanes_needed; i++) {\r
-\r
-                       if (num_mst_in_lane[i] < new_num_min_lane) {\r
-                               new_num_min_lane = num_mst_in_lane[i];\r
-                               min_filled_lane = i;\r
-                       }\r
-\r
-                       if (num_mst_in_lane[i] > new_num_max_lane) {\r
-                               new_num_max_lane = num_mst_in_lane[i];\r
-                               max_filled_lane = i;\r
-                       }\r
-               }\r
-\r
-               if (old_min_filled_lane != min_filled_lane) {\r
-                       trials = num_mst_in_lane[max_filled_lane];\r
-                       for (i = 0; i < num_switches; i++)\r
-                               for (j = 0; j < num_switches; j++)\r
-                                       if (virtual_location[i][j][max_filled_lane] == 2)\r
-                                               virtual_location[i][j][max_filled_lane] = 1;\r
-               }\r
-\r
-               if (old_max_filled_lane != max_filled_lane) {\r
-                       trials = num_mst_in_lane[max_filled_lane];\r
-                       for (i = 0; i < num_switches; i++)\r
-                               for (j = 0; j < num_switches; j++)\r
-                                       if (virtual_location[i][j][old_max_filled_lane] == 2)\r
-                                               virtual_location[i][j][old_max_filled_lane] = 1;\r
-               }\r
-       }\r
-       return 0;\r
-}\r
-\r
-static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw)\r
-{\r
-       unsigned num_switches = p_lash->num_switches;\r
-       unsigned num_ports = p_sw->num_ports;\r
-       switch_t *sw;\r
-       unsigned int i;\r
-\r
-       sw = malloc(sizeof(*sw) + num_switches * sizeof(sw->routing_table[0]));\r
-       if (!sw)\r
-               return NULL;\r
-\r
-       memset(sw, 0, sizeof(*sw));\r
-       for (i = 0; i < num_switches; i++) {\r
-               sw->routing_table[i].out_link = NONE;\r
-               sw->routing_table[i].lane = NONE;\r
-       }\r
-\r
-       sw->id = id;\r
-       sw->dij_channels = malloc(num_ports * sizeof(int));\r
-       if (!sw->dij_channels) {\r
-               free(sw);\r
-               return NULL;\r
-       }\r
-\r
-       sw->p_sw = p_sw;\r
-       p_sw->priv = sw;\r
-\r
-       if (osm_mesh_node_create(p_lash, sw)) {\r
-               free(sw->dij_channels);\r
-               free(sw);\r
-               return NULL;\r
-       }\r
-\r
-       return sw;\r
-}\r
-\r
-static void switch_delete(lash_t *p_lash, switch_t * sw)\r
-{\r
-       if (sw->dij_channels)\r
-               free(sw->dij_channels);\r
-       free(sw);\r
-}\r
-\r
-static void delete_mesh_switches(lash_t *p_lash)\r
-{\r
-       if (p_lash->switches) {\r
-               unsigned id;\r
-               for (id = 0; ((int)id) < p_lash->num_switches; id++)\r
-                       if (p_lash->switches[id])\r
-                               osm_mesh_node_delete(p_lash,\r
-                                                    p_lash->switches[id]);\r
-       }\r
-}\r
-\r
-static void free_lash_structures(lash_t * p_lash)\r
-{\r
-       unsigned int i, j, k;\r
-       unsigned num_switches = p_lash->num_switches;\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       delete_mesh_switches(p_lash);\r
-\r
-       /* free cdg_vertex_matrix */\r
-       for (i = 0; i < p_lash->vl_min; i++) {\r
-               for (j = 0; j < num_switches; j++) {\r
-                       for (k = 0; k < num_switches; k++)\r
-                               if (p_lash->cdg_vertex_matrix[i][j][k])\r
-                                       free(p_lash->cdg_vertex_matrix[i][j][k]);\r
-                       if (p_lash->cdg_vertex_matrix[i][j])\r
-                               free(p_lash->cdg_vertex_matrix[i][j]);\r
-               }\r
-               if (p_lash->cdg_vertex_matrix[i])\r
-                       free(p_lash->cdg_vertex_matrix[i]);\r
-       }\r
-\r
-       if (p_lash->cdg_vertex_matrix)\r
-               free(p_lash->cdg_vertex_matrix);\r
-\r
-       /* free virtual_location */\r
-       for (i = 0; i < num_switches; i++) {\r
-               for (j = 0; j < num_switches; j++) {\r
-                       if (p_lash->virtual_location[i][j])\r
-                               free(p_lash->virtual_location[i][j]);\r
-               }\r
-               if (p_lash->virtual_location[i])\r
-                       free(p_lash->virtual_location[i]);\r
-       }\r
-       if (p_lash->virtual_location)\r
-               free(p_lash->virtual_location);\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-static int init_lash_structures(lash_t * p_lash)\r
-{\r
-       unsigned vl_min = p_lash->vl_min;\r
-       unsigned num_switches = p_lash->num_switches;\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int status = 0;\r
-       unsigned int i, j, k;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* initialise cdg_vertex_matrix[num_switches][num_switches][num_switches] */\r
-       p_lash->cdg_vertex_matrix =\r
-           (cdg_vertex_t ****) malloc(vl_min * sizeof(cdg_vertex_t ****));\r
-       if (p_lash->cdg_vertex_matrix == NULL)\r
-               goto Exit_Mem_Error;\r
-       for (i = 0; i < vl_min; i++) {\r
-               p_lash->cdg_vertex_matrix[i] =\r
-                   (cdg_vertex_t ***) malloc(num_switches *\r
-                                             sizeof(cdg_vertex_t ***));\r
-\r
-               if (p_lash->cdg_vertex_matrix[i] == NULL)\r
-                       goto Exit_Mem_Error;\r
-       }\r
-\r
-       for (i = 0; i < vl_min; i++) {\r
-               for (j = 0; j < num_switches; j++) {\r
-                       p_lash->cdg_vertex_matrix[i][j] =\r
-                           (cdg_vertex_t **) malloc(num_switches *\r
-                                                    sizeof(cdg_vertex_t **));\r
-                       if (p_lash->cdg_vertex_matrix[i][j] == NULL)\r
-                               goto Exit_Mem_Error;\r
-\r
-                       for (k = 0; k < num_switches; k++)\r
-                               p_lash->cdg_vertex_matrix[i][j][k] = NULL;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * initialise virtual_location[num_switches][num_switches][num_layers],\r
-        * default value = 0\r
-        */\r
-       p_lash->virtual_location =\r
-           (int ***)malloc(num_switches * sizeof(int ***));\r
-       if (p_lash->virtual_location == NULL)\r
-               goto Exit_Mem_Error;\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-               p_lash->virtual_location[i] =\r
-                   (int **)malloc(num_switches * sizeof(int **));\r
-               if (p_lash->virtual_location[i] == NULL)\r
-                       goto Exit_Mem_Error;\r
-       }\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-               for (j = 0; j < num_switches; j++) {\r
-                       p_lash->virtual_location[i][j] =\r
-                           (int *)malloc(vl_min * sizeof(int *));\r
-                       if (p_lash->virtual_location[i][j] == NULL)\r
-                               goto Exit_Mem_Error;\r
-                       for (k = 0; k < vl_min; k++)\r
-                               p_lash->virtual_location[i][j][k] = 0;\r
-               }\r
-       }\r
-\r
-       /* initialise num_mst_in_lane[num_switches], default 0 */\r
-       memset(p_lash->num_mst_in_lane, 0,\r
-              IB_MAX_NUM_VLS * sizeof(p_lash->num_mst_in_lane[0]));\r
-\r
-       goto Exit;\r
-\r
-Exit_Mem_Error:\r
-       status = -1;\r
-       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D01: "\r
-               "Could not allocate required memory for LASH errno %d, errno %d for lack of memory\n",\r
-               errno, ENOMEM);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-static int lash_core(lash_t * p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       unsigned num_switches = p_lash->num_switches;\r
-       switch_t **switches = p_lash->switches;\r
-       unsigned lanes_needed = 1;\r
-       unsigned int i, j, k, dest_switch = 0;\r
-       reachable_dest_t *dests, *idest;\r
-       int cycle_found = 0;\r
-       unsigned v_lane;\r
-       int stop = 0, output_link, i_next_switch;\r
-       int output_link2, i_next_switch2;\r
-       int cycle_found2 = 0;\r
-       int status = -1;\r
-       int *switch_bitmap = NULL;      /* Bitmap to check if we have processed this pair */\r
-       unsigned start_vl = p_lash->p_osm->subn.opt.lash_start_vl;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       if (p_lash->p_osm->subn.opt.do_mesh_analysis && osm_do_mesh_analysis(p_lash)) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D05: Mesh analysis failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-\r
-               shortest_path(p_lash, i);\r
-               if (generate_routing_func_for_mst(p_lash, i, &dests)) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D06: "\r
-                               "generate_routing_func_for_mst failed\n");\r
-                       goto Exit;\r
-               }\r
-\r
-               idest = dests;\r
-               while (idest != NULL) {\r
-                       dests = dests->next;\r
-                       free(idest);\r
-                       idest = dests;\r
-               }\r
-\r
-               for (j = 0; j < num_switches; j++) {\r
-                       switches[j]->used_channels = 0;\r
-                       switches[j]->q_state = UNQUEUED;\r
-               }\r
-       }\r
-\r
-       switch_bitmap = calloc(num_switches * num_switches, sizeof(int));\r
-       if (!switch_bitmap) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D04: "\r
-                       "Failed allocating switch_bitmap - out of memory\n");\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_switches; i++) {\r
-               for (dest_switch = 0; dest_switch < num_switches; dest_switch++)\r
-                       if (dest_switch != i && switch_bitmap[i * num_switches + dest_switch] == 0) {\r
-                               v_lane = 0;\r
-                               stop = 0;\r
-                               while (v_lane < lanes_needed && stop == 0) {\r
-                                       if (generate_cdg_for_sp(p_lash, i, dest_switch, v_lane) ||\r
-                                           generate_cdg_for_sp(p_lash, dest_switch, i, v_lane)) {\r
-                                               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                                       "ERR 4D07: generate_cdg_for_sp failed\n");\r
-                                               goto Exit;\r
-                                       }\r
-\r
-                                       output_link =\r
-                                           switches[i]->routing_table[dest_switch].out_link;\r
-                                       output_link2 =\r
-                                           switches[dest_switch]->routing_table[i].out_link;\r
-\r
-                                       i_next_switch = get_next_switch(p_lash, i, output_link);\r
-                                       i_next_switch2 = get_next_switch(p_lash, dest_switch, output_link2);\r
-\r
-                                       CL_ASSERT(p_lash->\r
-                                                 cdg_vertex_matrix[v_lane][i][i_next_switch] !=\r
-                                                 NULL);\r
-                                       CL_ASSERT(p_lash->\r
-                                                 cdg_vertex_matrix[v_lane][dest_switch]\r
-                                                 [i_next_switch2] != NULL);\r
-\r
-                                       cycle_found =\r
-                                           cycle_exists(p_lash->\r
-                                                        cdg_vertex_matrix[v_lane][i]\r
-                                                        [i_next_switch], NULL, NULL, 1);\r
-                                       cycle_found2 =\r
-                                           cycle_exists(p_lash->\r
-                                                        cdg_vertex_matrix[v_lane][dest_switch]\r
-                                                        [i_next_switch2], NULL, NULL, 1);\r
-\r
-                                       for (j = 0; j < num_switches; j++)\r
-                                               for (k = 0; k < num_switches; k++)\r
-                                                       if (p_lash->\r
-                                                           cdg_vertex_matrix[v_lane][j][k] !=\r
-                                                           NULL) {\r
-                                                               p_lash->\r
-                                                                   cdg_vertex_matrix[v_lane][j]\r
-                                                                   [k]->visiting_number = 0;\r
-                                                               p_lash->\r
-                                                                   cdg_vertex_matrix[v_lane][j]\r
-                                                                   [k]->seen = 0;\r
-                                                       }\r
-\r
-                                       if (cycle_found == 1 || cycle_found2 == 1) {\r
-                                               remove_temp_depend_for_sp(p_lash, i, dest_switch,\r
-                                                                         v_lane);\r
-                                               remove_temp_depend_for_sp(p_lash, dest_switch, i,\r
-                                                                         v_lane);\r
-                                               v_lane++;\r
-                                       } else {\r
-                                               set_temp_depend_to_permanent_for_sp(p_lash, i,\r
-                                                                                   dest_switch,\r
-                                                                                   v_lane);\r
-                                               set_temp_depend_to_permanent_for_sp(p_lash,\r
-                                                                                   dest_switch, i,\r
-                                                                                   v_lane);\r
-                                               stop = 1;\r
-                                               p_lash->num_mst_in_lane[v_lane]++;\r
-                                               p_lash->num_mst_in_lane[v_lane]++;\r
-                                       }\r
-                               }\r
-\r
-                               switches[i]->routing_table[dest_switch].lane = v_lane + start_vl;\r
-                               switches[dest_switch]->routing_table[i].lane = v_lane + start_vl;\r
-\r
-                               if (cycle_found == 1 || cycle_found2 == 1) {\r
-                                       if (++lanes_needed > p_lash->vl_min)\r
-                                               goto Error_Not_Enough_Lanes;\r
-\r
-                                       if (generate_cdg_for_sp(p_lash, i, dest_switch, v_lane) ||\r
-                                           generate_cdg_for_sp(p_lash, dest_switch, i, v_lane)) {\r
-                                               OSM_LOG(p_log, OSM_LOG_ERROR,\r
-                                                       "ERR 4D08: generate_cdg_for_sp failed\n");\r
-                                               goto Exit;\r
-                                       }\r
-\r
-                                       set_temp_depend_to_permanent_for_sp(p_lash, i, dest_switch,\r
-                                                                           v_lane);\r
-                                       set_temp_depend_to_permanent_for_sp(p_lash, dest_switch, i,\r
-                                                                           v_lane);\r
-\r
-                                       p_lash->num_mst_in_lane[v_lane]++;\r
-                                       p_lash->num_mst_in_lane[v_lane]++;\r
-                               }\r
-                               p_lash->virtual_location[i][dest_switch][v_lane] = 1;\r
-                               p_lash->virtual_location[dest_switch][i][v_lane] = 1;\r
-\r
-                               switch_bitmap[i * num_switches + dest_switch] = 1;\r
-                               switch_bitmap[dest_switch * num_switches + i] = 1;\r
-                       }\r
-       }\r
-\r
-       for (i = 0; i < lanes_needed; i++)\r
-               OSM_LOG(p_log, OSM_LOG_INFO, "Lanes in layer %d: %d\n",\r
-                       i, p_lash->num_mst_in_lane[i]);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO,\r
-               "Lanes needed: %d, Balancing\n", lanes_needed);\r
-\r
-       if (balance_virtual_lanes(p_lash, lanes_needed)) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D09: Balancing failed\n");\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < lanes_needed; i++)\r
-               OSM_LOG(p_log, OSM_LOG_INFO, "Lanes in layer %d: %d\n",\r
-                       i, p_lash->num_mst_in_lane[i]);\r
-\r
-       status = 0;\r
-       goto Exit;\r
-\r
-Error_Not_Enough_Lanes:\r
-       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D02: "\r
-               "Lane requirements (%d) exceed available lanes (%d)"\r
-               " with starting lane (%d)\n",\r
-               lanes_needed, p_lash->vl_min, start_vl);\r
-Exit:\r
-       if (switch_bitmap)\r
-               free(switch_bitmap);\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-static unsigned get_lash_id(osm_switch_t * p_sw)\r
-{\r
-       return ((switch_t *) p_sw->priv)->id;\r
-}\r
-\r
-static int get_next_port(switch_t *sw, int link)\r
-{\r
-       link_t *l = sw->node->links[link];\r
-       int port = l->next_port++;\r
-\r
-       /*\r
-        * note if not doing mesh analysis\r
-        * then num_ports is always 1\r
-        */\r
-       if (l->next_port >= l->num_ports)\r
-               l->next_port = 0;\r
-\r
-       return l->ports[port];\r
-}\r
-\r
-static void populate_fwd_tbls(lash_t * p_lash)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       osm_subn_t *p_subn = &p_lash->p_osm->subn;\r
-       osm_switch_t *p_sw, *p_next_sw, *p_dst_sw;\r
-       osm_port_t *port;\r
-       uint16_t max_lid_ho, lid;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-\r
-       /* Go through each switch individually */\r
-       while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {\r
-               uint64_t current_guid;\r
-               switch_t *sw;\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               max_lid_ho = p_sw->max_lid_ho;\r
-               current_guid = p_sw->p_node->node_info.port_guid;\r
-               sw = p_sw->priv;\r
-\r
-               memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);\r
-\r
-               for (lid = 1; lid <= max_lid_ho; lid++) {\r
-                       port = osm_get_port_by_lid_ho(p_subn, lid);\r
-                       if (!port)\r
-                               continue;\r
-\r
-                       p_dst_sw = get_osm_switch_from_port(port);\r
-                       if (p_dst_sw == p_sw) {\r
-                               uint8_t egress_port = port->p_node->sw ? 0 :\r
-                                       port->p_physp->p_remote_physp->port_num;\r
-                               p_sw->new_lft[lid] = egress_port;\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "LASH fwd MY SRC SRC GUID 0x%016" PRIx64\r
-                                       " src lash id (%d), src lid no (%u) src lash port (%d) "\r
-                                       "DST GUID 0x%016" PRIx64\r
-                                       " src lash id (%d), src lash port (%d)\n",\r
-                                       cl_ntoh64(current_guid), -1, lid,\r
-                                       egress_port, cl_ntoh64(current_guid),\r
-                                       -1, egress_port);\r
-                       } else if (p_dst_sw) {\r
-                               unsigned dst_lash_switch_id =\r
-                                   get_lash_id(p_dst_sw);\r
-                               uint8_t lash_egress_port =\r
-                                   (uint8_t) sw->\r
-                                   routing_table[dst_lash_switch_id].out_link;\r
-                               uint8_t physical_egress_port =\r
-                                       get_next_port(sw, lash_egress_port);\r
-\r
-                               p_sw->new_lft[lid] = physical_egress_port;\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "LASH fwd SRC GUID 0x%016" PRIx64\r
-                                       " src lash id (%d), "\r
-                                       "src lid no (%u) src lash port (%d) "\r
-                                       "DST GUID 0x%016" PRIx64\r
-                                       " src lash id (%d), src lash port (%d)\n",\r
-                                       cl_ntoh64(current_guid), sw->id, lid,\r
-                                       lash_egress_port,\r
-                                       cl_ntoh64(p_dst_sw->p_node->node_info.\r
-                                                 port_guid),\r
-                                       dst_lash_switch_id,\r
-                                       physical_egress_port);\r
-                       }\r
-               }               /* for */\r
-       }\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-static void osm_lash_process_switch(lash_t * p_lash, osm_switch_t * p_sw)\r
-{\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int i, port_count;\r
-       osm_physp_t *p_current_physp, *p_remote_physp;\r
-       unsigned switch_a_lash_id, switch_b_lash_id;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       switch_a_lash_id = get_lash_id(p_sw);\r
-       port_count = osm_node_get_num_physp(p_sw->p_node);\r
-\r
-       /* starting at port 1, ignoring management port on switch */\r
-       for (i = 1; i < port_count; i++) {\r
-\r
-               p_current_physp = osm_node_get_physp_ptr(p_sw->p_node, i);\r
-               if (p_current_physp) {\r
-                       p_remote_physp = p_current_physp->p_remote_physp;\r
-                       if (p_remote_physp && p_remote_physp->p_node->sw) {\r
-                               int physical_port_a_num =\r
-                                   osm_physp_get_port_num(p_current_physp);\r
-                               int physical_port_b_num =\r
-                                   osm_physp_get_port_num(p_remote_physp);\r
-                               switch_b_lash_id =\r
-                                   get_lash_id(p_remote_physp->p_node->sw);\r
-\r
-                               connect_switches(p_lash, switch_a_lash_id,\r
-                                                switch_b_lash_id,\r
-                                                physical_port_a_num);\r
-                               OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-                                       "LASH SUCCESS connected G 0x%016" PRIx64\r
-                                       " , lash_id(%u), P(%u) " " to G 0x%016"\r
-                                       PRIx64 " , lash_id(%u) , P(%u)\n",\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_current_physp)),\r
-                                       switch_a_lash_id, physical_port_a_num,\r
-                                       cl_ntoh64(osm_physp_get_port_guid\r
-                                                 (p_remote_physp)),\r
-                                       switch_b_lash_id, physical_port_b_num);\r
-                       }\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-}\r
-\r
-static void lash_cleanup(lash_t * p_lash)\r
-{\r
-       osm_subn_t *p_subn = &p_lash->p_osm->subn;\r
-       osm_switch_t *p_next_sw, *p_sw;\r
-\r
-       /* drop any existing references to old lash switches */\r
-       p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-       while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-               p_sw->priv = NULL;\r
-       }\r
-\r
-       if (p_lash->switches) {\r
-               unsigned id;\r
-               for (id = 0; ((int)id) < p_lash->num_switches; id++)\r
-                       if (p_lash->switches[id])\r
-                               switch_delete(p_lash, p_lash->switches[id]);\r
-               free(p_lash->switches);\r
-       }\r
-       p_lash->switches = NULL;\r
-}\r
-\r
-/*\r
-  static int  discover_network_properties()\r
-  Traverse the topology of the network in order to determine\r
-   - the maximum number of switches,\r
-   - the minimum number of virtual layers\r
-*/\r
-\r
-static int discover_network_properties(lash_t * p_lash)\r
-{\r
-       int i, id = 0;\r
-       uint8_t vl_min;\r
-       osm_subn_t *p_subn = &p_lash->p_osm->subn;\r
-       osm_switch_t *p_next_sw, *p_sw;\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-\r
-       p_lash->num_switches = cl_qmap_count(&p_subn->sw_guid_tbl);\r
-\r
-       p_lash->switches = calloc(p_lash->num_switches, sizeof(switch_t *));\r
-       if (!p_lash->switches)\r
-               return -1;\r
-\r
-       vl_min = 5;             /* set to a high value */\r
-\r
-       p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-       while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {\r
-               uint16_t port_count;\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               p_lash->switches[id] = switch_create(p_lash, id, p_sw);\r
-               if (!p_lash->switches[id])\r
-                       return -1;\r
-               id++;\r
-\r
-               port_count = osm_node_get_num_physp(p_sw->p_node);\r
-\r
-               /* Note, ignoring port 0. management port */\r
-               for (i = 1; i < port_count; i++) {\r
-                       osm_physp_t *p_current_physp =\r
-                           osm_node_get_physp_ptr(p_sw->p_node, i);\r
-\r
-                       if (p_current_physp\r
-                           && p_current_physp->p_remote_physp) {\r
-\r
-                               ib_port_info_t *p_port_info =\r
-                                   &p_current_physp->port_info;\r
-                               uint8_t port_vl_min =\r
-                                   ib_port_info_get_op_vls(p_port_info);\r
-                               if (port_vl_min && port_vl_min < vl_min)\r
-                                       vl_min = port_vl_min;\r
-                       }\r
-               }               /* for */\r
-       }                       /* while */\r
-\r
-       vl_min = 1 << (vl_min - 1);\r
-       if (vl_min > 15)\r
-               vl_min = 15;\r
-\r
-       if (p_lash->p_osm->subn.opt.lash_start_vl >= vl_min) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 4D03: "\r
-                       "Start VL(%d) too high for min operational vl(%d)\n",\r
-                       p_lash->p_osm->subn.opt.lash_start_vl, vl_min);\r
-               return -1;\r
-       }\r
-\r
-       p_lash->vl_min = vl_min - p_lash->p_osm->subn.opt.lash_start_vl;\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO,\r
-               "min operational vl(%d) start vl(%d) max_switches(%d)\n",\r
-               p_lash->vl_min, p_lash->p_osm->subn.opt.lash_start_vl,\r
-               p_lash->num_switches);\r
-       return 0;\r
-}\r
-\r
-static void process_switches(lash_t * p_lash)\r
-{\r
-       osm_switch_t *p_sw, *p_next_sw;\r
-       osm_subn_t *p_subn = &p_lash->p_osm->subn;\r
-\r
-       /* Go through each switch and process it. i.e build the connection\r
-          structure required by LASH */\r
-       p_next_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-       while (p_next_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl)) {\r
-               p_sw = p_next_sw;\r
-               p_next_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);\r
-\r
-               osm_lash_process_switch(p_lash, p_sw);\r
-       }\r
-}\r
-\r
-static int lash_process(void *context)\r
-{\r
-       lash_t *p_lash = context;\r
-       osm_log_t *p_log = &p_lash->p_osm->log;\r
-       int status = 0;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_lash->balance_limit = 6;\r
-\r
-       /* everything starts here */\r
-       lash_cleanup(p_lash);\r
-\r
-       status = discover_network_properties(p_lash);\r
-       if (status)\r
-               goto Exit;\r
-\r
-       status = init_lash_structures(p_lash);\r
-       if (status)\r
-               goto Exit;\r
-\r
-       process_switches(p_lash);\r
-\r
-       status = lash_core(p_lash);\r
-       if (status)\r
-               goto Exit;\r
-\r
-       populate_fwd_tbls(p_lash);\r
-\r
-Exit:\r
-       if (p_lash->vl_min)\r
-               free_lash_structures(p_lash);\r
-       OSM_LOG_EXIT(p_log);\r
-\r
-       return status;\r
-}\r
-\r
-static lash_t *lash_create(osm_opensm_t * p_osm)\r
-{\r
-       lash_t *p_lash;\r
-\r
-       p_lash = calloc(1, sizeof(lash_t));\r
-       if (!p_lash)\r
-               return NULL;\r
-\r
-       p_lash->p_osm = p_osm;\r
-\r
-       return p_lash;\r
-}\r
-\r
-static void lash_delete(void *context)\r
-{\r
-       lash_t *p_lash = context;\r
-\r
-       if (p_lash->switches) {\r
-               unsigned id;\r
-               for (id = 0; ((int)id) < p_lash->num_switches; id++)\r
-                       if (p_lash->switches[id])\r
-                               switch_delete(p_lash, p_lash->switches[id]);\r
-               free(p_lash->switches);\r
-       }\r
-\r
-       free(p_lash);\r
-}\r
-\r
-uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, const osm_port_t * p_src_port,\r
-                       const osm_port_t * p_dst_port)\r
-{\r
-       unsigned dst_id;\r
-       unsigned src_id;\r
-       osm_switch_t *p_sw;\r
-\r
-       if (p_osm->routing_engine_used != OSM_ROUTING_ENGINE_TYPE_LASH)\r
-               return OSM_DEFAULT_SL;\r
-\r
-       p_sw = get_osm_switch_from_port(p_dst_port);\r
-       if (!p_sw || !p_sw->priv)\r
-               return OSM_DEFAULT_SL;\r
-       dst_id = get_lash_id(p_sw);\r
-\r
-       p_sw = get_osm_switch_from_port(p_src_port);\r
-       if (!p_sw || !p_sw->priv)\r
-               return OSM_DEFAULT_SL;\r
-\r
-       src_id = get_lash_id(p_sw);\r
-       if (src_id == dst_id)\r
-               return p_osm->subn.opt.lash_start_vl;\r
-\r
-       return (uint8_t) ((switch_t *) p_sw->priv)->routing_table[dst_id].lane;\r
-}\r
-\r
-int osm_ucast_lash_setup(struct osm_routing_engine *r, osm_opensm_t *p_osm)\r
-{\r
-       lash_t *p_lash = lash_create(p_osm);\r
-       if (!p_lash)\r
-               return -1;\r
-\r
-       r->context = p_lash;\r
-       r->ucast_build_fwd_tables = lash_process;\r
-       r->delete = lash_delete;\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_mgr.c b/branches/opensm_3/user/opensm/osm_ucast_mgr.c
deleted file mode 100644 (file)
index 9ccd583..0000000
+++ /dev/null
@@ -1,1156 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_ucast_mgr_t.\r
- * This file implements the Unicast Manager object.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qlist.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-#include <opensm/osm_sm.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_msgdef.h>\r
-#include <opensm/osm_opensm.h>\r
-\r
-void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr)\r
-{\r
-       memset(p_mgr, 0, sizeof(*p_mgr));\r
-}\r
-\r
-void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr)\r
-{\r
-       CL_ASSERT(p_mgr);\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       if (p_mgr->cache_valid)\r
-               osm_ucast_cache_invalidate(p_mgr);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr, IN osm_sm_t * sm)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       osm_ucast_mgr_construct(p_mgr);\r
-\r
-       p_mgr->sm = sm;\r
-       p_mgr->p_log = sm->p_log;\r
-       p_mgr->p_subn = sm->p_subn;\r
-       p_mgr->p_lock = sm->p_lock;\r
-\r
-       if (sm->p_subn->opt.use_ucast_cache)\r
-               cl_qmap_init(&p_mgr->cache_sw_tbl);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return status;\r
-}\r
-\r
-/**********************************************************************\r
- Add each switch's own and neighbor LIDs to its LID matrix\r
-**********************************************************************/\r
-static void ucast_mgr_process_hop_0_1(IN cl_map_item_t * p_map_item,\r
-                                     IN void *context)\r
-{\r
-       osm_switch_t * p_sw = (osm_switch_t *) p_map_item;\r
-       osm_node_t *p_remote_node;\r
-       uint16_t lid, remote_lid;\r
-       uint8_t i;\r
-\r
-       lid = cl_ntoh16(osm_node_get_base_lid(p_sw->p_node, 0));\r
-       osm_switch_set_hops(p_sw, lid, 0, 0);\r
-\r
-       for (i = 1; i < p_sw->num_ports; i++) {\r
-               osm_physp_t *p = osm_node_get_physp_ptr(p_sw->p_node, i);\r
-               p_remote_node = (p && p->p_remote_physp) ?\r
-                   p->p_remote_physp->p_node : NULL;\r
-\r
-               if (p_remote_node && p_remote_node->sw &&\r
-                   p_remote_node != p_sw->p_node) {\r
-                       remote_lid = osm_node_get_base_lid(p_remote_node, 0);\r
-                       remote_lid = cl_ntoh16(remote_lid);\r
-                       osm_switch_set_hops(p_sw, remote_lid, i, p->hop_wf);\r
-               }\r
-       }\r
-}\r
-\r
-static void ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * p_mgr,\r
-                                      IN osm_switch_t * p_this_sw,\r
-                                      IN osm_switch_t * p_remote_sw,\r
-                                      IN uint8_t port_num,\r
-                                      IN uint8_t remote_port_num)\r
-{\r
-       osm_switch_t *p_sw;\r
-       cl_map_item_t *item;\r
-       uint16_t lid_ho;\r
-       uint8_t hops;\r
-       osm_physp_t *p;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Node 0x%" PRIx64 ", remote node 0x%" PRIx64\r
-               ", port %u, remote port %u\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_this_sw->p_node)),\r
-               cl_ntoh64(osm_node_get_node_guid(p_remote_sw->p_node)),\r
-               port_num, remote_port_num);\r
-\r
-       p = osm_node_get_physp_ptr(p_this_sw->p_node, port_num);\r
-\r
-       for (item = cl_qmap_head(&p_mgr->p_subn->sw_guid_tbl);\r
-            item != cl_qmap_end(&p_mgr->p_subn->sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *) item;\r
-               lid_ho = cl_ntoh16(osm_node_get_base_lid(p_sw->p_node, 0));\r
-               hops = osm_switch_get_least_hops(p_remote_sw, lid_ho);\r
-               if (hops == OSM_NO_PATH)\r
-                       continue;\r
-               hops += p->hop_wf;\r
-               if (hops <\r
-                   osm_switch_get_hop_count(p_this_sw, lid_ho, port_num)) {\r
-                       if (osm_switch_set_hops\r
-                           (p_this_sw, lid_ho, port_num, hops) != 0)\r
-                               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A03: "\r
-                                       "cannot set hops for lid %u at switch 0x%"\r
-                                       PRIx64 "\n", lid_ho,\r
-                                       cl_ntoh64(osm_node_get_node_guid\r
-                                                 (p_this_sw->p_node)));\r
-                       p_mgr->some_hop_count_set = TRUE;\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static struct osm_remote_node *find_and_add_remote_sys(osm_switch_t * sw,\r
-                                                      uint8_t port,\r
-                                                      boolean_t dor, struct\r
-                                                      osm_remote_guids_count\r
-                                                      *r)\r
-{\r
-       unsigned i;\r
-       osm_physp_t *p = osm_node_get_physp_ptr(sw->p_node, port);\r
-       osm_node_t *node = p->p_remote_physp->p_node;\r
-       uint8_t rem_port = osm_physp_get_port_num(p->p_remote_physp);\r
-\r
-       for (i = 0; i < r->count; i++)\r
-               if (r->guids[i].node == node)\r
-                       if (!dor || (r->guids[i].port == rem_port))\r
-                               return &r->guids[i];\r
-\r
-       r->guids[i].node = node;\r
-       r->guids[i].forwarded_to = 0;\r
-       r->guids[i].port = rem_port;\r
-       r->count++;\r
-       return &r->guids[i];\r
-}\r
-\r
-static void ucast_mgr_process_port(IN osm_ucast_mgr_t * p_mgr,\r
-                                  IN osm_switch_t * p_sw,\r
-                                  IN osm_port_t * p_port,\r
-                                  IN unsigned lid_offset)\r
-{\r
-       uint16_t min_lid_ho;\r
-       uint16_t max_lid_ho;\r
-       uint16_t lid_ho;\r
-       uint8_t port;\r
-       boolean_t is_ignored_by_port_prof;\r
-       ib_net64_t node_guid;\r
-       unsigned start_from = 1;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);\r
-\r
-       /* If the lids are zero - then there was some problem with\r
-        * the initialization. Don't handle this port. */\r
-       if (min_lid_ho == 0 || max_lid_ho == 0) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A04: "\r
-                       "Port 0x%" PRIx64 " has LID 0. An initialization "\r
-                       "error occurred. Ignoring port\n",\r
-                       cl_ntoh64(osm_port_get_guid(p_port)));\r
-               goto Exit;\r
-       }\r
-\r
-       lid_ho = min_lid_ho + lid_offset;\r
-\r
-       if (lid_ho > max_lid_ho)\r
-               goto Exit;\r
-\r
-       if (lid_offset && !p_mgr->is_dor)\r
-               /* ignore potential overflow - it is handled in osm_switch.c */\r
-               start_from = osm_switch_get_port_by_lid(p_sw, lid_ho - 1) + 1;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Processing port 0x%" PRIx64\r
-               " (\'%s\' port %u), LID %u [%u,%u]\n",\r
-               cl_ntoh64(osm_port_get_guid(p_port)),\r
-               p_port->p_node->print_desc, p_port->p_physp->port_num, lid_ho,\r
-               min_lid_ho, max_lid_ho);\r
-\r
-       /* TODO - This should be runtime error, not a CL_ASSERT() */\r
-       CL_ASSERT(max_lid_ho <= IB_LID_UCAST_END_HO);\r
-\r
-       node_guid = osm_node_get_node_guid(p_sw->p_node);\r
-\r
-       /*\r
-          The lid matrix contains the number of hops to each\r
-          lid from each port.  From this information we determine\r
-          how best to distribute the LID range across the ports\r
-          that can reach those LIDs.\r
-        */\r
-       port = osm_switch_recommend_path(p_sw, p_port, lid_ho, start_from,\r
-                                        p_mgr->p_subn->ignore_existing_lfts,\r
-                                        p_mgr->is_dor);\r
-\r
-       if (port == OSM_NO_PATH) {\r
-               /* do not try to overwrite the ppro of non existing port ... */\r
-               is_ignored_by_port_prof = TRUE;\r
-\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "No path to get to LID %u from switch 0x%" PRIx64 "\n",\r
-                       lid_ho, cl_ntoh64(node_guid));\r
-       } else {\r
-               osm_physp_t *p = osm_node_get_physp_ptr(p_sw->p_node, port);\r
-\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Routing LID %u to port %u for switch 0x%" PRIx64 "\n",\r
-                       lid_ho, port, cl_ntoh64(node_guid));\r
-\r
-               /*\r
-                  we would like to optionally ignore this port in equalization\r
-                  as in the case of the Mellanox Anafa Internal PCI TCA port\r
-                */\r
-               is_ignored_by_port_prof = p->is_prof_ignored;\r
-\r
-               /*\r
-                  We also would ignore this route if the target lid is of\r
-                  a switch and the port_profile_switch_node is not TRUE\r
-                */\r
-               if (!p_mgr->p_subn->opt.port_profile_switch_nodes)\r
-                       is_ignored_by_port_prof |=\r
-                           (osm_node_get_type(p_port->p_node) ==\r
-                            IB_NODE_TYPE_SWITCH);\r
-       }\r
-\r
-       /*\r
-          We have selected the port for this LID.\r
-          Write it to the forwarding tables.\r
-        */\r
-       p_sw->new_lft[lid_ho] = port;\r
-       if (!is_ignored_by_port_prof) {\r
-               struct osm_remote_node *rem_node_used;\r
-               osm_switch_count_path(p_sw, port);\r
-               if (port > 0 && p_port->priv &&\r
-                   (rem_node_used = find_and_add_remote_sys(p_sw, port,\r
-                                                            p_mgr->is_dor,\r
-                                                            p_port->priv)))\r
-                       rem_node_used->forwarded_to++;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static void alloc_ports_priv(osm_ucast_mgr_t * mgr)\r
-{\r
-       cl_qmap_t *port_tbl = &mgr->p_subn->port_guid_tbl;\r
-       struct osm_remote_guids_count *r;\r
-       osm_port_t *port;\r
-       cl_map_item_t *item;\r
-       unsigned lmc;\r
-\r
-       for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               port = (osm_port_t *) item;\r
-               lmc = ib_port_info_get_lmc(&port->p_physp->port_info);\r
-               if (!lmc)\r
-                       continue;\r
-               r = malloc(sizeof(*r) + sizeof(r->guids[0]) * (1 << lmc));\r
-               if (!r) {\r
-                       OSM_LOG(mgr->p_log, OSM_LOG_ERROR, "ERR 3A09: "\r
-                               "cannot allocate memory to track remote"\r
-                               " systems for lmc > 0\n");\r
-                       port->priv = NULL;\r
-                       continue;\r
-               }\r
-               memset(r, 0, sizeof(*r) + sizeof(r->guids[0]) * (1 << lmc));\r
-               port->priv = r;\r
-       }\r
-}\r
-\r
-static void free_ports_priv(osm_ucast_mgr_t * mgr)\r
-{\r
-       cl_qmap_t *port_tbl = &mgr->p_subn->port_guid_tbl;\r
-       osm_port_t *port;\r
-       cl_map_item_t *item;\r
-       for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               port = (osm_port_t *) item;\r
-               if (port->priv) {\r
-                       free(port->priv);\r
-                       port->priv = NULL;\r
-               }\r
-       }\r
-}\r
-\r
-static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item,\r
-                                 IN void *context)\r
-{\r
-       osm_ucast_mgr_t *p_mgr = context;\r
-       osm_switch_t * p_sw = (osm_switch_t *) p_map_item;\r
-       unsigned i, lids_per_port;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       CL_ASSERT(p_sw && p_sw->p_node);\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Processing switch 0x%" PRIx64 "\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));\r
-\r
-       /* Initialize LIDs in buffer to invalid port number. */\r
-       memset(p_sw->new_lft, OSM_NO_PATH, p_sw->max_lid_ho + 1);\r
-\r
-       if (p_mgr->p_subn->opt.lmc)\r
-               alloc_ports_priv(p_mgr);\r
-\r
-       /*\r
-          Iterate through every port setting LID routes for each\r
-          port based on base LID and LMC value.\r
-        */\r
-       lids_per_port = 1 << p_mgr->p_subn->opt.lmc;\r
-       for (i = 0; i < lids_per_port; i++) {\r
-               cl_qlist_t *list = &p_mgr->port_order_list;\r
-               cl_list_item_t *item;\r
-               for (item = cl_qlist_head(list); item != cl_qlist_end(list);\r
-                    item = cl_qlist_next(item)) {\r
-#ifndef __WIN__\r
-                       osm_port_t *port=cl_item_obj(item, port, list_item);\r
-#else\r
-                       osm_port_t *port=NULL; // skip uninitialized var err\r
-                       port = cl_item_obj(item, port, list_item);\r
-#endif\r
-                       ucast_mgr_process_port(p_mgr, p_sw, port, i);\r
-               }\r
-       }\r
-\r
-       if (p_mgr->p_subn->opt.lmc)\r
-               free_ports_priv(p_mgr);\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item,\r
-                                       IN void *context)\r
-{\r
-       osm_switch_t * p_sw = (osm_switch_t *) p_map_item;\r
-       osm_ucast_mgr_t * p_mgr = context;\r
-       osm_node_t *p_node;\r
-       osm_node_t *p_remote_node;\r
-       uint32_t port_num;\r
-       uint8_t remote_port_num;\r
-       uint32_t num_ports;\r
-       osm_physp_t *p_physp;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       CL_ASSERT(p_node);\r
-       CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Processing switch with GUID 0x%" PRIx64 "\n",\r
-               cl_ntoh64(osm_node_get_node_guid(p_node)));\r
-\r
-       num_ports = osm_node_get_num_physp(p_node);\r
-\r
-       /*\r
-          Start with port 1 to skip the switch's management port.\r
-        */\r
-       for (port_num = 1; port_num < num_ports; port_num++) {\r
-               p_remote_node = osm_node_get_remote_node(p_node,\r
-                                                        (uint8_t) port_num,\r
-                                                        &remote_port_num);\r
-               if (p_remote_node && p_remote_node->sw\r
-                   && (p_remote_node != p_node)) {\r
-                       /* make sure the link is healthy. If it is not - don't\r
-                          propagate through it. */\r
-                       p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-                       if (!p_physp || !osm_link_is_healthy(p_physp))\r
-                               continue;\r
-\r
-                       ucast_mgr_process_neighbor(p_mgr, p_sw,\r
-                                                  p_remote_node->sw,\r
-                                                  (uint8_t) port_num,\r
-                                                  remote_port_num);\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static int set_hop_wf(void *ctx, uint64_t guid, char *p)\r
-{\r
-       osm_ucast_mgr_t *m = ctx;\r
-       osm_node_t *node = osm_get_node_by_guid(m->p_subn, cl_hton64(guid));\r
-       osm_physp_t *physp;\r
-       unsigned port, hop_wf;\r
-       char *e;\r
-\r
-       if (!node || !node->sw) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "switch with guid 0x%016" PRIx64 " is not found\n",\r
-                       guid);\r
-               return 0;\r
-       }\r
-\r
-       if (!p || !*p || !(port = strtoul(p, &e, 0)) || (p == e) ||\r
-           port >= node->sw->num_ports) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "bad port specified for guid 0x%016" PRIx64 "\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       p = e + 1;\r
-\r
-       if (!*p || !(hop_wf = strtoul(p, &e, 0)) || p == e || hop_wf >= 0x100) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "bad hop weight factor specified for guid 0x%016" PRIx64\r
-                       "port %u\n", guid, port);\r
-               return 0;\r
-       }\r
-\r
-       physp = osm_node_get_physp_ptr(node, port);\r
-       if (!physp)\r
-               return 0;\r
-\r
-       physp->hop_wf = hop_wf;\r
-\r
-       return 0;\r
-}\r
-\r
-static void set_default_hop_wf(cl_map_item_t * p_map_item, void *ctx)\r
-{\r
-       osm_switch_t *sw = (osm_switch_t *) p_map_item;\r
-       int i;\r
-\r
-       for (i = 1; i < sw->num_ports; i++) {\r
-               osm_physp_t *p = osm_node_get_physp_ptr(sw->p_node, i);\r
-               if (p)\r
-                       p->hop_wf = 1;\r
-       }\r
-}\r
-\r
-static int set_dimn_ports(void *ctx, uint64_t guid, char *p)\r
-{\r
-       osm_subn_t *p_subn = ctx;\r
-       osm_node_t *node = osm_get_node_by_guid(p_subn, cl_hton64(guid));\r
-       osm_switch_t *sw;\r
-       uint8_t *dimn_ports = NULL;\r
-       uint8_t port;\r
-       unsigned int *ports = NULL;\r
-       const int bpw = sizeof(*ports)*8;\r
-       int words;\r
-       int i = 1; /* port 0 maps to port 0 */\r
-\r
-       if (!node || !(sw = node->sw)) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "switch with guid 0x%016" PRIx64 " is not found\n",\r
-                       guid);\r
-               return 0;\r
-       }\r
-\r
-       if (sw->dimn_ports) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "switch with guid 0x%016" PRIx64 " already listed\n",\r
-                       guid);\r
-               return 0;\r
-       }\r
-\r
-       dimn_ports = malloc(sizeof(*dimn_ports)*sw->num_ports);\r
-       if (!dimn_ports) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,\r
-                       "ERR 3A07: cannot allocate memory for dimn_ports\n");\r
-               return -1;\r
-       }\r
-       memset(dimn_ports, 0, sizeof(*dimn_ports)*sw->num_ports);\r
-\r
-       /* the ports array is for record keeping of which ports have\r
-        * been seen */\r
-       words = (sw->num_ports + bpw - 1)/bpw;\r
-       ports = malloc(words*sizeof(*ports));\r
-       if (!ports) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR,\r
-                       "ERR 3A08: cannot allocate memory for ports\n");\r
-               return -1;\r
-       }\r
-       memset(ports, 0, words*sizeof(*ports));\r
-\r
-       while ((*p != '\0') && (*p != '#')) {\r
-               char *e;\r
-\r
-               port = strtoul(p, &e, 0);\r
-               if ((p == e) || (port == 0) || (port >= sw->num_ports) ||\r
-                   !osm_node_get_physp_ptr(node, port)) {\r
-                       OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,\r
-                               "bad port %d specified for guid 0x%016" PRIx64 "\n",\r
-                               port, guid);\r
-                       free(dimn_ports);\r
-                       free(ports);\r
-                       return 0;\r
-               }\r
-\r
-               if (ports[port/bpw] & (1u << (port%bpw))) {\r
-                       OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE,\r
-                               "port %d already specified for guid 0x%016" PRIx64 "\n",\r
-                               port, guid);\r
-                       free(dimn_ports);\r
-                       free(ports);\r
-                       return 0;\r
-               }\r
-\r
-               ports[port/bpw] |= (1u << (port%bpw));\r
-               dimn_ports[i++] = port;\r
-\r
-               p = e;\r
-               while (isspace(*p)) {\r
-                       p++;\r
-               }\r
-       }\r
-\r
-       if (i > 1) {\r
-               for (port = 1; port < sw->num_ports; port++) {\r
-                       /* fill out the rest of the dimn_ports array\r
-                        * in sequence using the remaining unspecified\r
-                        * ports.\r
-                        */\r
-                       if (!(ports[port/bpw] & (1u << (port%bpw)))) {\r
-                               dimn_ports[i++] = port;\r
-                       }\r
-               }\r
-               sw->dimn_ports = dimn_ports;\r
-       } else {\r
-               free(dimn_ports);\r
-       }\r
-\r
-       free(ports);\r
-       return 0;\r
-}\r
-\r
-int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr)\r
-{\r
-       uint32_t i;\r
-       uint32_t iteration_max;\r
-       cl_qmap_t *p_sw_guid_tbl;\r
-\r
-       p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,\r
-               "Starting switches' Min Hop Table Assignment\n");\r
-\r
-       /*\r
-          Set up the weighting factors for the routing.\r
-        */\r
-       cl_qmap_apply_func(p_sw_guid_tbl, set_default_hop_wf, NULL);\r
-       if (p_mgr->p_subn->opt.hop_weights_file) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Fetching hop weight factor file \'%s\'\n",\r
-                       p_mgr->p_subn->opt.hop_weights_file);\r
-               if (parse_node_map(p_mgr->p_subn->opt.hop_weights_file,\r
-                                  set_hop_wf, p_mgr)) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "\r
-                               "cannot parse hop_weights_file \'%s\'\n",\r
-                               p_mgr->p_subn->opt.hop_weights_file);\r
-               }\r
-       }\r
-\r
-       /*\r
-          Set the switch matrices for each switch's own port 0 LID(s)\r
-          then set the lid matrices for the each switch's leaf nodes.\r
-        */\r
-       cl_qmap_apply_func(p_sw_guid_tbl, ucast_mgr_process_hop_0_1, p_mgr);\r
-\r
-       /*\r
-          Get the switch matrices for each switch's neighbors.\r
-          This process requires a number of iterations equal to\r
-          the number of switches in the subnet minus 1.\r
-\r
-          In each iteration, a switch learns the lid/port/hop\r
-          information (as contained by a switch's lid matrix) from\r
-          its immediate neighbors.  After each iteration, a switch\r
-          (and it's neighbors) know more routing information than\r
-          it did on the previous iteration.\r
-          Thus, by repeatedly absorbing the routing information of\r
-          neighbor switches, every switch eventually learns how to\r
-          route all LIDs on the subnet.\r
-\r
-          Note that there may not be any switches in the subnet if\r
-          we are in simple p2p configuration.\r
-        */\r
-       iteration_max = cl_qmap_count(p_sw_guid_tbl);\r
-\r
-       /*\r
-          If there are switches in the subnet, iterate until the lid\r
-          matrix has been constructed.  Otherwise, just immediately\r
-          indicate we're done if no switches exist.\r
-        */\r
-       if (iteration_max) {\r
-               iteration_max--;\r
-\r
-               /*\r
-                  we need to find out when the propagation of\r
-                  hop counts has relaxed. So this global variable\r
-                  is preset to 0 on each iteration and if\r
-                  if non of the switches was set will exit the\r
-                  while loop\r
-                */\r
-               p_mgr->some_hop_count_set = TRUE;\r
-               for (i = 0; (i < iteration_max) && p_mgr->some_hop_count_set;\r
-                    i++) {\r
-                       p_mgr->some_hop_count_set = FALSE;\r
-                       cl_qmap_apply_func(p_sw_guid_tbl,\r
-                                          ucast_mgr_process_neighbors, p_mgr);\r
-               }\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Min-hop propagated in %d steps\n", i);\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)\r
-{\r
-       osm_switch_t *p_sw;\r
-       uint16_t lids;\r
-\r
-       lids = (uint16_t) cl_ptr_vector_get_size(&p_subn->port_lid_tbl);\r
-       lids = lids ? lids - 1 : 0;\r
-\r
-       for (p_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl);\r
-            p_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl);\r
-            p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {\r
-               if (osm_switch_prepare_path_rebuild(p_sw, lids)) {\r
-                       OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A0B: "\r
-                               "cannot setup switch 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(osm_node_get_node_guid\r
-                                         (p_sw->p_node)));\r
-                       return -1;\r
-               }\r
-               if (p_sw->dimn_ports) {\r
-                       free(p_sw->dimn_ports);\r
-                       p_sw->dimn_ports = NULL;\r
-               }\r
-       }\r
-\r
-       if (p_subn->opt.dimn_ports_file) {\r
-               OSM_LOG(&p_subn->p_osm->log, OSM_LOG_DEBUG,\r
-                       "Fetching dimension ports file \'%s\'\n",\r
-                       p_subn->opt.dimn_ports_file);\r
-               if (parse_node_map(p_subn->opt.dimn_ports_file,\r
-                                  set_dimn_ports, p_subn)) {\r
-                       OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A05: "\r
-                               "cannot parse dimn_ports_file \'%s\'\n",\r
-                               p_subn->opt.dimn_ports_file);\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)\r
-{\r
-       osm_ucast_mgr_t *m = ctx;\r
-       osm_port_t *port = osm_get_port_by_guid(m->p_subn, cl_hton64(guid));\r
-\r
-       if (!port) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "port guid not found: 0x%016" PRIx64 "\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       if (port->flag) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "port guid specified multiple times 0x%016" PRIx64 "\n",\r
-                       guid);\r
-               return 0;\r
-       }\r
-\r
-       cl_qlist_insert_tail(&m->port_order_list, &port->list_item);\r
-       port->flag = 1;\r
-\r
-       return 0;\r
-}\r
-\r
-static void add_port_to_order_list(cl_map_item_t * p_map_item, void *ctx)\r
-{\r
-       osm_port_t *port = (osm_port_t *) p_map_item;\r
-       osm_ucast_mgr_t *m = ctx;\r
-\r
-       if (!port->flag)\r
-               cl_qlist_insert_tail(&m->port_order_list, &port->list_item);\r
-       else\r
-               port->flag = 0;\r
-}\r
-\r
-static int mark_ignored_port(void *ctx, uint64_t guid, char *p)\r
-{\r
-       osm_ucast_mgr_t *m = ctx;\r
-       osm_node_t *node = osm_get_node_by_guid(m->p_subn, cl_hton64(guid));\r
-       osm_physp_t *physp;\r
-       unsigned port;\r
-\r
-       if (!node || !node->sw) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "switch with guid 0x%016" PRIx64 " is not found\n",\r
-                       guid);\r
-               return 0;\r
-       }\r
-\r
-       if (!p || !*p || !(port = strtoul(p, NULL, 0)) ||\r
-           port >= node->sw->num_ports) {\r
-               OSM_LOG(m->p_log, OSM_LOG_DEBUG,\r
-                       "bad port specified for guid 0x%016" PRIx64 "\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       physp = osm_node_get_physp_ptr(node, port);\r
-       if (!physp)\r
-               return 0;\r
-\r
-       physp->is_prof_ignored = 1;\r
-\r
-       return 0;\r
-}\r
-\r
-static void clear_prof_ignore_flag(cl_map_item_t * p_map_item, void *ctx)\r
-{\r
-       osm_switch_t *sw = (osm_switch_t *) p_map_item;\r
-       int i;\r
-\r
-       for (i = 1; i < sw->num_ports; i++) {\r
-               osm_physp_t *p = osm_node_get_physp_ptr(sw->p_node, i);\r
-               if (p)\r
-                       p->is_prof_ignored = 0;\r
-       }\r
-}\r
-\r
-static void add_sw_endports_to_order_list(osm_switch_t * sw,\r
-                                         osm_ucast_mgr_t * m)\r
-{\r
-       osm_port_t *port;\r
-       osm_physp_t *p;\r
-       int i;\r
-\r
-       for (i = 1; i < sw->num_ports; i++) {\r
-               p = osm_node_get_physp_ptr(sw->p_node, i);\r
-               if (p && p->p_remote_physp && !p->p_remote_physp->p_node->sw) {\r
-                       port = osm_get_port_by_guid(m->p_subn,\r
-                                                   p->p_remote_physp->\r
-                                                   port_guid);\r
-                       cl_qlist_insert_tail(&m->port_order_list,\r
-                                            &port->list_item);\r
-                       port->flag = 1;\r
-               }\r
-       }\r
-}\r
-\r
-static void sw_count_endport_links(osm_switch_t * sw)\r
-{\r
-       osm_physp_t *p;\r
-       int i;\r
-\r
-       sw->endport_links = 0;\r
-       for (i = 1; i < sw->num_ports; i++) {\r
-               p = osm_node_get_physp_ptr(sw->p_node, i);\r
-               if (p && p->p_remote_physp && !p->p_remote_physp->p_node->sw)\r
-                       sw->endport_links++;\r
-       }\r
-}\r
-\r
-static int OSM_CDECL compar_sw_load(const void *s1, const void *s2)\r
-{\r
-#define get_sw_endport_links(s) (*(osm_switch_t **)s)->endport_links\r
-       return get_sw_endport_links(s2) - get_sw_endport_links(s1);\r
-}\r
-\r
-static void sort_ports_by_switch_load(osm_ucast_mgr_t * m)\r
-{\r
-       int i, num = cl_qmap_count(&m->p_subn->sw_guid_tbl);\r
-       void **s = malloc(num * sizeof(*s));\r
-       if (!s) {\r
-               OSM_LOG(m->p_log, OSM_LOG_ERROR, "ERR 3A0C: "\r
-                       "No memory, skip by switch load sorting.\n");\r
-               return;\r
-       }\r
-       s[0] = cl_qmap_head(&m->p_subn->sw_guid_tbl);\r
-       for (i = 1; i < num; i++)\r
-               s[i] = cl_qmap_next(s[i - 1]);\r
-\r
-       for (i = 0; i < num; i++)\r
-               sw_count_endport_links(s[i]);\r
-\r
-       qsort(s, num, sizeof(*s), compar_sw_load);\r
-\r
-       for (i = 0; i < num; i++)\r
-               add_sw_endports_to_order_list(s[i], m);\r
-       free(s);\r
-}\r
-\r
-static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cl_qlist_init(&p_mgr->port_order_list);\r
-\r
-       if (p_mgr->p_subn->opt.guid_routing_order_file) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Fetching guid routing order file \'%s\'\n",\r
-                       p_mgr->p_subn->opt.guid_routing_order_file);\r
-\r
-               if (parse_node_map(p_mgr->p_subn->opt.guid_routing_order_file,\r
-                                  add_guid_to_order_list, p_mgr))\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A0D: "\r
-                               "cannot parse guid routing order file \'%s\'\n",\r
-                               p_mgr->p_subn->opt.guid_routing_order_file);\r
-       } else\r
-               sort_ports_by_switch_load(p_mgr);\r
-\r
-       if (p_mgr->p_subn->opt.port_prof_ignore_file) {\r
-               cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl,\r
-                                  clear_prof_ignore_flag, NULL);\r
-               if (parse_node_map(p_mgr->p_subn->opt.port_prof_ignore_file,\r
-                                  mark_ignored_port, p_mgr)) {\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A0E: "\r
-                               "cannot parse port prof ignore file \'%s\'\n",\r
-                               p_mgr->p_subn->opt.port_prof_ignore_file);\r
-               }\r
-       }\r
-\r
-       cl_qmap_apply_func(&p_mgr->p_subn->port_guid_tbl,\r
-                          add_port_to_order_list, p_mgr);\r
-\r
-       cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl, ucast_mgr_process_tbl,\r
-                          p_mgr);\r
-\r
-       cl_qlist_remove_all(&p_mgr->port_order_list);\r
-\r
-       return 0;\r
-}\r
-\r
-static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,\r
-                                 IN void *cxt)\r
-{\r
-       osm_ucast_mgr_t *p_mgr = cxt;\r
-       osm_switch_t * p_sw = (osm_switch_t *) p_map_item;\r
-       osm_node_t *p_node;\r
-       osm_dr_path_t *p_path;\r
-       osm_madw_context_t context;\r
-       ib_api_status_t status;\r
-       ib_switch_info_t si;\r
-       boolean_t set_swinfo_require = FALSE;\r
-       uint16_t lin_top;\r
-       uint8_t life_state;\r
-\r
-       CL_ASSERT(p_mgr);\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       CL_ASSERT(p_sw);\r
-\r
-       p_node = p_sw->p_node;\r
-\r
-       CL_ASSERT(p_node);\r
-\r
-       if (p_mgr->max_lid < p_sw->max_lid_ho)\r
-               p_mgr->max_lid = p_sw->max_lid_ho;\r
-\r
-       p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));\r
-\r
-       /*\r
-          Set the top of the unicast forwarding table.\r
-        */\r
-       si = p_sw->switch_info;\r
-       lin_top = cl_hton16(p_sw->max_lid_ho);\r
-       if (lin_top != si.lin_top) {\r
-               set_swinfo_require = TRUE;\r
-               si.lin_top = lin_top;\r
-       }\r
-\r
-       /* check to see if the change state bit is on. If it is - then we\r
-          need to clear it. */\r
-       if (ib_switch_info_get_state_change(&si))\r
-               life_state = ((p_mgr->p_subn->opt.packet_life_time << 3)\r
-                             | (si.life_state & IB_SWITCH_PSC)) & 0xfc;\r
-       else\r
-               life_state = (p_mgr->p_subn->opt.packet_life_time << 3) & 0xf8;\r
-\r
-       if (life_state != si.life_state || ib_switch_info_get_state_change(&si)) {\r
-               set_swinfo_require = TRUE;\r
-               si.life_state = life_state;\r
-       }\r
-\r
-       if (set_swinfo_require) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-                       "Setting switch FT top to LID %u\n", p_sw->max_lid_ho);\r
-\r
-               context.si_context.light_sweep = FALSE;\r
-               context.si_context.node_guid = osm_node_get_node_guid(p_node);\r
-               context.si_context.set_method = TRUE;\r
-\r
-               status = osm_req_set(p_mgr->sm, p_path, (uint8_t *) & si,\r
-                                    sizeof(si), IB_MAD_ATTR_SWITCH_INFO,\r
-                                    0, CL_DISP_MSGID_NONE, &context);\r
-\r
-               if (status != IB_SUCCESS)\r
-                       OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A06: "\r
-                               "Sending SwitchInfo attribute failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-}\r
-\r
-static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr,\r
-                        IN uint16_t block_id_ho)\r
-{\r
-       uint8_t block[IB_SMP_DATA_SIZE];\r
-       osm_madw_context_t context;\r
-       osm_dr_path_t *p_path;\r
-       ib_api_status_t status;\r
-\r
-       /*\r
-          Send linear forwarding table blocks to the switch\r
-          as long as the switch indicates it has blocks needing\r
-          configuration.\r
-        */\r
-       if (!p_sw->new_lft) {\r
-               /* any routing should provide the new_lft */\r
-               CL_ASSERT(p_mgr->p_subn->opt.use_ucast_cache &&\r
-                         p_mgr->cache_valid && !p_sw->need_update);\r
-               return -1;\r
-       }\r
-\r
-       p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_sw->p_node, 0));\r
-\r
-       context.lft_context.node_guid = osm_node_get_node_guid(p_sw->p_node);\r
-       context.lft_context.set_method = TRUE;\r
-\r
-       if (!osm_switch_get_lft_block(p_sw, block_id_ho, block) ||\r
-           (!p_sw->need_update && !p_mgr->p_subn->need_update &&\r
-            !memcmp(block, p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,\r
-                    IB_SMP_DATA_SIZE)))\r
-               return 0;\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,\r
-               "Writing FT block %u to switch 0x%" PRIx64 "\n", block_id_ho,\r
-               cl_ntoh64(context.lft_context.node_guid));\r
-\r
-       status = osm_req_set(p_mgr->sm, p_path,\r
-                            p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,\r
-                            IB_SMP_DATA_SIZE, IB_MAD_ATTR_LIN_FWD_TBL,\r
-                            cl_hton32(block_id_ho),\r
-                            CL_DISP_MSGID_NONE, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "\r
-                       "Sending linear fwd. tbl. block failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               return -1;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-static void ucast_mgr_pipeline_fwd_tbl(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       cl_qmap_t *tbl;\r
-       cl_map_item_t *item;\r
-       unsigned i, max_block = p_mgr->max_lid / 64 + 1;\r
-\r
-       tbl = &p_mgr->p_subn->sw_guid_tbl;\r
-       for (i = 0; i < max_block; i++)\r
-               for (item = cl_qmap_head(tbl); item != cl_qmap_end(tbl);\r
-                    item = cl_qmap_next(item))\r
-                       set_lft_block((osm_switch_t *)item, p_mgr, i);\r
-}\r
-\r
-void osm_ucast_mgr_set_fwd_tables(osm_ucast_mgr_t * p_mgr)\r
-{\r
-       p_mgr->max_lid = 0;\r
-\r
-       cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl, ucast_mgr_set_fwd_top,\r
-                          p_mgr);\r
-\r
-       ucast_mgr_pipeline_fwd_tbl(p_mgr);\r
-}\r
-\r
-static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t * osm)\r
-{\r
-       int ret;\r
-\r
-       OSM_LOG(&osm->log, OSM_LOG_VERBOSE,\r
-               "building routing with \'%s\' routing algorithm...\n", r->name);\r
-\r
-       if (!r->build_lid_matrices ||\r
-           (ret = r->build_lid_matrices(r->context)) > 0)\r
-               ret = osm_ucast_mgr_build_lid_matrices(&osm->sm.ucast_mgr);\r
-\r
-       if (ret < 0) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "%s: cannot build lid matrices.\n", r->name);\r
-               return ret;\r
-       }\r
-\r
-       if (!r->ucast_build_fwd_tables ||\r
-           (ret = r->ucast_build_fwd_tables(r->context)) > 0)\r
-               ret = ucast_mgr_build_lfts(&osm->sm.ucast_mgr);\r
-\r
-       if (ret < 0) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "%s: cannot build fwd tables.\n", r->name);\r
-               return ret;\r
-       }\r
-\r
-       osm->routing_engine_used = osm_routing_engine_type(r->name);\r
-\r
-       osm_ucast_mgr_set_fwd_tables(&osm->sm.ucast_mgr);\r
-\r
-       return 0;\r
-}\r
-\r
-int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)\r
-{\r
-       osm_opensm_t *p_osm;\r
-       struct osm_routing_engine *p_routing_eng;\r
-       cl_qmap_t *p_sw_guid_tbl;\r
-\r
-       OSM_LOG_ENTER(p_mgr->p_log);\r
-\r
-       p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;\r
-       p_osm = p_mgr->p_subn->p_osm;\r
-       p_routing_eng = p_osm->routing_engine_list;\r
-\r
-       CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);\r
-\r
-       /*\r
-          If there are no switches in the subnet, we are done.\r
-        */\r
-       if (cl_qmap_count(p_sw_guid_tbl) == 0 ||\r
-           ucast_mgr_setup_all_switches(p_mgr->p_subn) < 0)\r
-               goto Exit;\r
-\r
-       p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;\r
-       while (p_routing_eng) {\r
-               if (!ucast_mgr_route(p_routing_eng, p_osm))\r
-                       break;\r
-               p_routing_eng = p_routing_eng->next;\r
-       }\r
-\r
-       if (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_NONE) {\r
-               /* If configured routing algorithm failed, use default MinHop */\r
-               osm_ucast_mgr_build_lid_matrices(p_mgr);\r
-               ucast_mgr_build_lfts(p_mgr);\r
-               osm_ucast_mgr_set_fwd_tables(p_mgr);\r
-               p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;\r
-       }\r
-\r
-       OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,\r
-               "%s tables configured on all switches\n",\r
-               osm_routing_engine_type_str(p_osm->routing_engine_used));\r
-\r
-       if (p_mgr->p_subn->opt.use_ucast_cache)\r
-               p_mgr->cache_valid = TRUE;\r
-\r
-Exit:\r
-       CL_PLOCK_RELEASE(p_mgr->p_lock);\r
-       OSM_LOG_EXIT(p_mgr->p_log);\r
-       return 0;\r
-}\r
-\r
-static int ucast_build_lid_matrices(void *context)\r
-{\r
-       return osm_ucast_mgr_build_lid_matrices(context);\r
-}\r
-\r
-static int ucast_build_lfts(void *context)\r
-{\r
-       return ucast_mgr_build_lfts(context);\r
-}\r
-\r
-int osm_ucast_minhop_setup(struct osm_routing_engine *r, osm_opensm_t * osm)\r
-{\r
-       r->context = &osm->sm.ucast_mgr;\r
-       r->build_lid_matrices = ucast_build_lid_matrices;\r
-       r->ucast_build_fwd_tables = ucast_build_lfts;\r
-       return 0;\r
-}\r
-\r
-static int ucast_dor_build_lfts(void *context)\r
-{\r
-       osm_ucast_mgr_t *mgr = context;\r
-       int ret;\r
-\r
-       mgr->is_dor = 1;\r
-       ret = ucast_mgr_build_lfts(mgr);\r
-       mgr->is_dor = 0;\r
-\r
-       return ret;\r
-}\r
-\r
-int osm_ucast_dor_setup(struct osm_routing_engine *r, osm_opensm_t * osm)\r
-{\r
-       r->context = &osm->sm.ucast_mgr;\r
-       r->build_lid_matrices = ucast_build_lid_matrices;\r
-       r->ucast_build_fwd_tables = ucast_dor_build_lfts;\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_ucast_updn.c b/branches/opensm_3/user/opensm/osm_ucast_updn.c
deleted file mode 100644 (file)
index e667488..0000000
+++ /dev/null
@@ -1,668 +0,0 @@
-/*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *      Implementation of Up Down Algorithm using ranking & Min Hop\r
- *      Calculation functions\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdlib.h>\r
-#include <ctype.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_switch.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_ucast_mgr.h>\r
-\r
-/* //////////////////////////// */\r
-/*  Local types                 */\r
-/* //////////////////////////// */\r
-\r
-/* direction */\r
-typedef enum updn_switch_dir {\r
-       UP = 0,\r
-       DOWN\r
-} updn_switch_dir_t;\r
-\r
-/* updn structure */\r
-typedef struct updn {\r
-       unsigned num_roots;\r
-       osm_opensm_t *p_osm;\r
-} updn_t;\r
-\r
-struct updn_node {\r
-       cl_list_item_t list;\r
-       osm_switch_t *sw;\r
-       uint64_t id;\r
-       updn_switch_dir_t dir;\r
-       unsigned rank;\r
-       unsigned visited;\r
-};\r
-\r
-/* This function returns direction based on rank and guid info of current &\r
-   remote ports */\r
-static updn_switch_dir_t updn_get_dir(unsigned cur_rank, unsigned rem_rank,\r
-                                     uint64_t cur_id, uint64_t rem_id)\r
-{\r
-       /* HACK: comes to solve root nodes connection, in a classic subnet root nodes do not connect\r
-          directly, but in case they are we assign to root node an UP direction to allow UPDN to discover\r
-          the subnet correctly (and not from the point of view of the last root node).\r
-        */\r
-       if (!cur_rank && !rem_rank)\r
-               return UP;\r
-\r
-       if (cur_rank < rem_rank)\r
-               return DOWN;\r
-       else if (cur_rank > rem_rank)\r
-               return UP;\r
-       else {\r
-               /* Equal rank, decide by id number, bigger == UP direction */\r
-               if (cur_id > rem_id)\r
-                       return UP;\r
-               else\r
-                       return DOWN;\r
-       }\r
-}\r
-\r
-/**********************************************************************\r
- * This function does the bfs of min hop table calculation by guid index\r
- * as a starting point.\r
- **********************************************************************/\r
-static int updn_bfs_by_node(IN osm_log_t * p_log, IN osm_subn_t * p_subn,\r
-                           IN osm_switch_t * p_sw)\r
-{\r
-       uint8_t pn, pn_rem;\r
-       cl_qlist_t list;\r
-       uint16_t lid;\r
-       struct updn_node *u;\r
-       updn_switch_dir_t next_dir, current_dir;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       lid = osm_node_get_base_lid(p_sw->p_node, 0);\r
-       lid = cl_ntoh16(lid);\r
-       osm_switch_set_hops(p_sw, lid, 0, 0);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Starting from switch - port GUID 0x%" PRIx64 " lid %u\n",\r
-               cl_ntoh64(p_sw->p_node->node_info.port_guid), lid);\r
-\r
-       u = p_sw->priv;\r
-       u->dir = UP;\r
-\r
-       /* Update list with the new element */\r
-       cl_qlist_init(&list);\r
-       cl_qlist_insert_tail(&list, &u->list);\r
-\r
-       /* BFS the list till no next element */\r
-       while (!cl_is_qlist_empty(&list)) {\r
-               u = (struct updn_node *)cl_qlist_remove_head(&list);\r
-               u->visited = 0; /* cleanup */\r
-               current_dir = u->dir;\r
-               /* Go over all ports of the switch and find unvisited remote nodes */\r
-               for (pn = 1; pn < u->sw->num_ports; pn++) {\r
-                       osm_node_t *p_remote_node;\r
-                       struct updn_node *rem_u;\r
-                       uint8_t current_min_hop, remote_min_hop,\r
-                           set_hop_return_value;\r
-                       osm_switch_t *p_remote_sw;\r
-\r
-                       p_remote_node =\r
-                           osm_node_get_remote_node(u->sw->p_node, pn,\r
-                                                    &pn_rem);\r
-                       /* If no remote node OR remote node is not a SWITCH\r
-                          continue to next pn */\r
-                       if (!p_remote_node || !p_remote_node->sw)\r
-                               continue;\r
-                       /* Fetch remote guid only after validation of remote node */\r
-                       p_remote_sw = p_remote_node->sw;\r
-                       rem_u = p_remote_sw->priv;\r
-                       /* Decide which direction to mark it (UP/DOWN) */\r
-                       next_dir = updn_get_dir(u->rank, rem_u->rank,\r
-                                               u->id, rem_u->id);\r
-\r
-                       /* Check if this is a legal step : the only illegal step is going\r
-                          from DOWN to UP */\r
-                       if ((current_dir == DOWN) && (next_dir == UP)) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                       "Avoiding move from 0x%016" PRIx64\r
-                                       " to 0x%016" PRIx64 "\n",\r
-                                       cl_ntoh64(osm_node_get_node_guid(u->sw->p_node)),\r
-                                       cl_ntoh64(osm_node_get_node_guid(p_remote_node)));\r
-                               /* Illegal step */\r
-                               continue;\r
-                       }\r
-                       /* Set MinHop value for the current lid */\r
-                       current_min_hop = osm_switch_get_least_hops(u->sw, lid);\r
-                       /* Check hop count if better insert into list && update\r
-                          the remote node Min Hop Table */\r
-                       remote_min_hop =\r
-                           osm_switch_get_hop_count(p_remote_sw, lid, pn_rem);\r
-                       if (current_min_hop + 1 < remote_min_hop) {\r
-                               set_hop_return_value =\r
-                                   osm_switch_set_hops(p_remote_sw, lid,\r
-                                                       pn_rem,\r
-                                                       current_min_hop + 1);\r
-                               if (set_hop_return_value) {\r
-                                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR AA01: "\r
-                                               "Invalid value returned from set min hop is: %d\n",\r
-                                               set_hop_return_value);\r
-                               }\r
-                               /* Check if remote port has already been visited */\r
-                               if (!rem_u->visited) {\r
-                                       /* Insert updn_switch item into the list */\r
-                                       rem_u->dir = next_dir;\r
-                                       rem_u->visited = 1;\r
-                                       cl_qlist_insert_tail(&list,\r
-                                                            &rem_u->list);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-/* NOTE : PLS check if we need to decide that the first */\r
-/*        rank is a SWITCH for BFS purpose */\r
-static int updn_subn_rank(IN updn_t * p_updn)\r
-{\r
-       osm_switch_t *p_sw;\r
-       osm_physp_t *p_physp, *p_remote_physp;\r
-       cl_qlist_t list;\r
-       cl_map_item_t *item;\r
-       struct updn_node *u, *remote_u;\r
-       uint8_t num_ports, port_num;\r
-       osm_log_t *p_log = &p_updn->p_osm->log;\r
-       unsigned max_rank = 0;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-       cl_qlist_init(&list);\r
-\r
-       /* add all roots to the list */\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *)item;\r
-               u = p_sw->priv;\r
-               if (!u->rank)\r
-                       cl_qlist_insert_tail(&list, &u->list);\r
-       }\r
-\r
-       /* BFS the list till it's empty */\r
-       while (!cl_is_qlist_empty(&list)) {\r
-               u = (struct updn_node *)cl_qlist_remove_head(&list);\r
-               /* Go over all remote nodes and rank them (if not already visited) */\r
-               p_sw = u->sw;\r
-               num_ports = p_sw->num_ports;\r
-               OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                       "Handling switch GUID 0x%" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));\r
-               for (port_num = 1; port_num < num_ports; port_num++) {\r
-                       ib_net64_t port_guid;\r
-\r
-                       /* Current port fetched in order to get remote side */\r
-                       p_physp =\r
-                           osm_node_get_physp_ptr(p_sw->p_node, port_num);\r
-\r
-                       if (!p_physp)\r
-                               continue;\r
-\r
-                       p_remote_physp = p_physp->p_remote_physp;\r
-\r
-                       /*\r
-                          make sure that all the following occur on p_remote_physp:\r
-                          1. The port isn't NULL\r
-                          2. It is a switch\r
-                        */\r
-                       if (p_remote_physp && p_remote_physp->p_node->sw) {\r
-                               remote_u = p_remote_physp->p_node->sw->priv;\r
-                               port_guid = p_remote_physp->port_guid;\r
-\r
-                               if (remote_u->rank > u->rank + 1) {\r
-                                       remote_u->rank = u->rank + 1;\r
-                                       max_rank = remote_u->rank;\r
-                                       cl_qlist_insert_tail(&list,\r
-                                                            &remote_u->list);\r
-                                       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-                                               "Rank of port GUID 0x%" PRIx64\r
-                                               " = %u\n", cl_ntoh64(port_guid),\r
-                                               remote_u->rank);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Print Summary of ranking */\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "Subnet ranking completed. Max Node Rank = %d\n", max_rank);\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-/* hack: preserve min hops entries to any other root switches */\r
-static void updn_clear_non_root_hops(updn_t * updn, osm_switch_t * sw)\r
-{\r
-       osm_port_t *port;\r
-       unsigned i;\r
-\r
-       for (i = 0; i < sw->num_hops; i++)\r
-               if (sw->hops[i]) {\r
-                       port = osm_get_port_by_lid_ho(&updn->p_osm->subn, i);\r
-                       if (!port || !port->p_node->sw\r
-                           || ((struct updn_node *)port->p_node->sw->priv)->\r
-                           rank != 0)\r
-                               memset(sw->hops[i], 0xff, sw->num_ports);\r
-               }\r
-}\r
-\r
-static int updn_set_min_hop_table(IN updn_t * p_updn)\r
-{\r
-       osm_subn_t *p_subn = &p_updn->p_osm->subn;\r
-       osm_log_t *p_log = &p_updn->p_osm->log;\r
-       osm_switch_t *p_sw;\r
-       cl_map_item_t *item;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       /* Go over all the switches in the subnet - for each init their Min Hop\r
-          Table */\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "Init Min Hop Table of all switches [\n");\r
-\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *)item;\r
-               /* Clear Min Hop Table */\r
-               if (p_subn->opt.connect_roots)\r
-                       updn_clear_non_root_hops(p_updn, p_sw);\r
-               else\r
-                       osm_switch_clear_hops(p_sw);\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "Init Min Hop Table of all switches ]\n");\r
-\r
-       /* Now do the BFS for each port  in the subnet */\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "BFS through all port guids in the subnet [\n");\r
-\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *)item;\r
-               updn_bfs_by_node(p_log, p_subn, p_sw);\r
-       }\r
-\r
-       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
-               "BFS through all port guids in the subnet ]\n");\r
-       /* Cleanup */\r
-       OSM_LOG_EXIT(p_log);\r
-       return 0;\r
-}\r
-\r
-static int updn_build_lid_matrices(IN updn_t * p_updn)\r
-{\r
-       int status;\r
-\r
-       OSM_LOG_ENTER(&p_updn->p_osm->log);\r
-\r
-       OSM_LOG(&p_updn->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Ranking all port guids in the list\n");\r
-       if (!p_updn->num_roots) {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR AA0A: "\r
-                       "No guids were provided or number of guids is 0\n");\r
-               status = -1;\r
-               goto _exit;\r
-       }\r
-\r
-       /* Check if it's not a switched subnet */\r
-       if (cl_is_qmap_empty(&p_updn->p_osm->subn.sw_guid_tbl)) {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR AAOB: "\r
-                       "This is not a switched subnet, cannot perform UPDN algorithm\n");\r
-               status = -1;\r
-               goto _exit;\r
-       }\r
-\r
-       /* Rank the subnet switches */\r
-       updn_subn_rank(p_updn);\r
-\r
-       /* After multiple ranking need to set Min Hop Table by UpDn algorithm  */\r
-       OSM_LOG(&p_updn->p_osm->log, OSM_LOG_VERBOSE,\r
-               "Setting all switches' Min Hop Table\n");\r
-       status = updn_set_min_hop_table(p_updn);\r
-\r
-_exit:\r
-       OSM_LOG_EXIT(&p_updn->p_osm->log);\r
-       return status;\r
-}\r
-\r
-static struct updn_node *create_updn_node(osm_switch_t * sw)\r
-{\r
-       struct updn_node *u;\r
-\r
-       u = malloc(sizeof(*u));\r
-       if (!u)\r
-               return NULL;\r
-       memset(u, 0, sizeof(*u));\r
-       u->sw = sw;\r
-       u->id = cl_ntoh64(osm_node_get_node_guid(sw->p_node));\r
-       u->rank = 0xffffffff;\r
-       return u;\r
-}\r
-\r
-static void delete_updn_node(struct updn_node *u)\r
-{\r
-       u->sw->priv = NULL;\r
-       free(u);\r
-}\r
-\r
-/* Find Root nodes automatically by Min Hop Table info */\r
-static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn)\r
-{\r
-       osm_opensm_t *p_osm = p_updn->p_osm;\r
-       osm_switch_t *p_sw;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       cl_map_item_t *item;\r
-       double thd1, thd2;\r
-       unsigned i, cas_num = 0;\r
-       unsigned *cas_per_sw;\r
-       uint16_t lid_ho;\r
-\r
-       OSM_LOG_ENTER(&p_osm->log);\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,\r
-               "Current number of ports in the subnet is %d\n",\r
-               cl_qmap_count(&p_osm->subn.port_guid_tbl));\r
-\r
-       lid_ho = (uint16_t) cl_ptr_vector_get_size(&p_updn->p_osm->subn.port_lid_tbl) + 1;\r
-       cas_per_sw = malloc(lid_ho * sizeof(*cas_per_sw));\r
-       if (!cas_per_sw) {\r
-               OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR AA14: "\r
-                       "cannot alloc mem for CAs per switch counter array\n");\r
-               goto _exit;\r
-       }\r
-       memset(cas_per_sw, 0, lid_ho * sizeof(*cas_per_sw));\r
-\r
-       /* Find the Maximum number of CAs (and routers) for histogram normalization */\r
-       OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-               "Finding the number of CAs and storing them in cl_map\n");\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.port_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.port_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_port = (osm_port_t *)item;\r
-               if (!p_port->p_node->sw) {\r
-                       p_physp = p_port->p_physp->p_remote_physp;\r
-                       if (!p_physp || !p_physp->p_node->sw)\r
-                               continue;\r
-                       lid_ho = osm_node_get_base_lid(p_physp->p_node, 0);\r
-                       lid_ho = cl_ntoh16(lid_ho);\r
-                       cas_per_sw[lid_ho]++;\r
-                       cas_num++;\r
-               }\r
-       }\r
-\r
-       thd1 = cas_num * 0.9;\r
-       thd2 = cas_num * 0.05;\r
-       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,\r
-               "Found %u CAs and RTRs, %u SWs in the subnet. "\r
-               "Thresholds are thd1 = %f && thd2 = %f\n",\r
-               cas_num, cl_qmap_count(&p_osm->subn.sw_guid_tbl), thd1, thd2);\r
-\r
-       OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,\r
-               "Passing through all switches to collect Min Hop info\n");\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               unsigned hop_hist[IB_SUBNET_PATH_HOPS_MAX];\r
-               uint16_t max_lid_ho;\r
-               uint8_t hop_val;\r
-               uint16_t numHopBarsOverThd1 = 0;\r
-               uint16_t numHopBarsOverThd2 = 0;\r
-\r
-               p_sw = (osm_switch_t *) item;\r
-\r
-               memset(hop_hist, 0, sizeof(hop_hist));\r
-\r
-               max_lid_ho = p_sw->max_lid_ho;\r
-               for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++)\r
-                       if (cas_per_sw[lid_ho]) {\r
-                               hop_val =\r
-                                   osm_switch_get_least_hops(p_sw, lid_ho);\r
-                               if (hop_val >= IB_SUBNET_PATH_HOPS_MAX)\r
-                                       continue;\r
-\r
-                               hop_hist[hop_val] += cas_per_sw[lid_ho];\r
-                       }\r
-\r
-               /* Now recognize the spines by requiring one bar to be\r
-                  above 90% of the number of CAs and RTRs */\r
-               for (i = 0; i < IB_SUBNET_PATH_HOPS_MAX; i++) {\r
-                       if (hop_hist[i] > thd1)\r
-                               numHopBarsOverThd1++;\r
-                       if (hop_hist[i] > thd2)\r
-                               numHopBarsOverThd2++;\r
-               }\r
-\r
-               /* If thd conditions are valid - rank the root node */\r
-               if (numHopBarsOverThd1 == 1 && numHopBarsOverThd2 == 1) {\r
-                       OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,\r
-                               "Ranking GUID 0x%" PRIx64 " as root node\n",\r
-                               cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));\r
-                       ((struct updn_node *)p_sw->priv)->rank = 0;\r
-                       p_updn->num_roots++;\r
-               }\r
-       }\r
-\r
-       free(cas_per_sw);\r
-_exit:\r
-       OSM_LOG_EXIT(&p_osm->log);\r
-       return;\r
-}\r
-\r
-static void dump_roots(cl_map_item_t *item, FILE *file, void *cxt)\r
-{\r
-       osm_switch_t *sw = (osm_switch_t *)item;\r
-       if (!((struct updn_node *)sw->priv)->rank)\r
-               fprintf(file, "0x%" PRIx64 "\n",\r
-                       cl_ntoh64(osm_node_get_node_guid(sw->p_node)));\r
-}\r
-\r
-static int update_id(void *cxt, uint64_t guid, char *p)\r
-{\r
-       osm_opensm_t *osm = cxt;\r
-       osm_switch_t *sw;\r
-       uint64_t id;\r
-       char *e;\r
-\r
-       sw = osm_get_switch_by_guid(&osm->subn, cl_hton64(guid));\r
-       if (!sw) {\r
-               OSM_LOG(&osm->log, OSM_LOG_VERBOSE,\r
-                       "switch with guid 0x%" PRIx64 " is not found\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       id = strtoull(p, &e, 0);\r
-       if (*e && !isspace(*e)) {\r
-               OSM_LOG(&osm->log, OSM_LOG_ERROR,\r
-                       "ERR: cannot parse node id \'%s\'", p);\r
-               return -1;\r
-       }\r
-\r
-       OSM_LOG(&osm->log, OSM_LOG_DEBUG,\r
-               "update node 0x%" PRIx64 " id to 0x%" PRIx64 "\n", guid, id);\r
-\r
-       ((struct updn_node *)sw->priv)->id = id;\r
-\r
-       return 0;\r
-}\r
-\r
-static int rank_root_node(void *cxt, uint64_t guid, char *p)\r
-{\r
-       updn_t *updn = cxt;\r
-       osm_switch_t *sw;\r
-\r
-       sw = osm_get_switch_by_guid(&updn->p_osm->subn, cl_hton64(guid));\r
-       if (!sw) {\r
-               OSM_LOG(&updn->p_osm->log, OSM_LOG_VERBOSE,\r
-                       "switch with guid 0x%" PRIx64 " is not found\n", guid);\r
-               return 0;\r
-       }\r
-\r
-       OSM_LOG(&updn->p_osm->log, OSM_LOG_DEBUG,\r
-               "Ranking root port GUID 0x%" PRIx64 "\n", guid);\r
-\r
-       ((struct updn_node *)sw->priv)->rank = 0;\r
-       updn->num_roots++;\r
-\r
-       return 0;\r
-}\r
-\r
-/* UPDN callback function */\r
-static int updn_lid_matrices(void *ctx)\r
-{\r
-       updn_t *p_updn = ctx;\r
-       cl_map_item_t *item;\r
-       osm_switch_t *p_sw;\r
-       int ret = 0;\r
-\r
-       OSM_LOG_ENTER(&p_updn->p_osm->log);\r
-\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *)item;\r
-               p_sw->priv = create_updn_node(p_sw);\r
-               if (!p_sw->priv) {\r
-                       OSM_LOG(&(p_updn->p_osm->log), OSM_LOG_ERROR, "ERR AA0C: "\r
-                               "cannot create updn node\n");\r
-                       OSM_LOG_EXIT(&p_updn->p_osm->log);\r
-                       return -1;\r
-               }\r
-       }\r
-\r
-       /* First setup root nodes */\r
-       p_updn->num_roots = 0;\r
-\r
-       if (p_updn->p_osm->subn.opt.root_guid_file) {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_DEBUG,\r
-                       "UPDN - Fetching root nodes from file \'%s\'\n",\r
-                       p_updn->p_osm->subn.opt.root_guid_file);\r
-\r
-               ret = parse_node_map(p_updn->p_osm->subn.opt.root_guid_file,\r
-                                    rank_root_node, p_updn);\r
-               if (ret)\r
-                       OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR : "\r
-                               "cannot parse root guids file \'%s\'\n",\r
-                               p_updn->p_osm->subn.opt.root_guid_file);\r
-               if (p_updn->p_osm->subn.opt.connect_roots &&\r
-                   p_updn->num_roots > 1)\r
-                       osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);\r
-       } else {\r
-               osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);\r
-               updn_find_root_nodes_by_min_hop(p_updn);\r
-       }\r
-\r
-       if (p_updn->p_osm->subn.opt.ids_guid_file) {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_DEBUG,\r
-                       "UPDN - update node ids from file \'%s\'\n",\r
-                       p_updn->p_osm->subn.opt.ids_guid_file);\r
-\r
-               ret = parse_node_map(p_updn->p_osm->subn.opt.ids_guid_file,\r
-                                    update_id, p_updn->p_osm);\r
-               if (ret)\r
-                       OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR : "\r
-                               "cannot parse node ids file \'%s\'\n",\r
-                               p_updn->p_osm->subn.opt.ids_guid_file);\r
-       }\r
-\r
-       /* Only if there are assigned root nodes do the algorithm, otherwise perform do nothing */\r
-       if (p_updn->num_roots) {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_DEBUG,\r
-                       "activating UPDN algorithm\n");\r
-               ret = updn_build_lid_matrices(p_updn);\r
-       } else {\r
-               OSM_LOG(&p_updn->p_osm->log, OSM_LOG_INFO,\r
-                       "disabling UPDN algorithm, no root nodes were found\n");\r
-               ret = -1;\r
-       }\r
-\r
-       if (osm_log_is_active(&p_updn->p_osm->log, OSM_LOG_ROUTING))\r
-               osm_dump_qmap_to_file(p_updn->p_osm, "opensm-updn-roots.dump",\r
-                                     &p_updn->p_osm->subn.sw_guid_tbl,\r
-                                     dump_roots, NULL);\r
-\r
-       for (item = cl_qmap_head(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item != cl_qmap_end(&p_updn->p_osm->subn.sw_guid_tbl);\r
-            item = cl_qmap_next(item)) {\r
-               p_sw = (osm_switch_t *) item;\r
-               delete_updn_node(p_sw->priv);\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_updn->p_osm->log);\r
-       return ret;\r
-}\r
-\r
-static void updn_delete(void *context)\r
-{\r
-       free(context);\r
-}\r
-\r
-int osm_ucast_updn_setup(struct osm_routing_engine *r, osm_opensm_t *osm)\r
-{\r
-       updn_t *updn;\r
-\r
-       updn = malloc(sizeof(updn_t));\r
-       if (!updn)\r
-               return -1;\r
-       memset(updn, 0, sizeof(updn_t));\r
-\r
-       updn->p_osm = osm;\r
-\r
-       r->context = updn;\r
-       r->delete = updn_delete;\r
-       r->build_lid_matrices = updn_lid_matrices;\r
-\r
-       return 0;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_vl15intf.c b/branches/opensm_3/user/opensm/osm_vl15intf.c
deleted file mode 100644 (file)
index 863120f..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-/*\r
- * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006,2009 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_vl15_t.\r
- * This object represents the VL15 Interface object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_thread.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_vl15intf.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_helper.h>\r
-\r
-static void vl15_send_mad(osm_vl15_t * p_vl, osm_madw_t * p_madw)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       /*\r
-          Non-response-expected mads are not throttled on the wire\r
-          since we can have no confirmation that they arrived\r
-          at their destination.\r
-        */\r
-       if (p_madw->resp_expected == TRUE)\r
-               /*\r
-                  Note that other threads may not see the response MAD\r
-                  arrive before send() even returns.\r
-                  In that case, the wire count would temporarily go negative.\r
-                  To avoid this confusion, preincrement the counts on the\r
-                  assumption that send() will succeed.\r
-                */\r
-               cl_atomic_inc(&p_vl->p_stats->qp0_mads_outstanding_on_wire);\r
-       else\r
-               cl_atomic_inc(&p_vl->p_stats->qp0_unicasts_sent);\r
-\r
-       cl_atomic_inc(&p_vl->p_stats->qp0_mads_sent);\r
-\r
-       status = osm_vendor_send(osm_madw_get_bind_handle(p_madw),\r
-                                p_madw, p_madw->resp_expected);\r
-\r
-       if (status == IB_SUCCESS) {\r
-               OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-                       "%u QP0 MADs on wire, %u outstanding, "\r
-                       "%u unicasts sent, %u total sent\n",\r
-                       p_vl->p_stats->qp0_mads_outstanding_on_wire,\r
-                       p_vl->p_stats->qp0_mads_outstanding,\r
-                       p_vl->p_stats->qp0_unicasts_sent,\r
-                       p_vl->p_stats->qp0_mads_sent);\r
-               return;\r
-       }\r
-\r
-       OSM_LOG(p_vl->p_log, OSM_LOG_ERROR, "ERR 3E03: "\r
-               "MAD send failed (%s)\n", ib_get_err_str(status));\r
-\r
-       /*\r
-          The MAD was never successfully sent, so\r
-          fix up the pre-incremented count values.\r
-        */\r
-\r
-       /* Decrement qp0_mads_sent that were incremented in the code above.\r
-          qp0_mads_outstanding will be decremented by send error callback\r
-          (called by osm_vendor_send() */\r
-       cl_atomic_dec(&p_vl->p_stats->qp0_mads_sent);\r
-       if (!p_madw->resp_expected)\r
-               cl_atomic_dec(&p_vl->p_stats->qp0_unicasts_sent);\r
-}\r
-\r
-static void vl15_poller(IN void *p_ptr)\r
-{\r
-       ib_api_status_t status;\r
-       osm_madw_t *p_madw;\r
-       osm_vl15_t *p_vl = p_ptr;\r
-       cl_qlist_t *p_fifo;\r
-\r
-       OSM_LOG_ENTER(p_vl->p_log);\r
-\r
-       if (p_vl->thread_state == OSM_THREAD_STATE_NONE)\r
-               p_vl->thread_state = OSM_THREAD_STATE_RUN;\r
-\r
-       while (p_vl->thread_state == OSM_THREAD_STATE_RUN) {\r
-               /*\r
-                  Start servicing the FIFOs by pulling off MAD wrappers\r
-                  and passing them to the transport interface.\r
-                  There are lots of corner cases here so tread carefully.\r
-\r
-                  The unicast FIFO has priority, since somebody is waiting\r
-                  for a timely response.\r
-                */\r
-               cl_spinlock_acquire(&p_vl->lock);\r
-\r
-               if (cl_qlist_count(&p_vl->ufifo) != 0)\r
-                       p_fifo = &p_vl->ufifo;\r
-               else\r
-                       p_fifo = &p_vl->rfifo;\r
-\r
-               p_madw = (osm_madw_t *) cl_qlist_remove_head(p_fifo);\r
-\r
-               cl_spinlock_release(&p_vl->lock);\r
-\r
-               if (p_madw != (osm_madw_t *) cl_qlist_end(p_fifo)) {\r
-                       OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-                               "Servicing p_madw = %p\n", p_madw);\r
-                       if (osm_log_is_active(p_vl->p_log, OSM_LOG_FRAMES))\r
-                               osm_dump_dr_smp(p_vl->p_log,\r
-                                               osm_madw_get_smp_ptr(p_madw),\r
-                                               OSM_LOG_FRAMES);\r
-\r
-                       vl15_send_mad(p_vl, p_madw);\r
-               } else\r
-                       /*\r
-                          The VL15 FIFO is empty, so we have nothing left to do.\r
-                        */\r
-                       status = cl_event_wait_on(&p_vl->signal,\r
-                                                 EVENT_NO_TIMEOUT, TRUE);\r
-\r
-               while (p_vl->p_stats->qp0_mads_outstanding_on_wire >=\r
-                      (int32_t) p_vl->max_wire_smps &&\r
-                      p_vl->thread_state == OSM_THREAD_STATE_RUN) {\r
-                       status = cl_event_wait_on(&p_vl->signal,\r
-                                                 EVENT_NO_TIMEOUT, TRUE);\r
-                       if (status != CL_SUCCESS) {\r
-                               OSM_LOG(p_vl->p_log, OSM_LOG_ERROR, "ERR 3E02: "\r
-                                       "Event wait failed (%s)\n",\r
-                                       CL_STATUS_MSG(status));\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-\r
-       /*\r
-          since we abort immediately when the state != OSM_THREAD_STATE_RUN\r
-          we might have some mads on the queues. After the thread exits\r
-          the vl15 destroy routine should put these mads back...\r
-        */\r
-\r
-       OSM_LOG_EXIT(p_vl->p_log);\r
-}\r
-\r
-void osm_vl15_construct(IN osm_vl15_t * p_vl)\r
-{\r
-       memset(p_vl, 0, sizeof(*p_vl));\r
-       p_vl->state = OSM_VL15_STATE_INIT;\r
-       p_vl->thread_state = OSM_THREAD_STATE_NONE;\r
-       cl_event_construct(&p_vl->signal);\r
-       cl_spinlock_construct(&p_vl->lock);\r
-       cl_qlist_init(&p_vl->rfifo);\r
-       cl_qlist_init(&p_vl->ufifo);\r
-       cl_thread_construct(&p_vl->poller);\r
-}\r
-\r
-void osm_vl15_destroy(IN osm_vl15_t * p_vl, IN struct osm_mad_pool *p_pool)\r
-{\r
-       osm_madw_t *p_madw;\r
-\r
-       OSM_LOG_ENTER(p_vl->p_log);\r
-\r
-       /*\r
-          Signal our threads that we're leaving.\r
-        */\r
-       p_vl->thread_state = OSM_THREAD_STATE_EXIT;\r
-\r
-       /*\r
-          Don't trigger unless event has been initialized.\r
-          Destroy the thread before we tear down the other objects.\r
-        */\r
-       if (p_vl->state != OSM_VL15_STATE_INIT)\r
-               cl_event_signal(&p_vl->signal);\r
-\r
-       cl_thread_destroy(&p_vl->poller);\r
-\r
-       /*\r
-          Return the outstanding messages to the pool\r
-        */\r
-\r
-       cl_spinlock_acquire(&p_vl->lock);\r
-\r
-       while (!cl_is_qlist_empty(&p_vl->rfifo)) {\r
-               p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->rfifo);\r
-               osm_mad_pool_put(p_pool, p_madw);\r
-       }\r
-       while (!cl_is_qlist_empty(&p_vl->ufifo)) {\r
-               p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->ufifo);\r
-               osm_mad_pool_put(p_pool, p_madw);\r
-       }\r
-\r
-       cl_spinlock_release(&p_vl->lock);\r
-\r
-       cl_event_destroy(&p_vl->signal);\r
-       p_vl->state = OSM_VL15_STATE_INIT;\r
-       cl_spinlock_destroy(&p_vl->lock);\r
-\r
-       OSM_LOG_EXIT(p_vl->p_log);\r
-}\r
-\r
-ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl, IN osm_vendor_t * p_vend,\r
-                             IN osm_log_t * p_log, IN osm_stats_t * p_stats,\r
-                             IN int32_t max_wire_smps)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       p_vl->p_vend = p_vend;\r
-       p_vl->p_log = p_log;\r
-       p_vl->p_stats = p_stats;\r
-       p_vl->max_wire_smps = max_wire_smps;\r
-\r
-       status = cl_event_init(&p_vl->signal, FALSE);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       p_vl->state = OSM_VL15_STATE_READY;\r
-\r
-       status = cl_spinlock_init(&p_vl->lock);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /*\r
-          Initialize the thread after all other dependent objects\r
-          have been initialized.\r
-        */\r
-       status = cl_thread_init(&p_vl->poller, vl15_poller, p_vl,\r
-                               "opensm poller");\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-void osm_vl15_poll(IN osm_vl15_t * p_vl)\r
-{\r
-       OSM_LOG_ENTER(p_vl->p_log);\r
-\r
-       CL_ASSERT(p_vl->state == OSM_VL15_STATE_READY);\r
-\r
-       /*\r
-          If we have room for more VL15 MADs on the wire,\r
-          then signal the poller thread.\r
-\r
-          This is not an airtight check, since the poller thread\r
-          could be just about to send another MAD as we signal\r
-          the event here.  To cover this rare case, the poller\r
-          thread checks for a spurious wake-up.\r
-        */\r
-       if (p_vl->p_stats->qp0_mads_outstanding_on_wire <\r
-           (int32_t) p_vl->max_wire_smps) {\r
-               OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-                       "Signalling poller thread\n");\r
-               cl_event_signal(&p_vl->signal);\r
-       }\r
-\r
-       OSM_LOG_EXIT(p_vl->p_log);\r
-}\r
-\r
-void osm_vl15_post(IN osm_vl15_t * p_vl, IN osm_madw_t * p_madw)\r
-{\r
-       OSM_LOG_ENTER(p_vl->p_log);\r
-\r
-       CL_ASSERT(p_vl->state == OSM_VL15_STATE_READY);\r
-\r
-       OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG, "Posting p_madw = %p\n", p_madw);\r
-\r
-       /*\r
-          Determine in which fifo to place the pending madw.\r
-        */\r
-       cl_spinlock_acquire(&p_vl->lock);\r
-       if (p_madw->resp_expected == TRUE) {\r
-               cl_qlist_insert_tail(&p_vl->rfifo, &p_madw->list_item);\r
-               osm_stats_inc_qp0_outstanding(p_vl->p_stats);\r
-       } else\r
-               cl_qlist_insert_tail(&p_vl->ufifo, &p_madw->list_item);\r
-       cl_spinlock_release(&p_vl->lock);\r
-\r
-       OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-               "%u QP0 MADs on wire, %u QP0 MADs outstanding\n",\r
-               p_vl->p_stats->qp0_mads_outstanding_on_wire,\r
-               p_vl->p_stats->qp0_mads_outstanding);\r
-\r
-       osm_vl15_poll(p_vl);\r
-\r
-       OSM_LOG_EXIT(p_vl->p_log);\r
-}\r
-\r
-void osm_vl15_shutdown(IN osm_vl15_t * p_vl, IN osm_mad_pool_t * p_mad_pool)\r
-{\r
-       osm_madw_t *p_madw;\r
-\r
-       OSM_LOG_ENTER(p_vl->p_log);\r
-\r
-       /* we only should get here after the VL15 interface was initialized */\r
-       CL_ASSERT(p_vl->state == OSM_VL15_STATE_READY);\r
-\r
-       /* grap a lock on the object */\r
-       cl_spinlock_acquire(&p_vl->lock);\r
-\r
-       /* go over all outstanding MADs and retire their transactions */\r
-\r
-       /* first we handle the list of response MADs */\r
-       p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->ufifo);\r
-       while (p_madw != (osm_madw_t *) cl_qlist_end(&p_vl->ufifo)) {\r
-               OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-                       "Releasing Response p_madw = %p\n", p_madw);\r
-\r
-               osm_mad_pool_put(p_mad_pool, p_madw);\r
-\r
-               p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->ufifo);\r
-       }\r
-\r
-       /* Request MADs we send out */\r
-       p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->rfifo);\r
-       while (p_madw != (osm_madw_t *) cl_qlist_end(&p_vl->rfifo)) {\r
-               OSM_LOG(p_vl->p_log, OSM_LOG_DEBUG,\r
-                       "Releasing Request p_madw = %p\n", p_madw);\r
-\r
-               osm_mad_pool_put(p_mad_pool, p_madw);\r
-               osm_stats_dec_qp0_outstanding(p_vl->p_stats);\r
-\r
-               p_madw = (osm_madw_t *) cl_qlist_remove_head(&p_vl->rfifo);\r
-       }\r
-\r
-       /* free the lock */\r
-       cl_spinlock_release(&p_vl->lock);\r
-\r
-       OSM_LOG_EXIT(p_vl->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c b/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c
deleted file mode 100644 (file)
index 37e30bd..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2010 HNR Consulting. All rights reserved.\r
- * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osm_vla_rcv_t.\r
- * This object represents the Vl Arbitration Receiver object.\r
- * This object is part of the opensm family of objects.\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <string.h>\r
-#include <iba/ib_types.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <complib/cl_debug.h>\r
-#include <opensm/osm_madw.h>\r
-#include <opensm/osm_log.h>\r
-#include <opensm/osm_node.h>\r
-#include <opensm/osm_subnet.h>\r
-#include <opensm/osm_helper.h>\r
-#include <opensm/osm_sm.h>\r
-\r
-/*\r
- * WE ONLY RECEIVE GET or SET responses\r
- */\r
-void osm_vla_rcv_process(IN void *context, IN void *data)\r
-{\r
-       osm_sm_t *sm = context;\r
-       osm_madw_t *p_madw = data;\r
-       ib_vl_arb_table_t *p_vla_tbl;\r
-       ib_smp_t *p_smp;\r
-       osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
-       osm_node_t *p_node;\r
-       osm_vla_context_t *p_context;\r
-       ib_net64_t port_guid;\r
-       ib_net64_t node_guid;\r
-       uint8_t port_num, block_num;\r
-\r
-       CL_ASSERT(sm);\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       CL_ASSERT(p_madw);\r
-\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\r
-\r
-       p_context = osm_madw_get_vla_context_ptr(p_madw);\r
-       p_vla_tbl = ib_smp_get_payload_ptr(p_smp);\r
-\r
-       port_guid = p_context->port_guid;\r
-       node_guid = p_context->node_guid;\r
-\r
-       CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION);\r
-\r
-       cl_plock_excl_acquire(sm->p_lock);\r
-       p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
-       if (!p_port) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3F06: "\r
-                       "No port object for port with GUID 0x%" PRIx64\r
-                       "\n\t\t\t\tfor parent node GUID 0x%" PRIx64\r
-                       ", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid),\r
-                       cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-               goto Exit;\r
-       }\r
-\r
-       p_node = p_port->p_node;\r
-       CL_ASSERT(p_node);\r
-\r
-       block_num = (uint8_t) (cl_ntoh32(p_smp->attr_mod) >> 16);\r
-       /* in case of a non switch node the attr modifier should be ignored */\r
-       if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {\r
-               port_num = (uint8_t) (cl_ntoh32(p_smp->attr_mod) & 0x000000FF);\r
-               p_physp = osm_node_get_physp_ptr(p_node, port_num);\r
-       } else {\r
-               p_physp = p_port->p_physp;\r
-               port_num = p_physp->port_num;\r
-       }\r
-\r
-       /*\r
-          We do not care if this is a result of a set or get -\r
-          all we want is to update the subnet.\r
-        */\r
-       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-               "Got GetResp(VLArb) block:%u port_num %u with GUID 0x%"\r
-               PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"\r
-               PRIx64 "\n", block_num, port_num, cl_ntoh64(port_guid),\r
-               cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));\r
-\r
-       /*\r
-          Determine if we encountered a new Physical Port.\r
-          If so, Ignore it.\r
-        */\r
-       if (!p_physp) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "Got invalid port number %u\n", port_num);\r
-               goto Exit;\r
-       }\r
-\r
-       if ((block_num < 1) || (block_num > 4)) {\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                       "Got invalid block number 0x%X\n", block_num);\r
-               goto Exit;\r
-       }\r
-\r
-       osm_dump_vl_arb_table(sm->p_log, port_guid, block_num, port_num,\r
-                             p_vla_tbl, OSM_LOG_DEBUG);\r
-       osm_physp_set_vla_tbl(p_physp, p_vla_tbl, block_num);\r
-\r
-Exit:\r
-       cl_plock_release(sm->p_lock);\r
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
-}\r
diff --git a/branches/opensm_3/user/opensm/st.c b/branches/opensm_3/user/opensm/st.c
deleted file mode 100644 (file)
index 676b1c2..0000000
+++ /dev/null
@@ -1,584 +0,0 @@
-/*\r
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/* static   char  sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <opensm/st.h>\r
-\r
-typedef struct st_table_entry st_table_entry;\r
-\r
-struct st_table_entry {\r
-       unsigned int hash;\r
-       st_data_t key;\r
-       st_data_t record;\r
-       st_table_entry *next;\r
-};\r
-\r
-#define ST_DEFAULT_MAX_DENSITY 5\r
-#define ST_DEFAULT_INIT_TABLE_SIZE 11\r
-\r
-/*\r
- * DEFAULT_MAX_DENSITY is the default for the largest we allow the\r
- * average number of items per bin before increasing the number of\r
- * bins\r
- *\r
- * DEFAULT_INIT_TABLE_SIZE is the default for the number of bins\r
- * allocated initially\r
- *\r
- */\r
-static int numcmp(void *, void *);\r
-static st_ptr_t numhash(void *);\r
-static struct st_hash_type type_numhash = {\r
-       numcmp,\r
-       numhash,\r
-};\r
-\r
-/* extern int strcmp(const char *, const char *); */\r
-static int strhash(const char *);\r
-\r
-static inline st_ptr_t st_strhash(void *key)\r
-{\r
-       return strhash((const char *)key);\r
-}\r
-\r
-static inline int st_strcmp(void *key1, void *key2)\r
-{\r
-       return strcmp((const char *)key1, (const char *)key2);\r
-}\r
-\r
-static struct st_hash_type type_strhash = {\r
-       st_strcmp,\r
-       st_strhash\r
-};\r
-\r
-#define xmalloc  malloc\r
-#define xcalloc  calloc\r
-#define xrealloc realloc\r
-#define xfree    free\r
-\r
-static void rehash(st_table *);\r
-\r
-#define alloc(type) (type*)xmalloc(sizeof(type))\r
-#define Calloc(n,s) (char*)xcalloc((n), (s))\r
-\r
-#define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)(((void*)x),((void *)y)) == 0)\r
-\r
-#define do_hash(key,table) (unsigned int)(*(table)->type->hash)(((void*)key))\r
-#define do_hash_bin(key,table) (do_hash(key, table)%(table)->num_bins)\r
-\r
-/*\r
- * MINSIZE is the minimum size of a dictionary.\r
- */\r
-\r
-#define MINSIZE 8\r
-\r
-/*\r
-  Table of prime numbers 2^n+a, 2<=n<=30.\r
-*/\r
-static long primes[] = {\r
-       8 + 3,\r
-       16 + 3,\r
-       32 + 5,\r
-       64 + 3,\r
-       128 + 3,\r
-       256 + 27,\r
-       512 + 9,\r
-       1024 + 9,\r
-       2048 + 5,\r
-       4096 + 3,\r
-       8192 + 27,\r
-       16384 + 43,\r
-       32768 + 3,\r
-       65536 + 45,\r
-       131072 + 29,\r
-       262144 + 3,\r
-       524288 + 21,\r
-       1048576 + 7,\r
-       2097152 + 17,\r
-       4194304 + 15,\r
-       8388608 + 9,\r
-       16777216 + 43,\r
-       33554432 + 35,\r
-       67108864 + 15,\r
-       134217728 + 29,\r
-       268435456 + 3,\r
-       536870912 + 11,\r
-       1073741824 + 85,\r
-       0\r
-};\r
-\r
-static int new_size(int size)\r
-{\r
-       int i;\r
-\r
-#if 0\r
-       for (i = 3; i < 31; i++) {\r
-               if ((1 << i) > size)\r
-                       return 1 << i;\r
-       }\r
-       return -1;\r
-#else\r
-       int newsize;\r
-\r
-       for (i = 0, newsize = MINSIZE;\r
-            i < sizeof(primes) / sizeof(primes[0]); i++, newsize <<= 1) {\r
-               if (newsize > size)\r
-                       return primes[i];\r
-       }\r
-       /* Ran out of polynomials */\r
-       return -1;              /* should raise exception */\r
-#endif\r
-}\r
-\r
-#ifdef HASH_LOG\r
-static int collision = 0;\r
-static int init_st = 0;\r
-\r
-static void stat_col(void)\r
-{\r
-       FILE *f = fopen(OSM_DEFAULT_TMP_DIR "osm_st_col", "w");\r
-       fprintf(f, "collision: %d\n", collision);\r
-       fclose(f);\r
-}\r
-#endif\r
-\r
-st_table *st_init_table_with_size(type, size)\r
-struct st_hash_type *type;\r
-size_t size;\r
-{\r
-       st_table *tbl;\r
-\r
-#ifdef HASH_LOG\r
-       if (init_st == 0) {\r
-               init_st = 1;\r
-               atexit(stat_col);\r
-       }\r
-#endif\r
-\r
-       size = new_size(size);  /* round up to prime number */\r
-\r
-       tbl = alloc(st_table);\r
-       tbl->type = type;\r
-       tbl->num_entries = 0;\r
-       tbl->num_bins = size;\r
-       tbl->bins = (st_table_entry **) Calloc(size, sizeof(st_table_entry *));\r
-\r
-       return tbl;\r
-}\r
-\r
-st_table *st_init_table(type)\r
-struct st_hash_type *type;\r
-{\r
-       return st_init_table_with_size(type, 0);\r
-}\r
-\r
-st_table *st_init_numtable(void)\r
-{\r
-       return st_init_table(&type_numhash);\r
-}\r
-\r
-st_table *st_init_numtable_with_size(size)\r
-size_t size;\r
-{\r
-       return st_init_table_with_size(&type_numhash, size);\r
-}\r
-\r
-st_table *st_init_strtable(void)\r
-{\r
-       return st_init_table(&type_strhash);\r
-}\r
-\r
-st_table *st_init_strtable_with_size(size)\r
-size_t size;\r
-{\r
-       return st_init_table_with_size(&type_strhash, size);\r
-}\r
-\r
-void st_free_table(table)\r
-st_table *table;\r
-{\r
-       register st_table_entry *ptr, *next;\r
-       int i;\r
-\r
-       for (i = 0; i < table->num_bins; i++) {\r
-               ptr = table->bins[i];\r
-               while (ptr != 0) {\r
-                       next = ptr->next;\r
-                       free(ptr);\r
-                       ptr = next;\r
-               }\r
-       }\r
-       free(table->bins);\r
-       free(table);\r
-}\r
-\r
-#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \\r
-((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key)))\r
-\r
-#ifdef HASH_LOG\r
-#define COLLISION collision++\r
-#else\r
-#define COLLISION\r
-#endif\r
-\r
-#define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\\r
-    bin_pos = hash_val%(table)->num_bins;\\r
-    ptr = (table)->bins[bin_pos];\\r
-    if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) \\r
-    {\\r
-      COLLISION;\\r
-      while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\\r
-      ptr = ptr->next;\\r
-    }\\r
-    ptr = ptr->next;\\r
-  }\\r
-} while (0)\r
-\r
-int st_lookup(table, key, value)\r
-st_table *table;\r
-register st_data_t key;\r
-st_data_t *value;\r
-{\r
-       unsigned int hash_val, bin_pos;\r
-       register st_table_entry *ptr;\r
-\r
-       hash_val = do_hash(key, table);\r
-       FIND_ENTRY(table, ptr, hash_val, bin_pos);\r
-\r
-       if (ptr == 0) {\r
-               return 0;\r
-       } else {\r
-               if (value != 0)\r
-                       *value = ptr->record;\r
-               return 1;\r
-       }\r
-}\r
-\r
-#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\\r
-do {\\r
-  st_table_entry *entry;\\r
-  if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) \\r
-  {\\r
-    rehash(table);\\r
-    bin_pos = hash_val % table->num_bins;\\r
-  }\\r
-  \\r
-  entry = alloc(st_table_entry);\\r
-  \\r
-  entry->hash = hash_val;\\r
-  entry->key = key;\\r
-  entry->record = value;\\r
-  entry->next = table->bins[bin_pos];\\r
-  table->bins[bin_pos] = entry;\\r
-  table->num_entries++;\\r
-} while (0);\r
-\r
-int st_insert(table, key, value)\r
-register st_table *table;\r
-register st_data_t key;\r
-st_data_t value;\r
-{\r
-       unsigned int hash_val, bin_pos;\r
-       register st_table_entry *ptr;\r
-\r
-       hash_val = do_hash(key, table);\r
-       FIND_ENTRY(table, ptr, hash_val, bin_pos);\r
-\r
-       if (ptr == 0) {\r
-               ADD_DIRECT(table, key, value, hash_val, bin_pos);\r
-               return 0;\r
-       } else {\r
-               ptr->record = value;\r
-               return 1;\r
-       }\r
-}\r
-\r
-void st_add_direct(table, key, value)\r
-st_table *table;\r
-st_data_t key;\r
-st_data_t value;\r
-{\r
-       unsigned int hash_val, bin_pos;\r
-\r
-       hash_val = do_hash(key, table);\r
-       bin_pos = hash_val % table->num_bins;\r
-       ADD_DIRECT(table, key, value, hash_val, bin_pos);\r
-}\r
-\r
-static void rehash(table)\r
-register st_table *table;\r
-{\r
-       register st_table_entry *ptr, *next, **new_bins;\r
-       int i, old_num_bins = table->num_bins, new_num_bins;\r
-       unsigned int hash_val;\r
-\r
-       new_num_bins = new_size(old_num_bins + 1);\r
-       new_bins =\r
-           (st_table_entry **) Calloc(new_num_bins, sizeof(st_table_entry *));\r
-\r
-       for (i = 0; i < old_num_bins; i++) {\r
-               ptr = table->bins[i];\r
-               while (ptr != 0) {\r
-                       next = ptr->next;\r
-                       hash_val = ptr->hash % new_num_bins;\r
-                       ptr->next = new_bins[hash_val];\r
-                       new_bins[hash_val] = ptr;\r
-                       ptr = next;\r
-               }\r
-       }\r
-       free(table->bins);\r
-       table->num_bins = new_num_bins;\r
-       table->bins = new_bins;\r
-}\r
-\r
-st_table *st_copy(old_table)\r
-st_table *old_table;\r
-{\r
-       st_table *new_table;\r
-       st_table_entry *ptr, *entry;\r
-       size_t i, num_bins = old_table->num_bins;\r
-\r
-       new_table = alloc(st_table);\r
-       if (new_table == 0) {\r
-               return 0;\r
-       }\r
-\r
-       *new_table = *old_table;\r
-       new_table->bins = (st_table_entry **)\r
-           Calloc(num_bins, sizeof(st_table_entry *));\r
-\r
-       if (new_table->bins == 0) {\r
-               free(new_table);\r
-               return 0;\r
-       }\r
-\r
-       for (i = 0; i < num_bins; i++) {\r
-               new_table->bins[i] = 0;\r
-               ptr = old_table->bins[i];\r
-               while (ptr != 0) {\r
-                       entry = alloc(st_table_entry);\r
-                       if (entry == 0) {\r
-                               free(new_table->bins);\r
-                               free(new_table);\r
-                               return 0;\r
-                       }\r
-                       *entry = *ptr;\r
-                       entry->next = new_table->bins[i];\r
-                       new_table->bins[i] = entry;\r
-                       ptr = ptr->next;\r
-               }\r
-       }\r
-       return new_table;\r
-}\r
-\r
-int st_delete(table, key, value)\r
-register st_table *table;\r
-register st_data_t *key;\r
-st_data_t *value;\r
-{\r
-       unsigned int hash_val;\r
-       st_table_entry *tmp;\r
-       register st_table_entry *ptr;\r
-\r
-       hash_val = do_hash_bin(*key, table);\r
-       ptr = table->bins[hash_val];\r
-\r
-       if (ptr == 0) {\r
-               if (value != 0)\r
-                       *value = 0;\r
-               return 0;\r
-       }\r
-\r
-       if (EQUAL(table, *key, ptr->key)) {\r
-               table->bins[hash_val] = ptr->next;\r
-               table->num_entries--;\r
-               if (value != 0)\r
-                       *value = ptr->record;\r
-               *key = ptr->key;\r
-               free(ptr);\r
-               return 1;\r
-       }\r
-\r
-       for (; ptr->next != 0; ptr = ptr->next) {\r
-               if (EQUAL(table, ptr->next->key, *key)) {\r
-                       tmp = ptr->next;\r
-                       ptr->next = ptr->next->next;\r
-                       table->num_entries--;\r
-                       if (value != 0)\r
-                               *value = tmp->record;\r
-                       *key = tmp->key;\r
-                       free(tmp);\r
-                       return 1;\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-int st_delete_safe(table, key, value, never)\r
-register st_table *table;\r
-register st_data_t *key;\r
-st_data_t *value;\r
-st_data_t never;\r
-{\r
-       unsigned int hash_val;\r
-       register st_table_entry *ptr;\r
-\r
-       hash_val = do_hash_bin(*key, table);\r
-       ptr = table->bins[hash_val];\r
-\r
-       if (ptr == 0) {\r
-               if (value != 0)\r
-                       *value = 0;\r
-               return 0;\r
-       }\r
-\r
-       for (; ptr != 0; ptr = ptr->next) {\r
-               if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {\r
-                       table->num_entries--;\r
-                       *key = ptr->key;\r
-                       if (value != 0)\r
-                               *value = ptr->record;\r
-                       ptr->key = ptr->record = never;\r
-                       return 1;\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-static int delete_never(st_data_t key, st_data_t value, st_data_t never)\r
-{\r
-       if (value == never)\r
-               return ST_DELETE;\r
-       return ST_CONTINUE;\r
-}\r
-\r
-void st_cleanup_safe(table, never)\r
-st_table *table;\r
-st_data_t never;\r
-{\r
-       int num_entries = table->num_entries;\r
-\r
-       st_foreach(table, delete_never, never);\r
-       table->num_entries = num_entries;\r
-}\r
-\r
-void st_foreach(table, func, arg)\r
-st_table *table;\r
-int (*func) (st_data_t key, st_data_t val, st_data_t arg);\r
-st_data_t arg;\r
-{\r
-       st_table_entry *ptr, *last, *tmp;\r
-       enum st_retval retval;\r
-       int i;\r
-\r
-       for (i = 0; i < table->num_bins; i++) {\r
-               last = 0;\r
-               for (ptr = table->bins[i]; ptr != 0;) {\r
-                       retval = (*func) (ptr->key, ptr->record, arg);\r
-                       switch (retval) {\r
-                       case ST_CONTINUE:\r
-                               last = ptr;\r
-                               ptr = ptr->next;\r
-                               break;\r
-                       case ST_STOP:\r
-                               return;\r
-                       case ST_DELETE:\r
-                               tmp = ptr;\r
-                               if (last == 0) {\r
-                                       table->bins[i] = ptr->next;\r
-                               } else {\r
-                                       last->next = ptr->next;\r
-                               }\r
-                               ptr = ptr->next;\r
-                               free(tmp);\r
-                               table->num_entries--;\r
-                       }\r
-               }\r
-       }\r
-}\r
-\r
-static int strhash(string)\r
-register const char *string;\r
-{\r
-       register int c;\r
-\r
-#ifdef HASH_ELFHASH\r
-       register unsigned int h = 0, g;\r
-\r
-       while ((c = *string++) != '\0') {\r
-               h = (h << 4) + c;\r
-               if (g = h & 0xF0000000)\r
-                       h ^= g >> 24;\r
-               h &= ~g;\r
-       }\r
-       return h;\r
-#elif HASH_PERL\r
-       register int val = 0;\r
-\r
-       while ((c = *string++) != '\0') {\r
-               val = val * 33 + c;\r
-       }\r
-\r
-       return val + (val >> 5);\r
-#else\r
-       register int val = 0;\r
-\r
-       while ((c = *string++) != '\0') {\r
-               val = val * 997 + c;\r
-       }\r
-\r
-       return val + (val >> 5);\r
-#endif\r
-}\r
-\r
-static int numcmp(x, y)\r
-void *x, *y;\r
-{\r
-       return (st_ptr_t) x != (st_ptr_t) y;\r
-}\r
-\r
-static st_ptr_t numhash(n)\r
-void *n;\r
-{\r
-       return (st_ptr_t) n;\r
-}\r
diff --git a/branches/opensm_3/user/opensm/vendor-ibal.inc b/branches/opensm_3/user/opensm/vendor-ibal.inc
deleted file mode 100644 (file)
index 85a2dce..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Vendor IBAL\r
-VENDOR_LIBS=$(LIBPATH)\*\osmv_ibal.lib\r
-VENDOR_LIBSD=$(VENDOR_LIBS)\r
-VENDOR_IF=OSM_VENDOR_INTF_AL\r
-\r
diff --git a/branches/opensm_3/user/opensm/vendor-umad.inc b/branches/opensm_3/user/opensm/vendor-umad.inc
deleted file mode 100644 (file)
index 48285ed..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Vendor umad\r
-\r
-VENDOR_INC= $(WINIBHOME)\ulp\libibmad\include; \\r
-       $(WINIBHOME)\ulp\libibumad\include;\r
-\r
-VENDOR_LIBS=$(TARGETPATH)\*\osmv_openib.lib \\r
-       $(LIBPATH)\*\libibmad.lib \\r
-       $(LIBPATH)\*\libibumad.lib \\r
-       $(LIBPATH)\*\libibverbs.lib \\r
-       $(LIBPATH)\*\winverbs.lib \r
-\r
-VENDOR_LIBSD=$(TARGETPATH)\*\osmv_openib.lib \\r
-       $(LIBPATH)\*\libibmadd.lib \\r
-       $(LIBPATH)\*\libibumadd.lib \\r
-       $(LIBPATH)\*\libibverbsd.lib \\r
-       $(LIBPATH)\*\winverbsd.lib\r
-\r
-VENDOR_IF=OSM_VENDOR_INTF_OPENIB\r
-\r
diff --git a/branches/opensm_3/user/osmeventplugin/libosmeventplugin.map b/branches/opensm_3/user/osmeventplugin/libosmeventplugin.map
deleted file mode 100644 (file)
index 15bf29a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-OSMPMDB_1.0 {\r
-       global:\r
-       osm_event_plugin;\r
-       local: *;\r
-};\r
diff --git a/branches/opensm_3/user/osmeventplugin/libosmeventplugin.ver b/branches/opensm_3/user/osmeventplugin/libosmeventplugin.ver
deleted file mode 100644 (file)
index c463efc..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# In this file we track the current API version\r
-# of the vendor interface (and libraries)\r
-# The version is built of the following\r
-# tree numbers:\r
-# API_REV:RUNNING_REV:AGE\r
-# API_REV - advance on any added API\r
-# RUNNING_REV - advance any change to the vendor files\r
-# AGE - number of backward versions the API still supports\r
-LIBVERSION=1:0:0\r
diff --git a/branches/opensm_3/user/osmeventplugin/src/osmeventplugin.c b/branches/opensm_3/user/osmeventplugin/src/osmeventplugin.c
deleted file mode 100644 (file)
index 2461878..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2007 The Regents of the University of California.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#if HAVE_CONFIG_H\r
-#  include <config.h>\r
-#endif                         /* HAVE_CONFIG_H */\r
-\r
-#include <errno.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <time.h>\r
-#include <dlfcn.h>\r
-#include <stdint.h>\r
-#include <complib/cl_qmap.h>\r
-#include <complib/cl_passivelock.h>\r
-#include <opensm/osm_version.h>\r
-#include <opensm/osm_opensm.h>\r
-#include <opensm/osm_log.h>\r
-\r
-/** =========================================================================\r
- * This is a simple example plugin which logs some of the events the OSM\r
- * generates to this interface.\r
- */\r
-#define SAMPLE_PLUGIN_OUTPUT_FILE "/tmp/osm_sample_event_plugin_output"\r
-typedef struct _log_events {\r
-       FILE *log_file;\r
-       osm_log_t *osmlog;\r
-} _log_events_t;\r
-\r
-/** =========================================================================\r
- */\r
-static void *construct(osm_opensm_t *osm)\r
-{\r
-       _log_events_t *log = malloc(sizeof(*log));\r
-       if (!log)\r
-               return (NULL);\r
-\r
-       log->log_file = fopen(SAMPLE_PLUGIN_OUTPUT_FILE, "a+");\r
-\r
-       if (!(log->log_file)) {\r
-               osm_log(&osm->log, OSM_LOG_ERROR,\r
-                       "Sample Event Plugin: Failed to open output file \"%s\"\n",\r
-                       SAMPLE_PLUGIN_OUTPUT_FILE);\r
-               free(log);\r
-               return (NULL);\r
-       }\r
-\r
-       log->osmlog = &osm->log;\r
-       return ((void *)log);\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void destroy(void *_log)\r
-{\r
-       _log_events_t *log = (_log_events_t *) _log;\r
-       fclose(log->log_file);\r
-       free(log);\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void handle_port_counter(_log_events_t * log, osm_epi_pe_event_t * pc)\r
-{\r
-       if (pc->symbol_err_cnt > 0\r
-           || pc->link_err_recover > 0\r
-           || pc->link_downed > 0\r
-           || pc->rcv_err > 0\r
-           || pc->rcv_rem_phys_err > 0\r
-           || pc->rcv_switch_relay_err > 0\r
-           || pc->xmit_discards > 0\r
-           || pc->xmit_constraint_err > 0\r
-           || pc->rcv_constraint_err > 0\r
-           || pc->link_integrity > 0\r
-           || pc->buffer_overrun > 0 || pc->vl15_dropped > 0) {\r
-               fprintf(log->log_file,\r
-                       "Port counter errors for node 0x%" PRIx64\r
-                       " (%s) port %d\n", pc->port_id.node_guid,\r
-                       pc->port_id.node_name, pc->port_id.port_num);\r
-       }\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void\r
-handle_port_counter_ext(_log_events_t * log, osm_epi_dc_event_t * epc)\r
-{\r
-       fprintf(log->log_file,\r
-               "Recieved Data counters for node 0x%" PRIx64 " (%s) port %d\n",\r
-               epc->port_id.node_guid,\r
-               epc->port_id.node_name, epc->port_id.port_num);\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void handle_port_select(_log_events_t * log, osm_epi_ps_event_t * ps)\r
-{\r
-       if (ps->xmit_wait > 0) {\r
-               fprintf(log->log_file,\r
-                       "Port select Xmit Wait counts for node 0x%" PRIx64\r
-                       " (%s) port %d\n", ps->port_id.node_guid,\r
-                       ps->port_id.node_name, ps->port_id.port_num);\r
-       }\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void handle_trap_event(_log_events_t *log, ib_mad_notice_attr_t *p_ntc)\r
-{\r
-       if (ib_notice_is_generic(p_ntc)) {\r
-               fprintf(log->log_file,\r
-                       "Generic trap type %d; event %d; from LID 0x%x\n",\r
-                       ib_notice_get_type(p_ntc),\r
-                       cl_ntoh16(p_ntc->g_or_v.generic.trap_num),\r
-                       cl_ntoh16(p_ntc->issuer_lid));\r
-       } else {\r
-               fprintf(log->log_file,\r
-                       "Vendor trap type %d; from LID 0x%x\n",\r
-                       ib_notice_get_type(p_ntc),\r
-                       cl_ntoh16(p_ntc->issuer_lid));\r
-       }\r
-\r
-}\r
-\r
-/** =========================================================================\r
- */\r
-static void report(void *_log, osm_epi_event_id_t event_id, void *event_data)\r
-{\r
-       _log_events_t *log = (_log_events_t *) _log;\r
-\r
-       switch (event_id) {\r
-       case OSM_EVENT_ID_PORT_ERRORS:\r
-               handle_port_counter(log, (osm_epi_pe_event_t *) event_data);\r
-               break;\r
-       case OSM_EVENT_ID_PORT_DATA_COUNTERS:\r
-               handle_port_counter_ext(log, (osm_epi_dc_event_t *) event_data);\r
-               break;\r
-       case OSM_EVENT_ID_PORT_SELECT:\r
-               handle_port_select(log, (osm_epi_ps_event_t *) event_data);\r
-               break;\r
-       case OSM_EVENT_ID_TRAP:\r
-               handle_trap_event(log, (ib_mad_notice_attr_t *) event_data);\r
-               break;\r
-       case OSM_EVENT_ID_SUBNET_UP:\r
-               fprintf(log->log_file, "Subnet up reported\n");\r
-               break;\r
-       case OSM_EVENT_ID_MAX:\r
-       default:\r
-               osm_log(log->osmlog, OSM_LOG_ERROR,\r
-                       "Unknown event (%d) reported to plugin\n", event_id);\r
-       }\r
-       fflush(log->log_file);\r
-}\r
-\r
-/** =========================================================================\r
- * Define the object symbol for loading\r
- */\r
-\r
-#if OSM_EVENT_PLUGIN_INTERFACE_VER != 2\r
-#error OpenSM plugin interface version missmatch\r
-#endif\r
-\r
-osm_event_plugin_t osm_event_plugin = {\r
-      osm_version:OSM_VERSION,\r
-      create:construct,\r
-      delete:destroy,\r
-      report:report\r
-};\r
diff --git a/branches/opensm_3/user/osmtest/Makefile b/branches/opensm_3/user/osmtest/Makefile
deleted file mode 100644 (file)
index b8c9cc3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#\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 ..\..\..\..\inc\openib.def \r
diff --git a/branches/opensm_3/user/osmtest/SOURCES b/branches/opensm_3/user/osmtest/SOURCES
deleted file mode 100644 (file)
index 1027e8d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-TARGETNAME=osmtest\r
-\r
-!if !defined(WINIBHOME)\r
-WINIBHOME=..\..\..\..\r
-!endif\r
-\r
-LIBPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-\r
-!if defined(OSM_TARGET)\r
-TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)\r
-!else\r
-TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
-!endif\r
-\r
-!include ..\mad-vendor.inc\r
-\r
-TARGETTYPE=PROGRAM\r
-UMTYPE=console\r
-USE_MSVCRT=1\r
-OVR_DIR=..\addon\r
-\r
-\r
-SOURCES=osmtest.rc \\r
-       osmt_files.c \\r
-       osmt_slvl_vl_arb.c \\r
-       osmt_service.c \\r
-       osmt_multicast.c \\r
-       osmt_inform.c \\r
-       osmtest.c \\r
-       main.c\r
-\r
-OSM_HOME=..\r
-\r
-TARGETLIBS=\\r
-       $(SDK_LIB_PATH)\kernel32.lib \\r
-       $(SDK_LIB_PATH)\ws2_32.lib \\r
-!if $(FREEBUILD)\r
-       $(VENDOR_LIBS) \\r
-       $(LIBPATH)\*\ibal.lib \\r
-       $(LIBPATH)\*\complib.lib\r
-!else\r
-       $(VENDOR_LIBSD) \\r
-       $(LIBPATH)\*\ibald.lib \\r
-       $(LIBPATH)\*\complibd.lib\r
-!endif\r
-\r
-\r
-INCLUDES= \\r
-       $(WINIBHOME)\inc; \\r
-       $(WINIBHOME)\inc\user; \\r
-       $(WINIBHOME)\inc\user\linux; \\r
-       $(VENDOR_INC) \\r
-       $(OSM_HOME); \\r
-       $(OSM_HOME)\osmtest\include; \\r
-       $(OSM_HOME)\include;\r
-\r
-# Could be any special flag needed for this project \r
-USER_C_FLAGS=$(USER_C_FLAGS) /MD\r
-\r
-#Add preproccessor definitions\r
-\r
-C_DEFINES=$(C_DEFINES) -D__WIN__ -D$(VENDOR_IF) -DHAVE_CONFIG_H\r
-\r
-!if !$(FREEBUILD)\r
-#C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG\r
-C_DEFINES=$(C_DEFINES) \r
-!endif\r
-\r
-LINKER_FLAGS= $(LINKER_FLAGS)\r
-MSC_WARNING_LEVEL= /W3 /wd4007 /wd4090\r
-\r
diff --git a/branches/opensm_3/user/osmtest/include/osmt_inform.h b/branches/opensm_3/user/osmtest/include/osmt_inform.h
deleted file mode 100644 (file)
index 4bae63a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifndef __OSMT_INFORM__\r
-#define __OSMT_INFORM__\r
-\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-#include <vendor/osm_vendor_mlx_inout.h>\r
-#include <ib_mgt.h>\r
-#include "osmt_mtl_regular_qp.h"\r
-#endif\r
-\r
-typedef struct _osmt_qp_ctx {\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-       osmt_mtl_mad_res_t qp_bind_hndl;\r
-#endif\r
-       uint8_t *p_send_buf;\r
-       uint8_t *p_recv_buf;\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-       IB_MGT_mad_hndl_t ib_mgt_qp0_handle;\r
-#endif\r
-} osmt_qp_ctx_t;\r
-\r
-ib_api_status_t\r
-osmt_bind_inform_qp(IN osmtest_t * const p_osmt, OUT osmt_qp_ctx_t * p_qp_ctx);\r
-\r
-void\r
-osmt_unbind_inform_qp(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx);\r
-\r
-ib_api_status_t\r
-osmt_reg_unreg_inform_info(IN osmtest_t * p_osmt,\r
-                          IN osmt_qp_ctx_t * p_qp_ctx,\r
-                          IN ib_inform_info_t * p_inform_info,\r
-                          IN uint8_t reg_flag);\r
-\r
-ib_api_status_t\r
-osmt_trap_wait(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx);\r
-\r
-ib_api_status_t\r
-osmt_init_inform_info(IN osmtest_t * const p_osmt, OUT ib_inform_info_t * p_ii);\r
-\r
-ib_api_status_t\r
-osmt_init_inform_info_by_trap(IN osmtest_t * const p_osmt,\r
-                             IN ib_net16_t trap_num,\r
-                             OUT ib_inform_info_t * p_ii);\r
-\r
-#endif                         /* __OSMT_INFORM__ */\r
diff --git a/branches/opensm_3/user/osmtest/include/osmt_mtl_regular_qp.h b/branches/opensm_3/user/osmtest/include/osmt_mtl_regular_qp.h
deleted file mode 100644 (file)
index b9136e6..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*\r
- * Copyright (c) 2001-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- *    mad.h -\r
- *      Header file for common special QP resources creation code.\r
- *\r
- *  Creation date:\r
- *\r
- *  Version: osmt_mtl_regular_qp.h,v 1.2 2003/03/20 16:05:10 eitan\r
- *\r
- *  Authors:\r
- *    Elazar Raab\r
- *\r
- *  Changes:\r
- */\r
-\r
-#ifndef H_MAD_H\r
-#define H_MAD_H\r
-\r
-#include <vapi.h>\r
-#include <evapi.h>\r
-#include <vapi_common.h>\r
-#include <ib_defs.h>\r
-\r
-#if defined(MAD_IN) || defined(MAD_OUT)\r
-#error MACROS MAD_IN and MAD_OUT are in use, do not override\r
-#endif\r
-#define MAD_IN\r
-#define MAD_OUT\r
-\r
-/* HCA Constants */\r
-#define HCA_ID     "mt21108_pci0"\r
-#define GRH_LEN 40\r
-#define KNOWN_QP1_QKEY 0x80010000\r
-\r
-#define MAX_OUTS_SQ   2                /* Max. buffers posted for requests in SQ */\r
-#define MAX_OUTS_RQ   5                /* Max. buffers posted for responses in RQ */\r
-\r
-#define MAX_POLL_CNT    300\r
-#define POLL_SLEEP      1      /* for usleep */\r
-\r
-#define MAD_SIZE               256     /* MADs are always 256B */\r
-#define MAD_ATTR_OFFSET 16\r
-#define MAD_TID_OFFSET  8\r
-\r
-/* Verbs SQP resources handles */\r
-typedef struct {\r
-       VAPI_hca_id_t hca_id;   /*id of HCA */\r
-       u_int8_t port_num;      /* the port num to use */\r
-       VAPI_hca_hndl_t hca_hndl;       /*handle of HCA */\r
-       VAPI_qp_hndl_t qp_hndl; /*handle of QP I use */\r
-       VAPI_mr_hndl_t mr_hndl; /*handle of memory region */\r
-       VAPI_cq_hndl_t rq_cq_hndl, sq_cq_hndl;  /*handle of send & receive completion Queues */\r
-       VAPI_pd_hndl_t pd_hndl; /*handle of Partition Domain */\r
-       /* VAPI_ud_av_hndl_t   av_hndl; */\r
-       IB_lid_t slid;\r
-        /*LID*/ void *buf_ptr; /*mem buffer for outstanding pkts */\r
-       MT_size_t buf_size;     /*size of mem buffer for outstanding pkts */\r
-\r
-       u_int32_t max_outs_sq;  /*max # of outstanding pkts in send queue */\r
-       u_int32_t max_outs_rq;  /*max # of outstanding pkts in receive queue */\r
-\r
-       IB_rkey_t l_key;        /*my l_key for memory regions */\r
-       VAPI_qkey_t qkey;       /*my qkey */\r
-\r
-       EVAPI_compl_handler_hndl_t rq_cq_eventh, sq_cq_eventh;  /* event handlers for polling */\r
-\r
-       bool is_sqp;            /* relate to union below - my QP */\r
-       union {\r
-               VAPI_special_qp_t sqp_type;\r
-               VAPI_qp_num_t qp_num;\r
-       } qp_id;\r
-       void *wait_q;\r
-} osmt_mtl_mad_res_t;\r
-\r
-/* init an osmt_mtl_mad_res_t with all resources initialized (use functions below) */\r
-VAPI_ret_t osmt_mtl_init(osmt_mtl_mad_res_t * res      /*pointer to res (resources) struct */\r
-    );\r
-VAPI_ret_t osmt_mtl_init_opened_hca(osmt_mtl_mad_res_t * res   /*pointer to res (resources) struct */\r
-    );\r
-\r
-/* Cleanup all resources of (which are valid) in res */\r
-VAPI_ret_t osmt_mtl_mad_cleanup(osmt_mtl_mad_res_t * res       /*pointer to res (resources) struct */\r
-    );\r
-\r
-/* create CQs and QP as given in res->is_sqp (if TRUE, get special QP) */\r
-VAPI_ret_t osmt_mtl_get_qp_resources(osmt_mtl_mad_res_t * res  /*pointer to res (resources) struct */\r
-    );\r
-\r
-/* move QP to RTS state */\r
-VAPI_ret_t osmt_mtl_mad_qp_init(osmt_mtl_mad_res_t * res       /*max number of outstanding packets allowed in send queue */\r
-    );\r
-\r
-/* create and register res->buf_ptr */\r
-VAPI_ret_t osmt_mtl_mad_create_mr(osmt_mtl_mad_res_t * res     /*pointer to res (resources) struct */\r
-    );\r
-\r
-VAPI_ret_t osmt_mtl_create_av(osmt_mtl_mad_res_t * res,        /* pointer to res (resources) struct */\r
-                             int16_t dlid,     /*destination lid */\r
-                             VAPI_ud_av_hndl_t * avh_p /* address vectr handle to update */\r
-    );\r
-\r
-/* Send MAD to given dest QP*/\r
-VAPI_ret_t osmt_mtl_mad_send(osmt_mtl_mad_res_t * res, /*pointer to res (resources) struct */\r
-                            VAPI_wr_id_t id,   /*wqe ID */\r
-                            void *mad, /*mad buffer to send */\r
-                            VAPI_qp_num_t dest_qp,     /*destination QP */\r
-                            IB_sl_t sl,        /*Service Level */\r
-                            u_int32_t dest_qkey,       /*Destination QP KEY */\r
-                            VAPI_ud_av_hndl_t avh      /* address vectr handle to use */\r
-    );\r
-\r
-/* post buffers to RQ. returns num of buffers actually posted */\r
-int osmt_mtl_mad_post_recv_bufs(osmt_mtl_mad_res_t * res,      /*pointer to res (resources) struct */\r
-                               void *buf_array,        /*array of receive buffers */\r
-                               u_int32_t num_o_bufs,   /*number of receive buffers */\r
-                               u_int32_t size, /* size of expected receive packet - MAD */\r
-                               VAPI_wr_id_t start_id   /* start id for receive buffers */\r
-    );\r
-\r
-/* Poll given CQ for completion max_poll times (POLL_SLEEP [usec] delays). result in wc_desc_p. */\r
-VAPI_ret_t osmt_mtl_mad_poll4cqe(VAPI_hca_hndl_t hca,  /*handle for HCA */\r
-                                VAPI_cq_hndl_t cq,     /*handle for Completion Queue - Rcv/Send  */\r
-                                VAPI_wc_desc_t * wc_desc_p,    /*handle of cqe */\r
-                                u_int32_t max_poll,    /*number of polling iterations */\r
-                                u_int32_t poll_sleep,  /*timeout for each polling    */\r
-                                VAPI_ud_av_hndl_t * avh_p      /* address vectopr handle to cleanup */\r
-    );\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/osmtest/include/osmtest.h b/branches/opensm_3/user/osmtest/include/osmtest.h
deleted file mode 100644 (file)
index e0d63b0..0000000
+++ /dev/null
@@ -1,510 +0,0 @@
-/*\r
- * Copyright (c) 2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Declaration of osmtest_t.\r
- * This object represents the OSMTest Test object.\r
- *\r
- */\r
-\r
-#ifndef _OSMTEST_H_\r
-#define _OSMTEST_H_\r
-\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_log.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <vendor/osm_vendor_sa_api.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-#include "osmtest_base.h"\r
-#include "osmtest_subnet.h"\r
-\r
-enum OSMT_FLOWS {\r
-       OSMT_FLOW_ALL = 0,\r
-       OSMT_FLOW_CREATE_INVENTORY,\r
-       OSMT_FLOW_VALIDATE_INVENTORY,\r
-       OSMT_FLOW_SERVICE_REGISTRATION,\r
-       OSMT_FLOW_EVENT_FORWARDING,\r
-       OSMT_FLOW_STRESS_SA,\r
-       OSMT_FLOW_MULTICAST,\r
-       OSMT_FLOW_QOS,\r
-       OSMT_FLOW_TRAP,\r
-};\r
-\r
-/****s* OpenSM: Subnet/osmtest_opt_t\r
- * NAME\r
- * osmtest_opt_t\r
- *\r
- * DESCRIPTION\r
- * Subnet options structure.  This structure contains the various\r
- * site specific configuration parameters for osmtest.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osmtest_opt {\r
-       uint32_t transaction_timeout;\r
-       boolean_t force_log_flush;\r
-       boolean_t create;\r
-       uint32_t retry_count;\r
-       uint32_t stress;\r
-       uint32_t mmode;\r
-       char file_name[OSMTEST_FILE_PATH_MAX];\r
-       uint8_t flow;\r
-       uint8_t wait_time;\r
-       char *log_file;\r
-       boolean_t ignore_path_records;\r
-} osmtest_opt_t;\r
-\r
-/*\r
- * FIELDS\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****h* OSMTest/OSMTest\r
- * NAME\r
- * OSMTest\r
- *\r
- * DESCRIPTION\r
- * The OSMTest object tests an SM/SA for conformance to a known\r
- * set of data about an Infiniband subnet.\r
- *\r
- * AUTHOR\r
- * Steve King, Intel\r
- *\r
- *********/\r
-\r
-/****s* OSMTest/osmtest_t\r
- * NAME\r
- * osmtest_t\r
- *\r
- * DESCRIPTION\r
- * OSMTest structure.\r
- *\r
- * This object should be treated as opaque and should\r
- * be manipulated only through the provided functions.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osmtest {\r
-       osm_log_t log;\r
-       struct _osm_vendor *p_vendor;\r
-       osm_bind_handle_t h_bind;\r
-       osm_mad_pool_t mad_pool;\r
-\r
-       osmtest_opt_t opt;\r
-       ib_port_attr_t local_port;\r
-       subnet_t exp_subn;\r
-       cl_qpool_t node_pool;\r
-       cl_qpool_t port_pool;\r
-       cl_qpool_t link_pool;\r
-\r
-       uint16_t max_lid;\r
-} osmtest_t;\r
-\r
-/*\r
- * FIELDS\r
- * log\r
- *    Log facility used by all OSMTest components.\r
- *\r
- * p_vendor\r
- *    Pointer to the vendor transport layer.\r
- *\r
- *  h_bind\r
- *     The bind handle obtained by osm_vendor_sa_api/osmv_bind_sa\r
- *\r
- *  mad_pool\r
- *     The mad pool provided for teh vendor layer to allocate mad wrappers in\r
- *\r
- * opt\r
- *    osmtest options structure\r
- *\r
- * local_port\r
- *    Port attributes for the port over which osmtest is running.\r
- *\r
- * exp_subn\r
- *    Subnet object representing the expected subnet\r
- *\r
- * node_pool\r
- *    Pool of objects for use in populating the subnet databases.\r
- *\r
- * port_pool\r
- *    Pool of objects for use in populating the subnet databases.\r
- *\r
- * link_pool\r
- *    Pool of objects for use in populating the subnet databases.\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****s* OpenSM: Subnet/osmtest_req_context_t\r
- * NAME\r
- * osmtest_req_context_t\r
- *\r
- * DESCRIPTION\r
- * Query context for ib_query callback function.\r
- *\r
- * SYNOPSIS\r
- */\r
-typedef struct _osmtest_req_context {\r
-       osmtest_t *p_osmt;\r
-       osmv_query_res_t result;\r
-} osmtest_req_context_t;\r
-\r
-typedef struct _osmtest_mgrp_t {\r
-       cl_map_item_t map_item;\r
-       ib_member_rec_t mcmember_rec;\r
-} osmtest_mgrp_t;\r
-\r
-/*\r
- * FIELDS\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_construct\r
- * NAME\r
- * osmtest_construct\r
- *\r
- * DESCRIPTION\r
- * This function constructs an OSMTest object.\r
- *\r
- * SYNOPSIS\r
- */\r
-void osmtest_construct(IN osmtest_t * const p_osmt);\r
-\r
-/*\r
- * PARAMETERS\r
- * p_osmt\r
- *    [in] Pointer to a OSMTest object to construct.\r
- *\r
- * RETURN VALUE\r
- * This function does not return a value.\r
- *\r
- * NOTES\r
- * Allows calling osmtest_init, osmtest_destroy.\r
- *\r
- * Calling osmtest_construct is a prerequisite to calling any other\r
- * method except osmtest_init.\r
- *\r
- * SEE ALSO\r
- * SM object, osmtest_init, osmtest_destroy\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_destroy\r
- * NAME\r
- * osmtest_destroy\r
- *\r
- * DESCRIPTION\r
- * The osmtest_destroy function destroys an osmtest object, releasing\r
- * all resources.\r
- *\r
- * SYNOPSIS\r
- */\r
-void osmtest_destroy(IN osmtest_t * const p_osmt);\r
-\r
-/*\r
- * PARAMETERS\r
- * p_osmt\r
- *    [in] Pointer to a OSMTest object to destroy.\r
- *\r
- * RETURN VALUE\r
- * This function does not return a value.\r
- *\r
- * NOTES\r
- * Performs any necessary cleanup of the specified OSMTest object.\r
- * Further operations should not be attempted on the destroyed object.\r
- * This function should only be called after a call to osmtest_construct or\r
- * osmtest_init.\r
- *\r
- * SEE ALSO\r
- * SM object, osmtest_construct, osmtest_init\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_init\r
- * NAME\r
- * osmtest_init\r
- *\r
- * DESCRIPTION\r
- * The osmtest_init function initializes a OSMTest object for use.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmtest_init(IN osmtest_t * const p_osmt,\r
-                            IN const osmtest_opt_t * const p_opt,\r
-                            IN const osm_log_level_t log_flags);\r
-\r
-/*\r
- * PARAMETERS\r
- * p_osmt\r
- *    [in] Pointer to an osmtest_t object to initialize.\r
- *\r
- * p_opt\r
- *    [in] Pointer to the options structure.\r
- *\r
- * log_flags\r
- *    [in] Log level flags to set.\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS if the OSMTest object was initialized successfully.\r
- *\r
- * NOTES\r
- * Allows calling other OSMTest methods.\r
- *\r
- * SEE ALSO\r
- * SM object, osmtest_construct, osmtest_destroy\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_run\r
- * NAME\r
- * osmtest_run\r
- *\r
- * DESCRIPTION\r
- * Runs the osmtest suite.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt);\r
-\r
-/*\r
- * PARAMETERS\r
- * p_osmt\r
- *    [in] Pointer to an osmtest_t object.\r
- *\r
- * guid\r
- *    [in] Port GUID over which to run the test suite.\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_bind\r
- * NAME\r
- * osmtest_bind\r
- *\r
- * DESCRIPTION\r
- * Binds osmtest to a local port.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmtest_bind(IN osmtest_t * p_osmt,\r
-                            IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL);\r
-\r
-/*\r
- * PARAMETERS\r
- * p_osmt\r
- *    [in] Pointer to an osmtest_t object.\r
- *\r
- *  max_lid\r
- *     [in] The maximal lid to query about (if RMPP is not supported)\r
- *\r
- * guid\r
- *    [in] Port GUID over which to run the test suite.\r
- *    If zero, the bind function will display a menu of local\r
- *    port guids and wait for user input.\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmtest_query_res_cb\r
- * NAME\r
- * osmtest_query_res_cb\r
- *\r
- * DESCRIPTION\r
- * A Callback for the query to invoke on completion\r
- *\r
- * SYNOPSIS\r
- */\r
-void osmtest_query_res_cb(IN osmv_query_res_t * p_rec);\r
-/*\r
- * PARAMETERS\r
- * p_rec\r
- *    [in] Pointer to an ib_query_rec_t object used for the query.\r
- *\r
- * RETURN VALUES\r
- * NONE\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/ib_get_mad_status_str\r
- * NAME\r
- * ib_get_mad_status_str\r
- *\r
- * DESCRIPTION\r
- * return the string representing the given  mad status\r
- *\r
- * SYNOPSIS\r
- */\r
-const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad);\r
-/*\r
- * PARAMETERS\r
- * p_mad\r
- *    [in] Pointer to the mad payload\r
- *\r
- * RETURN VALUES\r
- * NONE\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmt_run_service_records_flow\r
- * NAME\r
- * osmt_run_service_records_flow\r
- *\r
- * DESCRIPTION\r
- * Run the service record testing flow.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmt_run_service_records_flow(IN osmtest_t * const p_osmt);\r
-/*\r
- * PARAMETERS\r
- *  p_osmt\r
- *    [in] Pointer to the osmtest obj\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS if PASS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-ib_api_status_t osmt_run_inform_info_flow(IN osmtest_t * const p_osmt);\r
-\r
-/****f* OSMTest/osmt_run_slvl_and_vlarb_records_flow\r
- * NAME\r
- * osmt_run_slvl_and_vlarb_records_flow\r
- *\r
- * DESCRIPTION\r
- * Run the sl2vl and vlarb tables testing flow.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t\r
-osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt);\r
-/*\r
- * PARAMETERS\r
- *  p_osmt\r
- *    [in] Pointer to the osmtest obj\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS if PASS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmt_run_mcast_flow\r
- * NAME\r
- * osmt_run_mcast_flow\r
- *\r
- * DESCRIPTION\r
- * Run the multicast test flow\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt);\r
-/*\r
- * PARAMETERS\r
- *  p_osmt\r
- *    [in] Pointer to the osmtest obj\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS if PASS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-/****f* OSMTest/osmt_run_trap64_65_flow\r
- * NAME\r
- * osmt_run_trap64_65_flow\r
- *\r
- * DESCRIPTION\r
- * Run the trap 64/65 test flow. This test is ran with\r
- * an outside tool.\r
- *\r
- * SYNOPSIS\r
- */\r
-ib_api_status_t osmt_run_trap64_65_flow(IN osmtest_t * const p_osmt);\r
-/*\r
- * PARAMETERS\r
- *  p_osmt\r
- *    [in] Pointer to the osmtest obj\r
- *\r
- * RETURN VALUES\r
- * IB_SUCCESS if PASS\r
- *\r
- * NOTES\r
- *\r
- * SEE ALSO\r
- *********/\r
-\r
-ib_api_status_t\r
-osmtest_get_all_recs(IN osmtest_t * const p_osmt,\r
-                    IN ib_net16_t const attr_id,\r
-                    IN size_t const attr_size,\r
-                    IN OUT osmtest_req_context_t * const p_context);\r
-\r
-ib_api_status_t\r
-osmtest_get_local_port_lmc(IN osmtest_t * const p_osmt,\r
-                          IN ib_net16_t lid, OUT uint8_t * const p_lmc);\r
-\r
-/*\r
- * A few auxiliary macros for logging\r
- */\r
-\r
-#define EXPECTING_ERRORS_START "[[ ===== Expecting Errors - START ===== "\r
-#define EXPECTING_ERRORS_END   "   ===== Expecting Errors  -  END ===== ]]"\r
-\r
-#endif                         /* _OSMTEST_H_ */\r
diff --git a/branches/opensm_3/user/osmtest/include/osmtest_base.h b/branches/opensm_3/user/osmtest/include/osmtest_base.h
deleted file mode 100644 (file)
index 0074970..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osmtest_t.\r
- *     This object represents the OSMTest Test object.\r
- *\r
- */\r
-#ifndef _OSMTEST_BASE_H_\r
-#define _OSMTEST_BASE_H_\r
-\r
-#ifndef __WIN__\r
-#include <limits.h>\r
-#else\r
-#include <vendor/winosm_common.h>\r
-#endif\r
-\r
-#define OSMTEST_MAX_LINE_LEN   120\r
-#define OSMTEST_FILE_PATH_MAX  PATH_MAX\r
-\r
-#define STRESS_SMALL_RMPP_THR 100000\r
-/*\r
-    Take long times when querying big clusters (over 40 nodes), an average of : 0.25 sec for query\r
-    each query receives 1000 records\r
-*/\r
-#define STRESS_LARGE_RMPP_THR 4000\r
-#define STRESS_LARGE_PR_RMPP_THR 20000\r
-#define STRESS_GET_PR 100000\r
-\r
-extern const char *const p_file;\r
-\r
-#endif                         /* _OSMTEST_BASE_H_ */\r
diff --git a/branches/opensm_3/user/osmtest/include/osmtest_subnet.h b/branches/opensm_3/user/osmtest/include/osmtest_subnet.h
deleted file mode 100644 (file)
index dfd9201..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*\r
- * Copyright (c) 2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Declaration of osmtest_t.\r
- *     This object represents the OSMTest Test object.\r
- *\r
- */\r
-\r
-#ifndef _OSMTEST_SUBNET_H_\r
-#define _OSMTEST_SUBNET_H_\r
-\r
-#include <stdlib.h>\r
-#include <complib/cl_qmap.h>\r
-#include <opensm/osm_log.h>\r
-#include <vendor/osm_vendor_api.h>\r
-#include <opensm/osm_mad_pool.h>\r
-#include <opensm/osm_helper.h>\r
-\r
-/****s* Subnet Database/generic_t\r
-* NAME\r
-*      generic_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet database object for fields common to all record types.\r
-*      All other database types must be castable to this type.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _generic {\r
-       cl_map_item_t map_item; /* must be first element! */\r
-       uint32_t count;         /* must be second element! */\r
-} generic_t;\r
-\r
-/*\r
-* FIELDS\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* Subnet Database/node_t\r
-* NAME\r
-*      node_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet database object for nodes.\r
-*      Must be castable to generic_t.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _node {\r
-       cl_map_item_t map_item; /* must be first element! */\r
-       uint32_t count;         /* must be second element! */\r
-       ib_node_record_t rec;\r
-       ib_node_record_t comp;\r
-} node_t;\r
-\r
-/*\r
-* FIELDS\r
-* map_item\r
-*      Provides linkage for the qmap container.\r
-*\r
-* rec\r
-*      NodeRecord for this node as read from the database file.\r
-*\r
-* comp\r
-*      NodeRecord indicating which fields should be compared against rec.\r
-*      Bits set in the comp NodeRecord indicate that bit in the rec structure\r
-*      should be compared against real-time data from the SA.\r
-*\r
-* count\r
-*      Utility counter used by the validation logic.  Typically used to\r
-*      to indicate the number of times a matching node was received from\r
-*      the SA.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-static inline node_t *node_new(void)\r
-{\r
-       node_t *p_obj;\r
-\r
-       p_obj = malloc(sizeof(*p_obj));\r
-       if (p_obj)\r
-               memset(p_obj, 0, sizeof(*p_obj));\r
-       return (p_obj);\r
-}\r
-\r
-static inline void node_delete(IN node_t * p_obj)\r
-{\r
-       free(p_obj);\r
-}\r
-\r
-/****s* Subnet Database/port_t\r
-* NAME\r
-*      port_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet database object for ports.\r
-*      Must be castable to generic_t.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _port {\r
-       cl_map_item_t map_item; /* must be first element! */\r
-       uint32_t count;         /* must be second element! */\r
-       /* Since there is no unique identifier for all ports we\r
-          must be able to have such a key by the lid and port num */\r
-       uint64_t port_id;\r
-       ib_portinfo_record_t rec;\r
-       ib_portinfo_record_t comp;\r
-} port_t;\r
-\r
-/*\r
-* FIELDS\r
-*\r
-* map_item\r
-*      Provides linkage for the qmap container.\r
-*\r
-* rec\r
-*      PortInfoRecord for this port as read from the database file.\r
-*\r
-* comp\r
-*      PortInfoRecord indicating which fields should be compared against rec.\r
-*      Bits set in the comp NodeRecord indicate that bit in the rec structure\r
-*      should be compared against real-time data from the SA.\r
-*\r
-* count\r
-*      Utility counter used by the validation logic.  Typically used to\r
-*      to indicate the number of times a matching node was received from\r
-*      the SA.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-static inline port_t *port_new(void)\r
-{\r
-       port_t *p_obj;\r
-\r
-       p_obj = malloc(sizeof(*p_obj));\r
-       if (p_obj)\r
-               memset(p_obj, 0, sizeof(*p_obj));\r
-       return (p_obj);\r
-}\r
-\r
-static inline void port_delete(IN port_t * p_obj)\r
-{\r
-       free(p_obj);\r
-}\r
-\r
-static inline uint64_t\r
-port_gen_id(IN ib_net16_t const lid, IN uint8_t const port_num)\r
-{\r
-       return (lid << 8 | port_num);\r
-}\r
-\r
-static inline void\r
-port_ext_id(IN uint64_t id, IN ib_net16_t * p_lid, IN uint8_t * p_port_num)\r
-{\r
-       CL_ASSERT((id & 0xFF) < 0x100);\r
-       *p_port_num = (uint8_t) (id & 0xFF);\r
-       CL_ASSERT(((id >> 8) & 0xFFFF) < 0x10000);\r
-       *p_lid = (uint16_t) ((id >> 8) & 0xFFFF);\r
-}\r
-\r
-static inline void\r
-port_set_id(IN port_t * p_obj,\r
-           IN ib_net16_t const lid, IN uint8_t const port_num)\r
-{\r
-       p_obj->port_id = port_gen_id(lid, port_num);\r
-}\r
-\r
-static inline void\r
-port_get_id(IN port_t * p_obj, IN ib_net16_t * p_lid, IN uint8_t * p_port_num)\r
-{\r
-       port_ext_id(p_obj->port_id, p_lid, p_port_num);\r
-}\r
-\r
-/****s* Subnet Database/path_t\r
-* NAME\r
-*      node_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet database object for paths.\r
-*      Must be castable to generic_t.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _path {\r
-       cl_map_item_t map_item; /* must be first element! */\r
-       uint32_t count;         /* must be second element! */\r
-       ib_path_rec_t rec;\r
-       ib_path_rec_t comp;\r
-} path_t;\r
-\r
-/*\r
-* FIELDS\r
-* map_item\r
-*      Provides linkage for the qmap container.\r
-*\r
-* rec\r
-*      PathRecord for this path as read from the database file.\r
-*\r
-* comp\r
-*      PathRecord indicating which fields should be compared against rec.\r
-*      Bits set in the comp PathRecord indicate that bit in the rec structure\r
-*      should be compared against real-time data from the SA.\r
-*\r
-* count\r
-*      Utility counter used by the validation logic.  Typically used to\r
-*      to indicate the number of times a matching node was received from\r
-*      the SA.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-static inline path_t *path_new(void)\r
-{\r
-       path_t *p_obj;\r
-\r
-       p_obj = malloc(sizeof(*p_obj));\r
-       if (p_obj)\r
-               memset(p_obj, 0, sizeof(*p_obj));\r
-       return (p_obj);\r
-}\r
-\r
-static inline void path_delete(IN path_t * p_obj)\r
-{\r
-       free(p_obj);\r
-}\r
-\r
-/****s* Subnet Database/subnet_t\r
-* NAME\r
-*      subnet_t\r
-*\r
-* DESCRIPTION\r
-*      Subnet database object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _subnet {\r
-       cl_qmap_t node_lid_tbl;\r
-       cl_qmap_t node_guid_tbl;\r
-       cl_qmap_t mgrp_mlid_tbl;\r
-       /* cl_qmap_t port_lid_tbl; */\r
-       /* cl_qmap_t port_guid_tbl; */\r
-       cl_qmap_t port_key_tbl;\r
-       cl_qmap_t link_tbl;\r
-       cl_qmap_t path_tbl;\r
-} subnet_t;\r
-\r
-/*\r
-* FIELDS\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* Subnet Database/subnet_construct\r
-* NAME\r
-*      subnet_construct\r
-*\r
-* DESCRIPTION\r
-*      This function constructs an subnet database object.\r
-*      This function cannot fail.\r
-*\r
-* SYNOPSIS\r
-*/\r
-void subnet_construct(IN subnet_t * const p_subn);\r
-\r
-/*\r
-* FIELDS\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* Subnet Database/subnet_init\r
-* NAME\r
-*      subnet_init\r
-*\r
-* DESCRIPTION\r
-*      This function initializes an subnet database object.\r
-*\r
-* SYNOPSIS\r
-*/\r
-cl_status_t subnet_init(IN subnet_t * const p_subn);\r
-\r
-/*\r
-* FIELDS\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#endif\r
diff --git a/branches/opensm_3/user/osmtest/main.c b/branches/opensm_3/user/osmtest/main.c
deleted file mode 100644 (file)
index a8f41fe..0000000
+++ /dev/null
@@ -1,622 +0,0 @@
-/*\r
- * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Command line interface for osmtest.\r
- *\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <getopt.h>\r
-#include <complib/cl_debug.h>\r
-#include "osmtest.h"\r
-\r
-/********************************************************************\r
-       D E F I N E    G L O B A L    V A R I A B L E S\r
-*********************************************************************/\r
-\r
-/*\r
-       This is the global osmtest object.\r
-       One osmtest object is required per subnet.\r
-       Future versions could support multiple subents by\r
-       instantiating more than one osmtest object.\r
-*/\r
-#define MAX_LOCAL_IBPORTS 64\r
-#define OSMT_DEFAULT_RETRY_COUNT 3\r
-#define OSMT_DEFAULT_TRANS_TIMEOUT_MILLISEC 1000\r
-#define OSMT_DEFAULT_TRAP_WAIT_TIMEOUT_SEC 10\r
-#define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)\r
-\r
-boolean_t osmt_is_debug(void)\r
-{\r
-#if defined( _DEBUG_ )\r
-       return TRUE;\r
-#else\r
-       return FALSE;\r
-#endif                         /* defined( _DEBUG_ ) */\r
-}\r
-\r
-void show_usage()\r
-{\r
-       printf\r
-           ("\n------- osmtest - Usage and options ----------------------\n");\r
-       printf("Usage:    osmtest [options]\n");\r
-       printf("Options:\n");\r
-       printf("-f <c|a|v|s|e|f|m|q|t>\n"\r
-              "--flow <c|a|v|s|e|f|m|q|t>\n"\r
-              "          This option directs osmtest to run a specific flow:\n"\r
-              "          FLOW  DESCRIPTION\n"\r
-              "          c = create an inventory file with all nodes, ports and paths\n"\r
-              "          a = run all validation tests (expecting an input inventory)\n"\r
-              "          v = only validate the given inventory file\n"\r
-              "          s = run service registration, deregistration, and lease test\n"\r
-              "          e = run event forwarding test\n"\r
-              "          f = flood the SA with queries according to the stress mode\n"\r
-              "          m = multicast flow\n"\r
-              "          q = QoS info: dump VLArb and SLtoVL tables\n"\r
-              "          t = run trap 64/65 flow (this flow requires running of external tool)\n"\r
-              "          (default is all flows except QoS)\n\n");\r
-\r
-       printf("-w <trap_wait_time>\n"\r
-              "--wait <trap_wait_time>\n"\r
-              "          This option specifies the wait time for trap 64/65 in seconds\n"\r
-              "          It is used only when running -f t - the trap 64/65 flow\n"\r
-              "          (default to 10 sec)\n\n");\r
-       printf("-d <number>\n"\r
-              "--debug <number>\n"\r
-              "          This option specifies a debug option\n"\r
-              "          These options are not normally needed\n"\r
-              "          The number following -d selects the debug\n"\r
-              "          option to enable as follows:\n"\r
-              "          OPT   Description\n"\r
-              "          ---    -----------------\n"\r
-              "          -d0  - Unused.\n"\r
-              "          -d1  - Do not scan/compare path records.\n"\r
-              "          -d2  - Force log flushing after each log message.\n"\r
-              "          Without -d, no debug options are enabled\n\n");\r
-       printf("-m <LID in hex>\n"\r
-              "--max_lid <LID in hex>\n"\r
-              "          This option specifies the maximal LID number to be searched\n"\r
-              "          for during inventory file build (default to 100)\n\n");\r
-       printf("-g <GUID in hex>\n"\r
-              "--guid <GUID in hex>\n"\r
-              "          This option specifies the local port GUID value\n"\r
-              "          with which osmtest should bind.  osmtest may be\n"\r
-              "          bound to 1 port at a time\n\n");\r
-       printf("-p \n"\r
-              "--port\n"\r
-              "          This option displays a menu of possible local port GUID values\n"\r
-              "          with which osmtest could bind\n\n");\r
-       printf("-h\n"\r
-              "--help\n" "          Display this usage info then exit\n\n");\r
-       printf("-i <filename>\n"\r
-              "--inventory <filename>\n"\r
-              "          This option specifies the name of the inventory file\n"\r
-              "          Normally, osmtest expects to find an inventory file,\n"\r
-              "          which osmtest uses to validate real-time information\n"\r
-              "          received from the SA during testing\n"\r
-              "          If -i is not specified, osmtest defaults to the file\n"\r
-              "          'osmtest.dat'\n"\r
-              "          See -c option for related information\n\n");\r
-       printf("-s\n"\r
-              "--stress\n"\r
-              "          This option runs the specified stress test instead\n"\r
-              "          of the normal test suite\n"\r
-              "          Stress test options are as follows:\n"\r
-              "          OPT    Description\n"\r
-              "          ---    -----------------\n"\r
-              "          -s1  - Single-MAD (RMPP) response SA queries\n"\r
-              "          -s2  - Multi-MAD (RMPP) response SA queries\n"\r
-              "          -s3  - Multi-MAD (RMPP) Path Record SA queries\n"\r
-              "          -s4  - Single-MAD (non RMPP) get Path Record SA queries\n"\r
-              "          Without -s, stress testing is not performed\n\n");\r
-       printf("-M\n"\r
-              "--Multicast_Mode\n"\r
-              "          This option specify length of Multicast test:\n"\r
-              "          OPT    Description\n"\r
-              "          ---    -----------------\n"\r
-              "          -M1  - Short Multicast Flow (default) - single mode\n"\r
-              "          -M2  - Short Multicast Flow - multiple mode\n"\r
-              "          -M3  - Long Multicast Flow - single mode\n"\r
-              "          -M4  - Long Multicast Flow - multiple mode\n"\r
-              " Single mode - Osmtest is tested alone, with no other\n"\r
-              "   apps that interact with OpenSM MC\n"\r
-              " Multiple mode - Could be run with other apps using MC with\n"\r
-              "   OpenSM."\r
-              " Without -M, default flow testing is performed\n\n");\r
-\r
-       printf("-t <milliseconds>\n"\r
-              "          This option specifies the time in milliseconds\n"\r
-              "          used for transaction timeouts\n"\r
-              "          Specifying -t 0 disables timeouts\n"\r
-              "          Without -t, osmtest defaults to a timeout value of\n"\r
-              "          1 second\n\n");\r
-       printf("-l\n"\r
-              "--log_file\n"\r
-              "          This option defines the log to be the given file\n"\r
-              "          By default the log goes to stdout\n\n");\r
-       printf("-v\n"\r
-              "          This option increases the log verbosity level\n"\r
-              "          The -v option may be specified multiple times\n"\r
-              "          to further increase the verbosity level\n"\r
-              "          See the -vf option for more information about.\n"\r
-              "          log verbosity\n\n");\r
-       printf("-V\n"\r
-              "          This option sets the maximum verbosity level and\n"\r
-              "          forces log flushing\n"\r
-              "          The -V is equivalent to '-vf 0xFF -d 2'\n"\r
-              "          See the -vf option for more information about.\n"\r
-              "          log verbosity\n\n");\r
-       printf("-vf <flags>\n"\r
-              "          This option sets the log verbosity level\n"\r
-              "          A flags field must follow the -vf option\n"\r
-              "          A bit set/clear in the flags enables/disables a\n"\r
-              "          specific log level as follows:\n"\r
-              "          BIT    LOG LEVEL ENABLED\n"\r
-              "          ----   -----------------\n"\r
-              "          0x01 - ERROR (error messages)\n"\r
-              "          0x02 - INFO (basic messages, low volume)\n"\r
-              "          0x04 - VERBOSE (interesting stuff, moderate volume)\n"\r
-              "          0x08 - DEBUG (diagnostic, high volume)\n"\r
-              "          0x10 - FUNCS (function entry/exit, very high volume)\n"\r
-              "          0x20 - FRAMES (dumps all SMP and GMP frames)\n"\r
-              "          0x40 - currently unused\n"\r
-              "          0x80 - currently unused\n"\r
-              "          Without -vf, osmtest defaults to ERROR + INFO (0x3)\n"\r
-              "          Specifying -vf 0 disables all messages\n"\r
-              "          Specifying -vf 0xFF enables all messages (see -V)\n"\r
-              "          High verbosity levels may require increasing\n"\r
-              "          the transaction timeout with the -t option\n\n");\r
-}\r
-\r
-static void print_all_guids(IN osmtest_t * p_osmt)\r
-{\r
-       ib_api_status_t status;\r
-       uint32_t num_ports = MAX_LOCAL_IBPORTS;\r
-       ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };\r
-       uint32_t i;\r
-\r
-       /*\r
-          Call the transport layer for a list of local port\r
-          GUID values.\r
-        */\r
-       status =\r
-           osm_vendor_get_all_port_attr(p_osmt->p_vendor, attr_array,\r
-                                        &num_ports);\r
-       if (status != IB_SUCCESS) {\r
-               printf("\nError from osm_vendor_get_all_port_attr (%x)\n",\r
-                      status);\r
-               return;\r
-       }\r
-\r
-       printf("\nListing GUIDs:\n");\r
-       for (i = 0; i < num_ports; i++)\r
-               printf("Port %i: 0x%" PRIx64 "\n", i,\r
-                      cl_hton64(attr_array[i].port_guid));\r
-}\r
-\r
-ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)\r
-{\r
-       ib_api_status_t status;\r
-       uint32_t num_ports = MAX_LOCAL_IBPORTS;\r
-       ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };\r
-       uint32_t i;\r
-\r
-       /*\r
-          Call the transport layer for a list of local port\r
-          GUID values.\r
-        */\r
-/* "local ports" is(?) phys, shouldn't this exclude port 0 then ? */\r
-       status =\r
-           osm_vendor_get_all_port_attr(p_osmt->p_vendor, attr_array,\r
-                                        &num_ports);\r
-       if (status != IB_SUCCESS) {\r
-               printf("\nError from osm_vendor_get_all_port_attr (%x)\n",\r
-                      status);\r
-               return (0);\r
-       }\r
-\r
-       if (num_ports == 1) {\r
-               printf("using default guid 0x%" PRIx64 "\n",\r
-                      cl_hton64(attr_array[0].port_guid));\r
-               return (attr_array[0].port_guid);\r
-       }\r
-\r
-       for (i = 0; i < num_ports; i++) {\r
-               if (attr_array[i].port_guid == port_guid ||\r
-                   (!port_guid && attr_array[i].link_state > IB_LINK_DOWN))\r
-                       return attr_array[i].port_guid;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-int main(int argc, char *argv[])\r
-{\r
-       static osmtest_t osm_test;\r
-       osmtest_opt_t opt = { 0 };\r
-       ib_net64_t guid = 0;\r
-       uint16_t max_lid = 100;\r
-       ib_api_status_t status;\r
-       uint32_t log_flags = OSM_LOG_ERROR | OSM_LOG_INFO;\r
-       int32_t vendor_debug = 0;\r
-       char flow_name[64];\r
-       uint32_t next_option;\r
-       const char *const short_option = \r
-#ifdef __WIN__\r
-       "?"\r
-#endif\r
-       "f:l:m:M:d:g:s:t:i:pcvVh";\r
-\r
-       /*\r
-        * In the array below, the 2nd parameter specified the number\r
-        * of arguments as follows:\r
-        * 0: no arguments\r
-        * 1: argument\r
-        * 2: optional\r
-        */\r
-       const struct option long_option[] = {\r
-               {"create", 0, NULL, 'c'},\r
-               {"debug", 1, NULL, 'd'},\r
-               {"flow", 1, NULL, 'f'},\r
-               {"wait", 1, NULL, 'w'},\r
-               {"inventory", 1, NULL, 'i'},\r
-               {"max_lid", 1, NULL, 'm'},\r
-               {"guid", 2, NULL, 'g'},\r
-               {"port", 0, NULL, 'p'},\r
-               {"help", 0, NULL, 'h'},\r
-               {"stress", 1, NULL, 's'},\r
-               {"Multicast_Mode", 1, NULL, 'M'},\r
-               {"timeout", 1, NULL, 't'},\r
-               {"verbose", 0, NULL, 'v'},\r
-               {"log_file", 1, NULL, 'l'},\r
-               {"vf", 1, NULL, 'x'},\r
-               {"V", 0, NULL, 'V'},\r
-\r
-               {NULL, 0, NULL, 0}      /* Required at end of array */\r
-       };\r
-\r
-       /* Make sure that the opensm, complib and osmtest were compiled using\r
-          same modes (debug/free) */\r
-       if (osm_is_debug() != cl_is_debug() || osm_is_debug() != osmt_is_debug()\r
-           || osmt_is_debug() != cl_is_debug()) {\r
-               fprintf(stderr,\r
-                       "-E- OpenSM, Complib and OsmTest were compiled using different modes\n");\r
-               fprintf(stderr,\r
-                       "-E- OpenSM debug:%d Complib debug:%d OsmTest debug:%d \n",\r
-                       osm_is_debug(), cl_is_debug(), osmt_is_debug());\r
-               exit(1);\r
-       }\r
-\r
-       opt.transaction_timeout = OSMT_DEFAULT_TRANS_TIMEOUT_MILLISEC;\r
-       opt.wait_time = OSMT_DEFAULT_TRAP_WAIT_TIMEOUT_SEC;\r
-       opt.retry_count = OSMT_DEFAULT_RETRY_COUNT;\r
-       opt.force_log_flush = FALSE;\r
-       opt.stress = 0;\r
-       opt.log_file = NULL;\r
-       opt.create = FALSE;\r
-       opt.mmode = 1;\r
-       opt.ignore_path_records = FALSE;        /*  Do path Records too */\r
-       opt.flow = OSMT_FLOW_ALL;       /*  run all validation tests */\r
-       strcpy(flow_name, "All Validations");\r
-       strcpy(opt.file_name, "osmtest.dat");\r
-\r
-       printf("\nCommand Line Arguments\n");\r
-       do {\r
-               next_option = getopt_long_only(argc, argv, short_option,\r
-                                              long_option, NULL);\r
-               switch (next_option) {\r
-               case 'c':\r
-                       /*\r
-                        * Create the inventory file.\r
-                        */\r
-                       opt.create = TRUE;\r
-                       printf("\tCreating inventory file\n");\r
-                       break;\r
-\r
-               case 'i':\r
-                       /*\r
-                        * Specifies inventory file name.\r
-                        */\r
-                       if (strlen(optarg) > OSMTEST_FILE_PATH_MAX)\r
-                               printf\r
-                                   ("\nError: path name too long (ignored)\n");\r
-                       else\r
-                               strcpy(opt.file_name, optarg);\r
-\r
-                       printf("\tFile = %s\n", opt.file_name);\r
-                       break;\r
-\r
-               case 'f':\r
-                       /*\r
-                        * Specifies Flow .\r
-                        */\r
-                       if (strlen(optarg) > OSMTEST_FILE_PATH_MAX)\r
-                               printf\r
-                                   ("\nError: path name too long (ignored)\n");\r
-                       else\r
-                               strcpy(flow_name, optarg);\r
-\r
-                       if (!strcmp("c", optarg)) {\r
-                               strcpy(flow_name, "Create Inventory");\r
-                               opt.flow = OSMT_FLOW_CREATE_INVENTORY;\r
-                       } else if (!strcmp("v", optarg)) {\r
-                               strcpy(flow_name, "Validate Inventory");\r
-                               opt.flow = OSMT_FLOW_VALIDATE_INVENTORY;\r
-                       } else if (!strcmp("s", optarg)) {\r
-                               strcpy(flow_name, "Services Registration");\r
-                               opt.flow = OSMT_FLOW_SERVICE_REGISTRATION;\r
-                       } else if (!strcmp("e", optarg)) {\r
-                               strcpy(flow_name, "Event Forwarding");\r
-                               opt.flow = OSMT_FLOW_EVENT_FORWARDING;\r
-                       } else if (!strcmp("f", optarg)) {\r
-                               strcpy(flow_name, "Stress SA");\r
-                               opt.flow = OSMT_FLOW_STRESS_SA;\r
-                       } else if (!strcmp("m", optarg)) {\r
-                               strcpy(flow_name, "Multicast");\r
-                               opt.flow = OSMT_FLOW_MULTICAST;\r
-                       } else if (!strcmp("q", optarg)) {\r
-                               strcpy(flow_name, "QoS: VLArb and SLtoVL");\r
-                               opt.flow = OSMT_FLOW_QOS;\r
-                       } else if (!strcmp("t", optarg)) {\r
-                               strcpy(flow_name, "Trap 64/65");\r
-                               opt.flow = OSMT_FLOW_TRAP;\r
-                       } else if (!strcmp("a", optarg)) {\r
-                               strcpy(flow_name, "All Validations");\r
-                               opt.flow = OSMT_FLOW_ALL;\r
-                       } else {\r
-                               printf("\nError: unknown flow %s\n", flow_name);\r
-                               exit(2);\r
-                       }\r
-                       break;\r
-\r
-               case 'w':\r
-                       /*\r
-                        * Specifies trap 64/65 wait time\r
-                        */\r
-                       CL_ASSERT(strtol(optarg, NULL, 0) < 0x100);\r
-                       opt.wait_time = (uint8_t) strtol(optarg, NULL, 0);\r
-                       printf("\tTrap 64/65 wait time = %d\n", opt.wait_time);\r
-                       break;\r
-\r
-               case 'm':\r
-                       /*\r
-                        * Specifies the max LID to search for during exploration.\r
-                        */\r
-                       max_lid = (uint16_t) atoi(optarg);\r
-                       printf("\tMAX-LID %u\n", max_lid);\r
-                       break;\r
-\r
-               case 'g':\r
-                       /*\r
-                        * Specifies port guid with which to bind.\r
-                        */\r
-                       guid = cl_hton64(strtoull(optarg, NULL, 16));\r
-                       printf(" Guid <0x%" PRIx64 ">\n", cl_hton64(guid));\r
-                       break;\r
-\r
-               case 'p':\r
-                       /*\r
-                        * Display current port guids\r
-                        */\r
-                       guid = INVALID_GUID;\r
-                       break;\r
-\r
-               case 't':\r
-                       /*\r
-                        * Specifies transaction timeout.\r
-                        */\r
-                       opt.transaction_timeout = strtol(optarg, NULL, 0);\r
-                       printf("\tTransaction timeout = %d\n",\r
-                              opt.transaction_timeout);\r
-                       break;\r
-\r
-               case 'l':\r
-                       opt.log_file = optarg;\r
-                       printf("\tLog File:%s\n", opt.log_file);\r
-                       break;\r
-\r
-               case 'v':\r
-                       /*\r
-                        * Increases log verbosity.\r
-                        */\r
-                       log_flags = (log_flags << 1) | 1;\r
-                       printf("\tVerbose option -v (log flags = 0x%X)\n",\r
-                              log_flags);\r
-                       break;\r
-\r
-               case 'V':\r
-                       /*\r
-                        * Specifies maximum log verbosity.\r
-                        */\r
-                       log_flags = 0xFFFFFFFF;\r
-                       opt.force_log_flush = TRUE;\r
-                       printf("\tEnabling maximum log verbosity\n");\r
-                       break;\r
-\r
-               case 's':\r
-                       /*\r
-                        * Perform stress test.\r
-                        */\r
-                       opt.stress = strtol(optarg, NULL, 0);\r
-                       printf("\tStress test enabled: ");\r
-                       switch (opt.stress) {\r
-                       case 1:\r
-                               printf("Small SA queries\n");\r
-                               break;\r
-                       case 2:\r
-                               printf("Large SA queries\n");\r
-                               break;\r
-                       case 3:\r
-                               printf("Large Path Record SA queries\n");\r
-                               break;\r
-                       case 4:\r
-                               printf("SA Get Path Record queries\n");\r
-                               break;\r
-                       default:\r
-                               printf("Unknown value %u (ignored)\n",\r
-                                      opt.stress);\r
-                               opt.stress = 0;\r
-                               break;\r
-                       }\r
-                       break;\r
-\r
-               case 'M':\r
-                       /*\r
-                        * Perform multicast test.\r
-                        */\r
-                       opt.mmode = strtol(optarg, NULL, 0);\r
-                       printf("\tMulticast test enabled: ");\r
-                       switch (opt.mmode) {\r
-                       case 1:\r
-                               printf\r
-                                   ("Short MC Flow - single mode (default)\n");\r
-                               break;\r
-                       case 2:\r
-                               printf("Short MC Flow - multiple mode\n");\r
-                               break;\r
-                       case 3:\r
-                               printf("Long MC Flow - single mode\n");\r
-                               break;\r
-                       case 4:\r
-                               printf("Long MC Flow - multiple mode\n");\r
-                               break;\r
-                       default:\r
-                               printf("Unknown value %u (ignored)\n",\r
-                                      opt.stress);\r
-                               opt.mmode = 0;\r
-                               break;\r
-                       }\r
-                       break;\r
-\r
-               case 'd':\r
-                       /*\r
-                        * Debug Options\r
-                        */\r
-                       printf("\tDebug Option: ");\r
-                       switch (strtol(optarg, NULL, 0)) {\r
-                       case 1:\r
-                               printf("Ignore Path Records\n");\r
-                               opt.ignore_path_records = TRUE;\r
-                               break;\r
-                       case 2:\r
-                               printf("Force Log Flush\n");\r
-                               opt.force_log_flush = TRUE;\r
-                               break;\r
-                       case 3:\r
-                               /* Used to be memory tracking */\r
-                       default:\r
-                               printf("Unknown value %ld (ignored)\n",\r
-                                      strtol(optarg, NULL, 0));\r
-                               break;\r
-                       }\r
-                       break;\r
-\r
-#ifdef __WIN__\r
-               case '?':\r
-#endif\r
-               case 'h':\r
-                       show_usage();\r
-                       return 0;\r
-\r
-               case 'x':\r
-                       log_flags = strtol(optarg, NULL, 0);\r
-                       printf\r
-                           ("\t\t\t\tVerbose option -vf (log flags = 0x%X)\n",\r
-                            log_flags);\r
-                       break;\r
-\r
-               case -1:\r
-                       printf("Done with args\n");\r
-                       break;\r
-\r
-               default:        /* something wrong */\r
-                       abort();\r
-               }\r
-\r
-       }\r
-       while (next_option != -1);\r
-\r
-       printf("\tFlow = %s\n", flow_name);\r
-\r
-       if (vendor_debug)\r
-               osm_vendor_set_debug(osm_test.p_vendor, vendor_debug);\r
-\r
-       complib_init();\r
-\r
-       status = osmtest_init(&osm_test, &opt, (osm_log_level_t) log_flags);\r
-       if (status != IB_SUCCESS) {\r
-               printf("\nError from osmtest_init: %s\n",\r
-                      ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-       if (cl_hton64(guid) == cl_hton64(INVALID_GUID)) {\r
-               print_all_guids(&osm_test);\r
-               complib_exit();\r
-               return (status);\r
-       }\r
-\r
-       /*\r
-          If the user didn't specify a GUID on the command line,\r
-          then get a port GUID value with which to bind.\r
-        */\r
-       if (guid == 0 && !(guid = get_port_guid(&osm_test, guid))) {\r
-               printf("\nError: port guid 0x%" PRIx64 " not found\n", guid);\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Guid may be zero going into this function if the user\r
-        * hasn't specified a binding port on the command line.\r
-        */\r
-       status = osmtest_bind(&osm_test, max_lid, guid);\r
-       if (status != IB_SUCCESS)\r
-               exit(status);\r
-\r
-       status = osmtest_run(&osm_test);\r
-       if (status != IB_SUCCESS) {\r
-               printf("OSMTEST: TEST \"%s\" FAIL\n", flow_name);\r
-       } else {\r
-               printf("OSMTEST: TEST \"%s\" PASS\n", flow_name);\r
-       }\r
-       osmtest_destroy(&osm_test);\r
-\r
-       complib_exit();\r
-\r
-Exit:\r
-       return (status);\r
-}\r
diff --git a/branches/opensm_3/user/osmtest/osmt_files.c b/branches/opensm_3/user/osmtest/osmt_files.c
deleted file mode 100644 (file)
index 65b6bcb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-\r
-/*\r
- * Supply missing files/routines for Windows osmtest build.\r
- * Point being to minimize mods to other OFED/opensm files...\r
- */\r
-\r
-void OsmReportState(const char *p_str) { }\r
-\r
-#include <..\opensm\osm_log.c>\r
-#include <..\opensm\osm_mad_pool.c>\r
-#include <..\opensm\osm_helper.c>\r
diff --git a/branches/opensm_3/user/osmtest/osmt_inform.c b/branches/opensm_3/user/osmtest/osmt_inform.c
deleted file mode 100644 (file)
index a28c005..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-/*\r
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-/*\r
- * Abstract:\r
- *    Implementation of InformInfo testing flow..\r
- *    Top level is osmt_run_inform_info_flow:\r
- *     osmt_bind_inform_qp\r
- *     osmt_reg_unreg_inform_info\r
- *     osmt_send_trap_wait_for_forward\r
- *\r
- */\r
-\r
-#include <unistd.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include <vendor/osm_vendor_mlx_hca.h>\r
-#include "osmtest.h"\r
-#include "osmt_inform.h"\r
-\r
-/*\r
- * Prepare an asynchronous QP (rcv) for sending inform info and\r
- * handling the incoming reports.\r
- *\r
- */\r
-ib_api_status_t\r
-osmt_bind_inform_qp(IN osmtest_t * const p_osmt, OUT osmt_qp_ctx_t * p_qp_ctx)\r
-{\r
-       ib_net64_t port_guid;\r
-       VAPI_hca_hndl_t hca_hndl;\r
-       VAPI_hca_id_t hca_id;\r
-       uint32_t port_num;\r
-       VAPI_ret_t vapi_ret;\r
-       IB_MGT_ret_t mgt_ret;\r
-       uint8_t hca_index;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       port_guid = p_osmt->local_port.port_guid;\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Binding to port 0x%" PRIx64 "\n",\r
-               cl_ntoh64(port_guid));\r
-\r
-       /* obtain the hca name and port num from the guid */\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "Finding CA and Port that owns port guid 0x%" PRIx64 "\n",\r
-               port_guid);\r
-\r
-       mgt_ret =\r
-           osm_vendor_get_guid_ca_and_port(p_osmt->p_vendor,\r
-                                           port_guid,\r
-                                           &hca_hndl,\r
-                                           &hca_id[0], &hca_index, &port_num);\r
-       if (mgt_ret != IB_MGT_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0109: "\r
-                       "Unable to obtain CA and port (%d).\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#define OSMT_MTL_REVERSE_QP1_WELL_KNOWN_Q_KEY 0x80010000\r
-\r
-       strncpy(p_qp_ctx->qp_bind_hndl.hca_id, hca_id, sizeof(hca_id));\r
-       p_qp_ctx->qp_bind_hndl.hca_hndl = hca_hndl;\r
-       p_qp_ctx->qp_bind_hndl.port_num = port_num;\r
-       p_qp_ctx->qp_bind_hndl.max_outs_sq = 10;\r
-       p_qp_ctx->qp_bind_hndl.max_outs_rq = 10;\r
-       p_qp_ctx->qp_bind_hndl.qkey = OSMT_MTL_REVERSE_QP1_WELL_KNOWN_Q_KEY;\r
-\r
-       vapi_ret = osmt_mtl_init_opened_hca(&p_qp_ctx->qp_bind_hndl);\r
-       if (vapi_ret != VAPI_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0114: "\r
-                       "Error initializing QP.\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* we use the pre-allocated buffers for send and receive :\r
-          send from buf[0]\r
-          receive from buf[2]\r
-        */\r
-       p_qp_ctx->p_send_buf =\r
-           (uint8_t *) p_qp_ctx->qp_bind_hndl.buf_ptr + GRH_LEN;\r
-       p_qp_ctx->p_recv_buf =\r
-           (uint8_t *) p_qp_ctx->qp_bind_hndl.buf_ptr + 2 * (GRH_LEN +\r
-                                                             MAD_BLOCK_SIZE);\r
-\r
-       /* Need to clear assigned memory of p_send_buf - before using it to send any data */\r
-       memset(p_qp_ctx->p_send_buf, 0, MAD_BLOCK_SIZE);\r
-\r
-       status = IB_SUCCESS;\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Initialized QP:0x%X in VAPI Mode\n",\r
-               p_qp_ctx->qp_bind_hndl.qp_id);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Binding to IB_MGT SMI\n");\r
-\r
-       /* we also need a QP0 handle for sending packets */\r
-       mgt_ret = IB_MGT_get_handle(hca_id, port_num, IB_MGT_SMI,\r
-                                   &(p_qp_ctx->ib_mgt_qp0_handle));\r
-       if (IB_MGT_OK != mgt_ret) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0115: "\r
-                       "Error obtaining IB_MGT handle to SMI\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Close the QP\r
- */\r
-void\r
-osmt_unbind_inform_qp(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx)\r
-{\r
-       osm_log_t *p_log = &p_osmt->log;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       osmt_mtl_mad_cleanup(&p_qp_ctx->qp_bind_hndl);\r
-\r
-       IB_MGT_release_handle(p_qp_ctx->ib_mgt_qp0_handle);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Unbind QP handles\n");\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-}\r
-\r
-/*\r
- * Register/Unregister to receive the given InformInfo\r
- *\r
- * Uses the qp context to send the inform info mad.\r
- * Wait for GetResp(InformInfoResp)\r
- *\r
- */\r
-ib_api_status_t\r
-osmt_reg_unreg_inform_info(IN osmtest_t * p_osmt,\r
-                          IN osmt_qp_ctx_t * p_qp_ctx,\r
-                          IN ib_inform_info_t * p_inform_info,\r
-                          IN uint8_t reg_flag)\r
-{\r
-       ib_sa_mad_t *p_sa_mad = (ib_sa_mad_t *) (p_qp_ctx->p_send_buf);\r
-       ib_inform_info_t *p_ii = ib_sa_mad_get_payload_ptr(p_sa_mad);   /*  SA Payload */\r
-       VAPI_ret_t vapi_ret;\r
-       VAPI_wc_desc_t wc_desc;\r
-       VAPI_ud_av_hndl_t avh;\r
-       static VAPI_wr_id_t wrid = 16198;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /* init the MAD */\r
-       ib_mad_init_new((ib_mad_t *) p_sa_mad,\r
-                       IB_MCLASS_SUBN_ADM,\r
-                       (uint8_t) 2,\r
-                       IB_MAD_METHOD_SET, cl_hton64(wrid), (ib_net16_t) 0, 0);\r
-       wrid++;\r
-       p_sa_mad->attr_id = IB_MAD_ATTR_INFORM_INFO;\r
-\r
-       /* copy the reference inform info */\r
-       memcpy(p_ii, p_inform_info, sizeof(ib_inform_info_t));\r
-\r
-       if (reg_flag) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Subscribing InformInfo: Traps from lid:0x%X to 0x%X, trap num :0x%X\n",\r
-                       p_ii->lid_range_begin, p_ii->lid_range_end,\r
-                       p_ii->g_or_v.generic.trap_num);\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "UnSubscribing InformInfo: Traps from lid:0x%X to 0x%X\n",\r
-                       p_ii->lid_range_begin, p_ii->lid_range_end);\r
-       }\r
-\r
-       /* set the subscribe bit */\r
-       if (reg_flag) {\r
-               p_ii->subscribe = 1;\r
-       } else {\r
-               p_ii->subscribe = 0;\r
-               /*\r
-                * we need to set the QPN on the mad if we unsubscribe:\r
-                * o13-2.1.1 - QPN Field need to be set when unsubscribing.\r
-                */\r
-               ib_inform_info_set_qpn(p_ii,\r
-                                      cl_hton32(p_qp_ctx->qp_bind_hndl.qp_id.\r
-                                                qp_num));\r
-       }\r
-\r
-       osm_dump_inform_info(&p_osmt->log, p_ii, OSM_LOG_DEBUG);\r
-\r
-       /* --------------------- PREP ------------------------- */\r
-       if (osmt_mtl_mad_post_recv_bufs(&p_qp_ctx->qp_bind_hndl, p_qp_ctx->p_recv_buf, 1,       /*  but we need only one mad at a time */\r
-                                       GRH_LEN + MAD_BLOCK_SIZE, wrid) != 1) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0120: "\r
-                       "Error posting recv bufs\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Posted recv bufs\n");\r
-\r
-       vapi_ret =\r
-           osmt_mtl_create_av(&p_qp_ctx->qp_bind_hndl,\r
-                              p_osmt->local_port.sm_lid, &avh);\r
-       if (vapi_ret != VAPI_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0121: "\r
-                       "Error Preparing AVH (%s)\n",\r
-                       VAPI_strerror_sym(vapi_ret));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Prepared AVH\n");\r
-\r
-       if (osm_log_is_active(p_log, OSM_LOG_DEBUG)) {\r
-               osm_dump_sa_mad(p_log, (ib_sa_mad_t *) (p_qp_ctx->p_send_buf),\r
-                               OSM_LOG_DEBUG);\r
-#if 0\r
-               for (i = 56; i < 253; i++) {\r
-                       if (i % 8 == 0) {\r
-                               printf("\n %d : ", i);\r
-                       }\r
-                       printf("0x%02X ", p_qp_ctx->p_send_buf[i]);\r
-               }\r
-#endif\r
-               printf("\n");\r
-       }\r
-\r
-       /* --------------------- SEND ------------------------- */\r
-       vapi_ret = osmt_mtl_mad_send(&p_qp_ctx->qp_bind_hndl, wrid, p_qp_ctx->p_send_buf, 1,    /*  SA is QP1 */\r
-                                    0, /*  SL is 0 */\r
-                                    OSMT_MTL_REVERSE_QP1_WELL_KNOWN_Q_KEY,\r
-                                    avh);\r
-       if (vapi_ret != VAPI_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0122: "\r
-                       "Error sending mad (%s)\n",\r
-                       VAPI_strerror_sym(vapi_ret));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       vapi_ret = osmt_mtl_mad_poll4cqe(p_qp_ctx->qp_bind_hndl.hca_hndl,\r
-                                        p_qp_ctx->qp_bind_hndl.sq_cq_hndl,\r
-                                        &wc_desc, 20, 10000, NULL);\r
-       if (vapi_ret != VAPI_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0123: "\r
-                       "Error getting send completion (%s)\n",\r
-                       VAPI_strerror_sym(vapi_ret));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (wc_desc.status != VAPI_SUCCESS) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0124: "\r
-                       "Error on send completion (%s) (%d)\n",\r
-                       VAPI_strerror_sym(wc_desc.status), wc_desc.status);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Sent MAD\n");\r
-\r
-       /* --------------------- RECV ------------------------- */\r
-       vapi_ret = osmt_mtl_mad_poll4cqe(p_qp_ctx->qp_bind_hndl.hca_hndl,\r
-                                        p_qp_ctx->qp_bind_hndl.rq_cq_hndl,\r
-                                        &wc_desc, 20, 10000, &avh);\r
-       if (vapi_ret != VAPI_SUCCESS) {\r
-               if (vapi_ret == VAPI_CQ_EMPTY) {\r
-                       status = IB_TIMEOUT;\r
-               } else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0125: "\r
-                               "Error receiving mad (%s)\n",\r
-                               VAPI_strerror_sym(vapi_ret));\r
-                       status = IB_ERROR;\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* check to see if successful - by examination of the subscribe bit */\r
-       p_sa_mad = (ib_sa_mad_t *) (p_qp_ctx->p_recv_buf + GRH_LEN);\r
-\r
-       if (p_sa_mad->status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "Remote error = %s\n",\r
-                       ib_get_mad_status_str((ib_mad_t *) p_sa_mad));\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET_RESP) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Expected IB_MAD_METHOD_GET_RESP but got:(%X)\n",\r
-                       p_sa_mad->method);\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_sa_mad->attr_id != IB_MAD_ATTR_INFORM_INFO) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Expected IB_MAD_ATTR_INFORM_INFO but got:(%X)\n",\r
-                       cl_ntoh16(p_sa_mad->attr_id));\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_ii = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-       if (!p_ii->subscribe) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0126: "\r
-                       "Subscribe/Unsubscribe Failed\n");\r
-               status = IB_REMOTE_ERROR;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Send a trap (Subn LID Route) Trap(Notice) through the regular\r
- * connection QP connection (targeted at QP0)\r
- *\r
- * Wait for the trap repress\r
- */\r
-ib_api_status_t\r
-osmt_send_trap_wait_for_forward(IN osmtest_t * const p_osmt,\r
-                               IN osmt_qp_ctx_t * p_qp_ctx)\r
-{\r
-       ib_smp_t *p_smp = (ib_smp_t *) (p_qp_ctx->p_send_buf);\r
-       ib_mad_notice_attr_t *p_ntc = ib_smp_get_payload_ptr(p_smp);\r
-       ib_sa_mad_t *p_sa_mad;\r
-       IB_MGT_ret_t mgt_res;\r
-       VAPI_ret_t vapi_ret;\r
-       VAPI_wc_desc_t wc_desc;\r
-       VAPI_ud_av_hndl_t avh;\r
-       IB_ud_av_t av;\r
-       static VAPI_wr_id_t wrid = 2222;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO,\r
-               "Sending Traps to QP0 of SA LID:0x%X\n",\r
-               p_osmt->local_port.sm_lid);\r
-\r
-       /* init the MAD */\r
-       memset(p_smp, 0, sizeof(ib_smp_t));\r
-       ib_mad_init_new((ib_mad_t *) p_smp,\r
-                       IB_MCLASS_SUBN_LID,\r
-                       (uint8_t) 2,\r
-                       IB_MAD_METHOD_TRAP, cl_hton64(wrid), (ib_net16_t) 0, 0);\r
-\r
-       wrid++;\r
-       p_smp->attr_id = IB_MAD_ATTR_NOTICE;\r
-\r
-       /* prepare the notice */\r
-       p_ntc->generic_type = 0x82;     /*  generic, type = 2 */\r
-       ib_notice_set_prod_type_ho(p_ntc, 1);\r
-       p_ntc->g_or_v.generic.trap_num = cl_hton16(0x26);\r
-       p_ntc->issuer_lid = cl_hton16(2);\r
-\r
-       /* --------------------- PREP ------------------------- */\r
-       if (osmt_mtl_mad_post_recv_bufs(&p_qp_ctx->qp_bind_hndl, p_qp_ctx->p_recv_buf, 1,       /*  we need to receive both trap repress and report */\r
-                                       GRH_LEN + MAD_BLOCK_SIZE, wrid) != 1) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0127: "\r
-                       "Error posting recv bufs\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Posted recv bufs\n");\r
-\r
-       av.dlid = p_osmt->local_port.sm_lid;\r
-       av.grh_flag = FALSE;\r
-\r
-       /*  EZ: returned in HACK: use constants */\r
-       av.static_rate = 0;     /*  p_mad_addr->static_rate; */\r
-       av.src_path_bits = 1;   /*  p_mad_addr->path_bits; */\r
-       av.sl = 0;              /*  p_mad_addr->addr_type.gsi.service_level; */\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG,\r
-               "av.dlid 0x%X, av.static_rate %d, av.path_bits %d\n",\r
-               cl_ntoh16(av.dlid), av.static_rate, av.src_path_bits);\r
-\r
-       /* send it */\r
-       mgt_res = IB_MGT_send_mad(p_qp_ctx->ib_mgt_qp0_handle, p_smp,   /*  actual payload */\r
-                                 &av,  /*  address vector */\r
-                                 wrid, /*  casting the mad wrapper pointer for err cb */\r
-                                 p_osmt->opt.transaction_timeout);\r
-       if (mgt_res != IB_MGT_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0128: "\r
-                       "Error sending mad (%d)\n", mgt_res);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       vapi_ret =\r
-           osmt_mtl_create_av(&p_qp_ctx->qp_bind_hndl,\r
-                              p_osmt->local_port.sm_lid, &avh);\r
-       if (vapi_ret != VAPI_OK) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0129: "\r
-                       "Error Preparing AVH (%s)\n",\r
-                       VAPI_strerror_sym(vapi_ret));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Prepared AVH\n");\r
-\r
-       OSM_LOG(p_log, OSM_LOG_DEBUG, "Trap MAD Sent\n");\r
-\r
-       /* --------------------- RECV ------------------------- */\r
-       vapi_ret = osmt_mtl_mad_poll4cqe(p_qp_ctx->qp_bind_hndl.hca_hndl,\r
-                                        p_qp_ctx->qp_bind_hndl.rq_cq_hndl,\r
-                                        &wc_desc, 200, 10000, &avh);\r
-       if (vapi_ret != VAPI_SUCCESS) {\r
-               if (vapi_ret == VAPI_CQ_EMPTY) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0130: "\r
-                               "Timeout receiving mad (%s)\n",\r
-                               VAPI_strerror_sym(vapi_ret));\r
-                       status = IB_TIMEOUT;\r
-               } else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0131: "\r
-                               "Error receiving mad (%s)\n",\r
-                               VAPI_strerror_sym(vapi_ret));\r
-                       status = IB_ERROR;\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* check to see if successful - by examination of the subscribe bit */\r
-       p_sa_mad = (ib_sa_mad_t *) (p_qp_ctx->p_recv_buf + GRH_LEN);\r
-\r
-       if (p_sa_mad->method == IB_MAD_METHOD_REPORT) {\r
-               if (p_sa_mad->attr_id == IB_MAD_ATTR_NOTICE) {\r
-                       OSM_LOG(p_log, OSM_LOG_INFO, "Received the Report!\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 1020"\r
-                               "Did not receive a Report(Notice) but attr:%d\n",\r
-                               cl_ntoh16(p_sa_mad->attr_id));\r
-                       status = IB_ERROR;\r
-               }\r
-       } else {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 1020"\r
-                       "Received an Unexpected Method:%d\n", p_smp->method);\r
-               status = IB_ERROR;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Wait for a trap on QPn\r
- *\r
- */\r
-ib_api_status_t\r
-osmt_trap_wait(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx)\r
-{\r
-       ib_smp_t *p_smp = (ib_smp_t *) (p_qp_ctx->p_send_buf);\r
-       ib_sa_mad_t *p_sa_mad;\r
-       VAPI_ret_t vapi_ret;\r
-       VAPI_wc_desc_t wc_desc;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(p_log, OSM_LOG_INFO,\r
-               "Waiting for Traps under QP:0x%X of SA LID:0x%X\n",\r
-               cl_ntoh16(p_osmt->local_port.sm_lid));\r
-\r
-       /* --------------------- RECV ------------------------- */\r
-       vapi_ret = osmt_mtl_mad_poll4cqe(p_qp_ctx->qp_bind_hndl.hca_hndl,\r
-                                        p_qp_ctx->qp_bind_hndl.rq_cq_hndl,\r
-                                        &wc_desc,\r
-                                        // 200,\r
-                                        p_osmt->opt.wait_time * 100,\r
-                                        10000, NULL);\r
-       if (vapi_ret != VAPI_SUCCESS) {\r
-               if (vapi_ret == VAPI_CQ_EMPTY) {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0130: "\r
-                               "Timeout receiving mad (%s)\n",\r
-                               VAPI_strerror_sym(vapi_ret));\r
-                       status = IB_TIMEOUT;\r
-               } else {\r
-                       OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0131: "\r
-                               "Error receiving mad (%s)\n",\r
-                               VAPI_strerror_sym(vapi_ret));\r
-                       status = IB_ERROR;\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* check to see if successful - by examination of the subscribe bit */\r
-       p_sa_mad = (ib_sa_mad_t *) (p_qp_ctx->p_recv_buf + GRH_LEN);\r
-\r
-       if (p_sa_mad->method == IB_MAD_METHOD_REPORT) {\r
-               if (p_sa_mad->attr_id == IB_MAD_ATTR_NOTICE) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Received the Report!\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 1020"\r
-                               "Did not receive a Report(Notice) but attr:%d\n",\r
-                               cl_ntoh16(p_sa_mad->attr_id));\r
-                       status = IB_ERROR;\r
-               }\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 1020"\r
-                       "Received an Unexpected Method:%d\n", p_smp->method);\r
-               status = IB_ERROR;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(p_log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Initialize an inform info attribute:\r
- * Catch all traps in the lid range of the p_osmt\r
- *\r
- */\r
-ib_api_status_t\r
-osmt_init_inform_info(IN osmtest_t * const p_osmt, OUT ib_inform_info_t * p_ii)\r
-{\r
-\r
-       memset(p_ii, 0, sizeof(ib_inform_info_t));\r
-       /*  p_ii->lid_range_begin = cl_hton16(1); */\r
-       p_ii->lid_range_begin = 0xFFFF;\r
-       p_ii->lid_range_end = cl_hton16(p_osmt->max_lid);\r
-       p_ii->is_generic = 1;   /*  have to choose */\r
-       p_ii->trap_type = 0xFFFF;       /*  ALL */\r
-       p_ii->g_or_v.generic.trap_num = 0xFFFF; /*  ALL */\r
-       p_ii->g_or_v.generic.node_type_lsb = 0xFFFF;    /*  ALL */\r
-       p_ii->g_or_v.generic.node_type_msb = 0xFF;      /*  ALL */\r
-       return IB_SUCCESS;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_init_inform_info_by_trap(IN osmtest_t * const p_osmt,\r
-                             IN ib_net16_t trap_num,\r
-                             OUT ib_inform_info_t * p_ii)\r
-{\r
-\r
-       memset(p_ii, 0, sizeof(ib_inform_info_t));\r
-       /*  p_ii->lid_range_begin = cl_hton16(1); */\r
-       p_ii->lid_range_begin = 0xFFFF;\r
-       p_ii->lid_range_end = cl_hton16(p_osmt->max_lid);\r
-       p_ii->is_generic = 1;   /*  have to choose */\r
-       p_ii->trap_type = 0xFFFF;       /*  ALL */\r
-       p_ii->g_or_v.generic.trap_num = trap_num;       /*  ALL */\r
-       p_ii->g_or_v.generic.node_type_lsb = 0xFFFF;    /*  ALL */\r
-       p_ii->g_or_v.generic.node_type_msb = 0xFF;      /*  ALL */\r
-       return IB_SUCCESS;\r
-}\r
-\r
-/*\r
- * Run a complete inform info test flow:\r
- * - try to unregister inform info (should fail)\r
- * - register an inform info\r
- * - try to unregister inform info (should succeed)\r
- * - register an inform info\r
- * - send a trap - sleep\r
- * - check that a Report(Notice) arrived that match the sent one\r
- *\r
- */\r
-ib_api_status_t osmt_run_inform_info_flow(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_inform_info_t inform_info;\r
-       ib_api_status_t status;\r
-       osmt_qp_ctx_t qp_ctx;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /* bind the QP */\r
-       status = osmt_bind_inform_qp(p_osmt, &qp_ctx);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /* init the inform info */\r
-       osmt_init_inform_info(p_osmt, &inform_info);\r
-\r
-       /* first try to unsubscribe */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 0);\r
-       /* WAS IB_REMOTE_ERROR */\r
-       if (status != IB_REMOTE_ERROR) {\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Error during UnSubscribe: (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Expected Failure to UnSubscribe non existing InformInfo\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /* send the inform info registration */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 1);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /* send a trap through QP0 and wait on QPN */\r
-       status = osmt_send_trap_wait_for_forward(p_osmt, &qp_ctx);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Error during Send Trap and Wait For Report: (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /* try to unsubscribe for cleanup */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 0);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Error during UnSubscribe: (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       } else {\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Remote Error during UnSubscribe\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       osmt_unbind_inform_qp(p_osmt, &qp_ctx);\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Run a complete inform info test flow:\r
- * - try to unregister inform info (should fail)\r
- * - register an inform info\r
- * - try to unregister inform info (should succeed)\r
- * - register an inform info\r
- * - send a trap - sleep\r
- * - check that a Report(Notice) arrived that match the sent one\r
- *\r
- */\r
-ib_api_status_t osmt_run_trap64_65_flow(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_inform_info_t inform_info;\r
-       ib_api_status_t status;\r
-       osmt_qp_ctx_t qp_ctx;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /* bind the QP */\r
-       status = osmt_bind_inform_qp(p_osmt, &qp_ctx);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /* init the inform info */\r
-       osmt_init_inform_info_by_trap(p_osmt, cl_hton16(64), &inform_info);\r
-\r
-       /* send the inform info registration */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 1);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-  /*--------------------- PREP -------------------------*/\r
-       if (osmt_mtl_mad_post_recv_bufs(&qp_ctx.qp_bind_hndl, qp_ctx.p_recv_buf, 1,     /* we need to receive the report */\r
-                                       GRH_LEN + MAD_BLOCK_SIZE, 1) != 1) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0127: "\r
-                       "Error posting recv bufs for trap 64\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "Posted recv bufs for trap 64\n");\r
-\r
-       /* init the inform info */\r
-       osmt_init_inform_info_by_trap(p_osmt, cl_hton16(65), &inform_info);\r
-\r
-       /* send the inform info registration */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 1);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-  /*--------------------- PREP -------------------------*/\r
-       if (osmt_mtl_mad_post_recv_bufs(&qp_ctx.qp_bind_hndl, qp_ctx.p_recv_buf, 1,     /* we need to receive the report */\r
-                                       GRH_LEN + MAD_BLOCK_SIZE, 1) != 1) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0127: "\r
-                       "Error posting recv bufs for trap 65\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "Posted recv bufs for trap 65\n");\r
-\r
-       /* Sleep for x seconds in order to allow external script trap generation */\r
-#if 0\r
-       sleep(p_osmt->opt.wait_time);\r
-#endif\r
-\r
-       /* wait for a trap on QPN */\r
-       status = osmt_trap_wait(p_osmt, &qp_ctx);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Error during Send Trap and Wait For Report: (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /* try to unsubscribe for cleanup */\r
-       status = osmt_reg_unreg_inform_info(p_osmt, &qp_ctx, &inform_info, 0);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Error during UnSubscribe: (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       osmt_unbind_inform_qp(p_osmt, &qp_ctx);\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-#endif                         /*  OSM_VENDOR_INTF_MTL */\r
diff --git a/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c b/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c
deleted file mode 100644 (file)
index f603ade..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-/*\r
- * Copyright (c) 2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-\r
-/*                  - Mellanox Confidential and Proprietary -\r
- *\r
- *  Copyright (C) Jul. 2001, Mellanox Technologies Ltd.  ALL RIGHTS RESERVED.\r
- *\r
- *  Except as specifically permitted herein, no portion of the information,\r
- *  including but not limited to object code and source code, may be reproduced,\r
- *  modified, distributed, republished or otherwise exploited in any form or by\r
- *  any means for any purpose without the prior written permission of Mellanox\r
- *  Technologies Ltd. Use of software subject to the terms and conditions\r
- *  detailed in the file "LICENSE.txt".\r
- *\r
- *  End of legal section ......................................................\r
- *\r
- *  osmt_mtl_regular_qp.c -\r
- *    Provide Simple Interface for Sending and Receiving MADS through a regular QP\r
- *\r
- *  Creation date:\r
- *\r
- *  Version: $Id$\r
- *\r
- *  Authors:\r
- *    Eitan Zahavi\r
- *\r
- *  Changes:\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <unistd.h>\r
-#include <signal.h>\r
-\r
-#include <mtl_common.h>\r
-#include <vapi.h>\r
-#include <evapi.h>\r
-#include <vapi_common.h>\r
-#include <ib_defs.h>\r
-#include <osmt_mtl_regular_qp.h>\r
-#include <complib/cl_types.h>\r
-/*\r
- * Initialize the QP etc.\r
- * Given in res: port_num, max_outs_sq, max_outs_rq\r
- */\r
-VAPI_ret_t osmt_mtl_get_qp_resources(IN OUT osmt_mtl_mad_res_t * res)\r
-{\r
-       VAPI_ret_t ret;\r
-       VAPI_hca_port_t hca_port_info;\r
-       VAPI_qp_init_attr_t qp_init_attr;\r
-       VAPI_qp_prop_t qp_prop;\r
-       VAPI_cqe_num_t act_num;\r
-\r
-       /* Get HCA LID */\r
-       ret =\r
-           VAPI_query_hca_port_prop(res->hca_hndl, res->port_num,\r
-                                    &hca_port_info);\r
-       VAPI_CHECK_RET;\r
-       res->slid = hca_port_info.lid;\r
-\r
-       /* Get a PD */\r
-       ret = VAPI_alloc_pd(res->hca_hndl, &(res->pd_hndl));\r
-       VAPI_CHECK_RET;\r
-\r
-       /* Create CQ for RQ and SQ *//* TBD - Check we have enough act nums */\r
-       ret =\r
-           VAPI_create_cq(res->hca_hndl, res->max_outs_sq + 1,\r
-                          &(res->sq_cq_hndl), &act_num);\r
-       VAPI_CHECK_RET;\r
-       ret =\r
-           VAPI_create_cq(res->hca_hndl, res->max_outs_rq + 1,\r
-                          &(res->rq_cq_hndl), &act_num);\r
-       VAPI_CHECK_RET;\r
-\r
-       /* register event handlers for polling(block mode) internal use */\r
-       /* ret= EVAPI_set_comp_eventh(res->hca_hndl,res->rq_cq_hndl, */\r
-       /*                            EVAPI_POLL_CQ_UNBLOCK_HANDLER,NULL,&(res->rq_cq_eventh)); */\r
-       /* VAPI_CHECK_RET; */\r
-       /* ret= EVAPI_set_comp_eventh(res->hca_hndl,res->sq_cq_hndl, */\r
-       /*                            EVAPI_POLL_CQ_UNBLOCK_HANDLER,NULL,&(res->sq_cq_eventh)); */\r
-       /* VAPI_CHECK_RET; */\r
-\r
-       /* Create QP */\r
-       qp_init_attr.cap.max_oust_wr_sq = res->max_outs_sq + 1;\r
-       qp_init_attr.cap.max_oust_wr_rq = res->max_outs_rq + 1;\r
-       qp_init_attr.cap.max_sg_size_sq = 4;\r
-       qp_init_attr.cap.max_sg_size_rq = 4;\r
-\r
-       qp_init_attr.pd_hndl = res->pd_hndl;\r
-       qp_init_attr.rdd_hndl = 0;\r
-       qp_init_attr.rq_cq_hndl = res->rq_cq_hndl;\r
-       qp_init_attr.rq_sig_type = VAPI_SIGNAL_ALL_WR;  /* That's default for IB */\r
-       qp_init_attr.sq_cq_hndl = res->sq_cq_hndl;\r
-       qp_init_attr.sq_sig_type = VAPI_SIGNAL_REQ_WR;\r
-       qp_init_attr.ts_type = VAPI_TS_UD;\r
-\r
-       ret =\r
-           VAPI_create_qp(res->hca_hndl, &qp_init_attr, &(res->qp_hndl),\r
-                          &qp_prop);\r
-       VAPI_CHECK_RET;\r
-       res->qp_id.qp_num = qp_prop.qp_num;\r
-\r
-       return (VAPI_OK);\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_qp_init(osmt_mtl_mad_res_t * res)\r
-{\r
-       VAPI_ret_t ret;\r
-\r
-       VAPI_qp_attr_t qp_attr;\r
-       VAPI_qp_attr_mask_t qp_attr_mask;\r
-       VAPI_qp_cap_t qp_cap;\r
-\r
-       /*\r
-        * Change QP to INIT\r
-        *\r
-        */\r
-       QP_ATTR_MASK_CLR_ALL(qp_attr_mask);\r
-       qp_attr.qp_state = VAPI_INIT;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);\r
-       qp_attr.pkey_ix = 0;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PKEY_IX);\r
-       qp_attr.port = res->port_num;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_PORT);\r
-       qp_attr.qkey = res->qkey;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QKEY);\r
-\r
-       /* If I do not set this mask, I get an error from HH. QPM should catch it */\r
-       ret =\r
-           VAPI_modify_qp(res->hca_hndl, res->qp_hndl, &qp_attr, &qp_attr_mask,\r
-                          &qp_cap);\r
-       VAPI_CHECK_RET;\r
-\r
-       return (ret);\r
-\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_qp_2_rtr_rts(osmt_mtl_mad_res_t * res)\r
-{\r
-       VAPI_ret_t ret;\r
-\r
-       VAPI_qp_attr_t qp_attr;\r
-       VAPI_qp_attr_mask_t qp_attr_mask;\r
-       VAPI_qp_cap_t qp_cap;\r
-\r
-       /*\r
-        *  Change QP to RTR\r
-        *\r
-        */\r
-       QP_ATTR_MASK_CLR_ALL(qp_attr_mask);\r
-       qp_attr.qp_state = VAPI_RTR;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);\r
-       /*   qp_attr.rq_psn   = 0;                */\r
-       /*   QP_ATTR_MASK_SET(qp_attr_mask,QP_ATTR_RQ_PSN); */\r
-\r
-       ret =\r
-           VAPI_modify_qp(res->hca_hndl, res->qp_hndl, &qp_attr, &qp_attr_mask,\r
-                          &qp_cap);\r
-       VAPI_CHECK_RET;\r
-\r
-       /*\r
-        * Change QP to RTS\r
-        *\r
-        */\r
-       QP_ATTR_MASK_CLR_ALL(qp_attr_mask);\r
-       qp_attr.qp_state = VAPI_RTS;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_QP_STATE);\r
-       qp_attr.sq_psn = 0;\r
-       QP_ATTR_MASK_SET(qp_attr_mask, QP_ATTR_SQ_PSN);\r
-\r
-       ret =\r
-           VAPI_modify_qp(res->hca_hndl, res->qp_hndl, &qp_attr, &qp_attr_mask,\r
-                          &qp_cap);\r
-       VAPI_CHECK_RET;\r
-\r
-       return (ret);\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_mad_create_mr(osmt_mtl_mad_res_t * res)\r
-{\r
-\r
-       VAPI_ret_t ret;\r
-\r
-       VAPI_mrw_t mr_in, mr_out;\r
-\r
-       res->buf_size =\r
-           (MAD_SIZE + GRH_LEN) * (res->max_outs_sq + res->max_outs_rq + 1);\r
-\r
-       /* Register single memory address region for all buffers */\r
-       res->buf_ptr = VMALLOC(res->buf_size);\r
-\r
-       if (res->buf_ptr == ((VAPI_virt_addr_t) NULL)) {\r
-               ret = VAPI_EAGAIN;\r
-               VAPI_CHECK_RET;\r
-       }\r
-\r
-       /* Enable local and remote access to memory region */\r
-       mr_in.acl = VAPI_EN_LOCAL_WRITE | VAPI_EN_REMOTE_WRITE;\r
-       mr_in.l_key = 0;\r
-       mr_in.pd_hndl = res->pd_hndl;\r
-       mr_in.r_key = 0;\r
-       mr_in.size = res->buf_size;\r
-       ASSERT_VOIDP2UINTN(res->buf_ptr);\r
-       mr_in.start = (VAPI_virt_addr_t) (uintn_t) (res->buf_ptr);\r
-       mr_in.type = VAPI_MR;\r
-\r
-       ret = VAPI_register_mr(res->hca_hndl, &mr_in, &(res->mr_hndl), &mr_out);\r
-       VAPI_CHECK_RET;\r
-\r
-       res->l_key = mr_out.l_key;\r
-\r
-       return (ret);\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_init_opened_hca(osmt_mtl_mad_res_t * res)\r
-{\r
-       VAPI_ret_t ret;\r
-\r
-       res->pd_hndl = VAPI_INVAL_HNDL;\r
-       res->rq_cq_hndl = VAPI_INVAL_HNDL;\r
-       res->sq_cq_hndl = VAPI_INVAL_HNDL;\r
-       res->sq_cq_eventh = VAPI_INVAL_HNDL;\r
-       res->rq_cq_eventh = VAPI_INVAL_HNDL;\r
-       res->qp_hndl = VAPI_INVAL_HNDL;\r
-       res->mr_hndl = VAPI_INVAL_HNDL;\r
-\r
-       /*\r
-        * Create QP\r
-        *\r
-        */\r
-       ret = osmt_mtl_get_qp_resources(res);\r
-       if (ret != VAPI_OK) {\r
-               return ret;\r
-       }\r
-\r
-       /*\r
-        * Move to init\r
-        *\r
-        */\r
-       ret = osmt_mtl_qp_init(res);\r
-       if (ret != VAPI_OK) {\r
-               return ret;\r
-       }\r
-\r
-       /*\r
-        * Initialize memory regions\r
-        *\r
-        */\r
-       ret = osmt_mtl_mad_create_mr(res);\r
-       if (ret != VAPI_OK) {\r
-               return ret;\r
-       }\r
-\r
-       /* only now move to RTR and RTS */\r
-       ret = osmt_mtl_qp_2_rtr_rts(res);\r
-       if (ret != VAPI_OK) {\r
-               return ret;\r
-       }\r
-\r
-       return VAPI_OK;\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_mad_cleanup(osmt_mtl_mad_res_t * res)\r
-{\r
-       if (res->qp_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_destroy_qp(res->hca_hndl, res->qp_hndl);\r
-       }\r
-       if (res->sq_cq_eventh != VAPI_INVAL_HNDL) {\r
-               EVAPI_clear_comp_eventh(res->hca_hndl, res->sq_cq_eventh);\r
-       }\r
-       if (res->rq_cq_eventh != VAPI_INVAL_HNDL) {\r
-               EVAPI_clear_comp_eventh(res->hca_hndl, res->rq_cq_eventh);\r
-       }\r
-       if (res->rq_cq_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_destroy_cq(res->hca_hndl, res->rq_cq_hndl);\r
-       }\r
-       if (res->sq_cq_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_destroy_cq(res->hca_hndl, res->sq_cq_hndl);\r
-       }\r
-       if (res->mr_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_deregister_mr(res->hca_hndl, res->mr_hndl);\r
-       }\r
-       if (res->pd_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_dealloc_pd(res->hca_hndl, res->pd_hndl);\r
-       }\r
-#if 0\r
-       /* open/close of HCA should be done system wide - not per application */\r
-       if (res->hca_hndl != VAPI_INVAL_HNDL) {\r
-               VAPI_close_hca(res->hca_hndl);  /* TBD: HCA_open/close should be done on a system wide basis */\r
-       }\r
-#endif\r
-       return VAPI_OK;\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_create_av(osmt_mtl_mad_res_t * res, int16_t dlid,\r
-                             VAPI_ud_av_hndl_t * avh_p)\r
-{\r
-       VAPI_ud_av_t av;\r
-       VAPI_ret_t ret;\r
-\r
-       av.dlid = dlid;\r
-       av.port = res->port_num;\r
-       av.sl = 0;              /* dest->sl; */\r
-       av.src_path_bits = 0;   /*  dest->ee_dlid.dst_path_bits; */\r
-       av.static_rate = 0;\r
-       /* GRH ? */\r
-       av.grh_flag = 0;\r
-\r
-       ret = VAPI_create_addr_hndl(res->hca_hndl, res->pd_hndl, &av, avh_p);\r
-       if (ret != VAPI_OK) {\r
-               MTL_ERROR1("%s: failed VAPI_create_addr_hndl (%s)\n", __func__,\r
-                          VAPI_strerror_sym(ret));\r
-               return ret;\r
-       }\r
-       return VAPI_OK;\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_mad_send(osmt_mtl_mad_res_t * res, VAPI_wr_id_t id,\r
-                            void *mad, VAPI_qp_num_t dest_qp, IB_sl_t sl,\r
-                            u_int32_t dest_qkey, VAPI_ud_av_hndl_t avh)\r
-{\r
-       VAPI_sr_desc_t sr;\r
-       VAPI_sg_lst_entry_t sg_entry;\r
-       VAPI_ret_t ret;\r
-\r
-       /* building SEND request */\r
-       sr.opcode = VAPI_SEND;\r
-       sr.remote_ah = avh;\r
-       sr.remote_qp = dest_qp;\r
-       sr.remote_qkey = dest_qkey;\r
-\r
-       sr.id = id;\r
-       sr.set_se = FALSE;\r
-       sr.fence = FALSE;\r
-       sr.comp_type = VAPI_SIGNALED;\r
-       sr.sg_lst_len = 1;\r
-       sr.sg_lst_p = &sg_entry;\r
-       ASSERT_VOIDP2UINTN(mad);\r
-       sg_entry.addr = (VAPI_virt_addr_t) (uintn_t) (mad);\r
-       sg_entry.len = MAD_SIZE;\r
-       sg_entry.lkey = res->l_key;\r
-\r
-       ret = VAPI_post_sr(res->hca_hndl, res->qp_hndl, &sr);\r
-       if (ret != VAPI_OK) {\r
-               MTL_ERROR1(__FUNCTION__ ": failed VAPI_post_sr (%s)\n",\r
-                          VAPI_strerror_sym(ret));\r
-               return ret;\r
-       }\r
-\r
-       return VAPI_OK;\r
-}\r
-\r
-int osmt_mtl_mad_post_recv_bufs(osmt_mtl_mad_res_t * res, void *buf_array,\r
-                               u_int32_t num_o_bufs, u_int32_t size,\r
-                               VAPI_wr_id_t start_id)\r
-{\r
-       uint32_t i;\r
-       void *cur_buf;\r
-       VAPI_rr_desc_t rr;\r
-       VAPI_sg_lst_entry_t sg_entry;\r
-       VAPI_ret_t ret;\r
-\r
-       rr.opcode = VAPI_RECEIVE;\r
-       rr.comp_type = VAPI_SIGNALED;   /* All with CQE (IB compliant) */\r
-       rr.sg_lst_len = 1;      /* single buffers */\r
-       rr.sg_lst_p = &sg_entry;\r
-       sg_entry.lkey = res->l_key;\r
-       cur_buf = buf_array;\r
-       for (i = 0; i < num_o_bufs; i++) {\r
-               rr.id = start_id + i;   /* WQE id used is the index to buffers ptr array */\r
-               ASSERT_VOIDP2UINTN(cur_buf);\r
-               sg_entry.addr = (VAPI_virt_addr_t) (uintn_t) cur_buf;\r
-               sg_entry.len = size;\r
-               memset(cur_buf, 0x00, size);    /* fill with 0 */\r
-               ret = VAPI_post_rr(res->hca_hndl, res->qp_hndl, &rr);\r
-               if (ret != VAPI_OK) {\r
-                       MTL_ERROR1(__FUNCTION__\r
-                                  ": failed posting RQ WQE (%s)\n",\r
-                                  VAPI_strerror_sym(ret));\r
-                       return i;\r
-               }\r
-               MTL_DEBUG4(__FUNCTION__ ": posted buf at %p\n", cur_buf);\r
-               cur_buf += size;\r
-       }\r
-\r
-       return i;               /* num of buffers posted */\r
-}\r
-\r
-VAPI_ret_t osmt_mtl_mad_poll4cqe(VAPI_hca_hndl_t hca, VAPI_cq_hndl_t cq,\r
-                                VAPI_wc_desc_t * wc_desc_p,\r
-                                u_int32_t max_poll, u_int32_t poll_sleep,\r
-                                VAPI_ud_av_hndl_t * avh_p)\r
-{\r
-       VAPI_ret_t ret = VAPI_CQ_EMPTY;\r
-       u_int32_t poll_cnt = 0;\r
-\r
-       /* wait for something to arrive */\r
-       while ((ret == VAPI_CQ_EMPTY) && (poll_cnt < max_poll)) {\r
-               ret = VAPI_poll_cq(hca, cq, wc_desc_p);\r
-               /* don't sleep if we already succeeded) */\r
-               if (ret != VAPI_CQ_EMPTY) {\r
-                       break;\r
-               }\r
-               usleep(poll_sleep);\r
-               poll_cnt++;\r
-       }\r
-\r
-       /* if passed an AVH to destory - do it */\r
-       if (avh_p != NULL) {\r
-               VAPI_destroy_addr_hndl(hca, *avh_p);\r
-       }\r
-\r
-       if ((poll_cnt == max_poll) && (ret == VAPI_CQ_EMPTY)) {\r
-               MTL_DEBUG1(__FUNCTION__\r
-                          ": Failed to get completion on wq after %d polls.\n",\r
-                          max_poll);\r
-               return VAPI_CQ_EMPTY;\r
-       }\r
-\r
-       if (ret != VAPI_OK) {\r
-               MTL_DEBUG1(__FUNCTION__\r
-                          ": VAPI_poll_cq failed with ret=%s on sq_cq\n",\r
-                          mtl_strerror_sym(ret));\r
-               return ret;\r
-       }\r
-\r
-       if (wc_desc_p->status != VAPI_SUCCESS) {\r
-               MTL_DEBUG1(__FUNCTION__ ": completion error (%d) detected\n",\r
-                          wc_desc_p->status);\r
-       }\r
-\r
-       return VAPI_OK;\r
-}\r
-\r
-#endif                         /*  OSM_VENDOR_INTF_MTL */\r
diff --git a/branches/opensm_3/user/osmtest/osmt_multicast.c b/branches/opensm_3/user/osmtest/osmt_multicast.c
deleted file mode 100644 (file)
index ed8577c..0000000
+++ /dev/null
@@ -1,2575 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *     Implementation of Multicast Member testing flow..\r
- *\r
- */\r
-\r
-#ifndef __WIN__\r
-#include <unistd.h>\r
-#endif\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <arpa/inet.h>\r
-#include <complib/cl_debug.h>\r
-#include <complib/cl_map.h>\r
-#include <complib/cl_list.h>\r
-#include "osmtest.h"\r
-\r
-static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)\r
-{\r
-       uint32_t i;\r
-       ib_api_status_t status;\r
-       osmv_query_req_t req;\r
-       osmv_user_query_t user;\r
-       osmtest_req_context_t context;\r
-       ib_member_rec_t *mcast_record;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-\r
-       user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(*mcast_record));\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = 1;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       context.p_osmt = p_osmt;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-\r
-       /* UnTrusted (SMKey of 0)  - get the multicast groups */\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS || context.result.status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B5: "\r
-                       "Failed getting the multicast groups records - %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_err_str(context.result.status));\r
-               return;\r
-       }\r
-\r
-       osm_log(&p_osmt->log, OSM_LOG_INFO,\r
-               "\n                    |------------------------------------------|"\r
-               "\n                    |        Remaining Multicast Groups        |"\r
-               "\n                    |------------------------------------------|\n");\r
-\r
-       for (i = 0; i < context.result.result_cnt; i++) {\r
-               mcast_record =\r
-                   osmv_get_query_mc_rec(context.result.p_result_madw, i);\r
-               osm_dump_mc_record(&p_osmt->log, mcast_record, OSM_LOG_INFO);\r
-       }\r
-\r
-       /* Trusted - now get the multicast group members */\r
-       req.sm_key = OSM_DEFAULT_SM_KEY;\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS || context.result.status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B6: "\r
-                       "Failed getting the multicast group members records - %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_err_str(context.result.status));\r
-               return;\r
-       }\r
-\r
-       osm_log(&p_osmt->log, OSM_LOG_INFO,\r
-               "\n                    |--------------------------------------------------|"\r
-               "\n                    |        Remaining Multicast Group Members        |"\r
-               "\n                    |--------------------------------------------------|\n");\r
-\r
-       for (i = 0; i < context.result.result_cnt; i++) {\r
-               mcast_record =\r
-                   osmv_get_query_mc_rec(context.result.p_result_madw, i);\r
-               osm_dump_mc_record(&p_osmt->log, mcast_record, OSM_LOG_INFO);\r
-       }\r
-\r
-}\r
-\r
-static cl_status_t\r
-__match_mgids(IN const void *const p_object, IN void *context)\r
-{\r
-       ib_gid_t *p_mgid_context = (ib_gid_t *) context;\r
-       ib_gid_t *p_mgid_list_item = (ib_gid_t *) p_object;\r
-       int32_t count;\r
-\r
-       count = memcmp(p_mgid_context, p_mgid_list_item, sizeof(ib_gid_t));\r
-       if (count == 0)\r
-               return CL_SUCCESS;\r
-       else\r
-               return CL_NOT_FOUND;\r
-}\r
-\r
-ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       osmtest_req_context_t context;\r
-       ib_member_rec_t *p_rec;\r
-       uint32_t i, num_recs = 0;\r
-       cl_list_t mgids_list;\r
-       cl_list_t *p_mgids_list;\r
-       cl_list_iterator_t p_mgids_res;\r
-       cl_status_t cl_status;\r
-       cl_map_item_t *p_item, *p_next_item;\r
-       osmtest_mgrp_t *p_mgrp;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Do a blocking query for all Multicast Records in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-\r
-       context.p_osmt = p_osmt;\r
-       user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0203: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0264: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR)\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s.\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               goto Exit;\r
-       }\r
-\r
-       /* ok we have got something */\r
-       /* First Delete the old MGID Table */\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.mgrp_mlid_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               cl_qmap_remove_item(&p_osmt->exp_subn.mgrp_mlid_tbl, p_item);\r
-               free(p_item);\r
-       }\r
-\r
-       cl_list_construct(&mgids_list);\r
-       cl_list_init(&mgids_list, num_recs);\r
-       p_mgids_list = &mgids_list;\r
-       num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
-               num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec = osmv_get_query_result(context.result.p_result_madw, i);\r
-               p_mgids_res =\r
-                   cl_list_find_from_head(p_mgids_list, __match_mgids,\r
-                                          &(p_rec->mgid));\r
-               /* If returns iterator other than end of list, same mgid exists already */\r
-               if (p_mgids_res != cl_list_end(p_mgids_list)) {\r
-                       char gid_str[INET6_ADDRSTRLEN];\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0265: "\r
-                               "MCG MGIDs are the same - invalid MGID : %s\n",\r
-                               inet_ntop(AF_INET6, p_rec->mgid.raw, gid_str,\r
-                                         sizeof gid_str));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-\r
-               }\r
-               osm_dump_mc_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);\r
-               cl_status = cl_list_insert_head(p_mgids_list, &(p_rec->mgid));\r
-               if (cl_status) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0205: "\r
-                               "Could not add MGID to cl_list\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-               p_mgrp = (osmtest_mgrp_t *) malloc(sizeof(*p_mgrp));\r
-               if (!p_mgrp) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0204: "\r
-                               "Could not allocate new MCG\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-               memcpy(&p_mgrp->mcmember_rec, p_rec,\r
-                      sizeof(p_mgrp->mcmember_rec));\r
-               cl_qmap_insert(&p_osmt->exp_subn.mgrp_mlid_tbl,\r
-                              cl_ntoh16(p_rec->mlid), &p_mgrp->map_item);\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/* given a multicast request send and wait for response. */\r
-ib_api_status_t\r
-osmt_send_mcast_request(IN osmtest_t * const p_osmt,\r
-                       IN uint8_t is_set,\r
-                       IN ib_member_rec_t * p_mc_req,\r
-                       IN uint64_t comp_mask, OUT ib_sa_mad_t * p_res)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&context, 0, sizeof(context));\r
-       memset(p_res, 0, sizeof(ib_sa_mad_t));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       user.p_attr = p_mc_req;\r
-       user.comp_mask = comp_mask;\r
-\r
-       if (is_set == 1)\r
-               req.query_type = OSMV_QUERY_UD_MULTICAST_SET;\r
-       else if (is_set == 0)\r
-               req.query_type = OSMV_QUERY_UD_MULTICAST_DELETE;\r
-       else if (is_set == 0xee) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Set USER DEFINED QUERY\n");\r
-               req.query_type = OSMV_QUERY_USER_DEFINED;\r
-               user.method = IB_MAD_METHOD_GET;\r
-               user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-       } else if (is_set == 0xff) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Set USER DEFINED QUERY\n");\r
-               req.query_type = OSMV_QUERY_USER_DEFINED;\r
-               user.method = IB_MAD_METHOD_SET;\r
-               user.attr_id = IB_MAD_ATTR_MCMEMBER_RECORD;\r
-               user.attr_offset = ib_get_attr_offset(sizeof(ib_member_rec_t));\r
-       }\r
-\r
-       /* TODO : Check the validity of all user fields in order to use\r
-          OSMV_QUERY_USER_DEFINED\r
-          p_user_query = ( osmv_user_query_t * ) p_query_req->p_query_input;\r
-          if (p_user_query->method) sa_mad_data.method = p_user_query->method;\r
-          sa_mad_data.attr_offset = p_user_query->attr_offset;\r
-          sa_mad_data.attr_id = p_user_query->attr_id;\r
-          sa_mad_data.comp_mask = p_user_query->comp_mask;\r
-          sa_mad_data.p_attr = p_user_query->p_attr;\r
-        */\r
-\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0206: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /* ok it worked */\r
-       memcpy(p_res, osm_madw_get_mad_ptr(context.result.p_result_madw),\r
-              sizeof(ib_sa_mad_t));\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0224: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR)\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,\r
-                           IN OUT ib_member_rec_t * p_mc_req)\r
-{\r
-       /* use default values so we can change only what we want later */\r
-       memset(p_mc_req, 0, sizeof(ib_member_rec_t));\r
-\r
-       /* we leave the MGID to the user */\r
-       memcpy(&p_mc_req->port_gid.unicast.interface_id,\r
-              &p_osmt->local_port.port_guid,\r
-              sizeof(p_osmt->local_port.port_guid));\r
-\r
-       /*  use our own subnet prefix: */\r
-       p_mc_req->port_gid.unicast.prefix = CL_HTON64(0xFE80000000000000ULL);\r
-\r
-       /*  ib_net32_t  qkey; */\r
-       /*  ib_net16_t  mlid; - we keep it zero for upper level to decide. */\r
-       /*  uint8_t     mtu; - keep it zero means - anything you have please. */\r
-       /*  uint8_t     tclass; can leave as zero for now (between subnets) */\r
-       /*  ib_net16_t  pkey; leave as zero */\r
-       p_mc_req->rate = IB_LINK_WIDTH_ACTIVE_4X;\r
-       /*  uint8_t     pkt_life; zero means greater than zero ... */\r
-       /*  ib_net32_t  sl_flow_hop; keep it all zeros */\r
-       /*  we want to use a link local scope: 0x02 */\r
-       p_mc_req->scope_state = ib_member_set_scope_state(0x02, 0);\r
-}\r
-\r
-/***********************************************************************\r
- * UD Multicast testing flow:\r
- * o15.0.1.3:\r
- * - Request new MCG with not enough components in comp_mask :\r
- *   ERR_INSUFFICIENT_COMPONENTS\r
- * o15.0.1.8:\r
- * - Request a join with irrelevant RATE and get a ERR_INVALID_REQ\r
- * o15.0.1.4:\r
- * - Create an MGID by asking for a join with MGID = 0\r
- *   providing P_Key, Q_Key, SL, FlowLabel, Tclass.\r
- * o15.0.1.5:\r
- * - Check the returned MGID is valid. (p 804)\r
- * o15.0.1.6:\r
- * - Create a new MCG with valid requested MGID.\r
- * - Try to create a new MCG with invalid MGID : get back ERR_REQ_INVALID\r
- * - Try again with MGID prefix = 0xA01B (maybe 0x1BA0 little or big ?)\r
- * - Try to create again the already created group: ERR_REQ_INVALID\r
- * o15.0.1.7 - implicitlly checked during the prev steps.\r
- * o15.0.1.9\r
- * - Create MCG with Invalid JoinState.FullMember != 1 : get ERR_REQ_INVALID\r
- * o15.0.1.10 - can't check on a single client .\r
- * o15.0.1.11:\r
- * - Try to join into a MGID that exists with JoinState=SendOnlyMember -\r
- *   see that it updates JoinState. What is the routing change?\r
- * - We can not check simple join since we have only one tester (for now)\r
- * o15.0.1.12:\r
- * - The last join should have a special treatment in the SA (sender only)\r
- *   but what is it ?\r
- * o15.0.1.13:\r
- * - Try joining with wrong rate - ERR_REQ_INVALID\r
- * o15.0.1.14:\r
- * - Try partial delete - actually updating the join state. check it.\r
- * - Register by InformInfo flow to receive trap 67 on MCG delete.\r
- * - Try full delete (JoinState and should be 0)\r
- * - Wait for trap 67.\r
- * - Try joining (not full mem) again to see the group was deleted.\r
- *   (should fail - o15.0.1.13)\r
- * o15.0.1.15:\r
- * - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID\r
- * o15.0.1.16:\r
- * - Try GetTable with PortGUID wildcarded and get back some groups.\r
- ***********************************************************************/\r
-\r
-/* The following macro can be used only within the osmt_run_mcast_flow() function */\r
-#define IS_IPOIB_MGID(p_mgid) \\r
-           ( !memcmp(&osm_ipoib_good_mgid,    (p_mgid), sizeof(osm_ipoib_good_mgid)) || \\r
-             !memcmp(&osm_ts_ipoib_good_mgid, (p_mgid), sizeof(osm_ts_ipoib_good_mgid)) )\r
-\r
-ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)\r
-{\r
-       char gid_str[INET6_ADDRSTRLEN];\r
-       char gid_str2[INET6_ADDRSTRLEN];\r
-       ib_api_status_t status;\r
-       ib_member_rec_t mc_req_rec;\r
-       union {\r
-               ib_sa_mad_t sa_mad;\r
-               ib_member_rec_t mcmr;\r
-       } res;\r
-       ib_sa_mad_t *sa_mad;\r
-       ib_member_rec_t *p_mc_res;\r
-       uint64_t comp_mask = 0;\r
-       ib_net64_t remote_port_guid = 0x0;\r
-       cl_qmap_t *p_mgrp_mlid_tbl;\r
-       osmtest_mgrp_t *p_mgrp;\r
-       ib_gid_t special_mgid, tmp_mgid, proxy_mgid;\r
-       ib_net16_t invalid_mlid = 0x0;\r
-       ib_net16_t max_mlid = cl_hton16(0xFFFE), tmp_mlid;\r
-       int start_cnt = 0, cnt, middle_cnt = 0, end_cnt = 0;\r
-       int start_ipoib_cnt = 0, end_ipoib_cnt = 0;\r
-       int mcg_outside_test_cnt = 0, fail_to_delete_mcg = 0;\r
-       osmtest_req_context_t context;\r
-       ib_node_record_t *p_rec;\r
-       uint32_t num_recs = 0, i;\r
-       uint8_t mtu_phys = 0, rate_phys = 0;\r
-       cl_map_t test_created_mlids;    /* List of all mlids created in this test */\r
-       boolean_t got_error = FALSE;\r
-\r
-       static ib_gid_t good_mgid = {\r
-               {\r
-                0xFF, 0x12, 0xA0, 0x1C,\r
-                0xFE, 0x80, 0x00, 0x00,\r
-                0x00, 0x00, 0x00, 0x00,\r
-                0x12, 0x34, 0x56, 0x78}\r
-       };\r
-       static ib_gid_t osm_ipoib_mgid = {\r
-               {\r
-                0xff,          /* multicast field */\r
-                0x12,          /* scope */\r
-                0x40, 0x1b,    /* IPv4 signature */\r
-                0xff, 0xff,    /* 16 bits of P_Key (to be filled in) */\r
-                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    /* 48 bits of zeros */\r
-                0xff, 0xff, 0xff, 0xee,        /* 32 bit IPv4 broadcast address */\r
-                },\r
-       };\r
-       static ib_gid_t osm_ts_ipoib_good_mgid = {\r
-               {\r
-                0xff,          /* multicast field */\r
-                0x12,          /* non-permanent bit,scope */\r
-                0x40, 0x1b,    /* IPv4 signature */\r
-                0xff, 0xff,    /* 16 bits of P_Key (to be filled in) */\r
-                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    /* 48 bits of zeros */\r
-                0x00, 0x00, 0x00, 0x01,        /* 32 bit IPv4 broadcast address */\r
-                },\r
-       };\r
-       static ib_gid_t osm_ipoib_good_mgid = {\r
-               {\r
-                0xff,          /* multicast field */\r
-                0x12,          /* non-permanent bit,scope */\r
-                0x40, 0x1b,    /* IPv4 signature */\r
-                0xff, 0xff,    /* 16 bits of P_Key (to be filled in) */\r
-                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    /* 48 bits of zeros */\r
-                0xff, 0xff, 0xff, 0xff,        /* 32 bit IPv4 broadcast address */\r
-                },\r
-       };\r
-       static ib_gid_t osm_link_local_mgid = {\r
-               {\r
-                0xFF, 0x02, 0x00, 0x00,\r
-                0x00, 0x00, 0x00, 0x00,\r
-                0x00, 0x00, 0x00, 0x00,\r
-                0x00, 0x00, 0x00, 0x01},\r
-       };\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "GetTable of all current MCGs...\n");\r
-       status = osmt_query_mcast(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2FF "\r
-                       "GetTable of all records has failed!\n");\r
-               goto Exit;\r
-       }\r
-\r
-       /* Initialize the test_created_mgrps map */\r
-       cl_map_construct(&test_created_mlids);\r
-       cl_map_init(&test_created_mlids, 1000);\r
-\r
-       p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       sa_mad = &res.sa_mad;\r
-       p_mc_res = ib_sa_mad_get_payload_ptr(sa_mad);\r
-\r
-       /* Only when we are on single mode check flow - do the count comparison, otherwise skip */\r
-       if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {\r
-               start_cnt = cl_qmap_count(p_mgrp_mlid_tbl);\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(start): "\r
-                       "Number of MC Records found in SA DB is %d\n",\r
-                       start_cnt);\r
-       }\r
-\r
-       /* This flow is being added due to bug discovered using SilverStorm stack -\r
-          The bug was initializing MCast with MTU & RATE min values that do\r
-          not match the subnet capability, even though that OpenSM\r
-          reponds with the correct value it does not store it in the MCG.\r
-          We want the check a join request to already existing group (ipoib)\r
-          without using MTU or RATE then getting response from OpenSM with\r
-          the correct values then join again with them and get IB_SUCCESS\r
-          all the way\r
-        */\r
-\r
-       /* First validate IPoIB exist in the SA DB */\r
-       p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);\r
-       /* scan all available multicast groups in the DB and fill in the table */\r
-       while (p_mgrp != (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {\r
-               /* search for ipoib mgid */\r
-               if (IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid))\r
-                       start_ipoib_cnt++;\r
-               else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Non-IPoIB MC Groups exist: mgid=%s\n",\r
-                               inet_ntop(AF_INET6,\r
-                                         p_mgrp->mcmember_rec.mgid.raw,\r
-                                         gid_str, sizeof gid_str));\r
-                       mcg_outside_test_cnt++;\r
-               }\r
-\r
-               p_mgrp = (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Found %d non-IPoIB MC Groups\n", mcg_outside_test_cnt);\r
-\r
-       if (start_ipoib_cnt) {\r
-               /* o15-0.2.4 - Check a join request to already created MCG */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Found IPoIB MC Group, so we run SilverStorm Bug Flow...\n");\r
-               /* Try to join first like IPoIB of SilverStorm */\r
-               memcpy(&mc_req_rec.mgid, &osm_ipoib_good_mgid,\r
-                      sizeof(ib_gid_t));\r
-               /* Request Join */\r
-               ib_member_set_join_state(&mc_req_rec,\r
-                                        IB_MC_REC_STATE_FULL_MEMBER);\r
-               comp_mask =\r
-                   IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-                   IB_MCR_COMPMASK_JOIN_STATE;\r
-\r
-               status = osmt_send_mcast_request(p_osmt, 0xff,  /* User Defined query Set */\r
-                                                &mc_req_rec, comp_mask,\r
-                                                sa_mad);\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Joining an existing IPoIB multicast group\n");\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Sent Join request with :\n\t\tport_gid=%s, mgid=%s\n"\r
-                       "\t\tjoin state= 0x%x, response is : %s\n",\r
-                       inet_ntop(AF_INET6, mc_req_rec.port_gid.raw,\r
-                                 gid_str, sizeof gid_str),\r
-                       inet_ntop(AF_INET6, mc_req_rec.mgid.raw,\r
-                                 gid_str2, sizeof gid_str2),\r
-                       (mc_req_rec.scope_state & 0x0F),\r
-                       ib_get_err_str(status));\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B3: "\r
-                               "Failed joining existing IPoIB MCGroup - got %s\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               /* Check MTU & Rate Value and resend with SA suggested values */\r
-\r
-               /* Prepare the mc_req_rec for the rest of the flow */\r
-               osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-               /*\r
-                  We simulate the same situation as in SilverStorm - a response with the\r
-                  exact RATE & MTU as the SA responded with. Actually the query\r
-                  has included some more fields but we know that problem was\r
-                  genereated by the RATE\r
-                */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Received attributes of MCG : \n\t\tMTU=0x%02X, RATE=0x%02X\n",\r
-                       p_mc_res->mtu, p_mc_res->rate);\r
-\r
-               mc_req_rec.mtu = p_mc_res->mtu;\r
-               mc_req_rec.rate = p_mc_res->rate;\r
-               /* Set feasible mtu & rate that will allow check the\r
-                  exact statement of OpenSM */\r
-               mtu_phys = p_mc_res->mtu;\r
-               rate_phys = p_mc_res->rate;\r
-\r
-               memcpy(&mc_req_rec.mgid, &osm_ipoib_good_mgid,\r
-                      sizeof(ib_gid_t));\r
-               /* Request Join */\r
-               ib_member_set_join_state(&mc_req_rec,\r
-                                        IB_MC_REC_STATE_FULL_MEMBER);\r
-               comp_mask =\r
-                   IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-                   IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_MTU_SEL |\r
-                   IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_RATE_SEL |\r
-                   IB_MCR_COMPMASK_RATE;\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Sending attributes of MCG : \n\t\tMTU=0x%02X, RATE=0x%02X\n",\r
-                       mc_req_rec.mtu, mc_req_rec.rate);\r
-               status = osmt_send_mcast_request(p_osmt, 0xff,  /* User Defined query */\r
-                                                &mc_req_rec, comp_mask,\r
-                                                sa_mad);\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Sent Join request using response values, response is : %s\n",\r
-                       ib_get_err_str(status));\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EF: "\r
-                               "Query as Full Member of already existing "\r
-                               "ipoib group gid %s has failed\n",\r
-                               inet_ntop(AF_INET6, mc_req_rec.mgid.raw,\r
-                                         gid_str, sizeof gid_str));\r
-                       goto Exit;\r
-               }\r
-               /* We do not want to leave the MCG since its IPoIB */\r
-       }\r
-\r
-  /**************************************************************************/\r
-       /* Check Get with invalid mlid */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Get with invalid mlid...\n");\r
-       /* Request Get */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-       mc_req_rec.mlid = invalid_mlid;\r
-       comp_mask = IB_MCR_COMPMASK_MLID;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 0xee,  /* User Defined query Get */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E0 "\r
-                       "SubnAdmGet with invalid mlid 0x%x succeeded\n",\r
-                       cl_ntoh16(mc_req_rec.mlid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Prepare the mc_req_rec for the rest of the flow */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-  /**************************************************************************/\r
-       /* Check Get with invalid port guid */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Get with invalid port guid (0x0) but valid interface ID : 0x%"\r
-               PRIx64 "...\n",\r
-               cl_ntoh64(mc_req_rec.port_gid.unicast.interface_id));\r
-\r
-       /* Request Get */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-       memset(&mc_req_rec.port_gid.unicast.interface_id, 0,\r
-              sizeof(ib_net64_t));\r
-       comp_mask = IB_MCR_COMPMASK_GID;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 0xee,  /* User Defined query Get */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E4 "\r
-                       "SubnAdmGet with invalid port guid succeeded\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Prepare the mc_req_rec for the rest of the flow */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-  /**************************************************************************/\r
-\r
-       /* o15.0.1.3:  */\r
-       /* - Request Join with insufficient comp_mask */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with insufficient comp mask qkey & pkey (o15.0.1.3)...\n");\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           /* IB_MCR_COMPMASK_QKEY |  */\r
-           /* IB_MCR_COMPMASK_PKEY | intentionaly missed to raise the error */\r
-           IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EE: "\r
-                       "Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with insufficient comp mask - sl (15.0.1.3)...\n");\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |\r
-           /* IB_MCR_COMPMASK_SL |  */\r
-           IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |        /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02ED: "\r
-                       "Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-\r
-       mc_req_rec.mgid.raw[15] = 0x01;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with insufficient comp mask - flow label (o15.0.1.3)...\n");\r
-\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |\r
-           /* IB_MCR_COMPMASK_FLOW | intentionaly missed to raise the error */\r
-           IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |       /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EC: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with insufficient comp mask - tclass (o15.0.1.3)...\n");\r
-\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |\r
-           IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |\r
-           /* IB_MCR_COMPMASK_TCLASS |  Intentionally missed to raise an error */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EA: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with insufficient comp mask - tclass qkey (o15.0.1.3)...\n");\r
-\r
-       /* no MGID */\r
-       /* memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t)); */\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           /* IB_MCR_COMPMASK_QKEY | intentionaly missed to raise the error */\r
-           IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |\r
-           IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |\r
-           /* IB_MCR_COMPMASK_TCLASS |  intentionaly missed to raise the error */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E9: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* o15.0.1.8: */\r
-       /* - Request join with irrelevant RATE : get a ERR_INSUFFICIENT_COMPONENTS */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic rate (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested rate */\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0207: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Check Valid value which is unreasonable now */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic rate 120GB (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested rate */\r
-       mc_req_rec.rate =\r
-           IB_PATH_RECORD_RATE_120_GBS | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0208: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Check Valid value which is unreasonable now */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with less than min rate 2.5GB (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested rate */\r
-       mc_req_rec.rate =\r
-           IB_PATH_RECORD_RATE_2_5_GBS | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AB: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Checking above max value of MTU which is impossible */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic mtu : \n\t\tmore than 4096 -"\r
-               " max (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested mtu */\r
-       mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AC: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Checking below min value of MTU which is impossible */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic mtu : \n\t\tless than 256 -"\r
-               " min (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested mtu */\r
-       mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AD: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic mtu (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested mtu */\r
-       mc_req_rec.mtu = 0x6 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AE: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#if 0\r
-       /* Currently PacketLifeTime isn't checked in opensm */\r
-       /* Check PacketLifeTime as 0 */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create with unrealistic packet life value less than 0 (o15.0.1.8)...\n");\r
-\r
-       /* impossible requested packet life */\r
-       mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AF: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_REQ_INVALID got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#endif\r
-\r
-       /* o15.0.1.4:  */\r
-       /* - Create an MGID by asking for a join with MGID = 0 */\r
-       /*   providing P_Key, Q_Key, SL, FlowLabel, Tclass. */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=0 skip service level (o15.0.1.4)...\n");\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY |\r
-           /* IB_MCR_COMPMASK_SL | Intentionally missed */\r
-           IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |        /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A8: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Check that no same MCG in the SMDB */\r
-       status = osmt_query_mcast(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02AA: "\r
-                       "Could not get all MC Records in subnet, got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Only when we are on single mode check flow - do the count comparison, otherwise skip */\r
-       if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {\r
-               middle_cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(post false create): "\r
-                       "Number of MC Records found in SA DB is %d\n",\r
-                       middle_cnt);\r
-               if (middle_cnt != start_cnt)\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Got different number of records stored in SA DB (before any creation)\n"\r
-                               "Instead of %d got %d\n", start_cnt,\r
-                               middle_cnt);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=0 skip Qkey and Pkey (o15.0.1.4)...\n");\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           /* IB_MCR_COMPMASK_QKEY | */\r
-           /* IB_MCR_COMPMASK_PKEY | Intentionally missed */\r
-           IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A7: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Bad Query o15.0.1.4 */\r
-\r
-       status = osmt_query_mcast(p_osmt);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=0 skip TClass (o15.0.1.4)...\n");\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |\r
-           IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |\r
-           /* IB_MCR_COMPMASK_TCLASS |  Intentionally missed */\r
-           /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR ||\r
-           ((ib_net16_t) (sa_mad->status & IB_SMP_STATUS_MASK)) !=\r
-           IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A6: "\r
-                       "Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=0 valid Set several options :\n\t\t"\r
-               "First above min RATE, Second less than max RATE\n\t\t"\r
-               "Third above min MTU, Second less than max MTU\n\t\t"\r
-               "Fifth exact MTU & RATE feasible, Sixth exact RATE feasible\n\t\t"\r
-               "Seventh exact MTU feasible (o15.0.1.4)...\n");\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A5: "\r
-                       "Failed to create MCG for MGID=0 with higher than minimum RATE - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_12X | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "\r
-                       "Failed to create MCG for MGID=0 with less than highest RATE - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-\r
-       mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0238: "\r
-                       "Failed to create MCG for MGID=0 with less than highest MTU - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-       mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0239: "\r
-                       "Failed to create MCG for MGID=0 with higher than lowest MTU - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-       /* Using Exact feasible MTU & RATE */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Using Exact feasible MTU & RATE: "\r
-               "MTU = 0x%02X, RATE = 0x%02X\n", mtu_phys, rate_phys);\r
-\r
-       mc_req_rec.mtu = mtu_phys;\r
-       mc_req_rec.rate = rate_phys;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL |\r
-           IB_MCR_COMPMASK_MTU |\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0240: "\r
-                       "Failed to create MCG for MGID=0 with exact MTU & RATE - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-       /* Using Exact feasible RATE */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Using Exact feasible RATE: 0x%02X\n", rate_phys);\r
-\r
-       mc_req_rec.rate = rate_phys;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0241: "\r
-                       "Failed to create MCG for MGID=0 with exact RATE - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-       /* Using Exact feasible MTU */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Using Exact feasible MTU: 0x%02X\n", mtu_phys);\r
-\r
-       mc_req_rec.mtu = mtu_phys;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0242: "\r
-                       "Failed to create MCG for MGID=0 with exact MTU - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* o15.0.1.5: */\r
-       /* - Check the returned MGID is valid. (p 804) */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating resulting MGID (o15.0.1.5)...\n");\r
-       /* prefix 0xFF1 Scope 0xA01B */\r
-       /* Since we did not directly specified SCOPE in comp mask\r
-          we should get the comp mask that is link-local scope */\r
-       if ((p_mc_res->mgid.multicast.header[0] != 0xFF) ||\r
-           (p_mc_res->mgid.multicast.header[1] != 0x12) ||\r
-           (p_mc_res->mgid.multicast.raw_group_id[0] != 0xA0) ||\r
-           (p_mc_res->mgid.multicast.raw_group_id[1] != 0x1B)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0209: "\r
-                       "Validating MGID failed. MGID:%s\n",\r
-                       inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Good Flow - mgid is 0 while giving all required fields for join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-       /* Using feasible GREATER_THAN 0 packet lifitime */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=0 (o15.0.1.4)...\n");\r
-\r
-       status = osmt_query_mcast(p_osmt);\r
-\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-       /* no MGID */\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0210: "\r
-                       "Failed to create MCG for MGID=0 - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* o15.0.1.6: */\r
-       /* - Create a new MCG with valid requested MGID. */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-       mc_req_rec.mgid = good_mgid;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given valid MGID=%s (o15.0.1.6)...\n",\r
-               inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,\r
-                         sizeof gid_str));\r
-\r
-       /* Before creation, need to check that this group doesn't exist */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Verifying that MCGroup with this MGID doesn't exist by trying to Join it (o15.0.1.13)...\n");\r
-\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_NON_MEMBER);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1,     /* join */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0301: "\r
-                       "Tried joining group that shouldn't have existed - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Set State to full member to allow group creation */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Now creating group with given valid MGID=%s (o15.0.1.6)...\n",\r
-               inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,\r
-                         sizeof gid_str));\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0211: "\r
-                       "Failed to create MCG for MGID=%s (o15.0.1.6) - got %s/%s\n",\r
-                       inet_ntop(AF_INET6, good_mgid.raw, gid_str,\r
-                                 sizeof gid_str), ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating resulting MGID (o15.0.1.6)...\n");\r
-       /* prefix 0xFF1 Scope 0xA01B */\r
-       if ((p_mc_res->mgid.multicast.header[0] != 0xFF) || (p_mc_res->mgid.multicast.header[1] != 0x12) ||     /* HACK hardcoded scope = 0x02 */\r
-           (p_mc_res->mgid.multicast.raw_group_id[0] != 0xA0) ||\r
-           (p_mc_res->mgid.multicast.raw_group_id[1] != 0x1C)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0212: "\r
-                       "Validating MGID failed. MGID:%s\n",\r
-                       inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try to create a new MCG with invalid MGID : get back ERR_REQ_INVALID */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD MGID=0xFA..... (o15.0.1.6)...\n");\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid.raw[0] = 0xFA;\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0213: "\r
-                       "Failed to recognize MGID error for MGID=0xFA - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try again with MGID prefix = 0xA01B (maybe 0x1BA0 little or big ?) */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD MGID=0xFF12A01B..... with link-local scope (o15.0.1.6)...\n");\r
-\r
-       mc_req_rec.mgid.raw[0] = 0xFF;\r
-       mc_req_rec.mgid.raw[3] = 0x1B;\r
-       comp_mask = comp_mask | IB_MCR_COMPMASK_SCOPE;\r
-       mc_req_rec.scope_state = mc_req_rec.scope_state & 0x2F; /* local scope */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0214: "\r
-                       "Failed to recognize MGID error for A01B with link-local bit (status %s) (rem status %s)\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Change the mgid prefix - get back ERR_REQ_INVALID */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD MGID PREFIX=0xEF... (o15.0.1.6)...\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[0] = 0xEF;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0215: "\r
-                       "Failed to recognize MGID PREFIX error for MGID=0xEF - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Change the scope to reserved - get back VALID REQ */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking local scope with full member \n\t\tand valid mgid %s"\r
-               "  ... (o15.0.1.6)...\n",\r
-               inet_ntop(AF_INET6, mc_req_rec.mgid.raw, gid_str,\r
-                         sizeof gid_str));\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[1] = 0x1F;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0216: "\r
-                       "Failed to create MCG for MGID=%s - got %s/%s\n",\r
-                       inet_ntop(AF_INET6, good_mgid.raw, gid_str,\r
-                                 sizeof gid_str), ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Change the flags to invalid value 0x2 - get back INVALID REQ */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking invalid flags=0xFF 22  ... (o15.0.1.6)...\n");\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[1] = 0x22;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0217: "\r
-                       "Failed to recognize create with invalid flags value 0x2 - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Change the MGID to link local MGID  - get back VALID REQ */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking link local MGID 0xFF02:0:0:0:0:0:0:1 (o15.0.1.6)...\n");\r
-\r
-       mc_req_rec.mgid = osm_link_local_mgid;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0218: "\r
-                       "Failed to create MCG for MGID=0xFF02:0:0:0:0:0:0:1 - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* o15.0.1.7 - implicitlly checked during the prev steps. */\r
-       /* o15.0.1.8 - implicitlly checked during the prev steps. */\r
-\r
-       /* o15.0.1.9 */\r
-       /* - Create MCG with Invalid JoinState.FullMember != 1 : get ERR_REQ_INVALID */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking new MGID with invalid join state (o15.0.1.9)...\n");\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[12] = 0xFF;\r
-       mc_req_rec.scope_state = 0x22;  /* link-local scope, non-member state */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0219: "\r
-                       "Failed to recognize create with JoinState != FullMember - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Lets try a valid join scope state */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking new MGID with valid join state (o15.0.1.9)...\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.scope_state = 0x23;  /* link-local scope, non member and full member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0220: "\r
-                       "Failed to create MCG with valid join state 0x3 - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* Lets try another invalid join scope state */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking new MGID with invalid join state (o15.0.1.9)...\n");\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       /* We have created a new MCG so now we need different mgid when cresting group otherwise it will be counted as join request . */\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[12] = 0xFC;\r
-       mc_req_rec.scope_state = 0x24;  /* link-local scope, send only member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0221: "\r
-                       "Failed to recognize create with JoinState != FullMember - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Lets try another valid join scope state */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking new MGID creation with valid join state (o15.0.2.3)...\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[12] = 0xFB;\r
-       memcpy(&special_mgid, &mc_req_rec.mgid, sizeof(ib_gid_t));\r
-       mc_req_rec.scope_state = 0x2F;  /* link-local scope, Full member with all other bits turned on */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0222: "\r
-                       "Failed to create MCG with valid join state 0xF - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* Save the mlid created in test_created_mlids map */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Created MGID:%s MLID:0x%04X\n",\r
-               inet_ntop(AF_INET6, p_mc_res->mgid.raw, gid_str,\r
-                         sizeof gid_str), cl_ntoh16(p_mc_res->mlid));\r
-       cl_map_insert(&test_created_mlids, cl_ntoh16(p_mc_res->mlid), p_mc_res);\r
-\r
-       /* o15.0.1.10 - can't check on a single client .-- obsolete -\r
-          checked by SilverStorm bug o15-0.2.4, never the less recheck */\r
-       /* o15-0.2.4 - Check a join request to already created MCG */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Check o15-0.2.4 statement...\n");\r
-       /* Try to join */\r
-       memcpy(&mc_req_rec.mgid, &p_mc_res->mgid, sizeof(ib_gid_t));\r
-       /* Request Join */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_NON_MEMBER);\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_MGID |\r
-           IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 0x1,   /* SubnAdmSet */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CC: "\r
-                       "Failed to join MCG with valid req, returned status = %s\n",\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_mc_res->scope_state & 0x7) != 0x7) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D0: "\r
-                       "Validating JoinState update failed. "\r
-                       "Expected 0x27 got 0x%02X\n", p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* o15.0.1.11: */\r
-       /* - Try to join into a MGID that exists with JoinState=SendOnlyMember -  */\r
-       /*   see that it updates JoinState. What is the routing change? */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Retry of existing MGID - See JoinState update (o15.0.1.11)...\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-\r
-       /* first, make sure  that the group exists */\r
-       mc_req_rec.scope_state = 0x21;\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CD: "\r
-                       "Failed to create/join as full member - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       mc_req_rec.scope_state = 0x22;  /* link-local scope, non-member */\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D1: "\r
-                       "Failed to update existing MGID - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State update with NonMember (o15.0.1.11)...\n");\r
-\r
-       if (p_mc_res->scope_state != 0x23) {    /* scope is LSB */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CE: "\r
-                       "Validating JoinState update failed. Expected 0x23 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Try delete current join state then update it with another value  */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking JoinState update request should return 0x22 (o15.0.1.11)...\n");\r
-\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       mc_req_rec.mgid = good_mgid;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Partially delete JoinState (o15.0.1.14)...\n");\r
-\r
-       /* link-local scope, both non-member bits,\r
-          so we should not be able to delete) */\r
-       mc_req_rec.scope_state = 0x26;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CF: "\r
-                       "Expected to fail partially update JoinState, "\r
-                       "but got %s\n", ib_get_err_str(status));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* link-local scope, NonMember bit, the FullMember bit should stay */\r
-       mc_req_rec.scope_state = 0x22;\r
-       status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D3: "\r
-                       "Failed to partially update JoinState : %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_mc_res->scope_state != 0x21) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02D4: "\r
-                       "Failed to partially update JoinState : "\r
-                       "JoinState = 0x%02X, expected 0x%02X\n",\r
-                       p_mc_res->scope_state, 0x21);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* So far successfully delete state - Now change it */\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.scope_state = 0x24;  /* link-local scope, send only  member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C0: "\r
-                       "Failed to update existing MCG - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State update with Send Only Member (o15.0.1.11)...\n");\r
-\r
-       if (p_mc_res->scope_state != 0x25) {    /* scope is MSB */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C1: "\r
-                       "Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       /* Now try to update value of join state */\r
-       mc_req_rec.scope_state = 0x21;  /* link-local scope, full member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C2: "\r
-                       "Failed to update existing MGID - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State update with Full Member\n\t\t"\r
-               "to an existing 0x5 state MCG (o15.0.1.11)...\n");\r
-\r
-       if (p_mc_res->scope_state != 0x25) {    /* scope is LSB */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C3: "\r
-                       "Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Now try to update value of join state */\r
-       mc_req_rec.scope_state = 0x22;  /* link-local scope,non member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C4: "\r
-                       "Failed to update existing MGID - got %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State update with Non Member\n\t\t"\r
-               "to an existing 0x5 state MCG (o15.0.1.11)...\n");\r
-\r
-       if (p_mc_res->scope_state != 0x27) {    /* scope is LSB */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C5: "\r
-                       "Validating JoinState update failed. Expected 0x27 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "DEBUG - Current scope_state value : 0x%02X...\n",\r
-               p_mc_res->scope_state);\r
-\r
-       /* - We can not check simple join since we have only one tester (for now) */\r
-\r
-       /* o15.0.1.12: Not Supported */\r
-       /* - The SendOnlyNonMem join should have a special treatment in the\r
-          SA but what is it ? */\r
-\r
-       /* o15.0.1.13: */\r
-       /* - Try joining with rate that does not exist in any MCG -\r
-          ERR_REQ_INVALID */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD RATE when connecting to existing MGID (o15.0.1.13)...\n");\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C6: "\r
-                       "Failed to catch BAD RATE joining an existing MGID: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Try MTU that does not exist in any MCG */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD MTU (higher than max) when connecting to "\r
-               "existing MGID (o15.0.1.13)...\n");\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = osm_ipoib_mgid;\r
-       mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C7: "\r
-                       "Failed to catch BAD RATE (higher than max) joining an existing MGID: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Try another MTU that does not exist in any MCG */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD MTU (less than min) when connecting "\r
-               "to existing MGID (o15.0.1.13)...\n");\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = osm_ipoib_mgid;\r
-       mc_req_rec.mtu = IB_MTU_LEN_256 | IB_PATH_SELECTOR_LESS_THAN << 6;\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C8: "\r
-                       "Failed to catch BAD RATE (less than min) joining an existing MGID: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* o15.0.1.14: */\r
-       /* - Try partial delete - actually updating the join state. check it. */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking partial JoinState delete request - removing NonMember (o15.0.1.14)...\n");\r
-\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       mc_req_rec.mgid = good_mgid;\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;\r
-       /* link-local scope, non member (so we should not be able to delete) */\r
-       /* but the NonMember bit should be gone */\r
-       mc_req_rec.scope_state = 0x22;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02C9: "\r
-                       "Fail to partially update JoinState during delete: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State removal of Non Member bit (o15.0.1.14)...\n");\r
-       if (p_mc_res->scope_state != 0x25) {    /* scope is MSB - now only the full member & send only member have left */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CA: "\r
-                       "Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Now use the same scope_state and delete all JoinState - leave multicast group since state is 0x0 */\r
-\r
-       mc_req_rec.scope_state = 0x25;\r
-       status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02CB: "\r
-                       "Failed to update JoinState during delete: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Validating Join State update remove (o15.0.1.14)...\n");\r
-\r
-       if (p_mc_res->scope_state != 0x25) {    /* scope is MSB - now only 0x0 so port is removed from MCG */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BF: "\r
-                       "Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",\r
-                       p_mc_res->scope_state);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try joining (not full mem) again to see the group was deleted. (should fail) */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Delete by trying to Join deleted group (o15.0.1.13)...\n");\r
-\r
-       mc_req_rec.scope_state = 0x22;  /* use non member - so if no group fail */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1,     /* join */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status != IB_REMOTE_ERROR) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BC: "\r
-                       "Succeeded Joining Deleted Group: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD Delete of Mgid membership (no prev join) (o15.0.1.15)...\n");\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = osm_ipoib_mgid;\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       mc_req_rec.scope_state = 0x21;  /* delete full member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 0,     /* delete flag */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BD: "\r
-                       "Failed to catch BAD delete from IPoIB: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Prepare another MCG for the following tests : */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Create given MGID=%s\n\t\t(o15.0.1.4)...\n",\r
-               inet_ntop(AF_INET6, osm_ipoib_mgid.raw, gid_str,\r
-                         sizeof gid_str));\r
-\r
-       mc_req_rec.mgid = good_mgid;\r
-       mc_req_rec.mgid.raw[12] = 0xAA;\r
-       mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       mc_req_rec.scope_state = 0x21;  /* Full memeber */\r
-       comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |    /* all above are required */\r
-           IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BE: "\r
-                       "Failed to create MCG for %s - got %s/%s\n",\r
-                       inet_ntop(AF_INET6, good_mgid.raw, gid_str,\r
-                                 sizeof gid_str), ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try delete with valid join state */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Full Delete of a group (o15.0.1.14)...\n");\r
-       mc_req_rec.scope_state = 0x21;  /* the FullMember is the current JoinState */\r
-       status = osmt_send_mcast_request(p_osmt, 0, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* o15.0.1.15: */\r
-       /* - Try deletion of the IPoIB MCG and get: ERR_REQ_INVALID */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking BAD Delete of IPoIB membership (no prev join) (o15.0.1.15)...\n");\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-       mc_req_rec.mgid = osm_ipoib_mgid;\r
-       mc_req_rec.rate =\r
-           IB_LINK_WIDTH_ACTIVE_1X | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       mc_req_rec.scope_state = 0x21;  /* delete full member */\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 0,     /* delete flag */\r
-                                        &mc_req_rec, comp_mask, sa_mad);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if ((status != IB_REMOTE_ERROR) ||\r
-           (sa_mad->status != IB_SA_MAD_STATUS_REQ_INVALID)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0223: "\r
-                       "Failed to catch BAD delete from IPoIB: %s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-  /**************************************************************************/\r
-       /* Checking join with invalid MTU */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Checking Join with unrealistic mtu : \n"\r
-               "\t\tFirst create new MCG than try to join it \n"\r
-               "\t\twith unrealistic MTU greater than 4096 (o15.0.1.8)...\n");\r
-\r
-       /* First create new mgrp */\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-       mc_req_rec.mtu = IB_MTU_LEN_1024 | IB_PATH_SELECTOR_EXACTLY << 6;\r
-       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02EB: "\r
-                       "Failed to create new mgrp\n");\r
-               goto Exit;\r
-       }\r
-       memcpy(&tmp_mgid, &p_mc_res->mgid, sizeof(ib_gid_t));\r
-       osm_dump_mc_record(&p_osmt->log, p_mc_res, OSM_LOG_INFO);\r
-       /* tmp_mtu = p_mc_res->mtu & 0x3F; */\r
-\r
-       /* impossible requested mtu always greater than exist in MCG */\r
-       mc_req_rec.mtu = IB_MTU_LEN_4096 | IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-       memcpy(&mc_req_rec.mgid, &tmp_mgid, sizeof(ib_gid_t));\r
-       ib_member_set_join_state(&mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);\r
-       comp_mask =\r
-           IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID |\r
-           IB_MCR_COMPMASK_JOIN_STATE |\r
-           IB_MCR_COMPMASK_MTU_SEL | IB_MCR_COMPMASK_MTU;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec, comp_mask,\r
-                                        sa_mad);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E4: "\r
-                       "Expected REMOTE ERROR got:%s/%s\n",\r
-                       ib_get_err_str(status),\r
-                       ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* - Try GetTable with PortGUID wildcarded and get back some groups. */\r
-       status = osmt_query_mcast(p_osmt);\r
-       cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(Before checking Max MCG creation): "\r
-               "Number of MC Records found in SA DB is %d\n", cnt);\r
-\r
-  /**************************************************************************/\r
-       /* Checking join on behalf of remote port gid */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Checking Proxy Join...\n");\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02E5: "\r
-                       "osmtest_get_all_recs failed on getting all node records(%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_node_rec(context.result.p_result_madw, i);\r
-               if (p_rec->node_info.port_guid != p_osmt->local_port.port_guid\r
-                   && p_rec->node_info.node_type == IB_NODE_TYPE_CA) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                               "remote port_guid = 0x%" PRIx64 "\n",\r
-                               cl_ntoh64(p_rec->node_info.port_guid));\r
-\r
-                       remote_port_guid = p_rec->node_info.port_guid;\r
-                       i = num_recs;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (remote_port_guid != 0x0) {\r
-               ib_member_set_join_state(&mc_req_rec,\r
-                                        IB_MC_REC_STATE_FULL_MEMBER);\r
-               memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-               mc_req_rec.port_gid.unicast.interface_id = remote_port_guid;\r
-               comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS;    /* all above are required */\r
-\r
-               status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec,\r
-                                                comp_mask, sa_mad);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B4: "\r
-                               "Could not join on behalf of remote port 0x%016"\r
-                               PRIx64 " remote status: %s\n",\r
-                               cl_ntoh64(remote_port_guid),\r
-                               ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               memcpy(&proxy_mgid, &p_mc_res->mgid, sizeof(ib_gid_t));\r
-\r
-               /* First try a bad deletion then good one */\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Trying deletion of remote port with local port guid\n");\r
-\r
-               osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-               ib_member_set_join_state(&mc_req_rec,\r
-                                        IB_MC_REC_STATE_FULL_MEMBER);\r
-               comp_mask =\r
-                   IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-                   IB_MCR_COMPMASK_JOIN_STATE;\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-\r
-               status = osmt_send_mcast_request(p_osmt, 0,     /* delete flag */\r
-                                                &mc_req_rec,\r
-                                                comp_mask, sa_mad);\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-               if (status == IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02A9: "\r
-                               "Successful deletion of remote port guid with local one MGID : "\r
-                               "%s, Got : %s/%s\n",\r
-                               inet_ntop(AF_INET6,\r
-                                         p_mgrp->mcmember_rec.mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               ib_get_err_str(status),\r
-                               ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Trying deletion of remote port with the right port guid\n");\r
-\r
-               osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-               ib_member_set_join_state(&mc_req_rec,\r
-                                        IB_MC_REC_STATE_FULL_MEMBER);\r
-               mc_req_rec.mgid = proxy_mgid;\r
-               mc_req_rec.port_gid.unicast.interface_id = remote_port_guid;\r
-               comp_mask =\r
-                   IB_MCR_COMPMASK_MGID |\r
-                   IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_JOIN_STATE;\r
-               status = osmt_send_mcast_request(p_osmt, 0,     /* delete flag */\r
-                                                &mc_req_rec,\r
-                                                comp_mask, sa_mad);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B0: "\r
-                               "Failed to delete mgid with remote port guid MGID : "\r
-                               "%s, Got : %s/%s\n",\r
-                               inet_ntop(AF_INET6,\r
-                                         p_mgrp->mcmember_rec.mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               ib_get_err_str(status),\r
-                               ib_get_mad_status_str((ib_mad_t *) sa_mad));\r
-                       goto Exit;\r
-               }\r
-       } else\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Could not check proxy join since could not found remote port, different from local port\n");\r
-\r
-       /* prepare init for next check */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-  /**************************************************************************/\r
-       if (p_osmt->opt.mmode > 2) {\r
-               /* Check invalid Join with max mlid which is more than the\r
-                  Mellanox switches support 0xC000+0x1000 = 0xd000 */\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                       "Checking Creation of Maximum avaliable Groups (MulticastFDBCap)...\n");\r
-               tmp_mlid = cl_ntoh16(max_mlid) - cnt;\r
-\r
-               while (tmp_mlid > 0) {\r
-                       uint16_t cur_mlid = 0;\r
-\r
-                       /* Request Set */\r
-                       ib_member_set_join_state(&mc_req_rec,\r
-                                                IB_MC_REC_STATE_FULL_MEMBER);\r
-                       /* Good Flow - mgid is 0 while giving all required fields for\r
-                          join : P_Key, Q_Key, SL, FlowLabel, Tclass */\r
-\r
-                       mc_req_rec.rate =\r
-                           IB_LINK_WIDTH_ACTIVE_1X |\r
-                           IB_PATH_SELECTOR_GREATER_THAN << 6;\r
-                       mc_req_rec.mlid = max_mlid;\r
-                       memset(&mc_req_rec.mgid, 0, sizeof(ib_gid_t));\r
-                       comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are required */\r
-                           IB_MCR_COMPMASK_MLID;\r
-                       status = osmt_send_mcast_request(p_osmt, 1, &mc_req_rec,\r
-                                                        comp_mask, sa_mad);\r
-                       if (status == IB_SUCCESS) {\r
-                               cur_mlid = cl_ntoh16(p_mc_res->mlid);\r
-                               /* Save the mlid created in test_created_mlids map */\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                                       "Created MGID:%s MLID:0x%04X\n",\r
-                                       inet_ntop(AF_INET6, p_mc_res->mgid.raw,\r
-                                                 gid_str, sizeof gid_str),\r
-                                       cl_ntoh16(p_mc_res->mlid));\r
-                               cl_map_insert(&test_created_mlids,\r
-                                             cl_ntoh16(p_mc_res->mlid),\r
-                                             p_mc_res);\r
-                       } else if (cur_mlid > cl_ntoh16(max_mlid)) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 2E1 "\r
-                                       "Successful Join with greater mlid than switches support (MulticastFDBCap) 0x%04X\n",\r
-                                       cur_mlid);\r
-                               status = IB_ERROR;\r
-                               osm_dump_mc_record(&p_osmt->log, p_mc_res,\r
-                                                  OSM_LOG_VERBOSE);\r
-                               goto Exit;\r
-                       } else if ((sa_mad->status & IB_SMP_STATUS_MASK) ==\r
-                                  IB_SA_MAD_STATUS_NO_RESOURCES)\r
-                               /* You can quietly exit the loop since no available mlid in SA DB\r
-                                  i.e. reached the maximum valid avalable mlid */\r
-                               break;\r
-                       tmp_mlid--;\r
-               }\r
-       }\r
-\r
-       /* Prepare the mc_req_rec for the rest of the flow */\r
-       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-\r
-  /**************************************************************************/\r
-       /* o15.0.1.16: */\r
-       /* - Try GetTable with PortGUID wildcarded and get back some groups. */\r
-\r
-       status = osmt_query_mcast(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B1: "\r
-                       "Failed to query multicast groups: %s\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "(Before Deletion of all MCG): "\r
-               "Number of MC Records found in SA DB is %d\n", cnt);\r
-\r
-       /* Delete all MCG that are not of IPoIB */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Cleanup all MCG that are not IPoIB...\n");\r
-\r
-       p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;\r
-       p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);\r
-       /* scan all available multicast groups in the DB and fill in the table */\r
-       while (p_mgrp != (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {\r
-               /* Only if different from IPoIB Mgid try to delete */\r
-               if (!IS_IPOIB_MGID(&p_mgrp->mcmember_rec.mgid)) {\r
-                       osmt_init_mc_query_rec(p_osmt, &mc_req_rec);\r
-                       mc_req_rec.mgid = p_mgrp->mcmember_rec.mgid;\r
-\r
-                       /* o15-0.1.4 - need to specify the oppsite state for a valid delete */\r
-                       if (!memcmp(&special_mgid, &p_mgrp->mcmember_rec.mgid,\r
-                                   sizeof(special_mgid)))\r
-                               mc_req_rec.scope_state = 0x2F;\r
-                       else\r
-                               mc_req_rec.scope_state = 0x21;\r
-                       comp_mask =\r
-                           IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |\r
-                           IB_MCR_COMPMASK_JOIN_STATE;\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                               "Sending request to delete MGID : %s"\r
-                               ", scope_state : 0x%02X\n",\r
-                               inet_ntop(AF_INET6, mc_req_rec.mgid.raw,\r
-                                         gid_str, sizeof gid_str),\r
-                               mc_req_rec.scope_state);\r
-                       status = osmt_send_mcast_request(p_osmt, 0,     /* delete flag */\r
-                                                        &mc_req_rec, comp_mask,\r
-                                                        sa_mad);\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                       "ERR 02FF: Failed to delete MGID : %s"\r
-                                       " ,\n\t\t it is not our MCG, Status : %s/%s\n",\r
-                                       inet_ntop(AF_INET6,\r
-                                                 p_mgrp->mcmember_rec.mgid.raw,\r
-                                                 gid_str, sizeof gid_str),\r
-                                       ib_get_err_str(status),\r
-                                       ib_get_mad_status_str((ib_mad_t *)\r
-                                                             sa_mad));\r
-                               fail_to_delete_mcg++;\r
-                       }\r
-               } else\r
-                       end_ipoib_cnt++;\r
-               p_mgrp = (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);\r
-       }\r
-\r
-       status = osmt_query_mcast(p_osmt);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02B2 "\r
-                       "GetTable of all records has failed - got %s\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /* If we are in single mode check flow - need to make sure all the multicast groups\r
-          that are left are not ones created during the flow.\r
-        */\r
-       if (p_osmt->opt.mmode == 1 || p_osmt->opt.mmode == 3) {\r
-               end_cnt = cl_qmap_count(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_INFO, "Status of MC Records in SA DB during the test flow:\n" "  Beginning of test\n" "       Unrelated to the test: %d\n" "       IPoIB MC Records     : %d\n" "       Total                : %d\n" "  End of test\n" "       Failed to delete     : %d\n" "       IPoIB MC Records     : %d\n" "       Total                : %d\n", mcg_outside_test_cnt,      /* Non-IPoIB that existed at the beginning */\r
-                       start_ipoib_cnt,        /* IPoIB records */\r
-                       start_cnt,      /* Total: IPoIB and MC Records unrelated to the test */\r
-                       fail_to_delete_mcg,     /* Failed to delete at the end */\r
-                       end_ipoib_cnt,  /* IPoIB records */\r
-                       end_cnt);       /* Total MC Records at the end */\r
-\r
-               /* when we compare num of MCG we should consider an outside source which create other MCGs */\r
-               if ((end_cnt - fail_to_delete_mcg - end_ipoib_cnt) !=\r
-                   (start_cnt - mcg_outside_test_cnt - start_ipoib_cnt)) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Got different number of non-IPoIB records stored in SA DB\n\t\t"\r
-                               "at Start got %d, at End got %d (IPoIB groups only)\n",\r
-                               (start_cnt - mcg_outside_test_cnt -\r
-                                start_ipoib_cnt),\r
-                               (end_cnt - fail_to_delete_mcg - end_ipoib_cnt));\r
-               }\r
-\r
-               p_mgrp_mlid_tbl = &p_osmt->exp_subn.mgrp_mlid_tbl;\r
-               p_mgrp = (osmtest_mgrp_t *) cl_qmap_head(p_mgrp_mlid_tbl);\r
-               while (p_mgrp !=\r
-                      (osmtest_mgrp_t *) cl_qmap_end(p_mgrp_mlid_tbl)) {\r
-                       uint16_t mlid =\r
-                           (uint16_t) cl_qmap_key((cl_map_item_t *) p_mgrp);\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Found MLID:0x%04X\n", mlid);\r
-                       /* Check if the mlid is in the test_created_mlids. If TRUE, then we\r
-                          didn't delete a MCgroup that was created in this flow. */\r
-                       if (cl_map_get(&test_created_mlids, mlid) != NULL) {\r
-                               /* This means that we still have an mgrp that we created!! */\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02FE: "\r
-                                       "Wasn't able to erase mgrp with MGID:%s"\r
-                                       " MLID:0x%04X\n",\r
-                                       inet_ntop(AF_INET6,\r
-                                                 p_mgrp->mcmember_rec.mgid.raw,\r
-                                                 gid_str, sizeof gid_str),\r
-                                       mlid);\r
-                               got_error = TRUE;\r
-                       } else {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                                       "Still exists %s MGID:%s\n",\r
-                                       (IS_IPOIB_MGID\r
-                                        (&p_mgrp->mcmember_rec.\r
-                                         mgid)) ? "IPoIB" : "non-IPoIB",\r
-                                       inet_ntop(AF_INET6,\r
-                                                 p_mgrp->mcmember_rec.mgid.raw,\r
-                                                 gid_str, sizeof gid_str));\r
-                       }\r
-                       p_mgrp =\r
-                           (osmtest_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);\r
-               }\r
-\r
-               if (got_error) {\r
-                       __osmt_print_all_multicast_records(p_osmt);\r
-                       status = IB_ERROR;\r
-               }\r
-       }\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/osmtest/osmt_service.c b/branches/opensm_3/user/osmtest/osmt_service.c
deleted file mode 100644 (file)
index 9921c26..0000000
+++ /dev/null
@@ -1,1587 +0,0 @@
-/*\r
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of service records testing flow..\r
- *    Top level is osmt_run_service_records_flow:\r
- *     osmt_register_service\r
- *     osmt_get_service_by_name\r
- *     osmt_get_all_services\r
- *     osmt_delete_service_by_name\r
- *\r
- */\r
-\r
-#ifndef __WIN__\r
-#include <unistd.h>\r
-#else\r
-#include <time.h>\r
-#endif\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include "osmtest.h"\r
-\r
-\r
-ib_api_status_t\r
-osmt_register_service(IN osmtest_t * const p_osmt,\r
-                     IN ib_net64_t service_id,\r
-                     IN ib_net16_t service_pkey,\r
-                     IN ib_net32_t service_lease,\r
-                     IN uint8_t service_key_lsb, IN char *service_name)\r
-{\r
-       osmv_query_req_t req;\r
-       osmv_user_query_t user;\r
-       osmtest_req_context_t context;\r
-       ib_service_record_t svc_rec;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Registering service: name: %s id: 0x%" PRIx64 "\n",\r
-               service_name, cl_ntoh64(service_id));\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-\r
-       /* set the new service record fields */\r
-       svc_rec.service_id = service_id;\r
-       svc_rec.service_pkey = service_pkey;\r
-       svc_rec.service_gid.unicast.prefix = 0;\r
-       svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;\r
-       svc_rec.service_lease = service_lease;\r
-       memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));\r
-       svc_rec.service_key[0] = service_key_lsb;\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memcpy(svc_rec.service_name, service_name,\r
-              (strlen(service_name) + 1) * sizeof(char));\r
-\r
-       /* prepare the data used for this query */\r
-       /*  sa_mad_data.method = IB_MAD_METHOD_SET; */\r
-       /*  sa_mad_data.sm_key = 0; */\r
-\r
-       context.p_osmt = p_osmt;\r
-       req.query_context = &context;\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.sm_key = 0;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-\r
-       user.method = IB_MAD_METHOD_SET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       if (ib_pkey_is_invalid(service_pkey)) {\r
-               /* if given an invalid service_pkey - don't turn the PKEY compmask on */\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;\r
-       } else {\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SPKEY |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;\r
-       }\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A01: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A02: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_register_service_with_full_key(IN osmtest_t * const p_osmt,\r
-                                   IN ib_net64_t service_id,\r
-                                   IN ib_net16_t service_pkey,\r
-                                   IN ib_net32_t service_lease,\r
-                                   IN uint8_t * service_key,\r
-                                   IN char *service_name)\r
-{\r
-       osmv_query_req_t req;\r
-       osmv_user_query_t user;\r
-       osmtest_req_context_t context;\r
-       ib_service_record_t svc_rec, *p_rec;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status;\r
-       uint8_t i, skey[16];\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Registering service: name: %s id: 0x%" PRIx64 "\n",\r
-               service_name, cl_ntoh64(service_id));\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-\r
-       /* set the new service record fields */\r
-       svc_rec.service_id = service_id;\r
-       svc_rec.service_pkey = service_pkey;\r
-       svc_rec.service_gid.unicast.prefix = 0;\r
-       svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;\r
-       svc_rec.service_lease = service_lease;\r
-       memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));\r
-       memcpy(svc_rec.service_key, service_key, 16 * sizeof(uint8_t));\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memset(skey, 0, 16 * sizeof(uint8_t));\r
-       memcpy(svc_rec.service_name, service_name,\r
-              (strlen(service_name) + 1) * sizeof(char));\r
-\r
-       /* prepare the data used for this query */\r
-       /*  sa_mad_data.method = IB_MAD_METHOD_SET; */\r
-       /*  sa_mad_data.sm_key = 0; */\r
-\r
-       context.p_osmt = p_osmt;\r
-       req.query_context = &context;\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.sm_key = 0;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-\r
-       user.method = IB_MAD_METHOD_SET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       if (ib_pkey_is_invalid(service_pkey)) {\r
-               /* if given an invalid service_pkey - don't turn the PKEY compmask on */\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;\r
-       } else {\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SPKEY |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME;\r
-       }\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A03: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A04: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check service key on context to see if match */\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Comparing service key...\n" "return key is:\n");\r
-       for (i = 0; i <= 15; i++) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "service_key sent[%u] = %u, service_key returned[%u] = %u\n",\r
-                       i, service_key[i], i, p_rec->service_key[i]);\r
-       }\r
-       /*  since c15-0.1.14 not supported all key association queries should bring in return zero in service key */\r
-       if (memcmp(skey, p_rec->service_key, 16 * sizeof(uint8_t)) != 0) {\r
-               status = IB_REMOTE_ERROR;\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A33: "\r
-                       "Data mismatch in service_key\n");\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_register_service_with_data(IN osmtest_t * const p_osmt,\r
-                               IN ib_net64_t service_id,\r
-                               IN ib_net16_t service_pkey,\r
-                               IN ib_net32_t service_lease,\r
-                               IN uint8_t service_key_lsb,\r
-                               IN uint8_t * service_data8,\r
-                               IN ib_net16_t * service_data16,\r
-                               IN ib_net32_t * service_data32,\r
-                               IN ib_net64_t * service_data64,\r
-                               IN char *service_name)\r
-{\r
-       osmv_query_req_t req;\r
-       osmv_user_query_t user;\r
-       osmtest_req_context_t context;\r
-       ib_service_record_t svc_rec, *p_rec;\r
-       osm_log_t *p_log = &p_osmt->log;\r
-       ib_api_status_t status;\r
-       /*   ib_service_record_t* p_rec; */\r
-\r
-       OSM_LOG_ENTER(p_log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Registering service: name: %s id: 0x%" PRIx64 "\n",\r
-               service_name, cl_ntoh64(service_id));\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-\r
-       /* set the new service record fields */\r
-       svc_rec.service_id = service_id;\r
-       svc_rec.service_pkey = service_pkey;\r
-       svc_rec.service_gid.unicast.prefix = 0;\r
-       svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;\r
-       svc_rec.service_lease = service_lease;\r
-       memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));\r
-       svc_rec.service_key[0] = service_key_lsb;\r
-\r
-       /*  Copy data to service_data arrays */\r
-       memcpy(svc_rec.service_data8, service_data8, 16 * sizeof(uint8_t));\r
-       memcpy(svc_rec.service_data16, service_data16, 8 * sizeof(ib_net16_t));\r
-       memcpy(svc_rec.service_data32, service_data32, 4 * sizeof(ib_net32_t));\r
-       memcpy(svc_rec.service_data64, service_data64, 2 * sizeof(ib_net64_t));\r
-\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memcpy(svc_rec.service_name, service_name,\r
-              (strlen(service_name) + 1) * sizeof(char));\r
-\r
-       /* prepare the data used for this query */\r
-       /*  sa_mad_data.method = IB_MAD_METHOD_SET; */\r
-       /*  sa_mad_data.sm_key = 0; */\r
-\r
-       context.p_osmt = p_osmt;\r
-       req.query_context = &context;\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.sm_key = 0;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-\r
-       user.method = IB_MAD_METHOD_SET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       if (ib_pkey_is_invalid(service_pkey)) {\r
-               /* if given an invalid service_pkey - don't turn the PKEY compmask on */\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY |\r
-                   IB_SR_COMPMASK_SNAME |\r
-                   IB_SR_COMPMASK_SDATA8_0 |\r
-                   IB_SR_COMPMASK_SDATA8_1 |\r
-                   IB_SR_COMPMASK_SDATA16_0 |\r
-                   IB_SR_COMPMASK_SDATA16_1 |\r
-                   IB_SR_COMPMASK_SDATA32_0 |\r
-                   IB_SR_COMPMASK_SDATA32_1 |\r
-                   IB_SR_COMPMASK_SDATA64_0 | IB_SR_COMPMASK_SDATA64_1;\r
-       } else {\r
-               user.comp_mask = IB_SR_COMPMASK_SID |\r
-                   IB_SR_COMPMASK_SGID |\r
-                   IB_SR_COMPMASK_SPKEY |\r
-                   IB_SR_COMPMASK_SLEASE |\r
-                   IB_SR_COMPMASK_SKEY |\r
-                   IB_SR_COMPMASK_SNAME |\r
-                   IB_SR_COMPMASK_SDATA8_0 |\r
-                   IB_SR_COMPMASK_SDATA8_1 |\r
-                   IB_SR_COMPMASK_SDATA16_0 |\r
-                   IB_SR_COMPMASK_SDATA16_1 |\r
-                   IB_SR_COMPMASK_SDATA32_0 |\r
-                   IB_SR_COMPMASK_SDATA32_1 |\r
-                   IB_SR_COMPMASK_SDATA64_0 | IB_SR_COMPMASK_SDATA64_1;\r
-       }\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       /*  Dump to Service Data b4 send */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Dumping service data b4 send\n");\r
-       osm_dump_service_record(&p_osmt->log, &svc_rec, OSM_LOG_VERBOSE);\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A05: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A06: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check data on context to see if match */\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Comparing service data...\n");\r
-       if (memcmp(service_data8, p_rec->service_data8, 16 * sizeof(uint8_t)) !=\r
-           0\r
-           || memcmp(service_data16, p_rec->service_data16,\r
-                     8 * sizeof(uint16_t)) != 0\r
-           || memcmp(service_data32, p_rec->service_data32,\r
-                     4 * sizeof(uint32_t)) != 0\r
-           || memcmp(service_data64, p_rec->service_data64,\r
-                     2 * sizeof(uint64_t)) != 0) {\r
-               status = IB_REMOTE_ERROR;\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Data mismatch in service_data8\n");\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_get_service_by_id_and_name(IN osmtest_t * const p_osmt,\r
-                               IN uint32_t rec_num,\r
-                               IN ib_net64_t sid,\r
-                               IN char *sr_name,\r
-                               OUT ib_service_record_t * p_out_rec)\r
-{\r
-\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmtest_req_context_t context;\r
-       osmv_query_req_t req;\r
-       ib_service_record_t svc_rec, *p_rec;\r
-       uint32_t num_recs = 0;\r
-       osmv_user_query_t user;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting service record: id: 0x%016" PRIx64\r
-               " and name: %s\n", cl_ntoh64(sid), sr_name);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       /* prepare the data used for this query */\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.sm_key = 0;\r
-\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-       memset(&user, 0, sizeof(user));\r
-       /* set the new service record fields */\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memcpy(svc_rec.service_name, sr_name,\r
-              (strlen(sr_name) + 1) * sizeof(char));\r
-       svc_rec.service_id = sid;\r
-       req.p_query_input = &user;\r
-\r
-       user.method = IB_MAD_METHOD_GET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       user.comp_mask = IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SNAME;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A07: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       num_recs = context.result.result_cnt;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               char mad_stat_err[256];\r
-\r
-               /* If the failure is due to IB_SA_MAD_STATUS_NO_RECORDS and rec_num is 0,\r
-                  then this is fine */\r
-               if (status == IB_REMOTE_ERROR)\r
-                       strcpy(mad_stat_err,\r
-                              ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                    (context.result.\r
-                                                     p_result_madw)));\r
-               else\r
-                       strcpy(mad_stat_err, ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR &&\r
-                   !strcmp(mad_stat_err, "IB_SA_MAD_STATUS_NO_RECORDS") &&\r
-                   rec_num == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "IS EXPECTED ERROR ^^^^\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A08: "\r
-                               "Query failed: %s (%s)\n",\r
-                               ib_get_err_str(status), mad_stat_err);\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (rec_num && num_recs != rec_num) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Unmatched number of records: expected: %d, received: %d\n",\r
-                       rec_num, num_recs);\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       *p_out_rec = *p_rec;\r
-\r
-       if (num_recs) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Found service record: name: %s id: 0x%016" PRIx64 "\n",\r
-                       p_rec->service_name, cl_ntoh64(p_rec->service_id));\r
-\r
-               osm_dump_service_record(&p_osmt->log, p_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Expected and found %d records\n", rec_num);\r
-\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_get_service_by_id(IN osmtest_t * const p_osmt,\r
-                      IN uint32_t rec_num,\r
-                      IN ib_net64_t sid, OUT ib_service_record_t * p_out_rec)\r
-{\r
-\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmtest_req_context_t context;\r
-       osmv_query_req_t req;\r
-       ib_service_record_t svc_rec, *p_rec;\r
-       uint32_t num_recs = 0;\r
-       osmv_user_query_t user;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting service record: id: 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(sid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       /* prepare the data used for this query */\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.sm_key = 0;\r
-\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-       memset(&user, 0, sizeof(user));\r
-       /* set the new service record fields */\r
-       svc_rec.service_id = sid;\r
-       req.p_query_input = &user;\r
-\r
-       user.method = IB_MAD_METHOD_GET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       user.comp_mask = IB_SR_COMPMASK_SID;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A09: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       num_recs = context.result.result_cnt;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               char mad_stat_err[256];\r
-\r
-               /* If the failure is due to IB_SA_MAD_STATUS_NO_RECORDS and rec_num is 0,\r
-                  then this is fine */\r
-               if (status == IB_REMOTE_ERROR)\r
-                       strcpy(mad_stat_err,\r
-                              ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                    (context.result.\r
-                                                     p_result_madw)));\r
-               else\r
-                       strcpy(mad_stat_err, ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR &&\r
-                   !strcmp(mad_stat_err, "IB_SA_MAD_STATUS_NO_RECORDS") &&\r
-                   rec_num == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "IS EXPECTED ERROR ^^^^\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0A: "\r
-                               "Query failed: %s (%s)\n",\r
-                               ib_get_err_str(status), mad_stat_err);\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (rec_num && num_recs != rec_num) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0B: "\r
-                       "Unmatched number of records: expected: %d received: %d\n",\r
-                       rec_num, num_recs);\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       *p_out_rec = *p_rec;\r
-\r
-       if (num_recs) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Found service record: name: %s id: 0x%016" PRIx64 "\n",\r
-                       p_rec->service_name, cl_ntoh64(p_rec->service_id));\r
-\r
-               osm_dump_service_record(&p_osmt->log, p_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Expected and found %d records\n", rec_num);\r
-\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_get_service_by_name_and_key(IN osmtest_t * const p_osmt,\r
-                                IN char *sr_name,\r
-                                IN uint32_t rec_num,\r
-                                IN uint8_t * skey,\r
-                                OUT ib_service_record_t * p_out_rec)\r
-{\r
-\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmtest_req_context_t context;\r
-       osmv_query_req_t req;\r
-       ib_service_record_t svc_rec, *p_rec;\r
-       uint32_t num_recs = 0, i;\r
-       osmv_user_query_t user;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting service record: name: %s and key: "\r
-               "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",\r
-               sr_name, skey[0], skey[1], skey[2], skey[3], skey[4], skey[5],\r
-               skey[6], skey[7], skey[8], skey[9], skey[10], skey[11],\r
-               skey[12], skey[13], skey[14], skey[15]);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       /* prepare the data used for this query */\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.sm_key = 0;\r
-\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-       memset(&user, 0, sizeof(user));\r
-       /* set the new service record fields */\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memcpy(svc_rec.service_name, sr_name,\r
-              (strlen(sr_name) + 1) * sizeof(char));\r
-       for (i = 0; i <= 15; i++)\r
-               svc_rec.service_key[i] = skey[i];\r
-\r
-       req.p_query_input = &user;\r
-\r
-       user.method = IB_MAD_METHOD_GET;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       user.comp_mask = IB_SR_COMPMASK_SNAME | IB_SR_COMPMASK_SKEY;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0C: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       num_recs = context.result.result_cnt;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               char mad_stat_err[256];\r
-\r
-               /* If the failure is due to IB_SA_MAD_STATUS_NO_RECORDS and rec_num is 0,\r
-                  then this is fine */\r
-               if (status == IB_REMOTE_ERROR)\r
-                       strcpy(mad_stat_err,\r
-                              ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                    (context.result.\r
-                                                     p_result_madw)));\r
-               else\r
-                       strcpy(mad_stat_err, ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR &&\r
-                   !strcmp(mad_stat_err, "IB_SA_MAD_STATUS_NO_RECORDS") &&\r
-                   rec_num == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "IS EXPECTED ERROR ^^^^\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0D: "\r
-                               "Query failed:%s (%s)\n",\r
-                               ib_get_err_str(status), mad_stat_err);\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (rec_num && num_recs != rec_num) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Unmatched number of records: expected: %d, received: %d\n",\r
-                       rec_num, num_recs);\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       *p_out_rec = *p_rec;\r
-\r
-       if (num_recs) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Found service record: name: %s id: 0x%016" PRIx64 "\n",\r
-                       sr_name, cl_ntoh64(p_rec->service_id));\r
-\r
-               osm_dump_service_record(&p_osmt->log, p_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Expected and found %d records\n", rec_num);\r
-\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-ib_api_status_t\r
-osmt_get_service_by_name(IN osmtest_t * const p_osmt,\r
-                        IN char *sr_name,\r
-                        IN uint32_t rec_num,\r
-                        OUT ib_service_record_t * p_out_rec)\r
-{\r
-\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmtest_req_context_t context;\r
-       osmv_query_req_t req;\r
-       ib_service_record_t *p_rec;\r
-       ib_svc_name_t service_name;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting service record: name: %s\n", sr_name);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       /* prepare the data used for this query */\r
-       req.query_type = OSMV_QUERY_SVC_REC_BY_NAME;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.sm_key = 0;\r
-\r
-       memset(service_name, 0, sizeof(service_name));\r
-       memcpy(service_name, sr_name, (strlen(sr_name) + 1) * sizeof(char));\r
-       req.p_query_input = service_name;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0E: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       num_recs = context.result.result_cnt;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               char mad_stat_err[256];\r
-\r
-               /*  If the failure is due to IB_SA_MAD_STATUS_NO_RECORDS and rec_num is 0,\r
-                  then this is fine */\r
-               if (status == IB_REMOTE_ERROR)\r
-                       strcpy(mad_stat_err,\r
-                              ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                    (context.result.\r
-                                                     p_result_madw)));\r
-               else\r
-                       strcpy(mad_stat_err, ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR &&\r
-                   !strcmp(mad_stat_err, "IB_SA_MAD_STATUS_NO_RECORDS") &&\r
-                   rec_num == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "IS EXPECTED ERROR ^^^^\n");\r
-                       status = IB_SUCCESS;\r
-               } else {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A0F: "\r
-                               "Query failed: %s (%s)\n",\r
-                               ib_get_err_str(status), mad_stat_err);\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       if (rec_num && num_recs != rec_num) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A10: "\r
-                       "Unmatched number of records: expected: %d, received: %d\n",\r
-                       rec_num, num_recs);\r
-               status = IB_REMOTE_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, 0);\r
-       *p_out_rec = *p_rec;\r
-\r
-       if (num_recs) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Found service record: name: %s id: 0x%016" PRIx64 "\n",\r
-                       sr_name, cl_ntoh64(p_rec->service_id));\r
-\r
-               osm_dump_service_record(&p_osmt->log, p_rec, OSM_LOG_DEBUG);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Expected and found %d records\n", rec_num);\r
-\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-ib_api_status_t\r
-osmt_get_all_services_and_check_names(IN osmtest_t * const p_osmt,\r
-                                     IN ib_svc_name_t *\r
-                                     const p_valid_service_names_arr,\r
-                                     IN uint8_t num_of_valid_names,\r
-                                     OUT uint32_t * num_services)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmtest_req_context_t context;\r
-       osmv_query_req_t req;\r
-       ib_service_record_t *p_rec;\r
-       uint32_t num_recs = 0, i, j;\r
-       uint8_t *p_checked_names;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /* Prepare tracker for the checked names */\r
-       p_checked_names =\r
-           (uint8_t *) malloc(sizeof(uint8_t) * num_of_valid_names);\r
-       for (j = 0; j < num_of_valid_names; j++) {\r
-               p_checked_names[j] = 0;\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Getting all service records\n");\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       req.query_type = OSMV_QUERY_ALL_SVC_RECS;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A12: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               if (status != IB_INVALID_PARAMETER) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A13: "\r
-                               "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               }\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Received %u records\n", num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec = osmv_get_query_svc_rec(context.result.p_result_madw, i);\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Found service record: name: %s id: 0x%016" PRIx64 "\n",\r
-                       p_rec->service_name, cl_ntoh64(p_rec->service_id));\r
-               osm_dump_service_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);\r
-               for (j = 0; j < num_of_valid_names; j++) {\r
-                       /* If the service names exist in the record, mark it as checked (1) */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                               "-I- Comparing source name : >%s<, with record name : >%s<, idx : %d\n",\r
-                               p_valid_service_names_arr[j],\r
-                               p_rec->service_name, p_checked_names[j]);\r
-                       if (strcmp\r
-                           ((char *)p_valid_service_names_arr[j],\r
-                            (char *)p_rec->service_name) == 0) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                                       "-I- The service %s is valid\n",\r
-                                       p_valid_service_names_arr[j]);\r
-                               p_checked_names[j] = 1;\r
-                               break;\r
-                       }\r
-               }\r
-       }\r
-       /* Check that all service names have been identified */\r
-       for (j = 0; j < num_of_valid_names; j++)\r
-               if (p_checked_names[j] == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A14: "\r
-                               "Missing valid service: name: %s\n",\r
-                               p_valid_service_names_arr[j]);\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       *num_services = num_recs;\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-#endif\r
-\r
-ib_api_status_t\r
-osmt_delete_service_by_name(IN osmtest_t * const p_osmt,\r
-                           IN uint8_t IsServiceExist,\r
-                           IN char *sr_name, IN uint32_t rec_num)\r
-{\r
-       osmv_query_req_t req;\r
-       osmv_user_query_t user;\r
-       osmtest_req_context_t context;\r
-       ib_service_record_t svc_rec;\r
-       ib_api_status_t status;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Trying to Delete service name: %s\n", sr_name);\r
-\r
-       memset(&svc_rec, 0, sizeof(svc_rec));\r
-\r
-       status = osmt_get_service_by_name(p_osmt, sr_name, rec_num, &svc_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A15: "\r
-                       "Failed to get service: name: %s\n", sr_name);\r
-               goto ExitNoDel;\r
-       }\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&user, 0, sizeof(user));\r
-\r
-       /* set the new service record fields */\r
-       memset(svc_rec.service_name, 0, sizeof(svc_rec.service_name));\r
-       memcpy(svc_rec.service_name, sr_name,\r
-              (strlen(sr_name) + 1) * sizeof(char));\r
-\r
-       /* prepare the data used for this query */\r
-       context.p_osmt = p_osmt;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.query_context = &context;\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;       /*  basically a don't care here */\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.sm_key = 0;\r
-\r
-       user.method = IB_MAD_METHOD_DELETE;\r
-       user.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-       user.comp_mask = IB_SR_COMPMASK_SNAME;\r
-       user.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t));\r
-       user.p_attr = &svc_rec;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A16: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-       if (IsServiceExist) {\r
-               /* If IsServiceExist = 1 then we should succeed here */\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A17: "\r
-                               "ib_query failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-\r
-                       if (status == IB_REMOTE_ERROR) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                       "ERR 4A18: Remote error = %s\n",\r
-                                       ib_get_mad_status_str\r
-                                       (osm_madw_get_mad_ptr\r
-                                        (context.result.p_result_madw)));\r
-                       }\r
-               }\r
-       } else {\r
-               /* If IsServiceExist = 0 then we should fail here */\r
-               if (status == IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A19: "\r
-                               "Succeeded to delete service: %s which "\r
-                               "shouldn't exist", sr_name);\r
-                       status = IB_ERROR;\r
-               } else {\r
-                       /* The deletion should have failed, since the service_name\r
-                          shouldn't exist. */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "IS EXPECTED ERROR ^^^^\n");\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "Failed to delete service_name: %s\n", sr_name);\r
-                       status = IB_SUCCESS;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-ExitNoDel:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
-\r
-/*\r
- * Run a complete service records flow:\r
- * - register a service\r
- * - register a service (with a lease period)\r
- * - get a service by name\r
- * - get all services / must be 2\r
- * - delete a service\r
- * - get all services / must be 1\r
- * - wait for the lease to expire\r
- * - get all services / must be 0\r
- * - get / set service by data\r
- */\r
-ib_api_status_t osmt_run_service_records_flow(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_service_record_t srv_rec;\r
-       ib_api_status_t status;\r
-       uint8_t instance, i;\r
-       uint8_t service_data8[16], service_key[16];\r
-       ib_net16_t service_data16[8];\r
-       ib_net32_t service_data32[4];\r
-       ib_net64_t service_data64[2];\r
-       uint64_t pid = getpid();\r
-       uint64_t id[7];\r
-       /* We use up to seven service names - we use the extra for bad flow */\r
-       ib_svc_name_t service_name[7];\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       /* This array contain only the valid names after registering vs SM */\r
-       ib_svc_name_t service_valid_names[3];\r
-       uint32_t num_recs = 0;\r
-#endif\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /* Init Service names */\r
-       for (i = 0; i < 7; i++) {\r
-#ifdef __WIN__\r
-               uint64_t rand_val = rand() - (uint64_t) i;\r
-#else\r
-               uint64_t rand_val = random() - (uint64_t) i;\r
-#endif\r
-               id[i] = abs((int)(pid - rand_val));\r
-               /* Just to be unique any place on any host */\r
-               sprintf((char *)(service_name[i]),\r
-                       "osmt.srvc.%" PRIu64 ".%" PRIu64, rand_val, pid);\r
-               /*printf("-I- Service Name is : %s, ID is : 0x%" PRIx64 "\n",service_name[i],id[i]); */\r
-       }\r
-\r
-       status = osmt_register_service(p_osmt, cl_ntoh64(id[0]),        /*  IN ib_net64_t      service_id, */\r
-                                      IB_DEFAULT_PKEY, /*  IN ib_net16_t      service_pkey, */\r
-                                      0xFFFFFFFF,      /*  IN ib_net32_t      service_lease, */\r
-                                      11,      /*  IN uint8_t         service_key_lsb, */\r
-                                      (char *)service_name[0]  /*  IN char            *service_name */\r
-           );\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmt_register_service(p_osmt, cl_ntoh64(id[1]),        /*  IN ib_net64_t      service_id, */\r
-                                      IB_DEFAULT_PKEY, /*  IN ib_net16_t      service_pkey, */\r
-                                      cl_hton32(0x00000004),   /*  IN ib_net32_t     service_lease, */\r
-                                      11,      /*  IN uint8_t         service_key_lsb, */\r
-                                      (char *)service_name[1]  /*  IN char            *service_name */\r
-           );\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmt_register_service(p_osmt, cl_ntoh64(id[2]),        /*  IN ib_net64_t      service_id, */\r
-                                      0,       /*  IN ib_net16_t      service_pkey, */\r
-                                      0xFFFFFFFF,      /*  IN ib_net32_t      service_lease, */\r
-                                      11,      /* Remove Service Record IN uint8_t service_key_lsb, */\r
-                                      (char *)service_name[2]  /*  IN char            *service_name */\r
-           );\r
-\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Generate 2 instances of service record with consecutive data */\r
-       for (instance = 0; instance < 2; instance++) {\r
-               /*  First, clear all arrays */\r
-               memset(service_data8, 0, 16 * sizeof(uint8_t));\r
-               memset(service_data16, 0, 8 * sizeof(uint16_t));\r
-               memset(service_data32, 0, 4 * sizeof(uint32_t));\r
-               memset(service_data64, 0, 2 * sizeof(uint64_t));\r
-               service_data8[instance] = instance + 1;\r
-               service_data16[instance] = cl_hton16(instance + 2);\r
-               service_data32[instance] = cl_hton32(instance + 3);\r
-               service_data64[instance] = cl_hton64(instance + 4);\r
-               status = osmt_register_service_with_data(p_osmt, cl_ntoh64(id[3]),      /*  IN ib_net64_t      service_id, */\r
-                                                        IB_DEFAULT_PKEY,       /*  IN ib_net16_t      service_pkey, */\r
-                                                        cl_ntoh32(10), /*  IN ib_net32_t      service_lease, */\r
-                                                        12,    /*  IN uint8_t         service_key_lsb, */\r
-                                                        service_data8, service_data16, service_data32, service_data64, /* service data structures */\r
-                                                        (char *)service_name[3]        /*  IN char            *service_name */\r
-                   );\r
-\r
-               if (status != IB_SUCCESS) {\r
-                       goto Exit;\r
-               }\r
-\r
-       }\r
-\r
-       /*  Trying to create service with zero key */\r
-       memset(service_key, 0, 16 * sizeof(uint8_t));\r
-       status = osmt_register_service_with_full_key(p_osmt, cl_ntoh64(id[5]),  /*  IN ib_net64_t      service_id, */\r
-                                                    0, /*  IN ib_net16_t      service_pkey, */\r
-                                                    0xFFFFFFFF,        /*  IN ib_net32_t      service_lease, */\r
-                                                    service_key,       /*  full service_key, */\r
-                                                    (char *)service_name[5]    /*  IN char            *service_name */\r
-           );\r
-\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Now update it with Unique key and different service name */\r
-       for (i = 0; i <= 15; i++) {\r
-               service_key[i] = i + 1;\r
-       }\r
-       status = osmt_register_service_with_full_key(p_osmt, cl_ntoh64(id[5]),  /*  IN ib_net64_t      service_id, */\r
-                                                    0, /*  IN ib_net16_t      service_pkey, */\r
-                                                    0xFFFFFFFF,        /*  IN ib_net32_t      service_lease, */\r
-                                                    service_key,       /* full service_key, */\r
-                                                    (char *)service_name[6]    /*  IN char            *service_name */\r
-           );\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /* Let OpenSM handle it */\r
-       usleep(100);\r
-\r
-       /* Make sure service_name[0] exists */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[0], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1A: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[0]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure service_name[1] exists */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[1], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1B: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[1]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure service_name[2] exists */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[2], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1C: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[2]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure service_name[3] exists. */\r
-       /* After 10 seconds the service should not exist: service_lease = 10 */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[3], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1D: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[3]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       sleep(10);\r
-\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[3], 0, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1E: "\r
-                       "Found service: name: %s that should have been "\r
-                       "deleted due to service lease expiring\n",\r
-                       (char *)service_name[3]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check that for service: id[5] only one record exists */\r
-       status = osmt_get_service_by_id(p_osmt, 1, cl_ntoh64(id[5]), &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A1F: "\r
-                       "Found number of records != 1 for "\r
-                       "service: id: 0x%016" PRIx64 "\n", id[5]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Bad Flow of Get with invalid Service ID: id[6] */\r
-       status = osmt_get_service_by_id(p_osmt, 0, cl_ntoh64(id[6]), &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A20: "\r
-                       "Found service: id: 0x%016" PRIx64 " "\r
-                       "that is invalid\n", id[6]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check by both id and service name: id[0], service_name[0] */\r
-       status = osmt_get_service_by_id_and_name(p_osmt, 1, cl_ntoh64(id[0]),\r
-                                                (char *)service_name[0],\r
-                                                &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A21: "\r
-                       "Fail to find service: id: 0x%016" PRIx64 " "\r
-                       "name: %s\n", id[0], (char *)service_name[0]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check by both id and service name: id[5], service_name[6] */\r
-       status = osmt_get_service_by_id_and_name(p_osmt, 1, cl_ntoh64(id[5]),\r
-                                                (char *)service_name[6],\r
-                                                &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A22: "\r
-                       "Fail to find service: id: 0x%016" PRIx64 " "\r
-                       "name: %s\n", id[5], (char *)service_name[6]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Bad Flow of Get with invalid name(service_name[3]) and valid ID(id[0]) */\r
-       status = osmt_get_service_by_id_and_name(p_osmt, 0, cl_ntoh64(id[0]),\r
-                                                (char *)service_name[3],\r
-                                                &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A23: "\r
-                       "Found service: id: 0x%016" PRIx64\r
-                       "name: %s which is an invalid service\n",\r
-                       id[0], (char *)service_name[3]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Bad Flow of Get with unmatched name(service_name[5]) and id(id[3]) (both valid) */\r
-       status = osmt_get_service_by_id_and_name(p_osmt, 0, cl_ntoh64(id[3]),\r
-                                                (char *)service_name[5],\r
-                                                &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A24: "\r
-                       "Found service: id: 0x%016" PRIx64\r
-                       "name: %s which is an invalid service\n",\r
-                       id[3], (char *)service_name[5]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Bad Flow of Get with service name that doesn't exist (service_name[4]) */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[4], 0, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A25: "\r
-                       "Found service: name: %s that shouldn't exist\n",\r
-                       (char *)service_name[4]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Bad Flow : Check that getting service_name[5] brings no records since another service\r
-          has been updated with the same ID (service_name[6] */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[5], 0, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A26: "\r
-                       "Found service: name: %s which is an "\r
-                       "invalid service\n", (char *)service_name[5]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Check that getting service_name[6] by name ONLY is valid,\r
-          since we do not support key&name association, also trusted queries */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[6], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A27: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[6]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Test Service Key */\r
-       memset(service_key, 0, 16 * sizeof(uint8_t));\r
-\r
-       /* Check for service_name[5] with service_key=0 - the service shouldn't\r
-          exist with this name. */\r
-       status = osmt_get_service_by_name_and_key(p_osmt,\r
-                                                 (char *)service_name[5],\r
-                                                 0, service_key, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A28: "\r
-                       "Found service: name: %s key:0 which is an "\r
-                       "invalid service (wrong name)\n",\r
-                       (char *)service_name[5]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Check for service_name[6] with service_key=0 - the service should\r
-          exist with different key. */\r
-       status = osmt_get_service_by_name_and_key(p_osmt,\r
-                                                 (char *)service_name[6],\r
-                                                 0, service_key, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A29: "\r
-                       "Found service: name: %s key: 0 which is an "\r
-                       "invalid service (wrong service_key)\n",\r
-                       (char *)service_name[6]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* check for service_name[6] with the correct service_key */\r
-       for (i = 0; i <= 15; i++)\r
-               service_key[i] = i + 1;\r
-       status = osmt_get_service_by_name_and_key(p_osmt,\r
-                                                 (char *)service_name[6],\r
-                                                 1, service_key, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2A: "\r
-                       "Fail to find service: name: %s with "\r
-                       "correct service key\n", (char *)service_name[6]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       /* These ar the only service_names which are valid */\r
-       memcpy(&service_valid_names[0], &service_name[0], sizeof(uint8_t) * 64);\r
-       memcpy(&service_valid_names[1], &service_name[2], sizeof(uint8_t) * 64);\r
-       memcpy(&service_valid_names[2], &service_name[6], sizeof(uint8_t) * 64);\r
-\r
-       status =\r
-           osmt_get_all_services_and_check_names(p_osmt, service_valid_names,\r
-                                                 3, &num_recs);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2B: "\r
-                       "Fail to find all services that should exist\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#endif\r
-\r
-       /* Delete service_name[0] */\r
-       status = osmt_delete_service_by_name(p_osmt, 1,\r
-                                            (char *)service_name[0], 1);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2C: "\r
-                       "Fail to delete service: name: %s\n",\r
-                       (char *)service_name[0]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure deletion of service_name[0] succeeded */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[0], 0, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2D: "\r
-                       "Found service: name: %s that was deleted\n",\r
-                       (char *)service_name[0]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure service_name[1] doesn't exist (expired service lease) */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[1], 0, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2E: "\r
-                       "Found service: name: %s that should have expired\n",\r
-                       (char *)service_name[1]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Make sure service_name[2] exists */\r
-       status = osmt_get_service_by_name(p_osmt,\r
-                                         (char *)service_name[2], 1, &srv_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A2F: "\r
-                       "Fail to find service: name: %s\n",\r
-                       (char *)service_name[2]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*  Bad Flow - try to delete non-existent service_name[5] */\r
-       status = osmt_delete_service_by_name(p_osmt, 0,\r
-                                            (char *)service_name[5], 0);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A30: "\r
-                       "Succeed to delete non-existent service: name: %s\n",\r
-                       (char *)service_name[5]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Delete service_name[2] */\r
-       status = osmt_delete_service_by_name(p_osmt, 1,\r
-                                            (char *)service_name[2], 1);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A31: "\r
-                       "Fail to delete service: name: %s\n",\r
-                       (char *)service_name[2]);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* Delete service_name[6] */\r
-       status = osmt_delete_service_by_name(p_osmt, 1,\r
-                                            (char *)service_name[6], 1);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 4A32: "\r
-                       "Failed to delete service name: %s\n",\r
-                       (char *)service_name[6]);\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c b/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c
deleted file mode 100644 (file)
index e82e7d8..0000000
+++ /dev/null
@@ -1,526 +0,0 @@
-/*\r
- * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of SLtoVL and VL Arbitration testing flow..\r
- *    Top level is osmt_run_slvl_and_vlarb_records_flow:\r
- *     osmt_query_all_ports_vl_arb\r
- *     osmt_query_all_ports_slvl_map\r
- *\r
- */\r
-\r
-#ifndef __WIN__\r
-#include <unistd.h>\r
-#endif\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <complib/cl_debug.h>\r
-#include "osmtest.h"\r
-\r
-static ib_api_status_t\r
-osmtest_write_vl_arb_table(IN osmtest_t * const p_osmt,\r
-                          IN FILE * fh,\r
-                          IN const ib_vl_arb_table_record_t * const p_rec)\r
-{\r
-       int result, i;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh,\r
-                        "VL_ARBITRATION_TABLE\n"\r
-                        "lid                     0x%X\n"\r
-                        "port_num                0x%X\n"\r
-                        "block                   0x%X\n",\r
-                        cl_ntoh16(p_rec->lid),\r
-                        p_rec->port_num, p_rec->block_num);\r
-\r
-       fprintf(fh, "       ");\r
-       for (i = 0; i < 32; i++)\r
-               fprintf(fh, "| %-2u ", i);\r
-       fprintf(fh, "|\nVL:    ");\r
-\r
-       for (i = 0; i < 32; i++)\r
-               fprintf(fh, "|0x%02X", p_rec->vl_arb_tbl.vl_entry[i].vl);\r
-       fprintf(fh, "|\nWEIGHT:");\r
-\r
-       for (i = 0; i < 32; i++)\r
-               fprintf(fh, "|0x%02X", p_rec->vl_arb_tbl.vl_entry[i].weight);\r
-       fprintf(fh, "|\nEND\n\n");\r
-\r
-       /*  Exit: */\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * GET A SINGLE PORT INFO BY NODE LID AND PORT NUMBER\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmt_query_vl_arb(IN osmtest_t * const p_osmt,\r
-                 IN ib_net16_t const lid,\r
-                 IN uint8_t const port_num,\r
-                 IN uint8_t const block_num, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_vl_arb_table_record_t record, *p_rec;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Getting VL_Arbitration Table for port with LID 0x%X Num:0x%X\n",\r
-               cl_ntoh16(lid), port_num);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       record.lid = lid;\r
-       record.port_num = port_num;\r
-       record.block_num = block_num;\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0405: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0466: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* ok it worked */\r
-       p_rec = osmv_get_query_result(context.result.p_result_madw, 0);\r
-       if (fh) {\r
-               osmtest_write_vl_arb_table(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmt_query_all_ports_vl_arb(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       cl_status_t status = CL_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-       port_t *p_src_port;\r
-       uint8_t block, anyErr = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Obtaining ALL Ports VL Arbitration Tables\n");\r
-\r
-       /*\r
-        * Go over all ports that exist in the subnet\r
-        * get the relevant VLarbs\r
-        */\r
-\r
-       p_tbl = &p_osmt->exp_subn.port_key_tbl;\r
-\r
-       p_src_port = (port_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_src_port != (port_t *) cl_qmap_end(p_tbl)) {\r
-\r
-               /* HACK we use capability_mask to know diff a CA port from switch port */\r
-               if (p_src_port->rec.port_info.capability_mask) {\r
-                       /* this is an hca port */\r
-                       for (block = 1; block <= 4; block++) {\r
-                               /*  NOTE to comply we must set port number to 0 and the SA should figure it out */\r
-                               /*  since it is a CA port */\r
-                               status =\r
-                                   osmt_query_vl_arb(p_osmt,\r
-                                                     p_src_port->rec.lid, 0,\r
-                                                     block, fh);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0467: "\r
-                                               "Failed to get Lid:0x%X Port:0x%X (%s)\n",\r
-                                               cl_ntoh16(p_src_port->rec.lid),\r
-                                               0, ib_get_err_str(status));\r
-                                       anyErr = 1;\r
-                               }\r
-                       }\r
-               } else {\r
-                       /* this is a switch port */\r
-                       for (block = 1; block <= 4; block++) {\r
-                               status =\r
-                                   osmt_query_vl_arb(p_osmt,\r
-                                                     p_src_port->rec.lid,\r
-                                                     p_src_port->rec.port_num,\r
-                                                     block, fh);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0468: "\r
-                                               "Failed to get Lid:0x%X Port:0x%X (%s)\n",\r
-                                               cl_ntoh16(p_src_port->rec.lid),\r
-                                               p_src_port->rec.port_num,\r
-                                               ib_get_err_str(status));\r
-                                       anyErr = 1;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               p_src_port = (port_t *) cl_qmap_next(&p_src_port->map_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       if (anyErr) {\r
-               status = IB_ERROR;\r
-       }\r
-       return (status);\r
-}\r
-\r
-/*******************************************************************************\r
- SLtoVL\r
-*******************************************************************************/\r
-static ib_api_status_t\r
-osmtest_write_slvl_map_table(IN osmtest_t * const p_osmt,\r
-                            IN FILE * fh,\r
-                            IN const ib_slvl_table_record_t * const p_rec)\r
-{\r
-       int result, i;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh,\r
-                        "SLtoVL_MAP_TABLE\n"\r
-                        "lid                     0x%X\n"\r
-                        "in_port_num             0x%X\n"\r
-                        "out_port_num            0x%X\n",\r
-                        cl_ntoh16(p_rec->lid),\r
-                        p_rec->in_port_num, p_rec->out_port_num);\r
-\r
-       fprintf(fh, "SL:");\r
-       for (i = 0; i < 16; i++)\r
-               fprintf(fh, "| %-2u  ", i);\r
-       fprintf(fh, "|\nVL:");\r
-\r
-       for (i = 0; i < 16; i++)\r
-               fprintf(fh, "| 0x%01X ",\r
-                       ib_slvl_table_get(&p_rec->slvl_tbl, (uint8_t) i));\r
-       fprintf(fh, "|\nEND\n\n");\r
-\r
-       /*  Exit: */\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * GET A SINGLE PORT INFO BY NODE LID AND PORT NUMBER\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmt_query_slvl_map(IN osmtest_t * const p_osmt,\r
-                   IN ib_net16_t const lid,\r
-                   IN uint8_t const out_port_num,\r
-                   IN uint8_t const in_port_num, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_slvl_table_record_t record, *p_rec;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Getting SLtoVL Map Table for out-port with LID 0x%X Num:0x%X from In-Port:0x%X\n",\r
-               cl_ntoh16(lid), out_port_num, in_port_num);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       record.lid = lid;\r
-       record.in_port_num = in_port_num;\r
-       record.out_port_num = out_port_num;\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_SLVL_BY_LID_AND_PORTS;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0469: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0470: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* ok it worked */\r
-       p_rec = osmv_get_query_result(context.result.p_result_madw, 0);\r
-       if (fh) {\r
-               osmtest_write_slvl_map_table(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmt_query_all_ports_slvl_map(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       cl_status_t status = CL_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-       port_t *p_src_port;\r
-       uint8_t in_port, anyErr = 0, num_ports;\r
-       node_t *p_node;\r
-       const cl_qmap_t *p_node_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Go over all ports that exist in the subnet\r
-        * get the relevant SLtoVLs\r
-        */\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Obtaining ALL Ports (to other ports) SLtoVL Maps\n");\r
-\r
-       p_tbl = &p_osmt->exp_subn.port_key_tbl;\r
-       p_node_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-\r
-       p_src_port = (port_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_src_port != (port_t *) cl_qmap_end(p_tbl)) {\r
-\r
-               /* HACK we use capability_mask to know diff a CA port from switch port */\r
-               if (p_src_port->rec.port_info.capability_mask) {\r
-                       /* this is an hca port */\r
-                       /*  NOTE to comply we must set port number to 0 and the SA should figure it out */\r
-                       /*  since it is a CA port */\r
-                       status =\r
-                           osmt_query_slvl_map(p_osmt, p_src_port->rec.lid, 0,\r
-                                               0, fh);\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0471: "\r
-                                       "Failed to get Lid:0x%X In-Port:0x%X Out-Port:0x%X(%s)\n",\r
-                                       cl_ntoh16(p_src_port->rec.lid), 0, 0,\r
-                                       ib_get_err_str(status));\r
-                               anyErr = 1;\r
-                       }\r
-               } else {\r
-                       /* this is a switch port */\r
-                       /* get the node */\r
-                       p_node =\r
-                           (node_t *) cl_qmap_get(p_node_tbl,\r
-                                                  p_src_port->rec.lid);\r
-                       if (p_node == (node_t *) cl_qmap_end(p_node_tbl)) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0472: "\r
-                                       "Failed to get Node by Lid:0x%X\n",\r
-                                       p_src_port->rec.lid);\r
-                               goto Exit;\r
-                       }\r
-\r
-                       num_ports = p_node->rec.node_info.num_ports;\r
-\r
-                       for (in_port = 1; in_port <= num_ports; in_port++) {\r
-                               status =\r
-                                   osmt_query_slvl_map(p_osmt,\r
-                                                       p_src_port->rec.lid,\r
-                                                       p_src_port->rec.\r
-                                                       port_num, in_port, fh);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0473: "\r
-                                               "Failed to get Lid:0x%X In-Port:0x%X Out-Port:0x%X (%s)\n",\r
-                                               cl_ntoh16(p_src_port->rec.lid),\r
-                                               p_src_port->rec.port_num,\r
-                                               in_port,\r
-                                               ib_get_err_str(status));\r
-                                       anyErr = 1;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               p_src_port = (port_t *) cl_qmap_next(&p_src_port->map_item);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       if (anyErr) {\r
-               status = IB_ERROR;\r
-       }\r
-       return (status);\r
-}\r
-\r
-/*\r
- * Run a vl arbitration queries and sl2vl maps queries flow:\r
- * Good flow:\r
- * - for each physical port on the network - obtain the VL Arb\r
- * - for each CA physical port obtain its SLtoVL Map\r
- * - for each SW physical port (out) obtain the SLtoVL Map to each other port\r
- * BAD flow:\r
- * - Try get with multiple results\r
- * - Try gettable\r
- * - Try providing non existing port\r
- */\r
-ib_api_status_t\r
-osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status;\r
-       FILE *fh;\r
-       ib_net16_t test_lid;\r
-       uint8_t lmc;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       fh = fopen("qos.txt", "w");\r
-\r
-       /* go over all ports in the subnet */\r
-       status = osmt_query_all_ports_vl_arb(p_osmt, fh);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmt_query_all_ports_slvl_map(p_osmt, fh);\r
-       if (status != IB_SUCCESS) {\r
-               goto Exit;\r
-       }\r
-\r
-       /* If LMC > 0, test non base LID SA QoS Record requests */\r
-       status =\r
-           osmtest_get_local_port_lmc(p_osmt, p_osmt->local_port.lid, &lmc);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (lmc != 0) {\r
-               test_lid = cl_ntoh16(p_osmt->local_port.lid + 1);\r
-\r
-               status = osmt_query_vl_arb(p_osmt, test_lid, 0, 1, NULL);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               status = osmt_query_slvl_map(p_osmt, test_lid, 0, 0, NULL);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-Exit:\r
-       fclose(fh);\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return status;\r
-}\r
diff --git a/branches/opensm_3/user/osmtest/osmtest.c b/branches/opensm_3/user/osmtest/osmtest.c
deleted file mode 100644 (file)
index 4c03370..0000000
+++ /dev/null
@@ -1,7410 +0,0 @@
-/*\r
- * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
- * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
- *\r
- * This software is available to you under a choice of one of two\r
- * licenses.  You may choose to be licensed under the terms of the GNU\r
- * General Public License (GPL) Version 2, available from the file\r
- * COPYING in the main directory of this source tree, or the\r
- * OpenIB.org BSD license below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-/* TODO : Check why we dont free the cl_qmap_items we store when reading DB */\r
-\r
-/*\r
- * Abstract:\r
- *    Implementation of osmtest_t.\r
- *    This object represents the OSMTest Test object.\r
- *\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <sys/time.h>\r
-#include <complib/cl_debug.h>\r
-#include "osmtest.h"\r
-\r
-#define POOL_MIN_ITEMS  64\r
-#define MAX_LOCAL_IBPORTS 64\r
-\r
-typedef struct _osmtest_sm_info_rec {\r
-       ib_net64_t sm_guid;\r
-       ib_net16_t lid;\r
-       uint8_t priority;\r
-       uint8_t sm_state;\r
-} osmtest_sm_info_rec_t;\r
-\r
-typedef struct _osmtest_inform_info {\r
-       boolean_t subscribe;\r
-       ib_net32_t qpn;\r
-       ib_net16_t trap;\r
-} osmtest_inform_info_t;\r
-\r
-typedef struct _osmtest_inform_info_rec {\r
-       ib_gid_t subscriber_gid;\r
-       ib_net16_t subscriber_enum;\r
-} osmtest_inform_info_rec_t;\r
-\r
-typedef enum _osmtest_token_val {\r
-       OSMTEST_TOKEN_COMMENT = 0,\r
-       OSMTEST_TOKEN_END,\r
-       OSMTEST_TOKEN_DEFINE_NODE,\r
-       OSMTEST_TOKEN_DEFINE_PORT,\r
-       OSMTEST_TOKEN_DEFINE_PATH,\r
-       OSMTEST_TOKEN_DEFINE_LINK,\r
-       OSMTEST_TOKEN_LID,\r
-       OSMTEST_TOKEN_BASE_VERSION,\r
-       OSMTEST_TOKEN_CLASS_VERSION,\r
-       OSMTEST_TOKEN_NODE_TYPE,\r
-       OSMTEST_TOKEN_NUM_PORTS,\r
-       OSMTEST_TOKEN_SYS_GUID,\r
-       OSMTEST_TOKEN_NODE_GUID,\r
-       OSMTEST_TOKEN_PORT_GUID,\r
-       OSMTEST_TOKEN_PARTITION_CAP,\r
-       OSMTEST_TOKEN_DEVICE_ID,\r
-       OSMTEST_TOKEN_REVISION,\r
-       OSMTEST_TOKEN_PORT_NUM,\r
-       OSMTEST_TOKEN_VENDOR_ID,\r
-       OSMTEST_TOKEN_DGID,\r
-       OSMTEST_TOKEN_SGID,\r
-       OSMTEST_TOKEN_DLID,\r
-       OSMTEST_TOKEN_SLID,\r
-       OSMTEST_TOKEN_HOP_FLOW_RAW,\r
-       OSMTEST_TOKEN_TCLASS,\r
-       OSMTEST_TOKEN_NUM_PATH,\r
-       OSMTEST_TOKEN_PKEY,\r
-       OSMTEST_TOKEN_SL,\r
-       OSMTEST_TOKEN_RATE,\r
-       OSMTEST_TOKEN_PKT_LIFE,\r
-       OSMTEST_TOKEN_PREFERENCE,\r
-       OSMTEST_TOKEN_MKEY,\r
-       OSMTEST_TOKEN_SUBN_PREF,\r
-       OSMTEST_TOKEN_BASE_LID,\r
-       OSMTEST_TOKEN_SM_BASE_LID,\r
-       OSMTEST_TOKEN_CAP_MASK,\r
-       OSMTEST_TOKEN_DIAG_CODE,\r
-       OSMTEST_TOKEN_MKEY_LEASE_PER,\r
-       OSMTEST_TOKEN_LOC_PORT_NUM,\r
-       OSMTEST_TOKEN_LINK_WID_EN,\r
-       OSMTEST_TOKEN_LINK_WID_SUP,\r
-       OSMTEST_TOKEN_LINK_WID_ACT,\r
-       OSMTEST_TOKEN_LINK_SPEED_SUP,\r
-       OSMTEST_TOKEN_PORT_STATE,\r
-       OSMTEST_TOKEN_STATE_INFO2,\r
-       OSMTEST_TOKEN_MKEY_PROT_BITS,\r
-       OSMTEST_TOKEN_LMC,\r
-       OSMTEST_TOKEN_LINK_SPEED,\r
-       OSMTEST_TOKEN_MTU_SMSL,\r
-       OSMTEST_TOKEN_VL_CAP,\r
-       OSMTEST_TOKEN_VL_HIGH_LIMIT,\r
-       OSMTEST_TOKEN_VL_ARB_HIGH_CAP,\r
-       OSMTEST_TOKEN_VL_ARB_LOW_CAP,\r
-       OSMTEST_TOKEN_MTU_CAP,\r
-       OSMTEST_TOKEN_VL_STALL_LIFE,\r
-       OSMTEST_TOKEN_VL_ENFORCE,\r
-       OSMTEST_TOKEN_MKEY_VIOL,\r
-       OSMTEST_TOKEN_PKEY_VIOL,\r
-       OSMTEST_TOKEN_QKEY_VIOL,\r
-       OSMTEST_TOKEN_GUID_CAP,\r
-       OSMTEST_TOKEN_SUBN_TIMEOUT,\r
-       OSMTEST_TOKEN_RESP_TIME_VAL,\r
-       OSMTEST_TOKEN_ERR_THRESHOLD,\r
-       OSMTEST_TOKEN_MTU,\r
-       OSMTEST_TOKEN_FROMLID,\r
-       OSMTEST_TOKEN_FROMPORTNUM,\r
-       OSMTEST_TOKEN_TOPORTNUM,\r
-       OSMTEST_TOKEN_TOLID,\r
-       OSMTEST_TOKEN_UNKNOWN\r
-} osmtest_token_val_t;\r
-\r
-typedef struct _osmtest_token {\r
-       osmtest_token_val_t val;\r
-       size_t str_size;\r
-       const char *str;\r
-} osmtest_token_t;\r
-\r
-const osmtest_token_t token_array[] = {\r
-       {OSMTEST_TOKEN_COMMENT, 1, "#"},\r
-       {OSMTEST_TOKEN_END, 3, "END"},\r
-       {OSMTEST_TOKEN_DEFINE_NODE, 11, "DEFINE_NODE"},\r
-       {OSMTEST_TOKEN_DEFINE_PORT, 11, "DEFINE_PORT"},\r
-       {OSMTEST_TOKEN_DEFINE_PATH, 11, "DEFINE_PATH"},\r
-       {OSMTEST_TOKEN_DEFINE_LINK, 11, "DEFINE_LINK"},\r
-       {OSMTEST_TOKEN_LID, 3, "LID"},\r
-       {OSMTEST_TOKEN_BASE_VERSION, 12, "BASE_VERSION"},\r
-       {OSMTEST_TOKEN_CLASS_VERSION, 13, "CLASS_VERSION"},\r
-       {OSMTEST_TOKEN_NODE_TYPE, 9, "NODE_TYPE"},\r
-       {OSMTEST_TOKEN_NUM_PORTS, 9, "NUM_PORTS"},\r
-       {OSMTEST_TOKEN_SYS_GUID, 8, "SYS_GUID"},\r
-       {OSMTEST_TOKEN_NODE_GUID, 9, "NODE_GUID"},\r
-       {OSMTEST_TOKEN_PORT_GUID, 9, "PORT_GUID"},\r
-       {OSMTEST_TOKEN_PARTITION_CAP, 13, "PARTITION_CAP"},\r
-       {OSMTEST_TOKEN_DEVICE_ID, 9, "DEVICE_ID"},\r
-       {OSMTEST_TOKEN_REVISION, 8, "REVISION"},\r
-       {OSMTEST_TOKEN_PORT_NUM, 8, "PORT_NUM"},\r
-       {OSMTEST_TOKEN_VENDOR_ID, 9, "VENDOR_ID"},\r
-       {OSMTEST_TOKEN_DGID, 4, "DGID"},\r
-       {OSMTEST_TOKEN_SGID, 4, "SGID"},\r
-       {OSMTEST_TOKEN_DLID, 4, "DLID"},\r
-       {OSMTEST_TOKEN_SLID, 4, "SLID"},\r
-       {OSMTEST_TOKEN_HOP_FLOW_RAW, 12, "HOP_FLOW_RAW"},\r
-       {OSMTEST_TOKEN_TCLASS, 6, "TCLASS"},\r
-       {OSMTEST_TOKEN_NUM_PATH, 8, "NUM_PATH"},\r
-       {OSMTEST_TOKEN_PKEY, 4, "PKEY"},\r
-       {OSMTEST_TOKEN_SL, 2, "SL"},\r
-       {OSMTEST_TOKEN_RATE, 4, "RATE"},\r
-       {OSMTEST_TOKEN_PKT_LIFE, 8, "PKT_LIFE"},\r
-       {OSMTEST_TOKEN_PREFERENCE, 10, "PREFERENCE"},\r
-       {OSMTEST_TOKEN_MKEY, 4, "M_KEY"},\r
-       {OSMTEST_TOKEN_SUBN_PREF, 13, "SUBNET_PREFIX"},\r
-       {OSMTEST_TOKEN_BASE_LID, 8, "BASE_LID"},\r
-       {OSMTEST_TOKEN_SM_BASE_LID, 18, "MASTER_SM_BASE_LID"},\r
-       {OSMTEST_TOKEN_CAP_MASK, 15, "CAPABILITY_MASK"},\r
-       {OSMTEST_TOKEN_DIAG_CODE, 9, "DIAG_CODE"},\r
-       {OSMTEST_TOKEN_MKEY_LEASE_PER, 18, "m_key_lease_period"},\r
-       {OSMTEST_TOKEN_LOC_PORT_NUM, 14, "local_port_num"},\r
-       {OSMTEST_TOKEN_LINK_WID_EN, 18, "link_width_enabled"},\r
-       {OSMTEST_TOKEN_LINK_WID_SUP, 20, "link_width_supported"},\r
-       {OSMTEST_TOKEN_LINK_WID_ACT, 17, "link_width_active"},\r
-       {OSMTEST_TOKEN_LINK_SPEED_SUP, 20, "link_speed_supported"},\r
-       {OSMTEST_TOKEN_PORT_STATE, 10, "port_state"},\r
-       {OSMTEST_TOKEN_STATE_INFO2, 10, "state_info2"},\r
-       {OSMTEST_TOKEN_MKEY_PROT_BITS, 3, "mpb"},\r
-       {OSMTEST_TOKEN_LMC, 3, "lmc"},\r
-       {OSMTEST_TOKEN_LINK_SPEED, 10, "link_speed"},\r
-       {OSMTEST_TOKEN_MTU_SMSL, 8, "mtu_smsl"},\r
-       {OSMTEST_TOKEN_VL_CAP, 6, "vl_cap"},\r
-       {OSMTEST_TOKEN_VL_HIGH_LIMIT, 13, "vl_high_limit"},\r
-       {OSMTEST_TOKEN_VL_ARB_HIGH_CAP, 15, "vl_arb_high_cap"},\r
-       {OSMTEST_TOKEN_VL_ARB_LOW_CAP, 14, "vl_arb_low_cap"},\r
-       {OSMTEST_TOKEN_MTU_CAP, 7, "mtu_cap"},\r
-       {OSMTEST_TOKEN_VL_STALL_LIFE, 13, "vl_stall_life"},\r
-       {OSMTEST_TOKEN_VL_ENFORCE, 10, "vl_enforce"},\r
-       {OSMTEST_TOKEN_MKEY_VIOL, 16, "m_key_violations"},\r
-       {OSMTEST_TOKEN_PKEY_VIOL, 16, "p_key_violations"},\r
-       {OSMTEST_TOKEN_QKEY_VIOL, 16, "q_key_violations"},\r
-       {OSMTEST_TOKEN_GUID_CAP, 8, "guid_cap"},\r
-       {OSMTEST_TOKEN_SUBN_TIMEOUT, 14, "subnet_timeout"},\r
-       {OSMTEST_TOKEN_RESP_TIME_VAL, 15, "resp_time_value"},\r
-       {OSMTEST_TOKEN_ERR_THRESHOLD, 15, "error_threshold"},\r
-       {OSMTEST_TOKEN_MTU, 3, "MTU"},  /*  must be after the other mtu... tokens. */\r
-       {OSMTEST_TOKEN_FROMLID, 8, "from_lid"},\r
-       {OSMTEST_TOKEN_FROMPORTNUM, 13, "from_port_num"},\r
-       {OSMTEST_TOKEN_TOPORTNUM, 11, "to_port_num"},\r
-       {OSMTEST_TOKEN_TOLID, 6, "to_lid"},\r
-       {OSMTEST_TOKEN_UNKNOWN, 0, ""}  /* must be last entry */\r
-};\r
-\r
-#define IB_MAD_STATUS_CLASS_MASK       (CL_HTON16(0xFF00))\r
-\r
-static const char ib_mad_status_str_busy[] = "IB_MAD_STATUS_BUSY";\r
-static const char ib_mad_status_str_redirect[] = "IB_MAD_STATUS_REDIRECT";\r
-static const char ib_mad_status_str_unsup_class_ver[] =\r
-    "IB_MAD_STATUS_UNSUP_CLASS_VER";\r
-static const char ib_mad_status_str_unsup_method[] =\r
-    "IB_MAD_STATUS_UNSUP_METHOD";\r
-static const char ib_mad_status_str_unsup_method_attr[] =\r
-    "IB_MAD_STATUS_UNSUP_METHOD_ATTR";\r
-static const char ib_mad_status_str_invalid_field[] =\r
-    "IB_MAD_STATUS_INVALID_FIELD";\r
-static const char ib_mad_status_str_no_resources[] =\r
-    "IB_SA_MAD_STATUS_NO_RESOURCES";\r
-static const char ib_mad_status_str_req_invalid[] =\r
-    "IB_SA_MAD_STATUS_REQ_INVALID";\r
-static const char ib_mad_status_str_no_records[] =\r
-    "IB_SA_MAD_STATUS_NO_RECORDS";\r
-static const char ib_mad_status_str_too_many_records[] =\r
-    "IB_SA_MAD_STATUS_TOO_MANY_RECORDS";\r
-static const char ib_mad_status_str_invalid_gid[] =\r
-    "IB_SA_MAD_STATUS_INVALID_GID";\r
-static const char ib_mad_status_str_insuf_comps[] =\r
-    "IB_SA_MAD_STATUS_INSUF_COMPS";\r
-static const char generic_or_str[] = " | ";\r
-\r
-const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad)\r
-{\r
-       static char line[512];\r
-       uint32_t offset = 0;\r
-       ib_net16_t status;\r
-       boolean_t first = TRUE;\r
-\r
-       line[offset] = '\0';\r
-\r
-       status = (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-\r
-       if (status == 0) {\r
-               strcat(&line[offset], "IB_SUCCESS");\r
-               return (line);\r
-       }\r
-\r
-       if (status & IB_MAD_STATUS_BUSY) {\r
-               strcat(&line[offset], ib_mad_status_str_busy);\r
-               offset += sizeof(ib_mad_status_str_busy);\r
-       }\r
-       if (status & IB_MAD_STATUS_REDIRECT) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_redirect);\r
-               offset += sizeof(ib_mad_status_str_redirect) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_INVALID_FIELD) ==\r
-           IB_MAD_STATUS_UNSUP_CLASS_VER) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_unsup_class_ver);\r
-               offset += sizeof(ib_mad_status_str_unsup_class_ver) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_INVALID_FIELD) ==\r
-           IB_MAD_STATUS_UNSUP_METHOD) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_unsup_method);\r
-               offset += sizeof(ib_mad_status_str_unsup_method) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_INVALID_FIELD) ==\r
-           IB_MAD_STATUS_UNSUP_METHOD_ATTR) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_unsup_method_attr);\r
-               offset += sizeof(ib_mad_status_str_unsup_method_attr) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_INVALID_FIELD) ==\r
-           IB_MAD_STATUS_INVALID_FIELD) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_invalid_field);\r
-               offset += sizeof(ib_mad_status_str_invalid_field) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) ==\r
-           IB_SA_MAD_STATUS_NO_RESOURCES) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_no_resources);\r
-               offset += sizeof(ib_mad_status_str_no_resources) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_REQ_INVALID) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_req_invalid);\r
-               offset += sizeof(ib_mad_status_str_req_invalid) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_NO_RECORDS) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_no_records);\r
-               offset += sizeof(ib_mad_status_str_no_records) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) ==\r
-           IB_SA_MAD_STATUS_TOO_MANY_RECORDS) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_too_many_records);\r
-               offset += sizeof(ib_mad_status_str_too_many_records) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_INVALID_GID) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_invalid_gid);\r
-               offset += sizeof(ib_mad_status_str_invalid_gid) - 1;\r
-       }\r
-       if ((status & IB_MAD_STATUS_CLASS_MASK) == IB_SA_MAD_STATUS_INSUF_COMPS) {\r
-               if (!first) {\r
-                       strcat(&line[offset], generic_or_str);\r
-                       offset += sizeof(generic_or_str) - 1;\r
-               }\r
-               first = FALSE;\r
-               strcat(&line[offset], ib_mad_status_str_insuf_comps);\r
-               offset += sizeof(ib_mad_status_str_insuf_comps) - 1;\r
-       }\r
-\r
-       return (line);\r
-}\r
-\r
-void subnet_construct(IN subnet_t * const p_subn)\r
-{\r
-       cl_qmap_init(&p_subn->link_tbl);\r
-       cl_qmap_init(&p_subn->node_lid_tbl);\r
-       cl_qmap_init(&p_subn->node_guid_tbl);\r
-       cl_qmap_init(&p_subn->mgrp_mlid_tbl);\r
-\r
-       /* NO WAY TO HAVE UNIQUE PORT BY LID OR GUID */\r
-       /* cl_qmap_init( &p_subn->port_lid_tbl ); */\r
-       /* cl_qmap_init( &p_subn->port_guid_tbl ); */\r
-\r
-       /* port key is a lid and num pair */\r
-       cl_qmap_init(&p_subn->port_key_tbl);\r
-       cl_qmap_init(&p_subn->path_tbl);\r
-}\r
-\r
-cl_status_t subnet_init(IN subnet_t * const p_subn)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       subnet_construct(p_subn);\r
-\r
-       return (status);\r
-}\r
-\r
-void osmtest_construct(IN osmtest_t * const p_osmt)\r
-{\r
-       memset(p_osmt, 0, sizeof(*p_osmt));\r
-       osm_log_construct(&p_osmt->log);\r
-       subnet_construct(&p_osmt->exp_subn);\r
-}\r
-\r
-void osmtest_destroy(IN osmtest_t * const p_osmt)\r
-{\r
-       cl_map_item_t *p_item, *p_next_item;\r
-\r
-       /* Currently there is a problem with IBAL exit flow - memory overrun,\r
-          so bypass vendor deletion - it will be cleaned by the Windows OS */\r
-#ifndef __WIN__\r
-       if (p_osmt->p_vendor)\r
-               osm_vendor_delete(&p_osmt->p_vendor);\r
-#endif\r
-\r
-       cl_qpool_destroy(&p_osmt->port_pool);\r
-       cl_qpool_destroy(&p_osmt->node_pool);\r
-\r
-       /* destroy the qmap tables */\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.link_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.link_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.mgrp_mlid_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.mgrp_mlid_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.node_guid_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.node_guid_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.node_lid_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.node_lid_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.path_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.path_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-       p_next_item = cl_qmap_head(&p_osmt->exp_subn.port_key_tbl);\r
-       while (p_next_item != cl_qmap_end(&p_osmt->exp_subn.port_key_tbl)) {\r
-               p_item = p_next_item;\r
-               p_next_item = cl_qmap_next(p_item);\r
-               free(p_item);\r
-       }\r
-\r
-       osm_log_destroy(&p_osmt->log);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_init(IN osmtest_t * const p_osmt,\r
-            IN const osmtest_opt_t * const p_opt,\r
-            IN const osm_log_level_t log_flags)\r
-{\r
-       ib_api_status_t status;\r
-\r
-       /* Can't use log macros here, since we're initializing the log. */\r
-       osmtest_construct(p_osmt);\r
-\r
-       status = osm_log_init_v2(&p_osmt->log, p_opt->force_log_flush,\r
-                                0x0001, p_opt->log_file, 0, TRUE);\r
-       if (status != IB_SUCCESS)\r
-               return (status);\r
-\r
-       /* but we do not want any extra stuff here */\r
-       osm_log_set_level(&p_osmt->log, log_flags);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_FUNCS, "[\n");\r
-\r
-       p_osmt->opt = *p_opt;\r
-\r
-       status = cl_qpool_init(&p_osmt->node_pool, POOL_MIN_ITEMS, 0,\r
-                              POOL_MIN_ITEMS, sizeof(node_t), NULL, NULL,\r
-                              NULL);\r
-       CL_ASSERT(status == CL_SUCCESS);\r
-\r
-       status = cl_qpool_init(&p_osmt->port_pool, POOL_MIN_ITEMS, 0,\r
-                              POOL_MIN_ITEMS, sizeof(port_t), NULL, NULL,\r
-                              NULL);\r
-       CL_ASSERT(status == CL_SUCCESS);\r
-\r
-       p_osmt->p_vendor = osm_vendor_new(&p_osmt->log,\r
-                                         p_opt->transaction_timeout);\r
-\r
-       if (p_osmt->p_vendor == NULL) {\r
-               status = IB_INSUFFICIENT_RESOURCES;\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0001: "\r
-                       "Unable to allocate vendor object");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       osm_mad_pool_construct(&p_osmt->mad_pool);\r
-       status = osm_mad_pool_init(&p_osmt->mad_pool);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-Exit:\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_FUNCS, "]\n");\r
-       return (status);\r
-}\r
-\r
-void osmtest_query_res_cb(IN osmv_query_res_t * p_rec)\r
-{\r
-       osmtest_req_context_t *const p_ctxt =\r
-           (osmtest_req_context_t *) p_rec->query_context;\r
-       osmtest_t *const p_osmt = p_ctxt->p_osmt;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_ctxt->result = *p_rec;\r
-\r
-       if (p_rec->status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0003: "\r
-                       "Error on query (%s)\n", ib_get_err_str(p_rec->status));\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_get_all_recs(IN osmtest_t * const p_osmt,\r
-                    IN ib_net16_t const attr_id,\r
-                    IN size_t const attr_size,\r
-                    IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "Getting all %s records\n",\r
-               ib_get_sa_attr_str(attr_id));\r
-\r
-       /*\r
-        * Do a blocking query for all <attr_id> records in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.attr_id = attr_id;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) (attr_size >> 3));\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0004: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0064: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (p_context->result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t osmtest_validate_sa_class_port_info(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_query_req_t req;\r
-       ib_class_port_info_t *p_cpi;\r
-       osmtest_req_context_t context;\r
-       osmtest_req_context_t *p_context = &context;\r
-       ib_sa_mad_t *p_resp_sa_madp;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Getting ClassPortInfo\n");\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       req.query_type = OSMV_QUERY_CLASS_PORT_INFO;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = 0;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0065: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0070: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (p_context->result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       /* ok we got it so please print it out */\r
-       p_resp_sa_madp =\r
-           (ib_sa_mad_t *) osm_madw_get_mad_ptr(context.result.p_result_madw);\r
-       p_cpi =\r
-           (ib_class_port_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_madp);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "\n-----------------------------\n"\r
-               "SA Class Port Info:\n"\r
-               " base_ver:%u\n"\r
-               " class_ver:%u\n"\r
-               " cap_mask:0x%X\n"\r
-               " cap_mask2:0x%X\n"\r
-               " resp_time_val:0x%X\n"\r
-               "-----------------------------\n",\r
-               p_cpi->base_ver, p_cpi->class_ver, cl_ntoh16(p_cpi->cap_mask),\r
-               ib_class_cap_mask2(p_cpi), ib_class_resp_time_val(p_cpi));\r
-\r
-Exit:\r
-#if 0\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-#endif\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_get_node_rec(IN osmtest_t * const p_osmt,\r
-                    IN ib_net64_t const node_guid,\r
-                    IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_node_record_t record;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting node record for 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(node_guid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.node_info.node_guid = node_guid;\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.comp_mask = IB_NR_COMPMASK_NODEGUID;\r
-       user.attr_id = IB_MAD_ATTR_NODE_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0071: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0072: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (p_context->result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get a node record by node LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_node_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                           IN ib_net16_t const lid,\r
-                           IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_node_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting node record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.comp_mask = IB_NR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_NODE_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0073: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0074: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt,\r
-                                 IN ib_net64_t sguid,\r
-                                 IN ib_net64_t dguid,\r
-                                 IN osmtest_req_context_t * p_context)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       osmv_query_req_t req;\r
-       osmv_guid_pair_t guid_pair;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(p_context, 0, sizeof(*p_context));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-\r
-       req.query_type = OSMV_QUERY_PATH_REC_BY_PORT_GUIDS;\r
-\r
-       guid_pair.dest_guid = dguid;\r
-       guid_pair.src_guid = sguid;\r
-\r
-       req.p_query_input = &guid_pair;\r
-       req.sm_key = 0;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Query for path from 0x%" PRIx64 " to 0x%" PRIx64 "\n",\r
-               sguid, dguid);\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0063: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = (*p_context).result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0066: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     ((*p_context).result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_get_path_rec_by_gid_pair(IN osmtest_t * const p_osmt,\r
-                                IN ib_gid_t sgid,\r
-                                IN ib_gid_t dgid,\r
-                                IN osmtest_req_context_t * p_context)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       osmv_query_req_t req;\r
-       osmv_gid_pair_t gid_pair;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(p_context, 0, sizeof(*p_context));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-\r
-       req.query_type = OSMV_QUERY_PATH_REC_BY_GIDS;\r
-\r
-       gid_pair.dest_gid = dgid;\r
-       gid_pair.src_gid = sgid;\r
-\r
-       req.p_query_input = &gid_pair;\r
-       req.sm_key = 0;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Query for path from 0x%016" PRIx64 " 0x%016" PRIx64\r
-               " to 0x%016" PRIx64 " 0x%016" PRIx64 "\n", sgid.unicast.prefix,\r
-               sgid.unicast.interface_id, dgid.unicast.prefix,\r
-               dgid.unicast.interface_id);\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006A: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = (*p_context).result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006B: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     ((*p_context).result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-static ib_api_status_t\r
-osmtest_get_multipath_rec(IN osmtest_t * const p_osmt,\r
-                         IN osmv_multipath_req_t * p_request,\r
-                         IN osmtest_req_context_t * p_context)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       osmv_query_req_t req;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-\r
-       req.query_type = OSMV_QUERY_MULTIPATH_REC;\r
-\r
-       req.p_query_input = p_request;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0068: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0069: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (p_context->result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-#endif\r
-\r
-ib_api_status_t\r
-osmtest_get_port_rec(IN osmtest_t * const p_osmt,\r
-                    IN ib_net16_t const lid,\r
-                    IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_portinfo_record_t record;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Getting PortInfoRecord for port with LID 0x%X\n",\r
-               cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.comp_mask = IB_PIR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0075: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0076: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (p_context->result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_get_port_rec_by_num(IN osmtest_t * const p_osmt,\r
-                           IN ib_net16_t const lid,\r
-                           IN uint8_t const port_num,\r
-                           IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_portinfo_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Getting PortInfoRecord for port with LID 0x%X Num:0x%X\n",\r
-               cl_ntoh16(lid), port_num);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       record.port_num = port_num;\r
-       user.p_attr = &record;\r
-\r
-       p_context->p_osmt = p_osmt;\r
-\r
-       req.query_type = OSMV_QUERY_PORT_REC_BY_LID_AND_NUM;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0077: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0078: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_port_recs_large(IN osmtest_t * const p_osmt,\r
-                              OUT uint32_t * const p_num_recs,\r
-                              OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_portinfo_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       /*\r
-        * Do a blocking query for all PortInfoRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PORTINFO_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0006: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       *p_num_recs += num_recs;\r
-       ++*p_num_queries;\r
-\r
-       if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Received %u records\n", num_recs);\r
-\r
-               for (i = 0; i < num_recs; i++) {\r
-                       p_rec =\r
-                           osmv_get_query_portinfo_rec(context.result.\r
-                                                       p_result_madw, i);\r
-                       osm_dump_portinfo_record(&p_osmt->log, p_rec,\r
-                                                OSM_LOG_VERBOSE);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_node_recs_large(IN osmtest_t * const p_osmt,\r
-                              OUT uint32_t * const p_num_recs,\r
-                              OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_node_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0007: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       *p_num_recs += num_recs;\r
-       ++*p_num_queries;\r
-\r
-       if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Received %u records\n", num_recs);\r
-\r
-               for (i = 0; i < num_recs; i++) {\r
-                       p_rec =\r
-                           osmv_get_query_node_rec(context.result.\r
-                                                   p_result_madw, i);\r
-                       osm_dump_node_record(&p_osmt->log, p_rec,\r
-                                            OSM_LOG_VERBOSE);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_path_recs_large(IN osmtest_t * const p_osmt,\r
-                              OUT uint32_t * const p_num_recs,\r
-                              OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_path_rec_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all PathRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0008: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       *p_num_recs += num_recs;\r
-       ++*p_num_queries;\r
-\r
-       if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Received %u records\n", num_recs);\r
-\r
-               for (i = 0; i < num_recs; i++) {\r
-                       p_rec =\r
-                           osmv_get_query_path_rec(context.result.\r
-                                                   p_result_madw, i);\r
-                       osm_dump_path_record(&p_osmt->log, p_rec,\r
-                                            OSM_LOG_VERBOSE);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_path_recs_by_guid(IN osmtest_t * const p_osmt,\r
-                                OUT uint32_t * const p_num_recs,\r
-                                OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_path_rec_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status = IB_SUCCESS;\r
-       uint32_t num_recs = 0;\r
-       node_t *p_src_node, *p_dst_node;\r
-       cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       p_tbl = &p_osmt->exp_subn.node_guid_tbl;\r
-\r
-       p_src_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-       /*\r
-        * Go over all nodes that exist in the subnet\r
-        * for each pair that are not switch nodes get the path record\r
-        */\r
-       while (p_src_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-               p_dst_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-               while (p_dst_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-                       /*\r
-                        * Do a blocking query for CA to CA Path Record\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                               "Source : guid = 0x%" PRIx64 " type = %d"\r
-                               "Target : guid = 0x%" PRIx64 " type = %d\n",\r
-                               cl_ntoh64(p_src_node->rec.node_info.port_guid),\r
-                               p_src_node->rec.node_info.node_type,\r
-                               cl_ntoh64(p_dst_node->rec.node_info.port_guid),\r
-                               p_dst_node->rec.node_info.node_type);\r
-\r
-                       if (p_src_node->rec.node_info.node_type ==\r
-                           IB_NODE_TYPE_CA\r
-                           && p_dst_node->rec.node_info.node_type ==\r
-                           IB_NODE_TYPE_CA) {\r
-                               status =\r
-                                   osmtest_get_path_rec_by_guid_pair(p_osmt,\r
-                                                                     p_src_node->\r
-                                                                     rec.\r
-                                                                     node_info.\r
-                                                                     port_guid,\r
-                                                                     p_dst_node->\r
-                                                                     rec.\r
-                                                                     node_info.\r
-                                                                     port_guid,\r
-                                                                     &context);\r
-\r
-                               /* In a case of TIMEOUT you still can try sending but cant count, maybe its a temporary issue */\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0009: "\r
-                                               "osmtest_get_path_rec_by_guid_pair failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       if (status != IB_TIMEOUT)\r
-                                               goto Exit;\r
-                               } else {\r
-                                       /* we might have received several records */\r
-                                       num_recs = context.result.result_cnt;\r
-                                       /*\r
-                                        * Populate the database with the received records.\r
-                                        */\r
-                                       *p_num_recs += num_recs;\r
-                                       ++*p_num_queries;\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                                               "Received %u records\n", num_recs);\r
-                                       /* Dont waste time if not VERBOSE and above */\r
-                                       if (p_osmt->log.level & OSM_LOG_VERBOSE) {\r
-                                               for (i = 0; i < num_recs; i++) {\r
-                                                       p_rec =\r
-                                                           osmv_get_query_path_rec\r
-                                                           (context.result.\r
-                                                            p_result_madw, i);\r
-                                                       osm_dump_path_record\r
-                                                           (&p_osmt->log,\r
-                                                            p_rec,\r
-                                                            OSM_LOG_VERBOSE);\r
-                                               }\r
-                                       }\r
-                               }\r
-                               if (context.result.p_result_madw != NULL) {\r
-                                       osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                                        context.result.\r
-                                                        p_result_madw);\r
-                                       context.result.p_result_madw = NULL;\r
-                               }\r
-                       }\r
-                       /* next one please */\r
-                       p_dst_node =\r
-                           (node_t *) cl_qmap_next(&p_dst_node->map_item);\r
-               }\r
-\r
-               p_src_node = (node_t *) cl_qmap_next(&p_src_node->map_item);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_port_recs_small(IN osmtest_t * const p_osmt,\r
-                              OUT uint32_t * const p_num_recs,\r
-                              OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_portinfo_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for our own PortInfoRecord in the subnet.\r
-        */\r
-       status = osmtest_get_port_rec(p_osmt,\r
-                                     cl_ntoh16(p_osmt->local_port.lid),\r
-                                     &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0010: "\r
-                       "osmtest_get_port_rec failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       *p_num_recs += num_recs;\r
-       ++*p_num_queries;\r
-\r
-       if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Received %u records\n", num_recs);\r
-\r
-               for (i = 0; i < num_recs; i++) {\r
-                       p_rec =\r
-                           osmv_get_query_portinfo_rec(context.result.\r
-                                                       p_result_madw, i);\r
-                       osm_dump_portinfo_record(&p_osmt->log, p_rec,\r
-                                                OSM_LOG_VERBOSE);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_get_local_port_lmc(IN osmtest_t * const p_osmt,\r
-                          IN ib_net16_t lid, OUT uint8_t * const p_lmc)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_portinfo_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       uint32_t num_recs = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for our own PortInfoRecord in the subnet.\r
-        */\r
-       status = osmtest_get_port_rec(p_osmt, cl_ntoh16(lid), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 001A: "\r
-                       "osmtest_get_port_rec failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_portinfo_rec(context.result.p_result_madw,\r
-                                               i);\r
-               osm_dump_portinfo_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);\r
-               if (p_lmc) {\r
-                       *p_lmc = ib_port_info_get_lmc(&p_rec->port_info);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "LMC %d\n", *p_lmc);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Use a wrong SM_Key in a simple port query and report success if\r
- * failed.\r
- **********************************************************************/\r
-ib_api_status_t osmtest_wrong_sm_key_ignored(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_portinfo_record_t record;\r
-       osmtest_req_context_t context;\r
-       osmtest_req_context_t *p_context = &context;\r
-       uint8_t port_num = 1;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-               "Trying PortInfoRecord for port with LID 0x%X Num:0x%X\n",\r
-               p_osmt->local_port.sm_lid, port_num);\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = p_osmt->local_port.sm_lid;\r
-       record.port_num = port_num;\r
-       user.p_attr = &record;\r
-\r
-       p_context->p_osmt = p_osmt;\r
-\r
-       req.query_type = OSMV_QUERY_PORT_REC_BY_LID_AND_NUM;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 9999;\r
-       context.result.p_result_madw = NULL;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       /* since we use a wrong sm_key we should get a timeout */\r
-       if (status != IB_TIMEOUT) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0011: "\r
-                       "Did not get a timeout but got (%s)\n",\r
-                       ib_get_err_str(status));\r
-               if (status == IB_SUCCESS) {\r
-                       /* assign some error value to status, since IB_SUCCESS is a bad rc */\r
-                       status = IB_ERROR;\r
-               }\r
-               goto Exit;\r
-       } else {\r
-               status = IB_SUCCESS;\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_write_port_info(IN osmtest_t * const p_osmt,\r
-                       IN FILE * fh,\r
-                       IN const ib_portinfo_record_t * const p_rec)\r
-{\r
-       int result;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh,\r
-                        "DEFINE_PORT\n"\r
-                        "lid                     0x%X\n"\r
-                        "port_num                0x%X\n"\r
-                        "m_key                   0x%016" PRIx64 "\n"\r
-                        "subnet_prefix           0x%016" PRIx64 "\n"\r
-                        "base_lid                0x%X\n"\r
-                        "master_sm_base_lid      0x%X\n"\r
-                        "capability_mask         0x%X\n"\r
-                        "diag_code               0x%X\n"\r
-                        "m_key_lease_period      0x%X\n"\r
-                        "local_port_num          0x%X\n"\r
-                        "link_width_enabled      0x%X\n"\r
-                        "link_width_supported    0x%X\n"\r
-                        "link_width_active       0x%X\n"\r
-                        "link_speed_supported    0x%X\n"\r
-                        "port_state              %s\n"\r
-                        "state_info2             0x%X\n"\r
-                        "mpb                     0x%X\n"\r
-                        "lmc                     0x%X\n"\r
-                        "link_speed              0x%X\n"\r
-                        "mtu_smsl                0x%X\n"\r
-                        "vl_cap                  0x%X\n"\r
-                        "vl_high_limit           0x%X\n"\r
-                        "vl_arb_high_cap         0x%X\n"\r
-                        "vl_arb_low_cap          0x%X\n"\r
-                        "mtu_cap                 0x%X\n"\r
-                        "vl_stall_life           0x%X\n"\r
-                        "vl_enforce              0x%X\n"\r
-                        "m_key_violations        0x%X\n"\r
-                        "p_key_violations        0x%X\n"\r
-                        "q_key_violations        0x%X\n"\r
-                        "guid_cap                0x%X\n"\r
-                        "subnet_timeout          0x%X\n"\r
-                        "resp_time_value         0x%X\n"\r
-                        "error_threshold         0x%X\n"\r
-                        "END\n\n",\r
-                        cl_ntoh16(p_rec->lid),\r
-                        p_rec->port_num,\r
-                        cl_ntoh64(p_rec->port_info.m_key),\r
-                        cl_ntoh64(p_rec->port_info.subnet_prefix),\r
-                        cl_ntoh16(p_rec->port_info.base_lid),\r
-                        cl_ntoh16(p_rec->port_info.master_sm_base_lid),\r
-                        cl_ntoh32(p_rec->port_info.capability_mask),\r
-                        cl_ntoh16(p_rec->port_info.diag_code),\r
-                        cl_ntoh16(p_rec->port_info.m_key_lease_period),\r
-                        p_rec->port_info.local_port_num,\r
-                        p_rec->port_info.link_width_enabled,\r
-                        p_rec->port_info.link_width_supported,\r
-                        p_rec->port_info.link_width_active,\r
-                        ib_port_info_get_link_speed_sup(&p_rec->port_info),\r
-                        ib_get_port_state_str(ib_port_info_get_port_state\r
-                                              (&p_rec->port_info)),\r
-                        p_rec->port_info.state_info2,\r
-                        ib_port_info_get_mpb(&p_rec->port_info),\r
-                        ib_port_info_get_lmc(&p_rec->port_info),\r
-                        p_rec->port_info.link_speed, p_rec->port_info.mtu_smsl,\r
-                        p_rec->port_info.vl_cap,\r
-                        p_rec->port_info.vl_high_limit,\r
-                        p_rec->port_info.vl_arb_high_cap,\r
-                        p_rec->port_info.vl_arb_low_cap,\r
-                        p_rec->port_info.mtu_cap,\r
-                        p_rec->port_info.vl_stall_life,\r
-                        p_rec->port_info.vl_enforce,\r
-                        cl_ntoh16(p_rec->port_info.m_key_violations),\r
-                        cl_ntoh16(p_rec->port_info.p_key_violations),\r
-                        cl_ntoh16(p_rec->port_info.q_key_violations),\r
-                        p_rec->port_info.guid_cap,\r
-                        ib_port_info_get_timeout(&p_rec->port_info),\r
-                        p_rec->port_info.resp_time_value,\r
-                        p_rec->port_info.error_threshold);\r
-\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0161: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_write_path_info(IN osmtest_t * const p_osmt,\r
-                       IN FILE * fh, IN const ib_path_rec_t * const p_rec)\r
-{\r
-       int result;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh,\r
-                        "DEFINE_PATH\n"\r
-                        "dgid                    0x%016" PRIx64 " 0x%016"\r
-                        PRIx64 "\nsgid                    0x%016" PRIx64\r
-                        " 0x%016" PRIx64 "\ndlid                    0x%X\n"\r
-                        "slid                    0x%X\n"\r
-                        "# hop_flow_raw          0x%X\n"\r
-                        "# tclass                0x%X\n"\r
-                        "# num_path              0x%X\n"\r
-                        "pkey                    0x%X\n"\r
-                        "# sl                    0x%X\n"\r
-                        "# qos_class             0x%X\n"\r
-                        "# mtu                   0x%X\n"\r
-                        "# rate                  0x%X\n"\r
-                        "# pkt_life              0x%X\n"\r
-                        "# preference            0x%X\n" "END\n\n",\r
-                        cl_ntoh64(p_rec->dgid.unicast.prefix),\r
-                        cl_ntoh64(p_rec->dgid.unicast.interface_id),\r
-                        cl_ntoh64(p_rec->sgid.unicast.prefix),\r
-                        cl_ntoh64(p_rec->sgid.unicast.interface_id),\r
-                        cl_ntoh16(p_rec->dlid), cl_ntoh16(p_rec->slid),\r
-                        cl_ntoh32(p_rec->hop_flow_raw), p_rec->tclass,\r
-                        p_rec->num_path, cl_ntoh16(p_rec->pkey),\r
-                        ib_path_rec_sl(p_rec), ib_path_rec_qos_class(p_rec),\r
-                        p_rec->mtu, p_rec->rate, p_rec->pkt_life,\r
-                        p_rec->preference);\r
-\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0162: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_write_node_info(IN osmtest_t * const p_osmt,\r
-                       IN FILE * fh, IN const ib_node_record_t * const p_rec)\r
-{\r
-       int result;\r
-       cl_status_t status = IB_SUCCESS;\r
-       char desc[IB_NODE_DESCRIPTION_SIZE + 1];\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memcpy(desc, p_rec->node_desc.description, IB_NODE_DESCRIPTION_SIZE);\r
-       desc[IB_NODE_DESCRIPTION_SIZE] = '\0';\r
-\r
-       result = fprintf(fh,\r
-                        "DEFINE_NODE\n"\r
-                        "lid                     0x%X\n"\r
-                        "base_version            0x%X\n"\r
-                        "class_version           0x%X\n"\r
-                        "node_type               0x%X # (%s)\n"\r
-                        "num_ports               0x%X\n"\r
-                        "sys_guid                0x%016" PRIx64 "\n"\r
-                        "node_guid               0x%016" PRIx64 "\n"\r
-                        "port_guid               0x%016" PRIx64 "\n"\r
-                        "partition_cap           0x%X\n"\r
-                        "device_id               0x%X\n"\r
-                        "revision                0x%X\n"\r
-                        "# port_num              0x%X\n"\r
-                        "# vendor_id             0x%X\n"\r
-                        "# node_desc             %s\n"\r
-                        "END\n\n",\r
-                        cl_ntoh16(p_rec->lid),\r
-                        p_rec->node_info.base_version,\r
-                        p_rec->node_info.class_version,\r
-                        p_rec->node_info.node_type,\r
-                        ib_get_node_type_str(p_rec->node_info.node_type),\r
-                        p_rec->node_info.num_ports,\r
-                        cl_ntoh64(p_rec->node_info.sys_guid),\r
-                        cl_ntoh64(p_rec->node_info.node_guid),\r
-                        cl_ntoh64(p_rec->node_info.port_guid),\r
-                        cl_ntoh16(p_rec->node_info.partition_cap),\r
-                        cl_ntoh16(p_rec->node_info.device_id),\r
-                        cl_ntoh32(p_rec->node_info.revision),\r
-                        ib_node_info_get_local_port_num(&p_rec->node_info),\r
-                        cl_ntoh32(ib_node_info_get_vendor_id\r
-                                  (&p_rec->node_info)), desc);\r
-\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0163: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_write_link(IN osmtest_t * const p_osmt,\r
-                  IN FILE * fh, IN const ib_link_record_t * const p_rec)\r
-{\r
-       int result;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh,\r
-                        "DEFINE_LINK\n"\r
-                        "from_lid                0x%X\n"\r
-                        "from_port_num           0x%X\n"\r
-                        "to_port_num             0x%X\n"\r
-                        "to_lid                  0x%X\n"\r
-                        "END\n\n",\r
-                        cl_ntoh16(p_rec->from_lid),\r
-                        p_rec->from_port_num,\r
-                        p_rec->to_port_num, cl_ntoh16(p_rec->to_lid));\r
-\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0164: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_link_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-       int result;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_LINK_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0165: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Write the received records out to the file.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Received %u records\n", num_recs);\r
-\r
-       result = fprintf(fh, "#\n" "# Link Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0166: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   (ib_link_record_t *) osmv_get_query_result(context.result.\r
-                                                              p_result_madw,\r
-                                                              i);\r
-\r
-               osmtest_write_link(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt,\r
-                                IN ib_net16_t slid,\r
-                                IN ib_net16_t dlid,\r
-                                IN osmtest_req_context_t * p_context)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       osmv_query_req_t req;\r
-       osmv_lid_pair_t lid_pair;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(p_context, 0, sizeof(*p_context));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-\r
-       req.query_type = OSMV_QUERY_PATH_REC_BY_LIDS;\r
-\r
-       lid_pair.dest_lid = dlid;\r
-       lid_pair.src_lid = slid;\r
-\r
-       req.p_query_input = &lid_pair;\r
-       req.sm_key = 0;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Query for path (by lid pair) from 0x%X to 0x%X\n", slid, dlid);\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0053: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = (*p_context).result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0067: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     ((*p_context).result.\r
-                                                      p_result_madw)));\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-/**********************************************************************\r
- * ASSUMES RMPP\r
- **********************************************************************/\r
-static ib_api_status_t\r
-osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_node_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-       int result;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0022: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Write the received records out to the file.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);\r
-\r
-       result = fprintf(fh, "#\n" "# Node Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0023: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_node_rec(context.result.p_result_madw, i);\r
-               osmtest_write_node_info(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * ASSUMES RMPP\r
- **********************************************************************/\r
-static ib_api_status_t\r
-osmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_portinfo_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-       int result;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PORTINFO_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0167: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Write the received records out to the file.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);\r
-\r
-       result = fprintf(fh, "#\n" "# PortInfo Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0024: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_portinfo_rec(context.result.p_result_madw,\r
-                                               i);\r
-               osmtest_write_port_info(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * ASSUMES RMPP\r
- **********************************************************************/\r
-static ib_api_status_t\r
-osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_path_rec_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-       int result;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all PathRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0025: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Write the received records out to the file.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs);\r
-\r
-       result = fprintf(fh, "#\n" "# Path Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0026: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_path_rec(context.result.p_result_madw, i);\r
-               osmtest_write_path_info(p_osmt, fh, p_rec);\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-#else /* !VENDOR_RMPP_SUPPORT */\r
-/*\r
- * NON RMPP BASED QUERY FOR ALL NODES: BASED ON THE MAX LID GIVEN BY THE USER\r
- */\r
-static ib_api_status_t\r
-osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       node_t *p_node;\r
-       node_t *p_guid_node;\r
-       const ib_node_record_t *p_rec;\r
-       cl_status_t status = CL_SUCCESS;\r
-       int result;\r
-       uint16_t lid;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       result = fprintf(fh, "#\n" "# Node Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0027: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Go over all LIDs in the range 1 to max_lid and do a\r
-        * NodeRecord query by that lid.\r
-        */\r
-       for (lid = 1; lid <= p_osmt->max_lid; lid++) {\r
-               /* prepare the query context */\r
-               memset(&context, 0, sizeof(context));\r
-\r
-               status =\r
-                   osmtest_get_node_rec_by_lid(p_osmt, cl_ntoh16(lid),\r
-                                               &context);\r
-               if (status != IB_SUCCESS) {\r
-                       if (status != IB_SA_MAD_STATUS_NO_RECORDS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "ERR 0028: "\r
-                                       "failed to get node info for LID:0x%02X (%s)\n",\r
-                                       cl_ntoh16(lid), ib_get_err_str(status));\r
-                               goto Exit;\r
-                       } else {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "WRN 0121: "\r
-                                       "failed to get node info for LID:0x%02X (%s)\n",\r
-                                       cl_ntoh16(lid), ib_get_err_str(status));\r
-                               status = IB_SUCCESS;\r
-                       }\r
-               } else {\r
-                       /* OK we got something */\r
-                       p_rec =\r
-                           osmv_get_query_node_rec(context.result.\r
-                                                   p_result_madw, 0);\r
-                       osmtest_write_node_info(p_osmt, fh, p_rec);\r
-\r
-                       /* create a subnet object */\r
-                       p_node = node_new();\r
-                       CL_ASSERT(p_node != NULL);\r
-\r
-                       /* copy the info to the subnet node object */\r
-                       p_node->rec = *p_rec;\r
-\r
-                       cl_qmap_insert(&p_osmt->exp_subn.node_lid_tbl,\r
-                                      p_node->rec.lid, &p_node->map_item);\r
-\r
-                       p_guid_node = node_new();\r
-                       CL_ASSERT(p_guid_node != NULL);\r
-\r
-                       *p_guid_node = *p_node;\r
-\r
-                       cl_qmap_insert(&p_osmt->exp_subn.node_guid_tbl,\r
-                                      p_guid_node->rec.node_info.node_guid,\r
-                                      &p_guid_node->map_item);\r
-\r
-               }\r
-\r
-               if (context.result.p_result_madw != NULL) {\r
-                       osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                        context.result.p_result_madw);\r
-                       context.result.p_result_madw = NULL;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/*\r
- * GET ALL PORT RECORDS IN THE FABRIC -\r
- * one by one by using the node info received\r
- */\r
-static ib_api_status_t\r
-osmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_node_record_t *p_node_rec;\r
-       const ib_portinfo_record_t *p_rec;\r
-       uint8_t port_num;\r
-       cl_status_t status = CL_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-       node_t *p_node;\r
-       port_t *p_port;\r
-       int result;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /* print header */\r
-       result = fprintf(fh, "#\n" "# PortInfo Records\n" "#\n");\r
-       if (result < 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0029: "\r
-                       "Write failed\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* use the pre-explored set of nodes */\r
-       p_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-       p_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-       /*\r
-        * Go over all LIDs in the range 1 to max_lid and do a\r
-        * NodeRecord query by that lid.\r
-        */\r
-       while (p_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-\r
-               p_node_rec = &(p_node->rec);\r
-\r
-               /* go through all ports of the node: */\r
-               for (port_num = 0; port_num <= p_node_rec->node_info.num_ports;\r
-                    port_num++) {\r
-                       /* prepare the query context */\r
-                       memset(&context, 0, sizeof(context));\r
-\r
-                       status = osmtest_get_port_rec_by_num(p_osmt,\r
-                                                            p_node_rec->lid,\r
-                                                            port_num,\r
-                                                            &context);\r
-                       if (status != IB_SUCCESS) {\r
-                               if (status != IB_SA_MAD_STATUS_NO_RECORDS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "WRN 0122: "\r
-                                               "Error encountered getting port info for LID:0x%04X Num:0x%02X (%s)\n",\r
-                                               p_node_rec->lid, port_num,\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               } else {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                                               "WRN 0123: "\r
-                                               "failed to get port info for LID:0x%04X Num:0x%02X (%s)\n",\r
-                                               p_node_rec->lid, port_num,\r
-                                               ib_get_err_str(status));\r
-                                       status = IB_SUCCESS;\r
-                               }\r
-                       } else {\r
-                               /* OK we got something */\r
-                               p_rec =\r
-                                   osmv_get_query_portinfo_rec(context.result.\r
-                                                               p_result_madw,\r
-                                                               0);\r
-                               osmtest_write_port_info(p_osmt, fh, p_rec);\r
-\r
-                               /* create a subnet object */\r
-                               p_port = port_new();\r
-                               CL_ASSERT(p_port != NULL);\r
-\r
-                               /* copy the info to the subnet node object */\r
-                               p_port->rec = *p_rec;\r
-\r
-                               cl_qmap_insert(&p_osmt->exp_subn.port_key_tbl,\r
-                                              port_gen_id(p_node_rec->lid,\r
-                                                          port_num),\r
-                                              &p_port->map_item);\r
-                       }\r
-\r
-                       if (context.result.p_result_madw != NULL) {\r
-                               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                                context.result.p_result_madw);\r
-                               context.result.p_result_madw = NULL;\r
-                       }\r
-               }\r
-               p_node = (node_t *) cl_qmap_next(&p_node->map_item);\r
-       }\r
-\r
-       /* we must set the exist status to avoid abort of the over all algorith */\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * ASSUMES NO RMPP\r
- **********************************************************************/\r
-static ib_api_status_t\r
-osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_path_rec_t *p_rec;\r
-       cl_status_t status = CL_SUCCESS;\r
-       int num_recs, i;\r
-       cl_qmap_t *p_tbl;\r
-       node_t *p_src_node, *p_dst_node;\r
-       ib_api_status_t got_status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Go over all nodes that exist in the subnet\r
-        * for each pair that are not switch nodes get the path record\r
-        */\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       p_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-\r
-       p_src_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_src_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-               /* HACK we use capability_mask to know diff a CA node from switch node */\r
-               /* if(p_src_node->rec.node_info.capability_mask  ) { */\r
-               p_dst_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-               while (p_dst_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-                       /* HACK we use capability_mask to know diff a CA node from switch node */\r
-                       /* if (p_dst_node->rec.node_info.capability_mask) { */\r
-\r
-                       /* query for it: */\r
-                       status = osmtest_get_path_rec_by_lid_pair(p_osmt,\r
-                                                                 p_src_node->\r
-                                                                 rec.lid,\r
-                                                                 p_dst_node->\r
-                                                                 rec.lid,\r
-                                                                 &context);\r
-\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012D: "\r
-                                       "failed to get path info from LID:0x%X To LID:0x%X (%s)\n",\r
-                                       p_src_node->rec.lid,\r
-                                       p_dst_node->rec.lid,\r
-                                       ib_get_err_str(status));\r
-                               /* remember the first error status */\r
-                               got_status =\r
-                                   (got_status ==\r
-                                    IB_SUCCESS) ? status : got_status;\r
-                       } else {\r
-                               /* we might have received several records */\r
-                               num_recs = context.result.result_cnt;\r
-                               for (i = 0; i < num_recs; i++) {\r
-                                       p_rec =\r
-                                           osmv_get_query_path_rec(context.\r
-                                                                   result.\r
-                                                                   p_result_madw,\r
-                                                                   i);\r
-                                       osmtest_write_path_info(p_osmt, fh,\r
-                                                               p_rec);\r
-                               }\r
-                       }\r
-/*  } */\r
-\r
-                       if (context.result.p_result_madw != NULL) {\r
-                               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                                context.result.p_result_madw);\r
-                               context.result.p_result_madw = NULL;\r
-                       }\r
-\r
-                       /* next one please */\r
-                       p_dst_node =\r
-                           (node_t *) cl_qmap_next(&p_dst_node->map_item);\r
-               }\r
-/* } */\r
-\r
-               p_src_node = (node_t *) cl_qmap_next(&p_src_node->map_item);\r
-       }\r
-\r
-       if (got_status != IB_SUCCESS)\r
-               status = got_status;\r
-\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-#endif\r
-\r
-static ib_api_status_t\r
-osmtest_create_inventory_file(IN osmtest_t * const p_osmt)\r
-{\r
-       FILE *fh;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       fh = fopen(p_osmt->opt.file_name, "w");\r
-       if (fh == NULL) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0079: "\r
-                       "Unable to open inventory file (%s)\n",\r
-                       p_osmt->opt.file_name);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /* HACK: the order is important: nodes ports paths */\r
-       status = osmtest_write_all_node_recs(p_osmt, fh);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       status = osmtest_write_all_port_recs(p_osmt, fh);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (!p_osmt->opt.ignore_path_records) {\r
-               status = osmtest_write_all_path_recs(p_osmt, fh);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       status = osmtest_write_all_link_recs(p_osmt, fh);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       fclose(fh);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_stress_large_rmpp_pr(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint64_t num_recs = 0;\r
-       uint64_t num_queries = 0;\r
-       uint32_t delta_recs;\r
-       uint32_t delta_queries;\r
-       uint32_t print_freq = 0;\r
-       struct timeval start_tv, end_tv;\r
-       long sec_diff, usec_diff;\r
-       float ratio;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-       gettimeofday(&start_tv, NULL);\r
-       printf("-I- Start time is : %09ld:%06ld [sec:usec]\n", start_tv.tv_sec,\r
-              (long)start_tv.tv_usec);\r
-\r
-       while (num_queries < STRESS_LARGE_PR_RMPP_THR) {\r
-               delta_recs = 0;\r
-               delta_queries = 0;\r
-\r
-               status = osmtest_stress_path_recs_by_guid(p_osmt, &delta_recs,\r
-                                                         &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               num_recs += delta_recs;\r
-               num_queries += delta_queries;\r
-\r
-               print_freq += delta_recs;\r
-               if (print_freq > 10000) {\r
-                       gettimeofday(&end_tv, NULL);\r
-                       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-                               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-                       } else {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-                               usec_diff =\r
-                                   1000000 - (start_tv.tv_usec -\r
-                                              end_tv.tv_usec);\r
-                       }\r
-                       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-                              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-                       printf("-I- Querying %" PRId64\r
-                              " Path Record queries CA to CA (rmpp)\n\ttook %04ld:%06ld [sec:usec]\n",\r
-                              num_queries, sec_diff, usec_diff);\r
-                       if (num_recs == 0)\r
-                               ratio = 0;\r
-                       else\r
-                               ratio = ((float)num_queries / (float)num_recs);\r
-                       printf("-I- Queries to Record Ratio is %" PRIu64\r
-                              " records, %" PRIu64 " queries : %.2f \n",\r
-                              num_recs, num_queries, ratio);\r
-                       print_freq = 0;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       gettimeofday(&end_tv, NULL);\r
-       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-       } else {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-               usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec);\r
-       }\r
-\r
-       printf("-I- Querying %" PRId64\r
-              " Path Record queries (rmpp) took %04ld:%06ld [sec:usec]\n",\r
-              num_queries, sec_diff, usec_diff);\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_stress_large_rmpp(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint64_t num_recs = 0;\r
-       uint64_t num_queries = 0;\r
-       uint32_t delta_recs;\r
-       uint32_t delta_queries;\r
-       uint32_t print_freq = 0;\r
-       struct timeval start_tv, end_tv;\r
-       long sec_diff, usec_diff;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-       gettimeofday(&start_tv, NULL);\r
-       printf("-I- Start time is : %09ld:%06ld [sec:usec]\n", start_tv.tv_sec,\r
-              (long)start_tv.tv_usec);\r
-\r
-       while (num_queries < STRESS_LARGE_RMPP_THR) {\r
-               delta_recs = 0;\r
-               delta_queries = 0;\r
-\r
-               status = osmtest_stress_node_recs_large(p_osmt, &delta_recs,\r
-                                                       &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               status = osmtest_stress_path_recs_large(p_osmt, &delta_recs,\r
-                                                       &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               status = osmtest_stress_port_recs_large(p_osmt, &delta_recs,\r
-                                                       &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               num_recs += delta_recs;\r
-               num_queries += delta_queries;\r
-\r
-               print_freq += delta_recs;\r
-\r
-               if (print_freq > 100000) {\r
-                       gettimeofday(&end_tv, NULL);\r
-                       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-                               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-                       } else {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-                               usec_diff =\r
-                                   1000000 - (start_tv.tv_usec -\r
-                                              end_tv.tv_usec);\r
-                       }\r
-                       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-                              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-                       printf("-I- Querying %" PRId64\r
-                              " large mixed queries (rmpp) took %04ld:%06ld [sec:usec]\n",\r
-                              num_queries, sec_diff, usec_diff);\r
-                       printf("%" PRIu64 " records, %" PRIu64 " queries\n",\r
-                              num_recs, num_queries);\r
-                       print_freq = 0;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       gettimeofday(&end_tv, NULL);\r
-       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-       } else {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-               usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec);\r
-       }\r
-\r
-       printf("-I- Querying %" PRId64\r
-              " large mixed queries (rmpp) took %04ld:%06ld [sec:usec]\n",\r
-              num_queries, sec_diff, usec_diff);\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_stress_small_rmpp(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint64_t num_recs = 0;\r
-       uint64_t num_queries = 0;\r
-       uint32_t delta_recs;\r
-       uint32_t delta_queries;\r
-       uint32_t print_freq = 0;\r
-       int num_timeouts = 0;\r
-       struct timeval start_tv, end_tv;\r
-       long sec_diff, usec_diff;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-       gettimeofday(&start_tv, NULL);\r
-       printf("-I- Start time is : %09ld:%06ld [sec:usec]\n",\r
-              start_tv.tv_sec, (long)start_tv.tv_usec);\r
-\r
-       while ((num_queries < STRESS_SMALL_RMPP_THR) && (num_timeouts < 100)) {\r
-               delta_recs = 0;\r
-               delta_queries = 0;\r
-\r
-               status = osmtest_stress_port_recs_small(p_osmt, &delta_recs,\r
-                                                       &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               num_recs += delta_recs;\r
-               num_queries += delta_queries;\r
-\r
-               print_freq += delta_recs;\r
-               if (print_freq > 5000) {\r
-                       gettimeofday(&end_tv, NULL);\r
-                       printf("%" PRIu64 " records, %" PRIu64 " queries\n",\r
-                              num_recs, num_queries);\r
-                       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-                               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-                       } else {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-                               usec_diff =\r
-                                   1000000 - (start_tv.tv_usec -\r
-                                              end_tv.tv_usec);\r
-                       }\r
-                       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-                              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-                       printf("-I- Querying %" PRId64\r
-                              " port_info queries (single mad) took %04ld:%06ld [sec:usec]\n",\r
-                              num_queries, sec_diff, usec_diff);\r
-                       print_freq = 0;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       gettimeofday(&end_tv, NULL);\r
-       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-       } else {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-               usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec);\r
-       }\r
-\r
-       printf("-I- Querying %" PRId64\r
-              " port_info queries (single mad) took %04ld:%06ld [sec:usec]\n",\r
-              num_queries, sec_diff, usec_diff);\r
-       if (num_timeouts > 50) {\r
-               status = IB_TIMEOUT;\r
-       }\r
-       /* Exit: */\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_stress_path_recs_by_lid(IN osmtest_t * const p_osmt,\r
-                               OUT uint32_t * const p_num_recs,\r
-                               OUT uint32_t * const p_num_queries)\r
-{\r
-       osmtest_req_context_t context;\r
-       ib_path_rec_t *p_rec;\r
-       cl_status_t status;\r
-       ib_net16_t dlid, slid;\r
-       int num_recs, i;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       slid = cl_ntoh16(p_osmt->local_port.lid);\r
-#ifdef OSM_VENDOR_INTF_AL\r
-       dlid = p_osmt->local_port.sm_lid; // already in correct byte-order\r
-#else\r
-       dlid = cl_ntoh16(p_osmt->local_port.sm_lid);\r
-#endif\r
-\r
-       /*\r
-        * Do a blocking query for the PathRecord.\r
-        */\r
-       status = osmtest_get_path_rec_by_lid_pair(p_osmt, slid, dlid, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 000A: "\r
-                       "osmtest_get_path_rec_by_lid_pair failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Populate the database with the received records.\r
-        */\r
-       num_recs = context.result.result_cnt;\r
-       *p_num_recs += num_recs;\r
-       ++*p_num_queries;\r
-\r
-       if (osm_log_is_active(&p_osmt->log, OSM_LOG_VERBOSE)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-                       "Received %u records\n", num_recs);\r
-\r
-               for (i = 0; i < num_recs; i++) {\r
-                       p_rec = osmv_get_query_path_rec(context.result.p_result_madw, 0);\r
-                       osm_dump_path_record(&p_osmt->log, p_rec, OSM_LOG_VERBOSE);\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_stress_get_pr(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint64_t num_recs = 0;\r
-       uint64_t num_queries = 0;\r
-       uint32_t delta_recs;\r
-       uint32_t delta_queries;\r
-       uint32_t print_freq = 0;\r
-       int num_timeouts = 0;\r
-       struct timeval start_tv, end_tv;\r
-       long sec_diff, usec_diff;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-       gettimeofday(&start_tv, NULL);\r
-       printf("-I- Start time is : %09ld:%06ld [sec:usec]\n",\r
-              start_tv.tv_sec, (long)start_tv.tv_usec);\r
-\r
-       while ((num_queries < STRESS_GET_PR) && (num_timeouts < 100)) {\r
-               delta_recs = 0;\r
-               delta_queries = 0;\r
-\r
-               status = osmtest_stress_path_recs_by_lid(p_osmt,\r
-                                                        &delta_recs,\r
-                                                        &delta_queries);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               num_recs += delta_recs;\r
-               num_queries += delta_queries;\r
-\r
-               print_freq += delta_recs;\r
-               if (print_freq > 5000) {\r
-                       gettimeofday(&end_tv, NULL);\r
-                       printf("%" PRIu64 " records, %" PRIu64 " queries\n",\r
-                              num_recs, num_queries);\r
-                       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-                               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-                       } else {\r
-                               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-                               usec_diff =\r
-                                   1000000 - (start_tv.tv_usec -\r
-                                              end_tv.tv_usec);\r
-                       }\r
-                       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-                              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-                       printf("-I- Querying %" PRId64\r
-                              " path_rec queries took %04ld:%06ld [sec:usec]\n",\r
-                              num_queries, sec_diff, usec_diff);\r
-                       print_freq = 0;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       gettimeofday(&end_tv, NULL);\r
-       printf("-I- End time is : %09ld:%06ld [sec:usec]\n",\r
-              end_tv.tv_sec, (long)end_tv.tv_usec);\r
-       if (end_tv.tv_usec > start_tv.tv_usec) {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec;\r
-               usec_diff = end_tv.tv_usec - start_tv.tv_usec;\r
-       } else {\r
-               sec_diff = end_tv.tv_sec - start_tv.tv_sec - 1;\r
-               usec_diff = 1000000 - (start_tv.tv_usec - end_tv.tv_usec);\r
-       }\r
-\r
-       printf("-I- Querying %" PRId64\r
-              " path_rec queries took %04ld:%06ld [sec:usec]\n",\r
-              num_queries, sec_diff, usec_diff);\r
-       if (num_timeouts > 50) {\r
-               status = IB_TIMEOUT;\r
-       }\r
-       /* Exit: */\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static void\r
-osmtest_prepare_db_generic(IN osmtest_t * const p_osmt,\r
-                          IN cl_qmap_t * const p_tbl)\r
-{\r
-       generic_t *p_generic;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_generic = (generic_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_generic != (generic_t *) cl_qmap_end(p_tbl)) {\r
-               p_generic->count = 0;\r
-               p_generic = (generic_t *) cl_qmap_next(&p_generic->map_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-}\r
-\r
-static void osmtest_prepare_db(IN osmtest_t * const p_osmt)\r
-{\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       osmtest_prepare_db_generic(p_osmt, &p_osmt->exp_subn.node_lid_tbl);\r
-       osmtest_prepare_db_generic(p_osmt, &p_osmt->exp_subn.path_tbl);\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-}\r
-\r
-static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt)\r
-{\r
-       const node_t *p_node;\r
-       cl_status_t status = IB_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-\r
-       p_node = (node_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_node != (node_t *) cl_qmap_end(p_tbl)) {\r
-               if (p_node->count == 0) {\r
-                       /*\r
-                        * This node was not reported by the SA\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0080: "\r
-                               "Missing node 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_node->rec.node_info.node_guid));\r
-                       status = IB_ERROR;\r
-               }\r
-\r
-               p_node = (node_t *) cl_qmap_next(&p_node->map_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt)\r
-{\r
-       const port_t *p_port;\r
-       cl_status_t status = IB_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_tbl = &p_osmt->exp_subn.port_key_tbl;\r
-\r
-       p_port = (port_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_port != (port_t *) cl_qmap_end(p_tbl)) {\r
-               if (p_port->count == 0) {\r
-                       /*\r
-                        * This port was not reported by the SA\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0081: "\r
-                               "Missing port LID:0x%X Num:0x%X\n",\r
-                               cl_ntoh16(p_port->rec.lid),\r
-                               p_port->rec.port_num);\r
-                       status = IB_ERROR;\r
-               }\r
-\r
-               p_port = (port_t *) cl_qmap_next(&p_port->map_item);\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_check_missing_paths(IN osmtest_t * const p_osmt)\r
-{\r
-       const path_t *p_path;\r
-       cl_status_t status = IB_SUCCESS;\r
-       cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_tbl = &p_osmt->exp_subn.path_tbl;\r
-\r
-       p_path = (path_t *) cl_qmap_head(p_tbl);\r
-\r
-       while (p_path != (path_t *) cl_qmap_end(p_tbl)) {\r
-               if (p_path->count == 0) {\r
-                       /*\r
-                        * This path was not reported by the SA\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0051: "\r
-                               "SA did not return path SLID 0x%X to DLID 0x%X\n",\r
-                               cl_ntoh16(p_path->rec.slid),\r
-                               cl_ntoh16(p_path->rec.dlid));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               p_path = (path_t *) cl_qmap_next(&p_path->map_item);\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-inline uint32_t osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return (p_rec->dlid << 16 | p_rec->slid);\r
-}\r
-\r
-static boolean_t\r
-osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt,\r
-                             IN const path_t * const p_path)\r
-{\r
-       if ((p_path->comp.dlid == 0) || (p_path->comp.slid == 0)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0168: "\r
-                       "SLID and DLID must be specified for defined paths\n");\r
-               return (FALSE);\r
-       }\r
-\r
-       return (TRUE);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_path_data(IN osmtest_t * const p_osmt,\r
-                          IN path_t * const p_path,\r
-                          IN const ib_path_rec_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       uint8_t lmc = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-               "Checking path SLID 0x%X to DLID 0x%X\n",\r
-               cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid));\r
-\r
-       status =\r
-           osmtest_get_local_port_lmc(p_osmt, p_osmt->local_port.lid, &lmc);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* HACK: Assume uniform LMC across endports in the subnet */\r
-       /* This is the only LMC mode which OpenSM currently supports */\r
-       /* In absence of this assumption, validation of this is much more complicated */\r
-       if (lmc == 0) {\r
-               /*\r
-                * Has this record already been returned?\r
-                */\r
-               if (p_path->count != 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0056: "\r
-                               "Already received path SLID 0x%X to DLID 0x%X\n",\r
-                               cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid));\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               /* Also, this doesn't detect fewer than the correct number of paths being returned */\r
-               if (p_path->count >= (uint32_t) (1 << (2 * lmc))) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0052: "\r
-                               "Already received path SLID 0x%X to DLID 0x%X count %d LMC %d\n",\r
-                               cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid),\r
-                               p_path->count, lmc);\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       ++p_path->count;\r
-\r
-       /*\r
-        * Check the fields the user wants checked.\r
-        */\r
-       if ((p_path->comp.dgid.unicast.interface_id &\r
-            p_path->rec.dgid.unicast.interface_id) !=\r
-           (p_path->comp.dgid.unicast.interface_id &\r
-            p_rec->dgid.unicast.interface_id)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0169: "\r
-                       "DGID mismatch on path SLID 0x%X to DLID 0x%X\n"\r
-                       "\t\t\t\tExpected 0x%016" PRIx64 " 0x%016" PRIx64 "\n"\r
-                       "\t\t\t\tReceived 0x%016" PRIx64 " 0x%016" PRIx64 "\n",\r
-                       cl_ntoh16(p_path->rec.slid),\r
-                       cl_ntoh16(p_path->rec.dlid),\r
-                       cl_ntoh64(p_path->rec.dgid.unicast.prefix),\r
-                       cl_ntoh64(p_path->rec.dgid.unicast.interface_id),\r
-                       cl_ntoh64(p_rec->dgid.unicast.prefix),\r
-                       cl_ntoh64(p_rec->dgid.unicast.interface_id));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Check the fields the user wants checked.\r
-        */\r
-       if ((p_path->comp.sgid.unicast.interface_id &\r
-            p_path->rec.sgid.unicast.interface_id) !=\r
-           (p_path->comp.sgid.unicast.interface_id &\r
-            p_rec->sgid.unicast.interface_id)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0057: "\r
-                       "SGID mismatch on path SLID 0x%X to DLID 0x%X\n"\r
-                       "\t\t\t\tExpected 0x%016" PRIx64 " 0x%016" PRIx64 ",\n"\r
-                       "\t\t\t\tReceived 0x%016" PRIx64 " 0x%016" PRIx64 ".\n",\r
-                       cl_ntoh16(p_path->rec.slid),\r
-                       cl_ntoh16(p_path->rec.dlid),\r
-                       cl_ntoh64(p_path->rec.sgid.unicast.prefix),\r
-                       cl_ntoh64(p_path->rec.sgid.unicast.interface_id),\r
-                       cl_ntoh64(p_rec->sgid.unicast.prefix),\r
-                       cl_ntoh64(p_rec->sgid.unicast.interface_id));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Compare the fields the user wishes to validate.\r
-        */\r
-       if ((p_path->comp.pkey & p_path->rec.pkey) !=\r
-           (p_path->comp.pkey & p_rec->pkey)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0012: "\r
-                       "PKEY mismatch on path SLID 0x%X to DLID 0x%X\n"\r
-                       "\t\t\t\tExpected 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_path->rec.slid),\r
-                       cl_ntoh16(p_path->rec.dlid),\r
-                       cl_ntoh16(p_path->rec.pkey), cl_ntoh16(p_rec->pkey));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_node_data(IN osmtest_t * const p_osmt,\r
-                          IN node_t * const p_node,\r
-                          IN const ib_node_record_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-               "Checking node 0x%016" PRIx64 ", LID 0x%X\n",\r
-               cl_ntoh64(p_rec->node_info.node_guid), cl_ntoh16(p_rec->lid));\r
-\r
-       /*\r
-        * Has this record already been returned?\r
-        */\r
-       if (p_node->count != 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0013: "\r
-                       "Already received node 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_node->rec.node_info.node_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       ++p_node->count;\r
-\r
-       /*\r
-        * Compare the fields the user wishes to validate.\r
-        */\r
-       if ((p_node->comp.lid & p_node->rec.lid) !=\r
-           (p_node->comp.lid & p_rec->lid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0014: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected LID 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid), p_node->rec.lid, p_rec->lid);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.base_version &\r
-            p_node->rec.node_info.base_version) !=\r
-           (p_node->comp.node_info.base_version &\r
-            p_rec->node_info.base_version)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0015: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected base_version 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       p_node->rec.node_info.base_version,\r
-                       p_rec->node_info.base_version);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.class_version &\r
-            p_node->rec.node_info.class_version) !=\r
-           (p_node->comp.node_info.class_version &\r
-            p_rec->node_info.class_version)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0016: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected class_version 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       p_node->rec.node_info.class_version,\r
-                       p_rec->node_info.class_version);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.node_type &\r
-            p_node->rec.node_info.node_type) !=\r
-           (p_node->comp.node_info.node_type & p_rec->node_info.node_type)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0017: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected node_type 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       p_node->rec.node_info.node_type,\r
-                       p_rec->node_info.node_type);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.sys_guid &\r
-            p_node->rec.node_info.sys_guid) !=\r
-           (p_node->comp.node_info.sys_guid & p_rec->node_info.sys_guid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0018: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected sys_guid 0x%016" PRIx64\r
-                       ", received 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh64(p_node->rec.node_info.sys_guid),\r
-                       cl_ntoh64(p_rec->node_info.sys_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.node_guid &\r
-            p_node->rec.node_info.node_guid) !=\r
-           (p_node->comp.node_info.node_guid & p_rec->node_info.node_guid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0019: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected node_guid 0x%016" PRIx64\r
-                       ", received 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh64(p_node->rec.node_info.node_guid),\r
-                       cl_ntoh64(p_rec->node_info.node_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.port_guid &\r
-            p_node->rec.node_info.port_guid) !=\r
-           (p_node->comp.node_info.port_guid & p_rec->node_info.port_guid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0031: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected port_guid 0x%016" PRIx64\r
-                       ", received 0x%016" PRIx64 "\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh64(p_node->rec.node_info.port_guid),\r
-                       cl_ntoh64(p_rec->node_info.port_guid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.partition_cap &\r
-            p_node->rec.node_info.partition_cap) !=\r
-           (p_node->comp.node_info.partition_cap &\r
-            p_rec->node_info.partition_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0032: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected partition_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh16(p_node->rec.node_info.partition_cap),\r
-                       cl_ntoh16(p_rec->node_info.partition_cap));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.device_id &\r
-            p_node->rec.node_info.device_id) !=\r
-           (p_node->comp.node_info.device_id & p_rec->node_info.device_id)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0033: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected device_id 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh16(p_node->rec.node_info.device_id),\r
-                       cl_ntoh16(p_rec->node_info.device_id));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_node->comp.node_info.revision &\r
-            p_node->rec.node_info.revision) !=\r
-           (p_node->comp.node_info.revision & p_rec->node_info.revision)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0034: "\r
-                       "Field mismatch node 0x%016" PRIx64 ", LID 0x%X\n"\r
-                       "\t\t\t\tExpected revision 0x%X, received 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid),\r
-                       cl_ntoh32(p_node->rec.node_info.revision),\r
-                       cl_ntoh32(p_rec->node_info.revision));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_node_rec(IN osmtest_t * const p_osmt,\r
-                         IN const ib_node_record_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       node_t *p_node;\r
-       const cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Find proper node record in the database.\r
-        */\r
-       p_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-       p_node = (node_t *) cl_qmap_get(p_tbl, p_rec->lid);\r
-       if (p_node == (node_t *) cl_qmap_end(p_tbl)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0035: "\r
-                       "Unexpected node 0x%016" PRIx64 ", LID 0x%X\n",\r
-                       cl_ntoh64(p_rec->node_info.node_guid),\r
-                       cl_ntoh16(p_rec->lid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmtest_validate_node_data(p_osmt, p_node, p_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_port_data(IN osmtest_t * const p_osmt,\r
-                          IN port_t * const p_port,\r
-                          IN const ib_portinfo_record_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-               "Checking port LID 0x%X, Num 0x%X\n",\r
-               cl_ntoh16(p_rec->lid), p_rec->port_num);\r
-\r
-       /*\r
-        * Has this record already been returned?\r
-        */\r
-       if (p_port->count != 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0036: "\r
-                       "Already received port LID 0x%X, Num 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       ++p_port->count;\r
-\r
-       /*\r
-        * Compare the fields the user wishes to validate.\r
-        */\r
-       if ((p_port->comp.lid & p_port->rec.lid) !=\r
-           (p_port->comp.lid & p_rec->lid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0037: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected LID 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.lid, p_rec->lid);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_num & p_port->rec.port_num) !=\r
-           (p_port->comp.port_num & p_rec->port_num)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0038: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected port_num 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_num, p_rec->port_num);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.m_key & p_port->rec.port_info.m_key) !=\r
-           (p_port->comp.port_info.m_key & p_rec->port_info.m_key)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0039: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected m_key 0x%016" PRIx64\r
-                       ", received 0x%016" PRIx64 "\n", cl_ntoh16(p_rec->lid),\r
-                       p_rec->port_num, p_port->rec.port_info.m_key,\r
-                       p_rec->port_info.m_key);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.subnet_prefix & p_port->rec.port_info.\r
-            subnet_prefix) !=\r
-           (p_port->comp.port_info.subnet_prefix & p_rec->port_info.\r
-            subnet_prefix)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0040: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected subnet_prefix 0x%016" PRIx64\r
-                       ", received 0x%016" PRIx64 "\n", cl_ntoh16(p_rec->lid),\r
-                       p_rec->port_num, p_port->rec.port_info.subnet_prefix,\r
-                       p_rec->port_info.subnet_prefix);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.base_lid & p_port->rec.port_info.\r
-            base_lid) !=\r
-           (p_port->comp.port_info.base_lid & p_rec->port_info.base_lid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0041: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected base_lid 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.base_lid,\r
-                       p_rec->port_info.base_lid);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.master_sm_base_lid & p_port->rec.port_info.\r
-            master_sm_base_lid) !=\r
-           (p_port->comp.port_info.master_sm_base_lid & p_rec->port_info.\r
-            master_sm_base_lid)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0042: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected master_sm_base_lid 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.master_sm_base_lid,\r
-                       p_rec->port_info.master_sm_base_lid);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.capability_mask & p_port->rec.port_info.\r
-            capability_mask) !=\r
-           (p_port->comp.port_info.capability_mask & p_rec->port_info.\r
-            capability_mask)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0043: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected capability_mask 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       cl_ntoh32(p_port->rec.port_info.capability_mask),\r
-                       cl_ntoh32(p_rec->port_info.capability_mask));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.diag_code & p_port->rec.port_info.\r
-            diag_code) !=\r
-           (p_port->comp.port_info.diag_code & p_rec->port_info.diag_code)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0044: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected diag_code 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.diag_code,\r
-                       p_rec->port_info.diag_code);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.m_key_lease_period & p_port->rec.port_info.\r
-            m_key_lease_period) !=\r
-           (p_port->comp.port_info.m_key_lease_period & p_rec->port_info.\r
-            m_key_lease_period)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0045: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected m_key_lease_period 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.m_key_lease_period,\r
-                       p_rec->port_info.m_key_lease_period);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.local_port_num & p_port->rec.port_info.\r
-            local_port_num) !=\r
-           (p_port->comp.port_info.local_port_num & p_rec->port_info.\r
-            local_port_num)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0046: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected local_port_num 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.local_port_num,\r
-                       p_rec->port_info.local_port_num);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.link_width_enabled & p_port->rec.port_info.\r
-            link_width_enabled) !=\r
-           (p_port->comp.port_info.link_width_enabled & p_rec->port_info.\r
-            link_width_enabled)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0047: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected link_width_enabled 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.link_width_enabled,\r
-                       p_rec->port_info.link_width_enabled);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.link_width_supported & p_port->rec.\r
-            port_info.link_width_supported) !=\r
-           (p_port->comp.port_info.link_width_supported & p_rec->port_info.\r
-            link_width_supported)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0048: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected link_width_supported 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.link_width_supported,\r
-                       p_rec->port_info.link_width_supported);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.link_width_active & p_port->rec.port_info.\r
-            link_width_active) !=\r
-           (p_port->comp.port_info.link_width_active & p_rec->port_info.\r
-            link_width_active)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0049: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected link_width_active 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.link_width_active,\r
-                       p_rec->port_info.link_width_active);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.link_speed & p_port->rec.port_info.\r
-            link_speed) !=\r
-           (p_port->comp.port_info.link_speed & p_rec->port_info.link_speed)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0054: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected link_speed 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.link_speed,\r
-                       p_rec->port_info.link_speed);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.state_info1 & p_port->rec.port_info.\r
-            state_info1) !=\r
-           (p_port->comp.port_info.state_info1 & p_rec->port_info.\r
-            state_info1)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0055: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected state_info1 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.state_info1,\r
-                       p_rec->port_info.state_info1);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.state_info2 & p_port->rec.port_info.\r
-            state_info2) !=\r
-           (p_port->comp.port_info.state_info2 & p_rec->port_info.\r
-            state_info2)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0058: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected state_info2 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.state_info2,\r
-                       p_rec->port_info.state_info2);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.mkey_lmc & p_port->rec.port_info.\r
-            mkey_lmc) !=\r
-           (p_port->comp.port_info.mkey_lmc & p_rec->port_info.mkey_lmc)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0059: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected mkey_lmc 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.mkey_lmc,\r
-                       p_rec->port_info.mkey_lmc);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.link_speed & p_port->rec.port_info.\r
-            link_speed) !=\r
-           (p_port->comp.port_info.link_speed & p_rec->port_info.link_speed)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0060: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected link_speed 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.link_speed,\r
-                       p_rec->port_info.link_speed);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.mtu_smsl & p_port->rec.port_info.\r
-            mtu_smsl) !=\r
-           (p_port->comp.port_info.mtu_smsl & p_rec->port_info.mtu_smsl)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0061: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected mtu_smsl 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.mtu_smsl,\r
-                       p_rec->port_info.mtu_smsl);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.vl_cap & p_port->rec.port_info.vl_cap) !=\r
-           (p_port->comp.port_info.vl_cap & p_rec->port_info.vl_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0062: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_cap, p_rec->port_info.vl_cap);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.vl_high_limit & p_port->rec.port_info.\r
-            vl_high_limit) !=\r
-           (p_port->comp.port_info.vl_high_limit & p_rec->port_info.\r
-            vl_high_limit)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0082: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_high_limit 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_high_limit,\r
-                       p_rec->port_info.vl_high_limit);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.vl_arb_high_cap & p_port->rec.port_info.\r
-            vl_arb_high_cap) !=\r
-           (p_port->comp.port_info.vl_arb_high_cap & p_rec->port_info.\r
-            vl_arb_high_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0083: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_arb_high_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_arb_high_cap,\r
-                       p_rec->port_info.vl_arb_high_cap);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.vl_arb_low_cap & p_port->rec.port_info.\r
-            vl_arb_low_cap) !=\r
-           (p_port->comp.port_info.vl_arb_low_cap & p_rec->port_info.\r
-            vl_arb_low_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0084: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_arb_low_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_arb_low_cap,\r
-                       p_rec->port_info.vl_arb_low_cap);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.mtu_cap & p_port->rec.port_info.mtu_cap) !=\r
-           (p_port->comp.port_info.mtu_cap & p_rec->port_info.mtu_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0085: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected mtu_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.mtu_cap,\r
-                       p_rec->port_info.mtu_cap);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#if 0\r
-       /* this is a dynamic attribute */\r
-       if ((p_port->comp.port_info.vl_stall_life & p_port->rec.port_info.\r
-            vl_stall_life) !=\r
-           (p_port->comp.port_info.vl_stall_life & p_rec->port_info.\r
-            vl_stall_life)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012F: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_stall_life 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_stall_life,\r
-                       p_rec->port_info.vl_stall_life);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-#endif\r
-\r
-       if ((p_port->comp.port_info.vl_enforce & p_port->rec.port_info.\r
-            vl_enforce) !=\r
-           (p_port->comp.port_info.vl_enforce & p_rec->port_info.vl_enforce)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0086: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected vl_enforce 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.vl_enforce,\r
-                       p_rec->port_info.vl_enforce);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.m_key_violations & p_port->rec.port_info.\r
-            m_key_violations) !=\r
-           (p_port->comp.port_info.m_key_violations & p_rec->port_info.\r
-            m_key_violations)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0087: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected m_key_violations 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       cl_ntoh16(p_port->rec.port_info.m_key_violations),\r
-                       cl_ntoh16(p_rec->port_info.m_key_violations));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.p_key_violations & p_port->rec.port_info.\r
-            p_key_violations) !=\r
-           (p_port->comp.port_info.p_key_violations & p_rec->port_info.\r
-            p_key_violations)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0088: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected p_key_violations 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       cl_ntoh16(p_port->rec.port_info.p_key_violations),\r
-                       cl_ntoh16(p_rec->port_info.p_key_violations));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.q_key_violations & p_port->rec.port_info.\r
-            q_key_violations) !=\r
-           (p_port->comp.port_info.q_key_violations & p_rec->port_info.\r
-            q_key_violations)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0089: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected q_key_violations 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       cl_ntoh16(p_port->rec.port_info.q_key_violations),\r
-                       cl_ntoh16(p_rec->port_info.q_key_violations));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.guid_cap & p_port->rec.port_info.\r
-            guid_cap) !=\r
-           (p_port->comp.port_info.guid_cap & p_rec->port_info.guid_cap)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0090: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected guid_cap 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.guid_cap,\r
-                       p_rec->port_info.guid_cap);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.subnet_timeout & p_port->rec.port_info.\r
-            subnet_timeout) !=\r
-           (p_port->comp.port_info.subnet_timeout & p_rec->port_info.\r
-            subnet_timeout)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0091: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected subnet_timeout 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       ib_port_info_get_timeout(&p_port->rec.port_info),\r
-                       ib_port_info_get_timeout(&p_rec->port_info));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.resp_time_value & p_port->rec.port_info.\r
-            resp_time_value) !=\r
-           (p_port->comp.port_info.resp_time_value & p_rec->port_info.\r
-            resp_time_value)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0092: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected resp_time_value 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.resp_time_value,\r
-                       p_rec->port_info.resp_time_value);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       if ((p_port->comp.port_info.error_threshold & p_port->rec.port_info.\r
-            error_threshold) !=\r
-           (p_port->comp.port_info.error_threshold & p_rec->port_info.\r
-            error_threshold)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0093: "\r
-                       "Field mismatch port LID 0x%X Num:0x%X\n"\r
-                       "\t\t\t\tExpected error_threshold 0x%X, received 0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num,\r
-                       p_port->rec.port_info.error_threshold,\r
-                       p_rec->port_info.error_threshold);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_port_rec(IN osmtest_t * const p_osmt,\r
-                         IN const ib_portinfo_record_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       port_t *p_port;\r
-       const cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Find proper port record in the database.\r
-        * (we use by guid - since lid is not unique)\r
-        */\r
-       p_tbl = &p_osmt->exp_subn.port_key_tbl;\r
-       p_port =\r
-           (port_t *) cl_qmap_get(p_tbl,\r
-                                  port_gen_id(p_rec->lid, p_rec->port_num));\r
-       if (p_port == (port_t *) cl_qmap_end(p_tbl)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0094: "\r
-                       "Unexpected port LID 0x%X, Num:0x%X\n",\r
-                       cl_ntoh16(p_rec->lid), p_rec->port_num);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmtest_validate_port_data(p_osmt, p_port, p_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_path_rec(IN osmtest_t * const p_osmt,\r
-                         IN const ib_path_rec_t * const p_rec)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       path_t *p_path;\r
-       const cl_qmap_t *p_tbl;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Find proper path record in the database.\r
-        */\r
-       p_tbl = &p_osmt->exp_subn.path_tbl;\r
-       p_path = (path_t *) cl_qmap_get(p_tbl, osmtest_path_rec_key_get(p_rec));\r
-       if (p_path == (path_t *) cl_qmap_end(p_tbl)) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0095: "\r
-                       "Unexpected path SLID 0x%X to DLID 0x%X\n",\r
-                       cl_ntoh16(p_rec->slid), cl_ntoh16(p_rec->dlid));\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       status = osmtest_validate_path_data(p_osmt, p_path, p_rec);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-ib_net64_t portguid = 0;\r
-\r
-static ib_api_status_t\r
-osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_node_record_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all NodeRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_NODE_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0096: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
-               num_recs);\r
-\r
-       /*\r
-        * Compare the received records to the database.\r
-        */\r
-       osmtest_prepare_db(p_osmt);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_node_rec(context.result.p_result_madw, i);\r
-\r
-               status = osmtest_validate_node_rec(p_osmt, p_rec);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0097: "\r
-                               "osmtest_valid_node_rec failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               if (!portguid)\r
-                       portguid = p_rec->node_info.port_guid;\r
-       }\r
-\r
-       status = osmtest_check_missing_nodes(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0098: "\r
-                       "osmtest_check_missing_nodes failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_guidinfo_record_t *p_rec;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all GuidInfoRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_GUIDINFO_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0099: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
-               num_recs);\r
-\r
-       /* No validation as yet */\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_path_rec_t *p_rec;\r
-       uint32_t i;\r
-       cl_status_t status;\r
-       size_t num_recs;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       /*\r
-        * Do a blocking query for all PathRecords in the subnet.\r
-        */\r
-       status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD,\r
-                                     sizeof(*p_rec), &context);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009A: "\r
-                       "osmtest_get_all_recs failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
-               num_recs);\r
-\r
-       /*\r
-        * Compare the received records to the database.\r
-        */\r
-       osmtest_prepare_db(p_osmt);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_path_rec(context.result.p_result_madw, i);\r
-\r
-               status = osmtest_validate_path_rec(p_osmt, p_rec);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0100: "\r
-                               "osmtest_validate_path_rec failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       status = osmtest_check_missing_paths(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0101: "\r
-                       "osmtest_check_missing_paths failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get link record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_link_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                           IN ib_net16_t const from_lid,\r
-                           IN ib_net16_t const to_lid,\r
-                           IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_link_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting link record from LID 0x%02X to LID 0x%02X\n",\r
-               cl_ntoh16(from_lid), cl_ntoh16(to_lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.from_lid = from_lid;\r
-       record.to_lid = to_lid;\r
-       p_context->p_osmt = p_osmt;\r
-       if (from_lid)\r
-               user.comp_mask |= IB_LR_COMPMASK_FROM_LID;\r
-       if (to_lid)\r
-               user.comp_mask |= IB_LR_COMPMASK_TO_LID;\r
-       user.attr_id = IB_MAD_ATTR_LINK_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007A: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007B: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "osmtest_get_link_rec_by_lid: "\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get GUIDInfo record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_guidinfo_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                               IN ib_net16_t const lid,\r
-                               IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_guidinfo_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting GUIDInfo record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       p_context->p_osmt = p_osmt;\r
-       user.comp_mask = IB_GIR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_GUIDINFO_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007C: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007D: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get PKeyTable record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_pkeytbl_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                              IN ib_net16_t const lid,\r
-                              IN ib_net64_t const sm_key,\r
-                              IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_pkey_table_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting PKeyTable record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       p_context->p_osmt = p_osmt;\r
-       user.comp_mask = IB_PKEY_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_PKEY_TBL_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = sm_key;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007E: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 007F: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get SwitchInfo record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_sw_info_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                              IN ib_net16_t const lid,\r
-                              IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_switch_info_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting SwitchInfo record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       p_context->p_osmt = p_osmt;\r
-       if (lid)\r
-               user.comp_mask = IB_SWIR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_SWITCH_INFO_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006C: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 006D: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get LFT record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_lft_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                          IN ib_net16_t const lid,\r
-                          IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_lft_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting LFT record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       p_context->p_osmt = p_osmt;\r
-       if (lid)\r
-               user.comp_mask = IB_LFTR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_LFT_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008A: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008B: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
- * Get MFT record by LID\r
- **********************************************************************/\r
-ib_api_status_t\r
-osmtest_get_mft_rec_by_lid(IN osmtest_t * const p_osmt,\r
-                          IN ib_net16_t const lid,\r
-                          IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_mft_record_t record;\r
-       ib_mad_t *p_mad;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Getting MFT record for LID 0x%02X\n", cl_ntoh16(lid));\r
-\r
-       /*\r
-        * Do a blocking query for this record in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-       p_context->p_osmt = p_osmt;\r
-       if (lid)\r
-               user.comp_mask = IB_MFTR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_MFT_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009B: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 009C: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_sminfo_record_request(IN osmtest_t * const p_osmt,\r
-                             IN uint8_t method,\r
-                             IN void *p_options,\r
-                             IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_sminfo_record_t record;\r
-       ib_mad_t *p_mad;\r
-       osmtest_sm_info_rec_t *p_sm_info_opt;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Do a blocking query for these records in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.attr_id = IB_MAD_ATTR_SMINFO_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       p_sm_info_opt = p_options;\r
-       if (p_sm_info_opt->sm_guid != 0) {\r
-               record.sm_info.guid = p_sm_info_opt->sm_guid;\r
-               user.comp_mask |= IB_SMIR_COMPMASK_GUID;\r
-       }\r
-       if (p_sm_info_opt->lid != 0) {\r
-               record.lid = p_sm_info_opt->lid;\r
-               user.comp_mask |= IB_SMIR_COMPMASK_LID;\r
-       }\r
-       if (p_sm_info_opt->priority != 0) {\r
-               record.sm_info.pri_state =\r
-                   (p_sm_info_opt->priority & 0x0F) << 4;\r
-               user.comp_mask |= IB_SMIR_COMPMASK_PRIORITY;\r
-       }\r
-       if (p_sm_info_opt->sm_state != 0) {\r
-               record.sm_info.pri_state |= p_sm_info_opt->sm_state & 0x0F;\r
-               user.comp_mask |= IB_SMIR_COMPMASK_SMSTATE;\r
-       }\r
-\r
-       user.method = method;\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008C: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               if (status != IB_INVALID_PARAMETER) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008D: "\r
-                               "ib_query failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-               }\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_informinfo_request(IN osmtest_t * const p_osmt,\r
-                          IN ib_net16_t attr_id,\r
-                          IN uint8_t method,\r
-                          IN void *p_options,\r
-                          IN OUT osmtest_req_context_t * const p_context)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_inform_info_t rec;\r
-       ib_inform_info_record_t record;\r
-       ib_mad_t *p_mad;\r
-       osmtest_inform_info_t *p_inform_info_opt;\r
-       osmtest_inform_info_rec_t *p_inform_info_rec_opt;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Do a blocking query for these records in the subnet.\r
-        * The result is returned in the result field of the caller's\r
-        * context structure.\r
-        *\r
-        * The query structures are locals.\r
-        */\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&rec, 0, sizeof(rec));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       p_context->p_osmt = p_osmt;\r
-       user.attr_id = attr_id;\r
-       if (attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD) {\r
-               user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-               p_inform_info_rec_opt = p_options;\r
-               if (p_inform_info_rec_opt->subscriber_gid.unicast.prefix != 0 &&\r
-                   p_inform_info_rec_opt->subscriber_gid.unicast.\r
-                   interface_id != 0) {\r
-                       record.subscriber_gid =\r
-                           p_inform_info_rec_opt->subscriber_gid;\r
-                       user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBERGID;\r
-               }\r
-               record.subscriber_enum =\r
-                   cl_hton16(p_inform_info_rec_opt->subscriber_enum);\r
-               user.comp_mask |= IB_IIR_COMPMASK_ENUM;\r
-               user.p_attr = &record;\r
-       } else {\r
-               user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(rec));\r
-               /* comp mask bits below are for InformInfoRecord rather than InformInfo */\r
-               /* as currently no comp mask bits defined for InformInfo!!! */\r
-               user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBE;\r
-               p_inform_info_opt = p_options;\r
-               rec.subscribe = (uint8_t) p_inform_info_opt->subscribe;\r
-               if (p_inform_info_opt->qpn) {\r
-                       rec.g_or_v.generic.qpn_resp_time_val =\r
-                           cl_hton32(p_inform_info_opt->qpn << 8);\r
-                       user.comp_mask |= IB_IIR_COMPMASK_QPN;\r
-               }\r
-               if (p_inform_info_opt->trap) {\r
-                       rec.g_or_v.generic.trap_num =\r
-                           cl_hton16(p_inform_info_opt->trap);\r
-                       user.comp_mask |= IB_IIR_COMPMASK_TRAPNUMB;\r
-               }\r
-               user.p_attr = &rec;\r
-       }\r
-       user.method = method;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = p_context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008E: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = p_context->result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               if (status != IB_INVALID_PARAMETER) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 008F: "\r
-                               "ib_query failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-               }\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       p_mad =\r
-                           osm_madw_get_mad_ptr(p_context->result.\r
-                                                p_result_madw);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(p_mad));\r
-\r
-                       status =\r
-                           (ib_net16_t) (p_mad->status & IB_SMP_STATUS_MASK);\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-#endif\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt,\r
-                                         IN path_t * const p_path)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_path_rec_t *p_rec;\r
-       cl_status_t status = IB_SUCCESS;\r
-       size_t num_recs;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       status = osmtest_get_path_rec_by_lid_pair(p_osmt,\r
-                                                 p_path->rec.slid,\r
-                                                 p_path->rec.dlid, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0102: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-       if (num_recs != 1) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0103: "\r
-                       "Too many records. Expected 1, received %u\n",\r
-                       num_recs);\r
-\r
-               status = IB_ERROR;\r
-       } else {\r
-               p_rec =\r
-                   osmv_get_query_path_rec(context.result.p_result_madw, 0);\r
-\r
-               status = osmtest_validate_path_data(p_osmt, p_path, p_rec);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0104: "\r
-                               "osmtest_validate_path_data failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt,\r
-                                    IN ib_net16_t const lid,\r
-                                    IN node_t * const p_node)\r
-{\r
-       cl_status_t status = IB_SUCCESS;\r
-       osmv_user_query_t user;\r
-       osmv_query_req_t req;\r
-       ib_node_record_t record;\r
-\r
-       osmtest_req_context_t context;\r
-       const ib_node_record_t *p_rec;\r
-       int num_recs, i;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Getting NodeRecord for node with LID 0x%X\n", cl_ntoh16(lid));\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&user, 0, sizeof(user));\r
-       memset(&record, 0, sizeof(record));\r
-\r
-       record.lid = lid;\r
-\r
-       context.p_osmt = p_osmt;\r
-       user.comp_mask = IB_NR_COMPMASK_LID;\r
-       user.attr_id = IB_MAD_ATTR_NODE_RECORD;\r
-       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
-       user.p_attr = &record;\r
-\r
-       req.query_type = OSMV_QUERY_USER_DEFINED;\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-       req.p_query_input = &user;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0105: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0106: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Received %d nodes\n", num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_node_rec(context.result.p_result_madw, i);\r
-\r
-               status = osmtest_validate_node_rec(p_osmt, p_rec);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0107: "\r
-                               "osmtest_validate_node_data failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_port_rec_lid(IN osmtest_t * const p_osmt,\r
-                                    IN port_t * const p_port)\r
-{\r
-       osmtest_req_context_t context;\r
-\r
-       const ib_portinfo_record_t *p_rec;\r
-       cl_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       context.p_osmt = p_osmt;\r
-       osmtest_get_port_rec_by_num(p_osmt,\r
-                                   p_port->rec.lid,\r
-                                   p_port->rec.port_num, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0108: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               goto Exit;\r
-       }\r
-\r
-       /* we should have got exactly one port */\r
-       p_rec = osmv_get_query_portinfo_rec(context.result.p_result_madw, 0);\r
-       status = osmtest_validate_port_rec(p_osmt, p_rec);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0109: "\r
-                       "osmtest_validate_port_data failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt,\r
-                                          IN const osmv_guid_pair_t *\r
-                                          const p_pair)\r
-{\r
-       osmtest_req_context_t context;\r
-       const ib_path_rec_t *p_rec;\r
-       cl_status_t status = IB_SUCCESS;\r
-       size_t num_recs;\r
-       osmv_query_req_t req;\r
-       uint32_t i;\r
-       boolean_t got_error = FALSE;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       memset(&req, 0, sizeof(req));\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-               "\n\t\t\t\tChecking src 0x%016" PRIx64\r
-               " to dest 0x%016" PRIx64 "\n",\r
-               cl_ntoh64(p_pair->src_guid), cl_ntoh64(p_pair->dest_guid));\r
-\r
-       context.p_osmt = p_osmt;\r
-\r
-       req.timeout_ms = p_osmt->opt.transaction_timeout;\r
-       req.retry_cnt = p_osmt->opt.retry_count;\r
-       req.flags = OSM_SA_FLAGS_SYNC;\r
-       req.query_context = &context;\r
-       req.pfn_query_cb = osmtest_query_res_cb;\r
-\r
-       req.query_type = OSMV_QUERY_PATH_REC_BY_PORT_GUIDS;\r
-       req.p_query_input = p_pair;\r
-       req.sm_key = 0;\r
-\r
-       status = osmv_query_sa(p_osmt->h_bind, &req);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0110: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       status = context.result.status;\r
-\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0111: "\r
-                       "ib_query failed (%s)\n", ib_get_err_str(status));\r
-\r
-               if (status == IB_REMOTE_ERROR) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               "Remote error = %s\n",\r
-                               ib_get_mad_status_str(osm_madw_get_mad_ptr\r
-                                                     (context.result.\r
-                                                      p_result_madw)));\r
-               }\r
-               goto Exit;\r
-       }\r
-\r
-       num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "%u records\n", num_recs);\r
-\r
-       for (i = 0; i < num_recs; i++) {\r
-               p_rec =\r
-                   osmv_get_query_path_rec(context.result.p_result_madw, i);\r
-\r
-               /*\r
-                * Make sure the GUID values are correct\r
-                */\r
-               if (p_rec->dgid.unicast.interface_id != p_pair->dest_guid) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0112: "\r
-                               "Destination GUID mismatch\n"\r
-                               "\t\t\t\texpected 0x%016" PRIx64\r
-                               ", received 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_pair->dest_guid),\r
-                               cl_ntoh64(p_rec->dgid.unicast.interface_id));\r
-                       got_error = TRUE;\r
-               }\r
-\r
-               if (p_rec->sgid.unicast.interface_id != p_pair->src_guid) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0113: "\r
-                               "Source GUID mismatch\n"\r
-                               "\t\t\t\texpected 0x%016" PRIx64\r
-                               ", received 0x%016" PRIx64 ".\n",\r
-                               cl_ntoh64(p_pair->src_guid),\r
-                               cl_ntoh64(p_rec->sgid.unicast.interface_id));\r
-                       got_error = TRUE;\r
-               }\r
-\r
-               status = osmtest_validate_path_rec(p_osmt, p_rec);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0114: "\r
-                               "osmtest_validate_path_rec failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       got_error = TRUE;\r
-               }\r
-               if (got_error || (status != IB_SUCCESS)) {\r
-                       osm_dump_path_record(&p_osmt->log, p_rec,\r
-                                            OSM_LOG_VERBOSE);\r
-                       if (status == IB_SUCCESS)\r
-                               status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-Exit:\r
-       /*\r
-        * Return the IB query MAD to the pool as necessary.\r
-        */\r
-       if (context.result.p_result_madw != NULL) {\r
-               osm_mad_pool_put(&p_osmt->mad_pool,\r
-                                context.result.p_result_madw);\r
-               context.result.p_result_madw = NULL;\r
-       }\r
-\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_path_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       path_t *p_path;\r
-       cl_status_t status = IB_SUCCESS;\r
-       const cl_qmap_t *p_path_tbl;\r
-/* We skip node to node path record validation since it might contains\r
-   NONEXISTENT PATHS, i.e. when using UPDN */\r
-       osmv_guid_pair_t guid_pair;\r
-       uint16_t cnt;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Validating individual path record queries\n");\r
-       p_path_tbl = &p_osmt->exp_subn.path_tbl;\r
-\r
-       osmtest_prepare_db(p_osmt);\r
-\r
-       /*\r
-        * Walk the list of all path records, and ask for each one\r
-        * specifically.  Make sure we get it.\r
-        */\r
-       cnt = 0;\r
-       p_path = (path_t *) cl_qmap_head(p_path_tbl);\r
-       while (p_path != (path_t *) cl_qmap_end(p_path_tbl)) {\r
-               status =\r
-                   osmtest_validate_single_path_rec_lid_pair(p_osmt, p_path);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-               cnt++;\r
-               p_path = (path_t *) cl_qmap_next(&p_path->map_item);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Total of %u path records validated using LID based query\n",\r
-               cnt);\r
-\r
-       status = osmtest_check_missing_paths(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0115: "\r
-                       "osmtest_check_missing_paths failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Do the whole thing again with port GUID pairs.\r
-        * Note that multiple path records may be returned\r
-        * for each guid pair if LMC > 0.\r
-        */\r
-       osmtest_prepare_db(p_osmt);\r
-       cnt = 0;\r
-       p_path = (path_t *) cl_qmap_head(p_path_tbl);\r
-       while (p_path != (path_t *) cl_qmap_end(p_path_tbl)) {\r
-               guid_pair.src_guid = p_path->rec.sgid.unicast.interface_id;\r
-               guid_pair.dest_guid = p_path->rec.dgid.unicast.interface_id;\r
-               status = osmtest_validate_single_path_rec_guid_pair(p_osmt,\r
-                                                                   &guid_pair);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-               cnt++;\r
-               p_path = (path_t *) cl_qmap_next(&p_path->map_item);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Total of %u path records validated using GUID based query\n",\r
-               cnt);\r
-\r
-       status = osmtest_check_missing_paths(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0116: "\r
-                       "osmtest_check_missing_paths failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_node_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       node_t *p_node;\r
-       cl_status_t status = IB_SUCCESS;\r
-       const cl_qmap_t *p_node_lid_tbl;\r
-       uint16_t cnt = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_node_lid_tbl = &p_osmt->exp_subn.node_lid_tbl;\r
-\r
-       osmtest_prepare_db(p_osmt);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Validating individual node record queries\n");\r
-\r
-       /*\r
-        * Walk the list of all node records, and ask for each one\r
-        * specifically.  Make sure we get it.\r
-        */\r
-       p_node = (node_t *) cl_qmap_head(p_node_lid_tbl);\r
-       while (p_node != (node_t *) cl_qmap_end(p_node_lid_tbl)) {\r
-               status = osmtest_validate_single_node_rec_lid(p_osmt,\r
-                                                             (ib_net16_t)\r
-                                                             cl_qmap_key((cl_map_item_t *) p_node), p_node);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 011A: "\r
-                               "osmtest_validate_single_node_rec_lid (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               cnt++;\r
-               p_node = (node_t *) cl_qmap_next(&p_node->map_item);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Total of %u node records validated\n", cnt);\r
-\r
-       status = osmtest_check_missing_nodes(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0117: "\r
-                       "osmtest_check_missing_nodes (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_validate_single_port_recs(IN osmtest_t * const p_osmt)\r
-{\r
-       port_t *p_port;\r
-       cl_status_t status = IB_SUCCESS;\r
-       const cl_qmap_t *p_port_key_tbl;\r
-       uint16_t cnt = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_port_key_tbl = &p_osmt->exp_subn.port_key_tbl;\r
-\r
-       osmtest_prepare_db(p_osmt);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Validating individual port record queries\n");\r
-\r
-       /*\r
-        * Walk the list of all port records, and ask for each one\r
-        * specifically.  Make sure we get it.\r
-        */\r
-       p_port = (port_t *) cl_qmap_head(p_port_key_tbl);\r
-       while (p_port != (port_t *) cl_qmap_end(p_port_key_tbl)) {\r
-               status = osmtest_validate_single_port_rec_lid(p_osmt, p_port);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 011B: "\r
-                               "osmtest_validate_single_port_rec_lid (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-               cnt++;\r
-               p_port = (port_t *) cl_qmap_next(&p_port->map_item);\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Total of %u port records validated\n", cnt);\r
-\r
-       status = osmtest_check_missing_ports(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0118: "\r
-                       "osmtest_check_missing_paths failed (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_validate_against_db(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       ib_gid_t portgid, mgid;\r
-       osmtest_sm_info_rec_t sm_info_rec_opt;\r
-       osmtest_inform_info_t inform_info_opt;\r
-       osmtest_inform_info_rec_t inform_info_rec_opt;\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       ib_net64_t sm_key;\r
-       ib_net16_t test_lid;\r
-       uint8_t lmc;\r
-       osmtest_req_context_t context;\r
-#ifdef DUAL_SIDED_RMPP\r
-       osmv_multipath_req_t request;\r
-#endif\r
-       uint8_t i;\r
-#endif\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       status = osmtest_validate_all_node_recs(p_osmt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-#endif\r
-\r
-       status = osmtest_validate_single_node_recs(p_osmt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Exercise SA PathRecord multicast destination code */\r
-       memset(&context, 0, sizeof(context));\r
-       ib_gid_set_default(&portgid, portguid);\r
-       /* Set IPoIB broadcast MGID */\r
-       mgid.unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);\r
-       mgid.unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);\r
-       /* Can't check status as don't know whether port is running IPoIB */\r
-       osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context);\r
-\r
-       /* Other link local unicast PathRecord */\r
-       memset(&context, 0, sizeof(context));\r
-       ib_gid_set_default(&portgid, portguid);\r
-       ib_gid_set_default(&mgid, portguid);\r
-       mgid.raw[7] = 0xff;     /* not default GID prefix */\r
-       /* Can't check status as don't know whether ??? */\r
-       osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context);\r
-\r
-       /* Off subnet (site local) unicast PathRecord */\r
-       memset(&context, 0, sizeof(context));\r
-       ib_gid_set_default(&portgid, portguid);\r
-       ib_gid_set_default(&mgid, portguid);\r
-       mgid.raw[1] = 0xc0;     /* site local */\r
-       /* Can't check status as don't know whether ??? */\r
-       osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context);\r
-\r
-       /* More than link local scope multicast PathRecord */\r
-       memset(&context, 0, sizeof(context));\r
-       ib_gid_set_default(&portgid, portguid);\r
-       /* Set IPoIB broadcast MGID */\r
-       mgid.unicast.prefix = CL_HTON64(0xff15401bffff0000ULL); /* site local */\r
-       mgid.unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);\r
-       /* Can't check status as don't know whether port is running IPoIB */\r
-       osmtest_get_path_rec_by_gid_pair(p_osmt, portgid, mgid, &context);\r
-\r
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&request, 0, sizeof(request));\r
-       request.comp_mask =\r
-           IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;\r
-       request.sgid_count = 1;\r
-       request.dgid_count = 1;\r
-       ib_gid_set_default(&request.gids[0], portguid);\r
-       ib_gid_set_default(&request.gids[1], portguid);\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&request, 0, sizeof(request));\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Got error %s\n", ib_get_err_str(status));\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&request, 0, sizeof(request));\r
-       request.comp_mask = IB_MPR_COMPMASK_SGIDCOUNT;\r
-       request.sgid_count = 1;\r
-       ib_gid_set_default(&request.gids[0], portguid);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Got error %s\n", ib_get_err_str(status));\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&request, 0, sizeof(request));\r
-       request.comp_mask =\r
-           IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;\r
-       request.sgid_count = 1;\r
-       request.dgid_count = 1;\r
-       ib_gid_set_default(&request.gids[0], portguid);\r
-       /* Set IPoIB broadcast MGID as DGID */\r
-       request.gids[1].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);\r
-       request.gids[1].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Got error %s\n", ib_get_err_str(status));\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       request.comp_mask =\r
-           IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT;\r
-       request.sgid_count = 1;\r
-       request.dgid_count = 1;\r
-       /* Set IPoIB broadcast MGID as SGID */\r
-       request.gids[0].unicast.prefix = CL_HTON64(0xff12401bffff0000ULL);\r
-       request.gids[0].unicast.interface_id = CL_HTON64(0x00000000ffffffffULL);\r
-       ib_gid_set_default(&request.gids[1], portguid);\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Got error %s\n", ib_get_err_str(status));\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       memset(&request, 0, sizeof(request));\r
-       request.comp_mask =\r
-           IB_MPR_COMPMASK_SGIDCOUNT | IB_MPR_COMPMASK_DGIDCOUNT |\r
-           IB_MPR_COMPMASK_NUMBPATH;\r
-       request.sgid_count = 2;\r
-       request.dgid_count = 2;\r
-       request.num_path = 2;\r
-       ib_gid_set_default(&request.gids[0], portguid);\r
-       ib_gid_set_default(&request.gids[1], portguid);\r
-       ib_gid_set_default(&request.gids[2], portguid);\r
-       ib_gid_set_default(&request.gids[3], portguid);\r
-       status = osmtest_get_multipath_rec(p_osmt, &request, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-#endif\r
-\r
-#ifdef VENDOR_RMPP_SUPPORT\r
-       /* GUIDInfoRecords */\r
-       status = osmtest_validate_all_guidinfo_recs(p_osmt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* If LMC > 0, test non base LID SA PortInfoRecord request */\r
-       status =\r
-           osmtest_get_local_port_lmc(p_osmt, p_osmt->local_port.lid, &lmc);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (lmc != 0) {\r
-               status =\r
-                   osmtest_get_local_port_lmc(p_osmt,\r
-                                              p_osmt->local_port.lid + 1,\r
-                                              NULL);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       status = osmtest_get_local_port_lmc(p_osmt, 0xffff, NULL);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       test_lid = cl_ntoh16(p_osmt->local_port.lid);\r
-\r
-       /* More GUIDInfo Record tests */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_guidinfo_rec_by_lid(p_osmt, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_guidinfo_rec_by_lid(p_osmt, 0xffff, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Some PKeyTable Record tests */\r
-       sm_key = OSM_DEFAULT_SM_KEY;\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, sm_key, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_START "\n");\r
-       status = osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, 0, &context);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                       "Got error %s\n", ib_get_err_str(status));\r
-       }\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, EXPECTING_ERRORS_END "\n");\r
-\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_get_pkeytbl_rec_by_lid(p_osmt, 0xffff, sm_key, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* SwitchInfo Record tests */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_sw_info_rec_by_lid(p_osmt, 0, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_sw_info_rec_by_lid(p_osmt, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* LFT Record tests */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_lft_rec_by_lid(p_osmt, 0, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_lft_rec_by_lid(p_osmt, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* MFT Record tests */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_mft_rec_by_lid(p_osmt, 0, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_mft_rec_by_lid(p_osmt, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Some LinkRecord tests */\r
-       /* FromLID */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_link_rec_by_lid(p_osmt, test_lid, 0, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* ToLID */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_link_rec_by_lid(p_osmt, 0, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* FromLID & ToLID */\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_get_link_rec_by_lid(p_osmt, test_lid, test_lid, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* NodeRecord test */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_get_node_rec_by_lid(p_osmt, 0xffff, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* SMInfoRecord tests */\r
-       memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_SET,\r
-                                              &sm_info_rec_opt, &context);\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "IS EXPECTED ERROR ^^^^\n");\r
-       }\r
-\r
-       memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_GETTABLE,\r
-                                              &sm_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-       sm_info_rec_opt.lid = test_lid; /* local LID */\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_sminfo_record_request(p_osmt, IB_MAD_METHOD_GETTABLE,\r
-                                              &sm_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (portguid != 0) {\r
-               memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-               sm_info_rec_opt.sm_guid = portguid;     /* local GUID */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_sminfo_record_request(p_osmt,\r
-                                                 IB_MAD_METHOD_GETTABLE,\r
-                                                 &sm_info_rec_opt, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       for (i = 1; i < 16; i++) {\r
-               memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-               sm_info_rec_opt.priority = i;\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_sminfo_record_request(p_osmt,\r
-                                                 IB_MAD_METHOD_GETTABLE,\r
-                                                 &sm_info_rec_opt, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       for (i = 1; i < 4; i++) {\r
-               memset(&sm_info_rec_opt, 0, sizeof(sm_info_rec_opt));\r
-               sm_info_rec_opt.sm_state = i;\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_sminfo_record_request(p_osmt,\r
-                                                 IB_MAD_METHOD_GETTABLE,\r
-                                                 &sm_info_rec_opt, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       /* InformInfoRecord tests */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a BAD - Set Unsubscribe request\n");\r
-       memset(&inform_info_opt, 0, sizeof(inform_info_opt));\r
-       memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_SET, &inform_info_rec_opt,\r
-                                      &context);\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfoRecord "\r
-                       "IS EXPECTED ERROR ^^^^\n");\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - Empty GetTable request\n");\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* InformInfo tests */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a BAD - Empty Get request "\r
-               "(should fail with NO_RECORDS)\n");\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_GET, &inform_info_opt,\r
-                                           &context);\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfo "\r
-                       "IS EXPECTED ERROR ^^^^\n");\r
-       }\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a BAD - Set Unsubscribe request\n");\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status == IB_SUCCESS) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       } else {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "InformInfo UnSubscribe "\r
-                       "IS EXPECTED ERROR ^^^^\n");\r
-       }\r
-\r
-       /* Now subscribe */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a Good - Set Subscribe request\n");\r
-       inform_info_opt.subscribe = TRUE;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Now unsubscribe (QPN needs to be 1 to work) */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a Good - Set Unsubscribe request\n");\r
-       inform_info_opt.subscribe = FALSE;\r
-       inform_info_opt.qpn = 1;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Now subscribe again */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a Good - Set Subscribe request\n");\r
-       inform_info_opt.subscribe = TRUE;\r
-       inform_info_opt.qpn = 1;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Subscribe over existing subscription */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a Good - Set Subscribe (again) request\n");\r
-       inform_info_opt.qpn = 0;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* More InformInfoRecord tests */\r
-       /* RID lookup (with currently invalid enum) */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable by GID\n");\r
-       ib_gid_set_default(&inform_info_rec_opt.subscriber_gid,\r
-                          p_osmt->local_port.port_guid);\r
-       inform_info_rec_opt.subscriber_enum = 1;\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Enum lookup */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable (subscriber_enum == 0) request\n");\r
-       inform_info_rec_opt.subscriber_enum = 0;\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Get all InformInfoRecords */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable (ALL records) request\n");\r
-       memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Another subscription */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending another Good - Set Subscribe (again) request\n");\r
-       inform_info_opt.qpn = 0;\r
-       inform_info_opt.trap = 0x1234;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET, &inform_info_opt,\r
-                                           &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Get all InformInfoRecords again */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable (ALL records) request\n");\r
-       memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Cleanup subscriptions before further testing */\r
-       /* Does order of deletion matter ? Test this !!! */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo "\r
-               "Sending a Good - Set (cleanup) request\n");\r
-       inform_info_opt.subscribe = FALSE;\r
-       inform_info_opt.qpn = 1;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET,\r
-                                           &inform_info_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Get all InformInfoRecords again */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable (ALL records) request\n");\r
-       memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfo"\r
-               "Sending a Good - Set (cleanup) request\n");\r
-       inform_info_opt.subscribe = FALSE;\r
-       inform_info_opt.qpn = 1;\r
-       inform_info_opt.trap = 0;\r
-       memset(&context, 0, sizeof(context));\r
-       status = osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO,\r
-                                           IB_MAD_METHOD_SET,\r
-                                           &inform_info_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       /* Get all InformInfoRecords a final time */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "InformInfoRecord "\r
-               "Sending a Good - GetTable (ALL records) request\n");\r
-       memset(&inform_info_rec_opt, 0, sizeof(inform_info_rec_opt));\r
-       memset(&context, 0, sizeof(context));\r
-       status =\r
-           osmtest_informinfo_request(p_osmt, IB_MAD_ATTR_INFORM_INFO_RECORD,\r
-                                      IB_MAD_METHOD_GETTABLE,\r
-                                      &inform_info_rec_opt, &context);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (lmc != 0) {\r
-               test_lid = cl_ntoh16(p_osmt->local_port.lid + 1);\r
-\r
-               /* Another GUIDInfo Record test */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_guidinfo_rec_by_lid(p_osmt, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* Another PKeyTable Record test */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_pkeytbl_rec_by_lid(p_osmt, test_lid, sm_key,\r
-                                                  &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* Another SwitchInfo Record test */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_sw_info_rec_by_lid(p_osmt, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* Another LFT Record test */\r
-               memset(&context, 0, sizeof(context));\r
-               status = osmtest_get_lft_rec_by_lid(p_osmt, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* Another MFT Record test */\r
-               memset(&context, 0, sizeof(context));\r
-               status = osmtest_get_mft_rec_by_lid(p_osmt, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* More LinkRecord tests */\r
-               /* FromLID */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_link_rec_by_lid(p_osmt, test_lid, 0, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* ToLID */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_link_rec_by_lid(p_osmt, 0, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               /* Another NodeRecord test */\r
-               memset(&context, 0, sizeof(context));\r
-               status =\r
-                   osmtest_get_node_rec_by_lid(p_osmt, test_lid, &context);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-       /* PathRecords */\r
-       if (!p_osmt->opt.ignore_path_records) {\r
-               status = osmtest_validate_all_path_recs(p_osmt);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-\r
-               if (lmc != 0) {\r
-                       memset(&context, 0, sizeof(context));\r
-                       status =\r
-                           osmtest_get_path_rec_by_lid_pair(p_osmt, test_lid,\r
-                                                            test_lid,\r
-                                                            &context);\r
-                       if (status != IB_SUCCESS)\r
-                               goto Exit;\r
-\r
-                       memset(&context, 0, sizeof(context));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               EXPECTING_ERRORS_START "\n");\r
-                       status =\r
-                           osmtest_get_path_rec_by_lid_pair(p_osmt, 0xffff,\r
-                                                            0xffff, &context);\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                       "Got error %s\n",\r
-                                       ib_get_err_str(status));\r
-                       }\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               EXPECTING_ERRORS_END "\n");\r
-\r
-                       if (status == IB_SUCCESS) {\r
-                               status = IB_ERROR;\r
-                               goto Exit;\r
-                       }\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               EXPECTING_ERRORS_START "\n");\r
-\r
-                       status =\r
-                           osmtest_get_path_rec_by_lid_pair(p_osmt, test_lid,\r
-                                                            0xffff, &context);\r
-                       if (status != IB_SUCCESS) {\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                       "Got error %s\n",\r
-                                       ib_get_err_str(status));\r
-                       }\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                               EXPECTING_ERRORS_END "\n");\r
-\r
-                       if (status == IB_SUCCESS) {\r
-                               status = IB_ERROR;\r
-                               goto Exit;\r
-                       }\r
-               }\r
-       }\r
-#endif\r
-\r
-       status = osmtest_validate_single_port_recs(p_osmt);\r
-       if (status != IB_SUCCESS)\r
-               goto Exit;\r
-\r
-       if (!p_osmt->opt.ignore_path_records) {\r
-               status = osmtest_validate_single_path_recs(p_osmt);\r
-               if (status != IB_SUCCESS)\r
-                       goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static const osmtest_token_t *str_get_token(IN char *const p_str)\r
-{\r
-       const osmtest_token_t *p_tok;\r
-       uint32_t index = 0;\r
-\r
-       p_tok = &token_array[index];\r
-\r
-       while (p_tok->val != OSMTEST_TOKEN_UNKNOWN) {\r
-               if (strncasecmp(p_str, p_tok->str, p_tok->str_size) == 0)\r
-                       return (p_tok);\r
-\r
-               p_tok = &token_array[++index];\r
-       }\r
-\r
-       return (NULL);\r
-}\r
-\r
-/**********************************************************************\r
-   Returns true if not whitespace character encountered before EOL.\r
-**********************************************************************/\r
-static boolean_t\r
-str_skip_white(IN char line[], IN OUT uint32_t * const p_offset)\r
-{\r
-       while (((line[*p_offset] == '\t') ||\r
-               (line[*p_offset] == ' ')) &&\r
-              (line[*p_offset] != '\n') && (line[*p_offset] != '\0')) {\r
-               ++*p_offset;\r
-       }\r
-\r
-       if ((line[*p_offset] == '\n') || (line[*p_offset] == '\0'))\r
-               return (FALSE);\r
-       else\r
-               return (TRUE);\r
-}\r
-\r
-/**********************************************************************\r
-   Returns true if not whitespace character encountered before EOL.\r
-**********************************************************************/\r
-static void str_skip_token(IN char line[], IN OUT uint32_t * const p_offset)\r
-{\r
-       while ((line[*p_offset] != '\t') &&\r
-              (line[*p_offset] != ' ') && (line[*p_offset] != '\0')) {\r
-               ++*p_offset;\r
-       }\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_parse_node(IN osmtest_t * const p_osmt,\r
-                  IN FILE * const fh, IN OUT uint32_t * const p_line_num)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint32_t offset;\r
-       char line[OSMTEST_MAX_LINE_LEN];\r
-       boolean_t done = FALSE;\r
-       node_t *p_node;\r
-       node_t *p_guid_node;\r
-       const osmtest_token_t *p_tok;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_node = node_new();\r
-       CL_ASSERT(p_node != NULL);\r
-\r
-       /*\r
-        * Parse the inventory file and create the database.\r
-        */\r
-       while (!done) {\r
-               if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) {\r
-                       /*\r
-                        * End of file in the middle of a definition.\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0119: "\r
-                               "Unexpected end of file\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               ++*p_line_num;\r
-\r
-               /*\r
-                * Skip whitespace\r
-                */\r
-               offset = 0;\r
-               if (!str_skip_white(line, &offset))\r
-                       continue;       /* whole line was whitespace */\r
-\r
-               p_tok = str_get_token(&line[offset]);\r
-               if (p_tok == NULL) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0120: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       continue;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                       "Found '%s' (line %u)\n", p_tok->str, *p_line_num);\r
-\r
-               str_skip_token(line, &offset);\r
-\r
-               switch (p_tok->val) {\r
-               case OSMTEST_TOKEN_COMMENT:\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LID:\r
-                       p_node->comp.lid = 0xFFFF;\r
-                       p_node->rec.lid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lid = 0x%X\n",\r
-                               cl_ntoh16(p_node->rec.lid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_BASE_VERSION:\r
-                       p_node->comp.node_info.base_version = 0xFF;\r
-                       p_node->rec.node_info.base_version =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "base_version = 0x%X\n",\r
-                               p_node->rec.node_info.base_version);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_CLASS_VERSION:\r
-                       p_node->comp.node_info.class_version = 0xFF;\r
-                       p_node->rec.node_info.class_version =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "class_version = 0x%X\n",\r
-                               p_node->rec.node_info.class_version);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_NODE_TYPE:\r
-                       p_node->comp.node_info.node_type = 0xFF;\r
-                       p_node->rec.node_info.node_type =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "node_type = 0x%X\n",\r
-                               p_node->rec.node_info.node_type);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_NUM_PORTS:\r
-                       p_node->comp.node_info.num_ports = 0xFF;\r
-                       p_node->rec.node_info.num_ports =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "num_ports = 0x%X\n",\r
-                               p_node->rec.node_info.num_ports);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SYS_GUID:\r
-                       p_node->comp.node_info.sys_guid = 0xFFFFFFFFFFFFFFFFULL;\r
-                       p_node->rec.node_info.sys_guid =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "sys_guid = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_node->rec.node_info.sys_guid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_NODE_GUID:\r
-                       p_node->comp.node_info.node_guid =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-                       p_node->rec.node_info.node_guid =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "node_guid = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_node->rec.node_info.node_guid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PORT_GUID:\r
-                       p_node->comp.node_info.port_guid =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-                       p_node->rec.node_info.port_guid =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "port_guid = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_node->rec.node_info.port_guid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PARTITION_CAP:\r
-                       p_node->comp.node_info.partition_cap = 0xFFFF;\r
-                       p_node->rec.node_info.partition_cap =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "partition_cap = 0x%X\n",\r
-                               cl_ntoh16(p_node->rec.node_info.partition_cap));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DEVICE_ID:\r
-                       p_node->comp.node_info.device_id = 0xFFFF;\r
-                       p_node->rec.node_info.device_id = cl_hton16((uint16_t)\r
-                                                                   strtoul\r
-                                                                   (&line\r
-                                                                    [offset],\r
-                                                                    NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "device_id = 0x%X\n",\r
-                               cl_ntoh16(p_node->rec.node_info.device_id));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_REVISION:\r
-                       p_node->comp.node_info.revision = 0xFFFFFFFF;\r
-                       p_node->rec.node_info.revision =\r
-                           cl_hton32(strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "revision = 0x%X\n",\r
-                               cl_ntoh32(p_node->rec.node_info.revision));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PORT_NUM:\r
-                       p_node->comp.node_info.port_num_vendor_id |=\r
-                           IB_NODE_INFO_PORT_NUM_MASK;\r
-                       p_node->rec.node_info.port_num_vendor_id |=\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "local_port_num = 0x%X\n",\r
-                               ib_node_info_get_local_port_num\r
-                               (&p_node->rec.node_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VENDOR_ID:\r
-                       p_node->comp.node_info.port_num_vendor_id |=\r
-                           IB_NODE_INFO_VEND_ID_MASK;\r
-                       p_node->rec.node_info.port_num_vendor_id |=\r
-                           cl_hton32(strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vendor_id = 0x%X\n",\r
-                               cl_ntoh32(ib_node_info_get_vendor_id\r
-                                         (&p_node->rec.node_info)));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_END:\r
-                       done = TRUE;\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0121: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-\r
-                       break;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Make sure the user specified enough information, then\r
-        * add this object to the database.\r
-        */\r
-       if (p_node->comp.lid == 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0122: "\r
-                       "LID must be specified for defined nodes\n");\r
-               node_delete(p_node);\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qmap_insert(&p_osmt->exp_subn.node_lid_tbl,\r
-                      p_node->rec.lid, &p_node->map_item);\r
-\r
-       p_guid_node = node_new();\r
-       CL_ASSERT(p_node != NULL);\r
-\r
-       *p_guid_node = *p_node;\r
-\r
-       cl_qmap_insert(&p_osmt->exp_subn.node_guid_tbl,\r
-                      p_guid_node->rec.node_info.node_guid,\r
-                      &p_guid_node->map_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_parse_port(IN osmtest_t * const p_osmt,\r
-                  IN FILE * const fh, IN OUT uint32_t * const p_line_num)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint32_t offset;\r
-       char line[OSMTEST_MAX_LINE_LEN];\r
-       boolean_t done = FALSE;\r
-       port_t *p_port;\r
-       const osmtest_token_t *p_tok;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_port = port_new();\r
-       CL_ASSERT(p_port != NULL);\r
-\r
-       /*\r
-        * Parse the inventory file and create the database.\r
-        */\r
-       while (!done) {\r
-               if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) {\r
-                       /*\r
-                        * End of file in the middle of a definition.\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0123: "\r
-                               "Unexpected end of file\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               ++*p_line_num;\r
-\r
-               /*\r
-                * Skip whitespace\r
-                */\r
-               offset = 0;\r
-               if (!str_skip_white(line, &offset))\r
-                       continue;       /* whole line was whitespace */\r
-\r
-               p_tok = str_get_token(&line[offset]);\r
-               if (p_tok == NULL) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0124: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       continue;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                       "Found '%s' (line %u)\n", p_tok->str, *p_line_num);\r
-\r
-               str_skip_token(line, &offset);\r
-\r
-               switch (p_tok->val) {\r
-               case OSMTEST_TOKEN_COMMENT:\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LID:\r
-                       p_port->comp.lid = 0xFFFF;\r
-                       p_port->rec.lid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lid = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.lid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PORT_NUM:\r
-                       p_port->comp.port_num = 0xFF;\r
-                       p_port->rec.port_num =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "port_num = 0x%u\n", p_port->rec.port_num);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MKEY:\r
-                       p_port->comp.port_info.m_key = 0xFFFFFFFFFFFFFFFFULL;\r
-                       p_port->rec.port_info.m_key =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "m_key = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_port->rec.port_info.m_key));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SUBN_PREF:\r
-                       p_port->comp.port_info.subnet_prefix =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-                       p_port->rec.port_info.subnet_prefix =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "subnet_prefix = 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_port->rec.port_info.subnet_prefix));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_BASE_LID:\r
-                       p_port->comp.port_info.base_lid = 0xFFFF;\r
-                       p_port->rec.port_info.base_lid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "base_lid = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.base_lid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SM_BASE_LID:\r
-                       p_port->comp.port_info.master_sm_base_lid = 0xFFFF;\r
-                       p_port->rec.port_info.master_sm_base_lid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "master_sm_base_lid = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.master_sm_base_lid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_CAP_MASK:\r
-                       p_port->comp.port_info.capability_mask = 0xFFFFFFFF;\r
-                       p_port->rec.port_info.capability_mask =\r
-                           cl_hton32((uint32_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "capability_mask = 0x%X\n",\r
-                               cl_ntoh32(p_port->rec.port_info.capability_mask));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DIAG_CODE:\r
-                       p_port->comp.port_info.diag_code = 0xFFFF;\r
-                       p_port->rec.port_info.diag_code =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "diag_code = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.diag_code));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MKEY_LEASE_PER:\r
-                       p_port->comp.port_info.m_key_lease_period = 0xFFFF;\r
-                       p_port->rec.port_info.m_key_lease_period =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "m_key_lease_period = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.m_key_lease_period));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LOC_PORT_NUM:\r
-                       p_port->comp.port_info.local_port_num = 0xFF;\r
-                       p_port->rec.port_info.local_port_num =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "local_port_num = 0x%u\n",\r
-                               p_port->rec.port_info.local_port_num);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LINK_WID_EN:\r
-                       p_port->comp.port_info.link_width_enabled = 0xFF;\r
-                       p_port->rec.port_info.link_width_enabled =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "link_width_enabled = 0x%u\n",\r
-                               p_port->rec.port_info.link_width_enabled);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LINK_WID_SUP:\r
-                       p_port->comp.port_info.link_width_supported = 0xFF;\r
-                       p_port->rec.port_info.link_width_supported =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "link_width_supported = 0x%u\n",\r
-                               p_port->rec.port_info.link_width_supported);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LINK_WID_ACT:\r
-                       p_port->comp.port_info.link_width_active = 0xFF;\r
-                       p_port->rec.port_info.link_width_active =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "link_width_active = 0x%u\n",\r
-                               p_port->rec.port_info.link_width_active);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LINK_SPEED_SUP:\r
-                       p_port->comp.port_info.state_info1 = 0xFF;\r
-                       ib_port_info_set_link_speed_sup((uint8_t)\r
-                                                       strtoul(&line[offset],\r
-                                                               NULL, 0),\r
-                                                       &p_port->rec.port_info);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "link_speed_supported = 0x%u\n",\r
-                               ib_port_info_get_link_speed_sup(&p_port->rec.port_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PORT_STATE:\r
-                       str_skip_white(line, &offset);\r
-                       p_port->comp.port_info.state_info1 = 0xFF;\r
-                       ib_port_info_set_port_state(&p_port->rec.port_info,\r
-                                                   ib_get_port_state_from_str\r
-                                                   (&line[offset]));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "port_state = 0x%u\n",\r
-                               ib_port_info_get_port_state(&p_port->rec.port_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_STATE_INFO2:\r
-                       p_port->comp.port_info.state_info2 = 0xFF;\r
-                       p_port->rec.port_info.state_info2 =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "state_info2 = 0x%u\n",\r
-                               p_port->rec.port_info.state_info2);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MKEY_PROT_BITS:\r
-                       p_port->comp.port_info.mkey_lmc = 0xFF;\r
-                       ib_port_info_set_mpb(&p_port->rec.port_info,\r
-                                            (uint8_t) strtoul(&line[offset],\r
-                                                              NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "mpb = 0x%u\n",\r
-                               ib_port_info_get_mpb(&p_port->rec.port_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LMC:\r
-                       p_port->comp.port_info.mkey_lmc = 0xFF;\r
-                       ib_port_info_set_lmc(&p_port->rec.port_info,\r
-                                            (uint8_t) strtoul(&line[offset],\r
-                                                              NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "lmc = 0x%u\n",\r
-                               ib_port_info_get_lmc(&p_port->rec.port_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_LINK_SPEED:\r
-                       p_port->comp.port_info.link_speed = 0xFF;\r
-                       p_port->rec.port_info.link_speed =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "link_speed = 0x%u\n",\r
-                               p_port->rec.port_info.link_speed);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MTU_SMSL:\r
-                       p_port->comp.port_info.mtu_smsl = 0xFF;\r
-                       p_port->rec.port_info.mtu_smsl =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "mtu_smsl = 0x%u\n",\r
-                               p_port->rec.port_info.mtu_smsl);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_CAP:\r
-                       p_port->comp.port_info.vl_cap = 0xFF;\r
-                       p_port->rec.port_info.vl_cap =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "vl_cap = 0x%u\n",\r
-                               p_port->rec.port_info.vl_cap);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_HIGH_LIMIT:\r
-                       p_port->comp.port_info.vl_high_limit = 0xFF;\r
-                       p_port->rec.port_info.vl_high_limit =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vl_high_limit = 0x%u\n",\r
-                               p_port->rec.port_info.vl_high_limit);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_ARB_HIGH_CAP:\r
-                       p_port->comp.port_info.vl_arb_high_cap = 0xFF;\r
-                       p_port->rec.port_info.vl_arb_high_cap =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vl_arb_high_cap = 0x%u\n",\r
-                               p_port->rec.port_info.vl_arb_high_cap);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_ARB_LOW_CAP:\r
-                       p_port->comp.port_info.vl_arb_low_cap = 0xFF;\r
-                       p_port->rec.port_info.vl_arb_low_cap =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vl_arb_low_cap = 0x%u\n",\r
-                               p_port->rec.port_info.vl_arb_low_cap);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MTU_CAP:\r
-                       p_port->comp.port_info.mtu_cap = 0xFF;\r
-                       p_port->rec.port_info.mtu_cap =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "mtu_cap = 0x%u\n",\r
-                               p_port->rec.port_info.mtu_cap);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_STALL_LIFE:\r
-                       p_port->comp.port_info.vl_stall_life = 0xFF;\r
-                       p_port->rec.port_info.vl_stall_life =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vl_stall_life = 0x%u\n",\r
-                               p_port->rec.port_info.vl_stall_life);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_VL_ENFORCE:\r
-                       p_port->comp.port_info.vl_enforce = 0xFF;\r
-                       p_port->rec.port_info.vl_enforce =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "vl_enforce = 0x%u\n",\r
-                               p_port->rec.port_info.vl_enforce);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_MKEY_VIOL:\r
-                       p_port->comp.port_info.m_key_violations = 0xFFFF;\r
-                       p_port->rec.port_info.m_key_violations =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "m_key_violations = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.m_key_violations));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PKEY_VIOL:\r
-                       p_port->comp.port_info.p_key_violations = 0xFFFF;\r
-                       p_port->rec.port_info.p_key_violations =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "p_key_violations = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.p_key_violations));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_QKEY_VIOL:\r
-                       p_port->comp.port_info.q_key_violations = 0xFFFF;\r
-                       p_port->rec.port_info.q_key_violations =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "q_key_violations = 0x%X\n",\r
-                               cl_ntoh16(p_port->rec.port_info.q_key_violations));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_GUID_CAP:\r
-                       p_port->comp.port_info.guid_cap = 0xFF;\r
-                       p_port->rec.port_info.guid_cap =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "guid_cap = 0x%u\n",\r
-                               p_port->rec.port_info.guid_cap);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SUBN_TIMEOUT:\r
-                       p_port->comp.port_info.subnet_timeout = 0x1F;\r
-                       p_port->rec.port_info.subnet_timeout =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "subnet_timeout = 0x%u\n",\r
-                               ib_port_info_get_timeout(&p_port->rec.port_info));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_RESP_TIME_VAL:\r
-                       p_port->comp.port_info.resp_time_value = 0xFF;\r
-                       p_port->rec.port_info.resp_time_value =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "resp_time_value = 0x%u\n",\r
-                               p_port->rec.port_info.resp_time_value);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_ERR_THRESHOLD:\r
-                       p_port->comp.port_info.error_threshold = 0xFF;\r
-                       p_port->rec.port_info.error_threshold =\r
-                           (uint8_t) strtoul(&line[offset], NULL, 0);\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "error_threshold = 0x%u\n",\r
-                               p_port->rec.port_info.error_threshold);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_END:\r
-                       done = TRUE;\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0125: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       break;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Make sure the user specified enough information, then\r
-        * add this object to the database.\r
-        */\r
-       if (p_port->comp.lid == 0) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0126: "\r
-                       "LID must be specified for defined ports\n");\r
-               port_delete(p_port);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qmap_insert(&p_osmt->exp_subn.port_key_tbl,\r
-                      port_gen_id(p_port->rec.lid, p_port->rec.port_num),\r
-                      &p_port->map_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_parse_path(IN osmtest_t * const p_osmt,\r
-                  IN FILE * const fh, IN OUT uint32_t * const p_line_num)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint32_t offset;\r
-       char line[OSMTEST_MAX_LINE_LEN];\r
-       boolean_t done = FALSE;\r
-       path_t *p_path;\r
-       const osmtest_token_t *p_tok;\r
-       boolean_t got_error = FALSE;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       p_path = path_new();\r
-       CL_ASSERT(p_path != NULL);\r
-\r
-       /*\r
-        * Parse the inventory file and create the database.\r
-        */\r
-       while (!done) {\r
-               if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) {\r
-                       /*\r
-                        * End of file in the middle of a definition.\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0127: "\r
-                               "Unexpected end of file\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               ++*p_line_num;\r
-\r
-               /*\r
-                * Skip whitespace\r
-                */\r
-               offset = 0;\r
-               if (!str_skip_white(line, &offset))\r
-                       continue;       /* whole line was whitespace */\r
-\r
-               p_tok = str_get_token(&line[offset]);\r
-               if (p_tok == NULL) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0128: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       got_error = TRUE;\r
-                       continue;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                       "Found '%s' (line %u)\n", p_tok->str, *p_line_num);\r
-\r
-               str_skip_token(line, &offset);\r
-\r
-               switch (p_tok->val) {\r
-               case OSMTEST_TOKEN_COMMENT:\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DGID:\r
-                       p_path->comp.dgid.unicast.prefix =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-                       p_path->comp.dgid.unicast.interface_id =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-\r
-                       str_skip_white(line, &offset);\r
-                       p_path->rec.dgid.unicast.prefix =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       str_skip_token(line, &offset);\r
-                       p_path->rec.dgid.unicast.interface_id =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "dgid = 0x%016" PRIx64 " 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_path->rec.dgid.unicast.prefix),\r
-                               cl_ntoh64(p_path->rec.dgid.unicast.interface_id));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SGID:\r
-                       p_path->comp.sgid.unicast.prefix =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-                       p_path->comp.sgid.unicast.interface_id =\r
-                           0xFFFFFFFFFFFFFFFFULL;\r
-\r
-                       str_skip_white(line, &offset);\r
-                       p_path->rec.sgid.unicast.prefix =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-                       str_skip_token(line, &offset);\r
-                       p_path->rec.sgid.unicast.interface_id =\r
-                           cl_hton64(strtoull(&line[offset], NULL, 0));\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                               "sgid = 0x%016" PRIx64 " 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(p_path->rec.sgid.unicast.prefix),\r
-                               cl_ntoh64(p_path->rec.sgid.unicast.interface_id));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DLID:\r
-                       p_path->comp.dlid = 0xFFFF;\r
-                       p_path->rec.dlid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "dlid = 0x%X\n",\r
-                               cl_ntoh16(p_path->rec.dlid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_SLID:\r
-                       p_path->comp.slid = 0xFFFF;\r
-                       p_path->rec.slid =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "slid = 0x%X\n",\r
-                               cl_ntoh16(p_path->rec.slid));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_PKEY:\r
-                       p_path->comp.pkey = 0xFFFF;\r
-                       p_path->rec.pkey =\r
-                           cl_hton16((uint16_t)\r
-                                     strtoul(&line[offset], NULL, 0));\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "pkey = 0x%X\n",\r
-                               cl_ntoh16(p_path->rec.pkey));\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_END:\r
-                       done = TRUE;\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0129: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       got_error = TRUE;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (got_error) {\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-       /*\r
-        * Make sure the user specified enough information, then\r
-        * add this object to the database.\r
-        */\r
-       if (osmtest_path_rec_kay_is_valid(p_osmt, p_path) == FALSE) {\r
-               path_delete(p_path);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       cl_qmap_insert(&p_osmt->exp_subn.path_tbl,\r
-                      osmtest_path_rec_key_get(&p_path->rec),\r
-                      &p_path->map_item);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t\r
-osmtest_parse_link(IN osmtest_t * const p_osmt,\r
-                  IN FILE * const fh, IN OUT uint32_t * const p_line_num)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint32_t offset;\r
-       char line[OSMTEST_MAX_LINE_LEN];\r
-       boolean_t done = FALSE;\r
-       const osmtest_token_t *p_tok;\r
-       boolean_t got_error = FALSE;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Parse the inventory file and create the database.\r
-        */\r
-       while (!done) {\r
-               if (fgets(line, OSMTEST_MAX_LINE_LEN, fh) == NULL) {\r
-                       /*\r
-                        * End of file in the middle of a definition.\r
-                        */\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012A: "\r
-                               "Unexpected end of file\n");\r
-                       status = IB_ERROR;\r
-                       goto Exit;\r
-               }\r
-\r
-               ++*p_line_num;\r
-\r
-               /*\r
-                * Skip whitespace\r
-                */\r
-               offset = 0;\r
-               if (!str_skip_white(line, &offset))\r
-                       continue;       /* whole line was whitespace */\r
-\r
-               p_tok = str_get_token(&line[offset]);\r
-               if (p_tok == NULL) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012B: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       got_error = TRUE;\r
-                       continue;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                       "Found '%s' (line %u)\n", p_tok->str, *p_line_num);\r
-\r
-               str_skip_token(line, &offset);\r
-\r
-               switch (p_tok->val) {\r
-               case OSMTEST_TOKEN_FROMLID:\r
-               case OSMTEST_TOKEN_FROMPORTNUM:\r
-               case OSMTEST_TOKEN_TOPORTNUM:\r
-               case OSMTEST_TOKEN_TOLID:\r
-                       /* For now */\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_END:\r
-                       done = TRUE;\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 012C: "\r
-                               "Ignoring line %u with unknown token: %s\n",\r
-                               *p_line_num, &line[offset]);\r
-                       got_error = TRUE;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if (got_error)\r
-               status = IB_ERROR;\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-static ib_api_status_t osmtest_create_db(IN osmtest_t * const p_osmt)\r
-{\r
-       FILE *fh;\r
-       ib_api_status_t status = IB_SUCCESS;\r
-       uint32_t offset;\r
-       char line[OSMTEST_MAX_LINE_LEN];\r
-       uint32_t line_num = 0;\r
-       const osmtest_token_t *p_tok;\r
-       boolean_t got_error = FALSE;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       fh = fopen(p_osmt->opt.file_name, "r");\r
-       if (fh == NULL) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0130: "\r
-                       "Unable to open inventory file (%s)\n",\r
-                       p_osmt->opt.file_name);\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-       /*\r
-        * Parse the inventory file and create the database.\r
-        */\r
-       while (fgets(line, OSMTEST_MAX_LINE_LEN, fh) != NULL) {\r
-               line_num++;\r
-\r
-               /*\r
-                * Skip whitespace\r
-                */\r
-               offset = 0;\r
-               if (!str_skip_white(line, &offset))\r
-                       continue;       /* whole line was whitespace */\r
-\r
-               p_tok = str_get_token(&line[offset]);\r
-               if (p_tok == NULL) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0131: "\r
-                               "Ignoring line %u: %s\n", line_num,\r
-                               &line[offset]);\r
-                       got_error = TRUE;\r
-                       continue;\r
-               }\r
-\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-                       "Found '%s' (line %u)\n", p_tok->str, line_num);\r
-\r
-               switch (p_tok->val) {\r
-               case OSMTEST_TOKEN_COMMENT:\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DEFINE_NODE:\r
-                       status = osmtest_parse_node(p_osmt, fh, &line_num);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DEFINE_PORT:\r
-                       status = osmtest_parse_port(p_osmt, fh, &line_num);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DEFINE_PATH:\r
-                       status = osmtest_parse_path(p_osmt, fh, &line_num);\r
-                       break;\r
-\r
-               case OSMTEST_TOKEN_DEFINE_LINK:\r
-                       status = osmtest_parse_link(p_osmt, fh, &line_num);\r
-                       break;\r
-\r
-               default:\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0132: "\r
-                               "Ignoring line %u: %s\n", line_num,\r
-                               &line[offset]);\r
-                       got_error = TRUE;\r
-                       break;\r
-               }\r
-\r
-               if (got_error)\r
-                       status = IB_ERROR;\r
-\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0133: "\r
-                               "Bad status received during parsing (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       fclose(fh);\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       fclose(fh);\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-/**********************************************************************\r
-   Returns the index in the local port attribute array for the\r
-   user's selection.\r
-**********************************************************************/\r
-static uint32_t\r
-osmtest_get_user_port(IN osmtest_t * const p_osmt,\r
-                     IN const ib_port_attr_t p_attr_array[],\r
-                     IN uint32_t const num_ports)\r
-{\r
-       uint32_t i, choice = 0;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * User needs prompting for the local port GUID with which\r
-        * to bind.\r
-        */\r
-\r
-       while (1) {\r
-               printf("\nChoose a local port number with which to bind:\n\n");\r
-               for (i = 0; i < num_ports; i++) {\r
-                       /*\r
-                        * Print the index + 1 since by convention, port numbers\r
-                        * start with 1 on host channel adapters.\r
-                        */\r
-\r
-                       printf("\t%u: GUID = 0x%8" PRIx64\r
-                              ", lid = 0x%04X, state = %s\n", i + 1,\r
-                              cl_ntoh64(p_attr_array[i].port_guid),\r
-                              p_attr_array[i].lid,\r
-                              ib_get_port_state_str(p_attr_array[i].\r
-                                                    link_state));\r
-               }\r
-\r
-               printf("\nEnter choice (1-%u): ", i);\r
-               fflush(stdout);\r
-               if (scanf("%u", &choice) <= 0) {\r
-                       char junk[256];\r
-                       if (scanf("%s", junk) <= 0)\r
-                               printf("\nError: Cannot scan!\n");\r
-               } else if (choice && choice <= num_ports)\r
-                       break;\r
-               printf("\nError: Lame choice!\n");\r
-       }\r
-       printf("\n");\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (choice - 1);\r
-}\r
-\r
-ib_api_status_t\r
-osmtest_bind(IN osmtest_t * p_osmt,\r
-            IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL)\r
-{\r
-       uint32_t port_index;\r
-       ib_api_status_t status;\r
-       uint32_t num_ports = MAX_LOCAL_IBPORTS;\r
-       ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       /*\r
-        * Call the transport layer for a list of local port\r
-        * GUID values.\r
-        */\r
-       status = osm_vendor_get_all_port_attr(p_osmt->p_vendor,\r
-                                             attr_array, &num_ports);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0134: "\r
-                       "Failure getting local port attributes (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       if (guid == 0) {\r
-               /*\r
-                * User needs prompting for the local port GUID with which\r
-                * to bind.\r
-                */\r
-               port_index =\r
-                   osmtest_get_user_port(p_osmt, attr_array, num_ports);\r
-\r
-               if (num_ports == 0) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0135: "\r
-                               "No local ports.  Unable to proceed\n");\r
-                       goto Exit;\r
-               }\r
-               guid = attr_array[port_index].port_guid;\r
-       } else {\r
-               for (port_index = 0; port_index < num_ports; port_index++) {\r
-                       if (attr_array[port_index].port_guid == guid)\r
-                               break;\r
-               }\r
-\r
-               if (port_index == num_ports) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0136: "\r
-                               "No local port with guid 0x%016" PRIx64 "\n",\r
-                               cl_ntoh64(guid));\r
-                       status = IB_NOT_FOUND;\r
-                       goto Exit;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * Copy the port info for the selected port.\r
-        */\r
-       memcpy(&p_osmt->local_port, &attr_array[port_index],\r
-              sizeof(p_osmt->local_port));\r
-\r
-       /* bind to the SA */\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,\r
-               "Using port with SM LID:0x%04X\n", p_osmt->local_port.sm_lid);\r
-       p_osmt->max_lid = max_lid;\r
-\r
-       p_osmt->h_bind =\r
-           osmv_bind_sa(p_osmt->p_vendor, &p_osmt->mad_pool, guid);\r
-\r
-       if (p_osmt->h_bind == OSM_BIND_INVALID_HANDLE) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0137: "\r
-                       "Unable to bind to SA\n");\r
-               status = IB_ERROR;\r
-               goto Exit;\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
-\r
-ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt)\r
-{\r
-       ib_api_status_t status = IB_SUCCESS;\r
-\r
-       OSM_LOG_ENTER(&p_osmt->log);\r
-\r
-       status = osmtest_validate_sa_class_port_info(p_osmt);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0138: "\r
-                       "Could not obtain SA ClassPortInfo (%s)\n",\r
-                       ib_get_err_str(status));\r
-               goto Exit;\r
-       }\r
-\r
-       if (p_osmt->opt.flow == OSMT_FLOW_CREATE_INVENTORY) {\r
-               /*\r
-                * Creating an inventory file with all nodes, ports and paths\r
-                */\r
-               status = osmtest_create_inventory_file(p_osmt);\r
-               if (status != IB_SUCCESS) {\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0139: "\r
-                               "Inventory file create failed (%s)\n",\r
-                               ib_get_err_str(status));\r
-                       goto Exit;\r
-               }\r
-       } else {\r
-               if (p_osmt->opt.flow == OSMT_FLOW_STRESS_SA) {\r
-                       /*\r
-                        * Stress SA - flood the SA with queries\r
-                        */\r
-                       switch (p_osmt->opt.stress) {\r
-                       case 0:\r
-                       case 1: /* small response SA query stress */\r
-                               status = osmtest_stress_small_rmpp(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0140: "\r
-                                               "Small RMPP stress test failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                               break;\r
-                       case 2: /* large response SA query stress */\r
-                               status = osmtest_stress_large_rmpp(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0141: "\r
-                                               "Large RMPP stress test failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                               break;\r
-                       case 3: /* large response Path Record SA query stress */\r
-                               status = osmtest_create_db(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0142: "\r
-                                               "Database creation failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               status = osmtest_stress_large_rmpp_pr(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0143: "\r
-                                               "Large RMPP stress test failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                               break;\r
-                       case 4: /* SA Get PR to SA LID */\r
-                               status = osmtest_stress_get_pr(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 014B: "\r
-                                               "SA Get PR stress test failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                               break;\r
-                       default:\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                       "ERR 0144: "\r
-                                       "Unknown stress test value %u\n",\r
-                                       p_osmt->opt.stress);\r
-                               break;\r
-                       }\r
-               } else {\r
-\r
-                       /*\r
-                        * Run normal validation tests.\r
-                        */\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||\r
-                           p_osmt->opt.flow == OSMT_FLOW_VALIDATE_INVENTORY) {\r
-                               /*\r
-                                * Only validate the given inventory file\r
-                                */\r
-                               status = osmtest_create_db(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0145: "\r
-                                               "Database creation failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               status = osmtest_validate_against_db(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0146: "\r
-                                               "SA validation database failure (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_ALL) {\r
-                               status = osmtest_wrong_sm_key_ignored(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0147: "\r
-                                               "Try wrong SM_Key failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||\r
-                           p_osmt->opt.flow == OSMT_FLOW_SERVICE_REGISTRATION)\r
-                       {\r
-                               /*\r
-                                * run service registration, deregistration, and lease test\r
-                                */\r
-                               status = osmt_run_service_records_flow(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0148: "\r
-                                               "Service Flow failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||\r
-                           p_osmt->opt.flow == OSMT_FLOW_EVENT_FORWARDING) {\r
-                               /*\r
-                                * Run event forwarding test\r
-                                */\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-                               status = osmt_run_inform_info_flow(p_osmt);\r
-\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0149: "\r
-                                               "Inform Info Flow failed: (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-#else\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                                       "The event forwarding flow "\r
-                                       "is not implemented yet!\n");\r
-                               status = IB_SUCCESS;\r
-                               goto Exit;\r
-#endif\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_QOS) {\r
-                               /*\r
-                                * QoS info: dump VLArb and SLtoVL tables.\r
-                                * Since it generates a huge file, we run it only\r
-                                * if explicitly required to\r
-                                */\r
-                               status = osmtest_create_db(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 014A: "\r
-                                               "Database creation failed (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-\r
-                               status =\r
-                                   osmt_run_slvl_and_vlarb_records_flow\r
-                                   (p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0150: "\r
-                                               "Failed to get SLtoVL and VL Arbitration Tables (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_TRAP) {\r
-                               /*\r
-                                * Run trap 64/65 flow (this flow requires running of external tool)\r
-                                */\r
-#ifdef OSM_VENDOR_INTF_MTL\r
-                               status = osmt_run_trap64_65_flow(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0151: "\r
-                                               "Trap 64/65 Flow failed: (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-#else\r
-                               OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                                       "The event forwarding flow "\r
-                                       "is not implemented yet!\n");\r
-                               status = IB_SUCCESS;\r
-                               goto Exit;\r
-#endif\r
-                       }\r
-\r
-                       if (p_osmt->opt.flow == OSMT_FLOW_ALL ||\r
-                           p_osmt->opt.flow == OSMT_FLOW_MULTICAST) {\r
-                               /*\r
-                                * Multicast flow\r
-                                */\r
-                               status = osmt_run_mcast_flow(p_osmt);\r
-                               if (status != IB_SUCCESS) {\r
-                                       OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,\r
-                                               "ERR 0152: "\r
-                                               "Multicast Flow failed: (%s)\n",\r
-                                               ib_get_err_str(status));\r
-                                       goto Exit;\r
-                               }\r
-                       }\r
-\r
-                       OSM_LOG(&p_osmt->log, OSM_LOG_INFO,\r
-                               "\n\n***************** ALL TESTS PASS *****************\n\n");\r
-\r
-               }\r
-       }\r
-\r
-Exit:\r
-       OSM_LOG_EXIT(&p_osmt->log);\r
-       return (status);\r
-}\r
diff --git a/branches/opensm_3/user/osmtest/osmtest.rc b/branches/opensm_3/user/osmtest/osmtest.rc
deleted file mode 100644 (file)
index 1b71a2d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
- * Copyright (c) 2005 Mellanox Technologies.  All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- *     Redistribution and use in source and binary forms, with or\r
- *     without modification, are permitted provided that the following\r
- *     conditions are met:\r
- *\r
- *      - Redistributions of source code must retain the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer.\r
- *\r
- *      - Redistributions in binary form must reproduce the above\r
- *        copyright notice, this list of conditions and the following\r
- *        disclaimer in the documentation and/or other materials\r
- *        provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE                   VFT_APP\r
-#define VER_FILESUBTYPE                        VFT2_UNKNOWN\r
-#ifdef _DEBUG_\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application 3.3.6 (Debug)"\r
-#define VER_INTERNALNAME_STR        "osmtest.exe"\r
-#define VER_ORIGINALFILENAME_STR    "osmtest.exe"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application 3.3.6"\r
-#define VER_INTERNALNAME_STR        "osmtest.exe"\r
-#define VER_ORIGINALFILENAME_STR    "osmtest.exe"\r
-#endif\r
-#include <common.ver>\r
diff --git a/branches/opensm_3/user/osmtest/vendor-ibal.inc b/branches/opensm_3/user/osmtest/vendor-ibal.inc
deleted file mode 100644 (file)
index 303cdd4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-\r
-!INCLUDE ..\opensm\vendor-ibal.inc\r
diff --git a/branches/opensm_3/user/osmtest/vendor-umad.inc b/branches/opensm_3/user/osmtest/vendor-umad.inc
deleted file mode 100644 (file)
index d106d80..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-\r
-!INCLUDE ..\opensm\vendor-umad.inc\r
diff --git a/branches/opensm_3/user/scripts/osm-regress.bat b/branches/opensm_3/user/scripts/osm-regress.bat
deleted file mode 100644 (file)
index 9229f91..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-@echo off\r
-setlocal\r
-\r
-rem requires cmd.exe /E /V, make it so... JLP\r
-set F=on\r
-set F=off\r
-if "!F!" == "off" goto OK\r
-\r
-%comspec% /E:on /V:on /C %0 %1 %2\r
-exit /B %ERRORLEVEL%\r
-\r
-:OK\r
-\r
-if "%1" == "" (\r
-:usage\r
-    echo usage: osm-regress results-filename {exit-on-error}\r
-    exit /B 1\r
-)\r
-if exist "%1"  del /Q "%1"\r
-\r
-rem if not exist "osmtest.dat" (\r
-rem    echo missing inventory file .\osmtest.dat ?\r
-rem    exit /B 1\r
-rem )\r
-\r
-rem set T=..\..\..\bin\user\objchk_wlh_amd64\amd64\osmtest.exe\r
-set T=osmtest.exe\r
-\r
-rem Event forwarding test 'e' is not yet implemented [3.3.5]\r
-\r
-set TESTS="c" "v" "m -M1" "m -M2" "m -M3" "m -M4" "f -s1" "f -s2" "f -s3" "f -s4" "s" "a"\r
-rem set TESTS="c" "v" "a" "f -s1" "f -s2" "f -s3" "f -s4" "s"\r
-\r
-for %%t in ( %TESTS% ) DO (\r
-    echo TEST: osmtest -f %%~t\r
-    echo TEST: osmtest -f %%~t >> %1\r
-    %T% -f %%~t >> %1\r
-    if !ERRORLEVEL! NEQ 0  (\r
-      echo Error !ERRORLEVEL! reported in osmtest -f %%~t ?\r
-      if Not "%2" == ""  exit /B 1\r
-    )\r
-    echo. >> %1\r
-    echo    PASS.\r
-)\r
-endlocal\r