]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[OPENSM] commit 3.3.6 opensm for review/testing
authorStan Smith <stan.smith@intel.com>
Wed, 2 Jun 2010 23:51:29 +0000 (23:51 +0000)
committerStan Smith <stan.smith@intel.com>
Wed, 2 Jun 2010 23:51:29 +0000 (23:51 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@2819 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

149 files changed:
branches/opensm_3/user/README.windows
branches/opensm_3/user/complib/README.txt [new file with mode: 0644]
branches/opensm_3/user/complib/cl_dispatcher.c
branches/opensm_3/user/complib/libosmcomp.ver [deleted file]
branches/opensm_3/user/doc/opensm_release_notes-3.3.txt
branches/opensm_3/user/ibtrapgen/SOURCES
branches/opensm_3/user/ibtrapgen/osm_files.c
branches/opensm_3/user/ibtrapgen/vendor-ibal.inc [new file with mode: 0644]
branches/opensm_3/user/ibtrapgen/vendor-umad.inc [new file with mode: 0644]
branches/opensm_3/user/include/iba/ib_types.h [deleted file]
branches/opensm_3/user/include/opensm/osm_base.h
branches/opensm_3/user/include/opensm/osm_config.h
branches/opensm_3/user/include/opensm/osm_event_plugin.h
branches/opensm_3/user/include/opensm/osm_log.h
branches/opensm_3/user/include/opensm/osm_mcast_tbl.h
branches/opensm_3/user/include/opensm/osm_multicast.h
branches/opensm_3/user/include/opensm/osm_partition.h
branches/opensm_3/user/include/opensm/osm_pkey.h
branches/opensm_3/user/include/opensm/osm_port.h
branches/opensm_3/user/include/opensm/osm_port_profile.h
branches/opensm_3/user/include/opensm/osm_qos_policy.h
branches/opensm_3/user/include/opensm/osm_router.h
branches/opensm_3/user/include/opensm/osm_sa.h
branches/opensm_3/user/include/opensm/osm_sm.h
branches/opensm_3/user/include/opensm/osm_subnet.h
branches/opensm_3/user/include/opensm/osm_switch.h
branches/opensm_3/user/include/opensm/osm_ucast_cache.h
branches/opensm_3/user/include/opensm/osm_version.h
branches/opensm_3/user/include/opensm/osm_vl15intf.h
branches/opensm_3/user/include/vendor/osm_vendor_api.h
branches/opensm_3/user/include/vendor/osm_vendor_mlx.h
branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h
branches/opensm_3/user/include/vendor/winosm_common.h
branches/opensm_3/user/libvendor/SOURCES
branches/opensm_3/user/libvendor/libosmvendor.map [deleted file]
branches/opensm_3/user/libvendor/libosmvendor.ver
branches/opensm_3/user/libvendor/osm_pkt_randomizer.c
branches/opensm_3/user/libvendor/osm_vendor_al.c
branches/opensm_3/user/libvendor/osm_vendor_ibumad.c
branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c
branches/opensm_3/user/libvendor/osm_vendor_mlx.c
branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c
branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c
branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c
branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c
branches/opensm_3/user/libvendor/winosm_common.c
branches/opensm_3/user/man/opensm.8 [new file with mode: 0644]
branches/opensm_3/user/man/opensm.8.in [deleted file]
branches/opensm_3/user/opensm/SOURCES
branches/opensm_3/user/opensm/libopensm.ver
branches/opensm_3/user/opensm/main.c
branches/opensm_3/user/opensm/opensm.rc
branches/opensm_3/user/opensm/osm_console.c
branches/opensm_3/user/opensm/osm_db_files.c
branches/opensm_3/user/opensm/osm_db_pack.c
branches/opensm_3/user/opensm/osm_drop_mgr.c
branches/opensm_3/user/opensm/osm_dump.c
branches/opensm_3/user/opensm/osm_event_plugin.c
branches/opensm_3/user/opensm/osm_files.c [new file with mode: 0644]
branches/opensm_3/user/opensm/osm_helper.c
branches/opensm_3/user/opensm/osm_inform.c
branches/opensm_3/user/opensm/osm_lid_mgr.c
branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c
branches/opensm_3/user/opensm/osm_link_mgr.c
branches/opensm_3/user/opensm/osm_log.c
branches/opensm_3/user/opensm/osm_mad_pool.c
branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c
branches/opensm_3/user/opensm/osm_mcast_mgr.c
branches/opensm_3/user/opensm/osm_mcast_tbl.c
branches/opensm_3/user/opensm/osm_mcm_port.c
branches/opensm_3/user/opensm/osm_mtree.c
branches/opensm_3/user/opensm/osm_multicast.c
branches/opensm_3/user/opensm/osm_node.c
branches/opensm_3/user/opensm/osm_node_desc_rcv.c
branches/opensm_3/user/opensm/osm_node_info_rcv.c
branches/opensm_3/user/opensm/osm_opensm.c
branches/opensm_3/user/opensm/osm_perfmgr.c
branches/opensm_3/user/opensm/osm_perfmgr_db.c
branches/opensm_3/user/opensm/osm_pkey.c
branches/opensm_3/user/opensm/osm_pkey_mgr.c
branches/opensm_3/user/opensm/osm_pkey_rcv.c
branches/opensm_3/user/opensm/osm_port.c
branches/opensm_3/user/opensm/osm_port_info_rcv.c
branches/opensm_3/user/opensm/osm_prtn.c
branches/opensm_3/user/opensm/osm_qos.c
branches/opensm_3/user/opensm/osm_qos_parser_l.c
branches/opensm_3/user/opensm/osm_qos_parser_l.l
branches/opensm_3/user/opensm/osm_qos_parser_y.c
branches/opensm_3/user/opensm/osm_qos_parser_y.y
branches/opensm_3/user/opensm/osm_qos_policy.c
branches/opensm_3/user/opensm/osm_remote_sm.c
branches/opensm_3/user/opensm/osm_req.c
branches/opensm_3/user/opensm/osm_resp.c
branches/opensm_3/user/opensm/osm_router.c
branches/opensm_3/user/opensm/osm_sa.c
branches/opensm_3/user/opensm/osm_sa_class_port_info.c
branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c
branches/opensm_3/user/opensm/osm_sa_informinfo.c
branches/opensm_3/user/opensm/osm_sa_lft_record.c
branches/opensm_3/user/opensm/osm_sa_link_record.c
branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c
branches/opensm_3/user/opensm/osm_sa_mcmember_record.c
branches/opensm_3/user/opensm/osm_sa_mft_record.c
branches/opensm_3/user/opensm/osm_sa_multipath_record.c
branches/opensm_3/user/opensm/osm_sa_node_record.c
branches/opensm_3/user/opensm/osm_sa_path_record.c
branches/opensm_3/user/opensm/osm_sa_pkey_record.c
branches/opensm_3/user/opensm/osm_sa_portinfo_record.c
branches/opensm_3/user/opensm/osm_sa_service_record.c
branches/opensm_3/user/opensm/osm_sa_slvl_record.c
branches/opensm_3/user/opensm/osm_sa_sminfo_record.c
branches/opensm_3/user/opensm/osm_sa_sw_info_record.c
branches/opensm_3/user/opensm/osm_sa_vlarb_record.c
branches/opensm_3/user/opensm/osm_service.c
branches/opensm_3/user/opensm/osm_slvl_map_rcv.c
branches/opensm_3/user/opensm/osm_sm.c
branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c
branches/opensm_3/user/opensm/osm_sm_state_mgr.c
branches/opensm_3/user/opensm/osm_sminfo_rcv.c
branches/opensm_3/user/opensm/osm_state_mgr.c
branches/opensm_3/user/opensm/osm_subnet.c
branches/opensm_3/user/opensm/osm_sw_info_rcv.c
branches/opensm_3/user/opensm/osm_switch.c
branches/opensm_3/user/opensm/osm_trap_rcv.c
branches/opensm_3/user/opensm/osm_ucast_cache.c
branches/opensm_3/user/opensm/osm_ucast_file.c
branches/opensm_3/user/opensm/osm_ucast_ftree.c
branches/opensm_3/user/opensm/osm_ucast_lash.c
branches/opensm_3/user/opensm/osm_ucast_mgr.c
branches/opensm_3/user/opensm/osm_ucast_updn.c
branches/opensm_3/user/opensm/osm_vl15intf.c
branches/opensm_3/user/opensm/osm_vl_arb_rcv.c
branches/opensm_3/user/opensm/st.c
branches/opensm_3/user/osmtest/SOURCES
branches/opensm_3/user/osmtest/main.c
branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c
branches/opensm_3/user/osmtest/osmt_multicast.c
branches/opensm_3/user/osmtest/osmt_service.c
branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c
branches/opensm_3/user/osmtest/osmtest.c
branches/opensm_3/user/osmtest/osmtest.rc
branches/opensm_3/user/osmtest/vendor-ibal.inc [new file with mode: 0644]
branches/opensm_3/user/osmtest/vendor-umad.inc [new file with mode: 0644]
branches/opensm_3/user/scripts/opensm.init.in [deleted file]
branches/opensm_3/user/scripts/opensm.logrotate [deleted file]
branches/opensm_3/user/scripts/opensm.sysconfig [deleted file]
branches/opensm_3/user/scripts/osm-regress.bat [new file with mode: 0644]
branches/opensm_3/user/scripts/redhat-opensm.init.in [deleted file]
branches/opensm_3/user/scripts/sldd.sh.in [deleted file]

index 4b64a4857c3bf8e7c471282ca988d395be9aebcf..99c8fc3e0339beac8da134751ea553ca35088386 100644 (file)
@@ -1,4 +1,4 @@
-OpenSM README for Windows: last updated [10-23-09]\r
+OpenSM for Windows: last updated [5-27-10]\r
 --------------------------------------------------\r
 \r
 OpenSM provides a user-mode implementation for an InfiniBand Subnet Manager and\r
@@ -10,13 +10,16 @@ provided in the doc sub directory.
 \r
 The installation of OpenSM includes:\r
 \r
-%ProgramFiles%\Winof\\r
+%ProgramFiles%\OFED\\r
    opensm.exe - the SM/SA executable\r
    osmtest.exe - a test program for the SM/SA\r
 \r
-The standard WinOF installation creates an OpenSM Windows Service which is\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 Windows Service is reset to start automatically at System boot.\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
@@ -25,36 +28,44 @@ Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600+
   build /wg\r
 \r
 \r
-OpenSM status\r
+OpenSM 3.3.6 status\r
 -------------\r
 \r
-Consider this an Alpha code drop.\r
-Opensm 3.3.2 has work to be completed and much testing to be done before prime\r
-time deployment. That said, openSM 3.3.2 configured a 20 node HPC fabric runing\r
-Intel MPI regression tests.\r
-The openSM as a service seems to be functioning well; log file in\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 I used\r
-osm_strdup() in places where the static paths were dup()'ed. osm_strdup() will\r
-expand environment vars during the string dup operation; a solution although\r
-likely not the final solution, as when the static paths printf() the '%' char\r
-of the environment vars are incorrectly treated as printf() control...sigh.\r
-\r
-The osm vendor is IBAL until UMAD is less buggy and has is_osm functionality.\r
-There are include files vendor.* which drive which osm vendor is being used.\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
-nmake/build pre-processing leaves much to be desired... :-(\r
 \r
 \r
 \r
 OpenSM Code Base\r
 ----------------\r
 \r
-OpenSM src is based on the OFED management\opensm sources.\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
-Based-on implies the following process:\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
@@ -70,7 +81,7 @@ Based-on implies the following process:
 \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 onogin story...sigh.\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
@@ -89,4 +100,4 @@ Based-on implies the following process:
         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
+\r
diff --git a/branches/opensm_3/user/complib/README.txt b/branches/opensm_3/user/complib/README.txt
new file mode 100644 (file)
index 0000000..abc98b4
--- /dev/null
@@ -0,0 +1,6 @@
+\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
index d0faea202f73277125d2f3ad322bc9e2c68964ef..d09c9b3c452c1e53c74d83f147b60c718e4c78b7 100644 (file)
@@ -118,8 +118,6 @@ void __cl_disp_worker(IN void *context)
        cl_spinlock_release(&p_disp->lock);\r
 }\r
 \r
-/********************************************************************\r
- ********************************************************************/\r
 void cl_disp_construct(IN cl_dispatcher_t * const p_disp)\r
 {\r
        CL_ASSERT(p_disp);\r
@@ -131,8 +129,6 @@ void cl_disp_construct(IN cl_dispatcher_t * const p_disp)
        cl_qpool_construct(&p_disp->msg_pool);\r
 }\r
 \r
-/********************************************************************\r
- ********************************************************************/\r
 void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)\r
 {\r
        CL_ASSERT(p_disp);\r
@@ -148,8 +144,6 @@ void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp)
                free(cl_qlist_remove_head(&p_disp->reg_list));\r
 }\r
 \r
-/********************************************************************\r
- ********************************************************************/\r
 void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)\r
 {\r
        CL_ASSERT(p_disp);\r
@@ -161,8 +155,6 @@ void cl_disp_destroy(IN cl_dispatcher_t * const p_disp)
        cl_ptr_vector_destroy(&p_disp->reg_vec);\r
 }\r
 \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
@@ -203,8 +195,6 @@ cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp,
        return (status);\r
 }\r
 \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
@@ -259,8 +249,6 @@ cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp,
        return (p_reg);\r
 }\r
 \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
@@ -297,8 +285,6 @@ void cl_disp_unregister(IN const cl_disp_reg_handle_t handle)
        cl_spinlock_release(&p_disp->lock);\r
 }\r
 \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
diff --git a/branches/opensm_3/user/complib/libosmcomp.ver b/branches/opensm_3/user/complib/libosmcomp.ver
deleted file mode 100644 (file)
index 23a0f4d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# In this file we track the current API version\r
-# of the complib library interface\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=2:5:0\r
index 290135557ff496ffcdcc0cd3830f244ad9c96b6c..fb27b274ed106da9ca4661283d7ff2c6cbeb5ccc 100644 (file)
@@ -3,14 +3,14 @@
 \r
 Version: OpenSM 3.3.x\r
 Repo:    git://git.openfabrics.org/~sashak/management.git\r
-Date:    Nov 2009\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.3.\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
@@ -53,9 +53,14 @@ This document includes the following sections:
   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 (very early stage yet).\r
+* Windows support (early stage).\r
 \r
 1.2 Minor New Features:\r
 \r
@@ -118,6 +123,14 @@ e21c651 opensm/osm_base.h: Add new SA ClassPortInfo:CapabilityMask2 bit
 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
@@ -231,6 +244,15 @@ d10660a opensm/osm_req.c: In osm_send_trap144, set producer type according
 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
@@ -292,7 +314,6 @@ b382ad8 opensm: avoid memory leaks on config parameters reloading
 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
-8406c65 opensm: fix port chooser\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
@@ -304,15 +325,14 @@ aa25fcb opensm/osm_port_info_rcv.c: don't clear sw->need_update if port 0
 67f4c07 opensm/lash: simplify some memory allocations\r
 3e6bcdb opensm/lash: fix memory leaks\r
 3ff97b9 opensm/vendor: save some stack memory\r
-fa90512 opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM\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
-\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 UMAD_CA_MAX_AGENTS\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
@@ -323,7 +343,6 @@ c027335 opensm/osm_ucast_updn.c: Further reduction in cas_per_sw allocation
 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
-\r
 c2ab189 opensm/osm_state_mgr.c: in cleanup_switch() check only relevant\r
        LFT part\r
 40c93d3 use transportable constant attributes\r
@@ -348,7 +367,6 @@ fe20080 osm_sa.c - void * arithmetic causes problems
 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
-7ec9f7c opensm: discard multicast SA PR with wildcard DGID\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
@@ -425,7 +443,6 @@ e0b8ec9 opensm/osm_sminfo_rcv.c: clean type of smi_rcv_process_get_sm()
 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
-5cdb53f opensm/osm_sa_node_record.c use comp mask to match by LID or GUID\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
@@ -442,6 +459,60 @@ cd226c7 OpenSM: include/vendor/osm_vendor.h - Replaced #elif with no
        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
@@ -621,6 +692,7 @@ Table 2 - Qualified IB Stacks
 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
index 850a113a9c1aa852f6ade0fdb54bc435358e6c01..b479a7086233ac044277e93f23b36cd3933a11db 100644 (file)
@@ -16,10 +16,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)
 TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
 !endif\r
 \r
-# include only one vendor definition\r
-\r
-!include ..\opensm\vendor-ibal.inc\r
-#!include ..\opensm\vendor-umad.inc\r
+!INCLUDE ..\mad-vendor.inc\r
 \r
 TARGETTYPE=PROGRAM\r
 UMTYPE=console\r
@@ -52,8 +49,9 @@ INCLUDES= \
        $(WINIBHOME)\inc; \\r
        $(WINIBHOME)\inc\user; \\r
        $(WINIBHOME)\inc\user\linux; \\r
+       $(VENDOR_INC); \\r
        $(OSM_HOME); \\r
-       $(OSM_HOME)\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
@@ -68,5 +66,5 @@ C_DEFINES=$(C_DEFINES)
 \r
 LINKER_FLAGS= $(LINKER_FLAGS)\r
 \r
-MSC_WARNING_LEVEL= /W3\r
+MSC_WARNING_LEVEL= /W3 /wd4090\r
 \r
index c4fbcdf1e8fc78920e6fb5761d48e4101aec1cc2..950655425ef71a41e02bfd9cc24908ba2dbced01 100644 (file)
@@ -5,3 +5,5 @@
 \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
new file mode 100644 (file)
index 0000000..303cdd4
--- /dev/null
@@ -0,0 +1,2 @@
+\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
new file mode 100644 (file)
index 0000000..d106d80
--- /dev/null
@@ -0,0 +1,2 @@
+\r
+!INCLUDE ..\opensm\vendor-umad.inc\r
diff --git a/branches/opensm_3/user/include/iba/ib_types.h b/branches/opensm_3/user/include/iba/ib_types.h
deleted file mode 100644 (file)
index 1b0f1f4..0000000
+++ /dev/null
@@ -1,10703 +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
-#if !defined(__IB_TYPES_H__)\r
-#define __IB_TYPES_H__\r
-\r
-#include <string.h>\r
-#include <complib/cl_types.h>\r
-#include <complib/cl_byteswap.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( __WIN__ )\r
-#if defined( EXPORT_AL_SYMBOLS )\r
-#define OSM_EXPORT     __declspec(dllexport)\r
-#else\r
-#define OSM_EXPORT     __declspec(dllimport)\r
-#endif\r
-#define OSM_API __stdcall\r
-#define OSM_CDECL __cdecl\r
-#else\r
-#define OSM_EXPORT     extern\r
-#define OSM_API\r
-#define OSM_CDECL\r
-#define __ptr64\r
-#endif\r
-/****h* IBA Base/Constants\r
-* NAME\r
-*      Constants\r
-*\r
-* DESCRIPTION\r
-*      The following constants are used throughout the IBA code base.\r
-*\r
-*      Definitions are from the InfiniBand Architecture Specification v1.2\r
-*\r
-*********/\r
-/****d* IBA Base: Constants/MAD_BLOCK_SIZE\r
-* NAME\r
-*      MAD_BLOCK_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Size of a non-RMPP MAD datagram.\r
-*\r
-* SOURCE\r
-*/\r
-#define MAD_BLOCK_SIZE                                         256\r
-/**********/\r
-/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE\r
-* NAME\r
-*      MAD_RMPP_HDR_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Size of an RMPP header, including the common MAD header.\r
-*\r
-* SOURCE\r
-*/\r
-#define MAD_RMPP_HDR_SIZE                                      36\r
-/**********/\r
-/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE\r
-* NAME\r
-*      MAD_RMPP_DATA_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Size of an RMPP transaction data section.\r
-*\r
-* SOURCE\r
-*/\r
-#define MAD_RMPP_DATA_SIZE             (MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)\r
-/**********/\r
-/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE\r
-* NAME\r
-*      MAD_BLOCK_GRH_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Size of a MAD datagram, including the GRH.\r
-*\r
-* SOURCE\r
-*/\r
-#define MAD_BLOCK_GRH_SIZE                                     296\r
-/**********/\r
-/****d* IBA Base: Constants/IB_LID_PERMISSIVE\r
-* NAME\r
-*      IB_LID_PERMISSIVE\r
-*\r
-* DESCRIPTION\r
-*      Permissive LID\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LID_PERMISSIVE                                      0xFFFF\r
-/**********/\r
-/****d* IBA Base: Constants/IB_DEFAULT_PKEY\r
-* NAME\r
-*      IB_DEFAULT_PKEY\r
-*\r
-* DESCRIPTION\r
-*      P_Key value for the default partition.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_DEFAULT_PKEY                                                0xFFFF\r
-/**********/\r
-/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY\r
-* NAME\r
-*      IB_QP1_WELL_KNOWN_Q_KEY\r
-*\r
-* DESCRIPTION\r
-*      Well-known Q_Key for QP1 privileged mode access (15.4.2).\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_QP1_WELL_KNOWN_Q_KEY                                CL_HTON32(0x80010000)\r
-/*********/\r
-#define IB_QP0                                                         0\r
-#define IB_QP1                                                         CL_HTON32(1)\r
-#define IB_QP_PRIVILEGED_Q_KEY                         CL_HTON32(0x80000000)\r
-/****d* IBA Base: Constants/IB_LID_UCAST_START\r
-* NAME\r
-*      IB_LID_UCAST_START\r
-*\r
-* DESCRIPTION\r
-*      Lowest valid unicast LID value.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LID_UCAST_START_HO                          0x0001\r
-#define IB_LID_UCAST_START                                     (CL_HTON16(IB_LID_UCAST_START_HO))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_LID_UCAST_END\r
-* NAME\r
-*      IB_LID_UCAST_END\r
-*\r
-* DESCRIPTION\r
-*      Highest valid unicast LID value.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LID_UCAST_END_HO                                    0xBFFF\r
-#define IB_LID_UCAST_END                                       (CL_HTON16(IB_LID_UCAST_END_HO))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_LID_MCAST_START\r
-* NAME\r
-*      IB_LID_MCAST_START\r
-*\r
-* DESCRIPTION\r
-*      Lowest valid multicast LID value.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LID_MCAST_START_HO                          0xC000\r
-#define IB_LID_MCAST_START                                     (CL_HTON16(IB_LID_MCAST_START_HO))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_LID_MCAST_END\r
-* NAME\r
-*      IB_LID_MCAST_END\r
-*\r
-* DESCRIPTION\r
-*      Highest valid multicast LID value.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LID_MCAST_END_HO                                    0xFFFE\r
-#define IB_LID_MCAST_END                                       (CL_HTON16(IB_LID_MCAST_END_HO))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX\r
-* NAME\r
-*      IB_DEFAULT_SUBNET_PREFIX\r
-*\r
-* DESCRIPTION\r
-*      Default subnet GID prefix.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_DEFAULT_SUBNET_PREFIX                       (CL_HTON64(0xFE80000000000000ULL))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX\r
-* NAME\r
-*      IB_NODE_NUM_PORTS_MAX\r
-*\r
-* DESCRIPTION\r
-*      Maximum number of ports in a single node (14.2.5.7).\r
-* SOURCE\r
-*/\r
-#define IB_NODE_NUM_PORTS_MAX                          0xFE\r
-/**********/\r
-/****d* IBA Base: Constants/IB_INVALID_PORT_NUM\r
-* NAME\r
-*      IB_INVALID_PORT_NUM\r
-*\r
-* DESCRIPTION\r
-*      Value used to indicate an invalid port number (14.2.5.10).\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_INVALID_PORT_NUM                                    0xFF\r
-/*********/\r
-/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX\r
-* NAME\r
-*      IB_SUBNET_PATH_HOPS_MAX\r
-*\r
-* DESCRIPTION\r
-*      Maximum number of directed route switch hops in a subnet (14.2.1.2).\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SUBNET_PATH_HOPS_MAX                                64\r
-/*********/\r
-/****d* IBA Base: Constants/IB_HOPLIMIT_MAX\r
-* NAME\r
-*      IB_HOPLIMIT_MAX\r
-*\r
-* DESCRIPTION\r
-*       Maximum number of router hops allowed.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_HOPLIMIT_MAX                                        255\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MC_SCOPE_*\r
-* NAME\r
-*      IB_MC_SCOPE_*\r
-*\r
-* DESCRIPTION\r
-*      Scope component definitions from IBA 1.2.1 (Table 3 p. 148)\r
-*/\r
-#define IB_MC_SCOPE_LINK_LOCAL         0x2\r
-#define IB_MC_SCOPE_SITE_LOCAL         0x5\r
-#define IB_MC_SCOPE_ORG_LOCAL          0x8\r
-#define IB_MC_SCOPE_GLOBAL             0xE\r
-/*********/\r
-/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS\r
-* NAME\r
-*      IB_PKEY_MAX_BLOCKS\r
-*\r
-* DESCRIPTION\r
-*      Maximum number of PKEY blocks (14.2.5.7).\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PKEY_MAX_BLOCKS                                     2048\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID\r
-* NAME\r
-*      IB_MCAST_MAX_BLOCK_ID\r
-*\r
-* DESCRIPTION\r
-*      Maximum number of Multicast port mask blocks\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_MAX_BLOCK_ID                          511\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO\r
-* NAME\r
-*      IB_MCAST_BLOCK_ID_MASK_HO\r
-*\r
-* DESCRIPTION\r
-*      Mask (host order) to recover the Multicast block ID.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_BLOCK_ID_MASK_HO                      0x000001FF\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE\r
-* NAME\r
-*      IB_MCAST_BLOCK_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Number of port mask entries in a multicast forwarding table block.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_BLOCK_SIZE                                    32\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE\r
-* NAME\r
-*      IB_MCAST_MASK_SIZE\r
-*\r
-* DESCRIPTION\r
-*      Number of port mask bits in each entry in the multicast forwarding table.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_MASK_SIZE                                     16\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO\r
-* NAME\r
-*      IB_MCAST_POSITION_MASK_HO\r
-*\r
-* DESCRIPTION\r
-*      Mask (host order) to recover the multicast block position.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_POSITION_MASK_HO                              0xF0000000\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX\r
-* NAME\r
-*      IB_MCAST_POSITION_MAX\r
-*\r
-* DESCRIPTION\r
-*      Maximum value for the multicast block position.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_POSITION_MAX                          0xF\r
-/*********/\r
-/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT\r
-* NAME\r
-*      IB_MCAST_POSITION_SHIFT\r
-*\r
-* DESCRIPTION\r
-*      Shift value to normalize the multicast block position value.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCAST_POSITION_SHIFT                                28\r
-/*********/\r
-/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX\r
-* NAME\r
-*      IB_PKEY_ENTRIES_MAX\r
-*\r
-* DESCRIPTION\r
-*      Maximum number of PKEY entries per port (14.2.5.7).\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK)\r
-/*********/\r
-/****d* IBA Base: Constants/IB_PKEY_BASE_MASK\r
-* NAME\r
-*      IB_PKEY_BASE_MASK\r
-*\r
-* DESCRIPTION\r
-*      Masks for the base P_Key value given a P_Key Entry.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PKEY_BASE_MASK                                      (CL_HTON16(0x7FFF))\r
-/*********/\r
-/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK\r
-* NAME\r
-*      IB_PKEY_TYPE_MASK\r
-*\r
-* DESCRIPTION\r
-*      Masks for the P_Key membership type given a P_Key Entry.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PKEY_TYPE_MASK                                      (CL_HTON16(0x8000))\r
-/*********/\r
-/****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY\r
-* NAME\r
-*      IB_DEFAULT_PARTIAL_PKEY\r
-*\r
-* DESCRIPTION\r
-*      0x7FFF in network order\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_DEFAULT_PARTIAL_PKEY                                       (CL_HTON16(0x7FFF))\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID\r
-* NAME\r
-*      IB_MCLASS_SUBN_LID\r
-*\r
-* DESCRIPTION\r
-*      Subnet Management Class, Subnet Manager LID routed (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_SUBN_LID                                     0x01\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR\r
-* NAME\r
-*      IB_MCLASS_SUBN_DIR\r
-*\r
-* DESCRIPTION\r
-*      Subnet Management Class, Subnet Manager directed route (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_SUBN_DIR                                     0x81\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM\r
-* NAME\r
-*      IB_MCLASS_SUBN_ADM\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Subnet Administration (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_SUBN_ADM                                     0x03\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_PERF\r
-* NAME\r
-*      IB_MCLASS_PERF\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Performance Management (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_PERF                                         0x04\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_BM\r
-* NAME\r
-*      IB_MCLASS_BM\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Baseboard Management (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_BM                                           0x05\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT\r
-* NAME\r
-*      IB_MCLASS_DEV_MGMT\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Device Management (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_DEV_MGMT                                     0x06\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT\r
-* NAME\r
-*      IB_MCLASS_COMM_MGMT\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Communication Management (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_COMM_MGMT                                    0x07\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_SNMP\r
-* NAME\r
-*      IB_MCLASS_SNMP\r
-*\r
-* DESCRIPTION\r
-*      Management Class, SNMP Tunneling (13.4.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_SNMP                                         0x08\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
-* NAME\r
-*      IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Vendor Specific Low Range Start\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
-* NAME\r
-*      IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Vendor Specific Low Range End\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM\r
-* NAME\r
-*      IB_MCLASS_DEV_ADM\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Device Administration\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_DEV_ADM 0x10\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_BIS\r
-* NAME\r
-*      IB_MCLASS_BIS\r
-*\r
-* DESCRIPTION\r
-*      Management Class, BIS\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_BIS 0x12\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
-* NAME\r
-*      IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Vendor Specific High Range Start\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30\r
-/**********/\r
-/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
-* NAME\r
-*      IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
-*\r
-* DESCRIPTION\r
-*      Management Class, Vendor Specific High Range End\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f\r
-/**********/\r
-/****f* IBA Base: Types/ib_class_is_vendor_specific_low\r
-* NAME\r
-*      ib_class_is_vendor_specific_low\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the Class Code if a vendor specific class from\r
-*  the low range\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_class_is_vendor_specific_low(IN const uint8_t class_code)\r
-{\r
-       return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&\r
-               (class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      class_code\r
-*              [in] The Management Datagram Class Code\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the class is in the Low range of Vendor Specific MADs\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_is_vendor_specific_high\r
-* NAME\r
-*      ib_class_is_vendor_specific_high\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the Class Code if a vendor specific class from\r
-*  the high range\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_class_is_vendor_specific_high(IN const uint8_t class_code)\r
-{\r
-       return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&\r
-               (class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      class_code\r
-*              [in] The Management Datagram Class Code\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the class is in the High range of Vendor Specific MADs\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_is_vendor_specific\r
-* NAME\r
-*      ib_class_is_vendor_specific\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the Class Code if a vendor specific class\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_class_is_vendor_specific(IN const uint8_t class_code)\r
-{\r
-       return (ib_class_is_vendor_specific_low(class_code) ||\r
-               ib_class_is_vendor_specific_high(class_code));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      class_code\r
-*              [in] The Management Datagram Class Code\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the class is a Vendor Specific MAD\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_is_rmpp\r
-* NAME\r
-*      ib_class_is_rmpp\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the Class Code supports RMPP\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)\r
-{\r
-       return ((class_code == IB_MCLASS_SUBN_ADM) ||\r
-               (class_code == IB_MCLASS_DEV_MGMT) ||\r
-               (class_code == IB_MCLASS_DEV_ADM) ||\r
-               (class_code == IB_MCLASS_BIS) ||\r
-               ib_class_is_vendor_specific_high(class_code));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      class_code\r
-*              [in] The Management Datagram Class Code\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the class supports RMPP\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-*********/\r
-\r
-/*\r
- *     MAD methods\r
- */\r
-\r
-/****d* IBA Base: Constants/IB_MAX_METHOD\r
-* NAME\r
-*      IB_MAX_METHOD\r
-*\r
-* DESCRIPTION\r
-*      Total number of methods available to a class, not including the R-bit.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAX_METHODS                                         128\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK\r
-* NAME\r
-*      IB_MAD_METHOD_RESP_MASK\r
-*\r
-* DESCRIPTION\r
-*      Response mask to extract 'R' bit from the method field. (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_RESP_MASK                                0x80\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_GET\r
-* NAME\r
-*      IB_MAD_METHOD_GET\r
-*\r
-* DESCRIPTION\r
-*      Get() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_GET                                      0x01\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_SET\r
-* NAME\r
-*      IB_MAD_METHOD_SET\r
-*\r
-* DESCRIPTION\r
-*      Set() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_SET                                      0x02\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP\r
-* NAME\r
-*      IB_MAD_METHOD_GET_RESP\r
-*\r
-* DESCRIPTION\r
-*      GetResp() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_GET_RESP                         0x81\r
-/**********/\r
-\r
-#define IB_MAD_METHOD_DELETE                           0x15\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE\r
-* NAME\r
-*      IB_MAD_METHOD_GETTABLE\r
-*\r
-* DESCRIPTION\r
-*      SubnAdmGetTable() Method (15.2.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_GETTABLE                         0x12\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP\r
-* NAME\r
-*      IB_MAD_METHOD_GETTABLE_RESP\r
-*\r
-* DESCRIPTION\r
-*      SubnAdmGetTableResp() Method (15.2.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_GETTABLE_RESP                    0x92\r
-\r
-/**********/\r
-\r
-#define IB_MAD_METHOD_GETTRACETABLE                    0x13\r
-#define IB_MAD_METHOD_GETMULTI                         0x14\r
-#define IB_MAD_METHOD_GETMULTI_RESP                    0x94\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_SEND\r
-* NAME\r
-*      IB_MAD_METHOD_SEND\r
-*\r
-* DESCRIPTION\r
-*      Send() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_SEND                                     0x03\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP\r
-* NAME\r
-*      IB_MAD_METHOD_TRAP\r
-*\r
-* DESCRIPTION\r
-*      Trap() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_TRAP                                     0x05\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT\r
-* NAME\r
-*      IB_MAD_METHOD_REPORT\r
-*\r
-* DESCRIPTION\r
-*      Report() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_REPORT                           0x06\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP\r
-* NAME\r
-*      IB_MAD_METHOD_REPORT_RESP\r
-*\r
-* DESCRIPTION\r
-*      ReportResp() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_REPORT_RESP                      0x86\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS\r
-* NAME\r
-*      IB_MAD_METHOD_TRAP_REPRESS\r
-*\r
-* DESCRIPTION\r
-*      TrapRepress() Method (13.4.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_METHOD_TRAP_REPRESS                     0x07\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY\r
-* NAME\r
-*      IB_MAD_STATUS_BUSY\r
-*\r
-* DESCRIPTION\r
-*      Temporarily busy, MAD discarded (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_BUSY                             (CL_HTON16(0x0001))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT\r
-* NAME\r
-*      IB_MAD_STATUS_REDIRECT\r
-*\r
-* DESCRIPTION\r
-*      QP Redirection required (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_REDIRECT                         (CL_HTON16(0x0002))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER\r
-* NAME\r
-*      IB_MAD_STATUS_UNSUP_CLASS_VER\r
-*\r
-* DESCRIPTION\r
-*      Unsupported class version (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_UNSUP_CLASS_VER                  (CL_HTON16(0x0004))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD\r
-* NAME\r
-*      IB_MAD_STATUS_UNSUP_METHOD\r
-*\r
-* DESCRIPTION\r
-*      Unsupported method (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_UNSUP_METHOD                     (CL_HTON16(0x0008))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
-* NAME\r
-*      IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
-*\r
-* DESCRIPTION\r
-*      Unsupported method/attribute combination (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_UNSUP_METHOD_ATTR                        (CL_HTON16(0x000C))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD\r
-* NAME\r
-*      IB_MAD_STATUS_INVALID_FIELD\r
-*\r
-* DESCRIPTION\r
-*      Attribute contains one or more invalid fields (13.4.7)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_STATUS_INVALID_FIELD                    (CL_HTON16(0x001C))\r
-/**********/\r
-\r
-#define IB_MAD_STATUS_CLASS_MASK                       (CL_HTON16(0xFF00))\r
-\r
-#define IB_SA_MAD_STATUS_SUCCESS                       (CL_HTON16(0x0000))\r
-#define IB_SA_MAD_STATUS_NO_RESOURCES                  (CL_HTON16(0x0100))\r
-#define IB_SA_MAD_STATUS_REQ_INVALID                   (CL_HTON16(0x0200))\r
-#define IB_SA_MAD_STATUS_NO_RECORDS                    (CL_HTON16(0x0300))\r
-#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS              (CL_HTON16(0x0400))\r
-#define IB_SA_MAD_STATUS_INVALID_GID                   (CL_HTON16(0x0500))\r
-#define IB_SA_MAD_STATUS_INSUF_COMPS                   (CL_HTON16(0x0600))\r
-#define IB_SA_MAD_STATUS_DENIED                                (CL_HTON16(0x0700))\r
-#define IB_SA_MAD_STATUS_PRIO_SUGGESTED                        (CL_HTON16(0x0800))\r
-\r
-#define IB_DM_MAD_STATUS_NO_IOC_RESP                   (CL_HTON16(0x0100))\r
-#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES                        (CL_HTON16(0x0200))\r
-#define IB_DM_MAD_STATUS_IOC_FAILURE                   (CL_HTON16(0x8000))\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_CLASS_PORT_INFO\r
-*\r
-* DESCRIPTION\r
-*      ClassPortInfo attribute (13.4.8)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_CLASS_PORT_INFO                    (CL_HTON16(0x0001))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE\r
-* NAME\r
-*      IB_MAD_ATTR_NOTICE\r
-*\r
-* DESCRIPTION\r
-*      Notice attribute (13.4.8)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_NOTICE                                     (CL_HTON16(0x0002))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_INFORM_INFO\r
-*\r
-* DESCRIPTION\r
-*      InformInfo attribute (13.4.8)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_INFORM_INFO                                (CL_HTON16(0x0003))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC\r
-* NAME\r
-*      IB_MAD_ATTR_NODE_DESC\r
-*\r
-* DESCRIPTION\r
-*      NodeDescription attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_NODE_DESC                          (CL_HTON16(0x0010))\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_SMPL_CTRL\r
-*\r
-* DESCRIPTION\r
-*      PortSamplesControl attribute (16.1.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_SMPL_CTRL                     (CL_HTON16(0x0010))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_NODE_INFO\r
-*\r
-* DESCRIPTION\r
-*      NodeInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_NODE_INFO                          (CL_HTON16(0x0011))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_SMPL_RSLT\r
-*\r
-* DESCRIPTION\r
-*      PortSamplesResult attribute (16.1.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_SMPL_RSLT                     (CL_HTON16(0x0011))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_SWITCH_INFO\r
-*\r
-* DESCRIPTION\r
-*      SwitchInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SWITCH_INFO                                (CL_HTON16(0x0012))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_CNTRS\r
-*\r
-* DESCRIPTION\r
-*      PortCounters attribute (16.1.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_CNTRS                         (CL_HTON16(0x0012))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS_EXT\r
-* NAME\r
-*       IB_MAD_ATTR_PORT_CNTRS_EXT\r
-*\r
-* DESCRIPTION\r
-*       PortCountersExtended attribute (16.1.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_CNTRS_EXT                     (CL_HTON16(0x001D))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_XMIT_DATA_SL\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_XMIT_DATA_SL\r
-*\r
-* DESCRIPTION\r
-*      PortXmitDataSL attribute (A13.6.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_XMIT_DATA_SL                  (CL_HTON16(0x0036))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_RCV_DATA_SL\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_RCV_DATA_SL\r
-*\r
-* DESCRIPTION\r
-*      PortRcvDataSL attribute (A13.6.4)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_RCV_DATA_SL                   (CL_HTON16(0x0037))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_GUID_INFO\r
-*\r
-* DESCRIPTION\r
-*      GUIDInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_GUID_INFO                          (CL_HTON16(0x0014))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_PORT_INFO\r
-*\r
-* DESCRIPTION\r
-*      PortInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORT_INFO                          (CL_HTON16(0x0015))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE\r
-* NAME\r
-*      IB_MAD_ATTR_P_KEY_TABLE\r
-*\r
-* DESCRIPTION\r
-*      PartitionTable attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_P_KEY_TABLE                                (CL_HTON16(0x0016))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE\r
-* NAME\r
-*      IB_MAD_ATTR_SLVL_TABLE\r
-*\r
-* DESCRIPTION\r
-*      SL VL Mapping Table attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SLVL_TABLE                         (CL_HTON16(0x0017))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION\r
-* NAME\r
-*      IB_MAD_ATTR_VL_ARBITRATION\r
-*\r
-* DESCRIPTION\r
-*      VL Arbitration Table attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_VL_ARBITRATION                     (CL_HTON16(0x0018))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL\r
-* NAME\r
-*      IB_MAD_ATTR_LIN_FWD_TBL\r
-*\r
-* DESCRIPTION\r
-*      Switch linear forwarding table\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_LIN_FWD_TBL                                (CL_HTON16(0x0019))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL\r
-* NAME\r
-*      IB_MAD_ATTR_RND_FWD_TBL\r
-*\r
-* DESCRIPTION\r
-*      Switch random forwarding table\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_RND_FWD_TBL                                (CL_HTON16(0x001A))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL\r
-* NAME\r
-*      IB_MAD_ATTR_MCAST_FWD_TBL\r
-*\r
-* DESCRIPTION\r
-*      Switch multicast forwarding table\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_MCAST_FWD_TBL                      (CL_HTON16(0x001B))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_NODE_RECORD\r
-*\r
-* DESCRIPTION\r
-*      NodeRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_NODE_RECORD                                (CL_HTON16(0x0011))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_PORTINFO_RECORD\r
-*\r
-* DESCRIPTION\r
-*      PortInfoRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PORTINFO_RECORD                    (CL_HTON16(0x0012))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD\r
-* NAME\r
-*       IB_MAD_ATTR_SWITCH_INFO_RECORD\r
-*\r
-* DESCRIPTION\r
-*       SwitchInfoRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SWITCH_INFO_RECORD                 (CL_HTON16(0x0014))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_LINK_RECORD\r
-*\r
-* DESCRIPTION\r
-*      LinkRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_LINK_RECORD                                (CL_HTON16(0x0020))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_SM_INFO\r
-*\r
-* DESCRIPTION\r
-*      SMInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SM_INFO                            (CL_HTON16(0x0020))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_SMINFO_RECORD\r
-*\r
-* DESCRIPTION\r
-*      SMInfoRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SMINFO_RECORD                      (CL_HTON16(0x0018))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD\r
-* NAME\r
-*       IB_MAD_ATTR_GUIDINFO_RECORD\r
-*\r
-* DESCRIPTION\r
-*       GuidInfoRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_GUIDINFO_RECORD                    (CL_HTON16(0x0030))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG\r
-* NAME\r
-*      IB_MAD_ATTR_VENDOR_DIAG\r
-*\r
-* DESCRIPTION\r
-*      VendorDiag attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_VENDOR_DIAG                                (CL_HTON16(0x0030))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_LED_INFO\r
-*\r
-* DESCRIPTION\r
-*      LedInfo attribute (14.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_LED_INFO                           (CL_HTON16(0x0031))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_SERVICE_RECORD\r
-*\r
-* DESCRIPTION\r
-*      ServiceRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SERVICE_RECORD                     (CL_HTON16(0x0031))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_LFT_RECORD\r
-*\r
-* DESCRIPTION\r
-*      LinearForwardingTableRecord attribute (15.2.5.6)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_LFT_RECORD                         (CL_HTON16(0x0015))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD\r
-* NAME\r
-*       IB_MAD_ATTR_MFT_RECORD\r
-*\r
-* DESCRIPTION\r
-*       MulticastForwardingTableRecord attribute (15.2.5.8)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_MFT_RECORD                         (CL_HTON16(0x0017))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_PKEYTBL_RECORD\r
-*\r
-* DESCRIPTION\r
-*      PKEY Table Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PKEY_TBL_RECORD                    (CL_HTON16(0x0033))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_PATH_RECORD\r
-*\r
-* DESCRIPTION\r
-*      PathRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PATH_RECORD                                (CL_HTON16(0x0035))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_VLARB_RECORD\r
-*\r
-* DESCRIPTION\r
-*      VL Arbitration Table Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_VLARB_RECORD                       (CL_HTON16(0x0036))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_SLVL_RECORD\r
-*\r
-* DESCRIPTION\r
-*      SLtoVL Mapping Table Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SLVL_RECORD                                (CL_HTON16(0x0013))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_MCMEMBER_RECORD\r
-*\r
-* DESCRIPTION\r
-*      MCMemberRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_MCMEMBER_RECORD                    (CL_HTON16(0x0038))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_TRACE_RECORD\r
-*\r
-* DESCRIPTION\r
-*      TraceRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_TRACE_RECORD                       (CL_HTON16(0x0039))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_MULTIPATH_RECORD\r
-*\r
-* DESCRIPTION\r
-*      MultiPathRecord attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_MULTIPATH_RECORD                   (CL_HTON16(0x003A))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
-*\r
-* DESCRIPTION\r
-*      Service Association Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD             (CL_HTON16(0x003B))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_INFORM_INFO_RECORD\r
-*\r
-* DESCRIPTION\r
-*      InformInfo Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_INFORM_INFO_RECORD                 (CL_HTON16(0x00F3))\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO\r
-* NAME\r
-*      IB_MAD_ATTR_IO_UNIT_INFO\r
-*\r
-* DESCRIPTION\r
-*      IOUnitInfo attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_IO_UNIT_INFO                       (CL_HTON16(0x0010))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE\r
-* NAME\r
-*      IB_MAD_ATTR_IO_CONTROLLER_PROFILE\r
-*\r
-* DESCRIPTION\r
-*      IOControllerProfile attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE      (CL_HTON16(0x0011))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES\r
-* NAME\r
-*      IB_MAD_ATTR_SERVICE_ENTRIES\r
-*\r
-* DESCRIPTION\r
-*      ServiceEntries attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SERVICE_ENTRIES                    (CL_HTON16(0x0012))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
-* NAME\r
-*      IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
-*\r
-* DESCRIPTION\r
-*      DiagnosticTimeout attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT         (CL_HTON16(0x0020))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST\r
-* NAME\r
-*      IB_MAD_ATTR_PREPARE_TO_TEST\r
-*\r
-* DESCRIPTION\r
-*      PrepareToTest attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_PREPARE_TO_TEST                    (CL_HTON16(0x0021))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE\r
-* NAME\r
-*      IB_MAD_ATTR_TEST_DEVICE_ONCE\r
-*\r
-* DESCRIPTION\r
-*      TestDeviceOnce attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_TEST_DEVICE_ONCE           (CL_HTON16(0x0022))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP\r
-* NAME\r
-*      IB_MAD_ATTR_TEST_DEVICE_LOOP\r
-*\r
-* DESCRIPTION\r
-*      TestDeviceLoop attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_TEST_DEVICE_LOOP           (CL_HTON16(0x0023))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE\r
-* NAME\r
-*      IB_MAD_ATTR_DIAG_CODE\r
-*\r
-* DESCRIPTION\r
-*      DiagCode attribute (16.3.3)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_DIAG_CODE                          (CL_HTON16(0x0024))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
-* NAME\r
-*      IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
-*\r
-* DESCRIPTION\r
-*      Service Association Record attribute (15.2.5)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD     (CL_HTON16(0x003B))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NODE_TYPE_CA\r
-* NAME\r
-*      IB_NODE_TYPE_CA\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic node type used in MAD attributes (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NODE_TYPE_CA                                                0x01\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH\r
-* NAME\r
-*      IB_NODE_TYPE_SWITCH\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic node type used in MAD attributes (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NODE_TYPE_SWITCH                                    0x02\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER\r
-* NAME\r
-*      IB_NODE_TYPE_ROUTER\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic node type used in MAD attributes (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NODE_TYPE_ROUTER                                    0x03\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CA\r
-* NAME\r
-*      IB_NOTICE_PRODUCER_TYPE_CA\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic producer type used in Notice attribute (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NOTICE_PRODUCER_TYPE_CA                     (CL_HTON32(0x000001))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_SWITCH\r
-* NAME\r
-*      IB_NOTICE_PRODUCER_TYPE_SWITCH\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic producer type used in Notice attribute (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NOTICE_PRODUCER_TYPE_SWITCH                 (CL_HTON32(0x000002))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_ROUTER\r
-* NAME\r
-*      IB_NOTICE_PRODUCER_TYPE_ROUTER\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic producer type used in Notice attribute (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NOTICE_PRODUCER_TYPE_ROUTER                 (CL_HTON32(0x000003))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CLASS_MGR\r
-* NAME\r
-*      IB_NOTICE_PRODUCER_TYPE_CLASS_MGR\r
-*\r
-* DESCRIPTION\r
-*      Encoded generic producer type used in Notice attribute (13.4.8.2)\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_NOTICE_PRODUCER_TYPE_CLASS_MGR                      (CL_HTON32(0x000004))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MTU_LEN_TYPE\r
-* NAME\r
-*      IB_MTU_LEN_TYPE\r
-*\r
-* DESCRIPTION\r
-*      Encoded path MTU.\r
-*              1: 256\r
-*              2: 512\r
-*              3: 1024\r
-*              4: 2048\r
-*              5: 4096\r
-*              others: reserved\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MTU_LEN_256                                                 1\r
-#define IB_MTU_LEN_512                                                 2\r
-#define IB_MTU_LEN_1024                                                        3\r
-#define IB_MTU_LEN_2048                                                        4\r
-#define IB_MTU_LEN_4096                                                        5\r
-\r
-#define IB_MIN_MTU    IB_MTU_LEN_256\r
-#define IB_MAX_MTU    IB_MTU_LEN_4096\r
-\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE\r
-* NAME\r
-*      IB_PATH_SELECTOR_TYPE\r
-*\r
-* DESCRIPTION\r
-*      Path selector.\r
-*              0: greater than specified\r
-*              1: less than specified\r
-*              2: exactly the specified\r
-*              3: largest available\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PATH_SELECTOR_GREATER_THAN          0\r
-#define IB_PATH_SELECTOR_LESS_THAN             1\r
-#define IB_PATH_SELECTOR_EXACTLY               2\r
-#define IB_PATH_SELECTOR_LARGEST               3\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE\r
-* NAME\r
-*      IB_SMINFO_STATE_NOTACTIVE\r
-*\r
-* DESCRIPTION\r
-*      Encoded state value used in the SMInfo attribute.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_STATE_NOTACTIVE                      0\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING\r
-* NAME\r
-*      IB_SMINFO_STATE_DISCOVERING\r
-*\r
-* DESCRIPTION\r
-*      Encoded state value used in the SMInfo attribute.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_STATE_DISCOVERING                    1\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY\r
-* NAME\r
-*      IB_SMINFO_STATE_STANDBY\r
-*\r
-* DESCRIPTION\r
-*      Encoded state value used in the SMInfo attribute.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_STATE_STANDBY                                2\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER\r
-* NAME\r
-*      IB_SMINFO_STATE_MASTER\r
-*\r
-* DESCRIPTION\r
-*      Encoded state value used in the SMInfo attribute.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_STATE_MASTER                         3\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_PATH_REC_SL_MASK\r
-* NAME\r
-*      IB_PATH_REC_SL_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the sl field for path record\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PATH_REC_SL_MASK                            0x000F\r
-\r
-/****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK\r
-* NAME\r
-*      IB_MILTIPATH_REC_SL_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the sl field for MultiPath record\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MULTIPATH_REC_SL_MASK                       0x000F\r
-\r
-/****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK\r
-* NAME\r
-*      IB_PATH_REC_QOS_CLASS_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the QoS class field for path record\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PATH_REC_QOS_CLASS_MASK                     0xFFF0\r
-\r
-/****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK\r
-* NAME\r
-*      IB_MULTIPATH_REC_QOS_CLASS_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the QoS class field for MultiPath record\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MULTIPATH_REC_QOS_CLASS_MASK                        0xFFF0\r
-\r
-/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK\r
-* NAME\r
-*      IB_PATH_REC_SELECTOR_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the selector field for path record MTU, rate,\r
-*      and packet lifetime.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PATH_REC_SELECTOR_MASK                      0xC0\r
-\r
-/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK\r
-* NAME\r
-*       IB_MULTIPATH_REC_SELECTOR_MASK\r
-*\r
-* DESCRIPTION\r
-*       Mask for the selector field for multipath record MTU, rate,\r
-*       and packet lifetime.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MULTIPATH_REC_SELECTOR_MASK                       0xC0\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK\r
-* NAME\r
-*      IB_PATH_REC_BASE_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask for the base value field for path record MTU, rate,\r
-*      and packet lifetime.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_PATH_REC_BASE_MASK                          0x3F\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK\r
-* NAME\r
-*       IB_MULTIPATH_REC_BASE_MASK\r
-*\r
-* DESCRIPTION\r
-*       Mask for the base value field for multipath record MTU, rate,\r
-*       and packet lifetime.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_MULTIPATH_REC_BASE_MASK                      0x3F\r
-/**********/\r
-\r
-/****h* IBA Base/Type Definitions\r
-* NAME\r
-*      Type Definitions\r
-*\r
-* DESCRIPTION\r
-*      Definitions are from the InfiniBand Architecture Specification v1.2\r
-*\r
-*********/\r
-\r
-/****d* IBA Base: Types/ib_net16_t\r
-* NAME\r
-*      ib_net16_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the network ordered type for 16-bit values.\r
-*\r
-* SOURCE\r
-*/\r
-typedef uint16_t ib_net16_t;\r
-/**********/\r
-\r
-/****d* IBA Base: Types/ib_net32_t\r
-* NAME\r
-*      ib_net32_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the network ordered type for 32-bit values.\r
-*\r
-* SOURCE\r
-*/\r
-typedef uint32_t ib_net32_t;\r
-/**********/\r
-\r
-/****d* IBA Base: Types/ib_net64_t\r
-* NAME\r
-*      ib_net64_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the network ordered type for 64-bit values.\r
-*\r
-* SOURCE\r
-*/\r
-typedef uint64_t ib_net64_t;\r
-/**********/\r
-\r
-/****d* IBA Base: Types/ib_gid_prefix_t\r
-* NAME\r
-*      ib_gid_prefix_t\r
-*\r
-* DESCRIPTION\r
-*\r
-* SOURCE\r
-*/\r
-typedef ib_net64_t ib_gid_prefix_t;\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/ib_link_states_t\r
-* NAME\r
-*      ib_link_states_t\r
-*\r
-* DESCRIPTION\r
-*      Defines the link states of a port.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_LINK_NO_CHANGE 0\r
-#define IB_LINK_DOWN      1\r
-#define IB_LINK_INIT     2\r
-#define IB_LINK_ARMED     3\r
-#define IB_LINK_ACTIVE    4\r
-#define IB_LINK_ACT_DEFER 5\r
-/**********/\r
-\r
-static const char *const __ib_node_type_str[] = {\r
-       "UNKNOWN",\r
-       "Channel Adapter",\r
-       "Switch",\r
-       "Router"\r
-};\r
-\r
-/****f* IBA Base: Types/ib_get_node_type_str\r
-* NAME\r
-*      ib_get_node_type_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified node type.\r
-*      14.2.5.3 NodeInfo\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API ib_get_node_type_str(IN uint8_t node_type)\r
-{\r
-       if (node_type > IB_NODE_TYPE_ROUTER)\r
-               node_type = 0;\r
-       return (__ib_node_type_str[node_type]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      node_type\r
-*              [in] Encoded node type as returned in the NodeInfo attribute.\r
-\r
-* RETURN VALUES\r
-*      Pointer to the node type string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* ib_node_info_t\r
-*********/\r
-\r
-static const char *const __ib_producer_type_str[] = {\r
-       "UNKNOWN",\r
-       "Channel Adapter",\r
-       "Switch",\r
-       "Router",\r
-       "Class Manager"\r
-};\r
-\r
-/****f* IBA Base: Types/ib_get_producer_type_str\r
-* NAME\r
-*      ib_get_producer_type_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified producer type\r
-*      13.4.8.2 Notice\r
-*      13.4.8.3 InformInfo\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API\r
-ib_get_producer_type_str(IN ib_net32_t producer_type)\r
-{\r
-       if (cl_ntoh32(producer_type) >\r
-           CL_NTOH32(IB_NOTICE_PRODUCER_TYPE_CLASS_MGR))\r
-               producer_type = 0;\r
-       return (__ib_producer_type_str[cl_ntoh32(producer_type)]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      producer_type\r
-*              [in] Encoded producer type from the Notice attribute\r
-\r
-* RETURN VALUES\r
-*      Pointer to the producer type string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* ib_notice_get_prod_type\r
-*********/\r
-\r
-static const char *const __ib_port_state_str[] = {\r
-       "No State Change (NOP)",\r
-       "DOWN",\r
-       "INIT",\r
-       "ARMED",\r
-       "ACTIVE",\r
-       "ACTDEFER",\r
-       "UNKNOWN"\r
-};\r
-\r
-/****f* IBA Base: Types/ib_get_port_state_str\r
-* NAME\r
-*      ib_get_port_state_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified port state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API ib_get_port_state_str(IN uint8_t port_state)\r
-{\r
-       if (port_state > IB_LINK_ACTIVE)\r
-               port_state = IB_LINK_ACTIVE + 1;\r
-       return (__ib_port_state_str[port_state]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      port_state\r
-*              [in] Encoded port state as returned in the PortInfo attribute.\r
-\r
-* RETURN VALUES\r
-*      Pointer to the port state string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* ib_port_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_get_port_state_from_str\r
-* NAME\r
-*      ib_get_port_state_from_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified port state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_get_port_state_from_str(IN char *p_port_state_str)\r
-{\r
-       if (!strncmp(p_port_state_str, "No State Change (NOP)", 12))\r
-               return (0);\r
-       else if (!strncmp(p_port_state_str, "DOWN", 4))\r
-               return (1);\r
-       else if (!strncmp(p_port_state_str, "INIT", 4))\r
-               return (2);\r
-       else if (!strncmp(p_port_state_str, "ARMED", 5))\r
-               return (3);\r
-       else if (!strncmp(p_port_state_str, "ACTIVE", 6))\r
-               return (4);\r
-       else if (!strncmp(p_port_state_str, "ACTDEFER", 8))\r
-               return (5);\r
-       return (6);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_port_state_str\r
-*              [in] A string matching one returned by ib_get_port_state_str\r
-*\r
-* RETURN VALUES\r
-*      The appropriate code.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_port_info_t\r
-*********/\r
-\r
-/****d* IBA Base: Constants/Join States\r
-* NAME\r
-*      Join States\r
-*\r
-* DESCRIPTION\r
-*      Defines the join state flags for multicast group management.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_JOIN_STATE_FULL             1\r
-#define IB_JOIN_STATE_NON              2\r
-#define IB_JOIN_STATE_SEND_ONLY                4\r
-/**********/\r
-\r
-/****f* IBA Base: Types/ib_pkey_get_base\r
-* NAME\r
-*      ib_pkey_get_base\r
-*\r
-* DESCRIPTION\r
-*      Returns the base P_Key value with the membership bit stripped.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t OSM_API ib_pkey_get_base(IN const ib_net16_t pkey)\r
-{\r
-       return ((ib_net16_t) (pkey & IB_PKEY_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      pkey\r
-*              [in] P_Key value\r
-*\r
-* RETURN VALUE\r
-*      Returns the base P_Key value with the membership bit stripped.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_pkey_is_full_member\r
-* NAME\r
-*      ib_pkey_is_full_member\r
-*\r
-* DESCRIPTION\r
-*      Indicates if the port is a full member of the parition.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)\r
-{\r
-       return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      pkey\r
-*              [in] P_Key value\r
-*\r
-* RETURN VALUE\r
-*      TRUE if the port is a full member of the partition.\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-* ib_pkey_get_base, ib_net16_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_pkey_is_invalid\r
-* NAME\r
-*      ib_pkey_is_invalid\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the given P_Key is an invalid P_Key\r
-*  C10-116: the CI shall regard a P_Key as invalid if its low-order\r
-*           15 bits are all zero...\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)\r
-{\r
-       return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      pkey\r
-*              [in] P_Key value\r
-*\r
-* RETURN VALUE\r
-*      Returns the base P_Key value with the membership bit stripped.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****d* IBA Base: Types/ib_gid_t\r
-* NAME\r
-*      ib_gid_t\r
-*\r
-* DESCRIPTION\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef union _ib_gid {\r
-       uint8_t raw[16];\r
-       struct _ib_gid_unicast {\r
-               ib_gid_prefix_t prefix;\r
-               ib_net64_t interface_id;\r
-       } PACK_SUFFIX unicast;\r
-       struct _ib_gid_multicast {\r
-               uint8_t header[2];\r
-               uint8_t raw_group_id[14];\r
-       } PACK_SUFFIX multicast;\r
-} PACK_SUFFIX ib_gid_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      raw\r
-*              GID represented as an unformated byte array.\r
-*\r
-*      unicast\r
-*              Typical unicast representation with subnet prefix and\r
-*              port GUID.\r
-*\r
-*      multicast\r
-*              Representation for multicast use.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_gid_is_multicast\r
-* NAME\r
-*      ib_gid_is_multicast\r
-*\r
-* DESCRIPTION\r
-*       Returns a boolean indicating whether a GID is a multicast GID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)\r
-{\r
-       return (p_gid->raw[0] == 0xFF);\r
-}\r
-\r
-/****f* IBA Base: Types/ib_gid_get_scope\r
-* NAME\r
-*      ib_gid_get_scope\r
-*\r
-* DESCRIPTION\r
-*      Returns scope of (assumed) multicast GID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API ib_mgid_get_scope(IN const ib_gid_t * p_gid)\r
-{\r
-       return (p_gid->raw[1] & 0x0F);\r
-}\r
-\r
-/****f* IBA Base: Types/ib_gid_set_scope\r
-* NAME\r
-*      ib_gid_set_scope\r
-*\r
-* DESCRIPTION\r
-*      Sets scope of (assumed) multicast GID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_mgid_set_scope(IN ib_gid_t * const p_gid, IN const uint8_t scope)\r
-{\r
-       p_gid->raw[1] &= 0xF0;\r
-       p_gid->raw[1] |= scope & 0x0F;\r
-}\r
-\r
-/****f* IBA Base: Types/ib_gid_set_default\r
-* NAME\r
-*      ib_gid_set_default\r
-*\r
-* DESCRIPTION\r
-*      Sets a GID to the default value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_gid_set_default(IN ib_gid_t * const p_gid, IN const ib_net64_t interface_id)\r
-{\r
-       p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;\r
-       p_gid->unicast.interface_id = interface_id;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-*      interface_id\r
-*              [in] Manufacturer assigned EUI64 value of a port.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_gid_get_subnet_prefix\r
-* NAME\r
-*      ib_gid_get_subnet_prefix\r
-*\r
-* DESCRIPTION\r
-*      Gets the subnet prefix from a GID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t OSM_API\r
-ib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid)\r
-{\r
-       return (p_gid->unicast.prefix);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-* RETURN VALUES\r
-*      64-bit subnet prefix value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_gid_is_link_local\r
-* NAME\r
-*      ib_gid_is_link_local\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the unicast GID scoping indicates link local,\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_gid_is_link_local(IN const ib_gid_t * const p_gid)\r
-{\r
-       return ((ib_gid_get_subnet_prefix(p_gid) &\r
-                CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the unicast GID scoping indicates link local,\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_gid_is_site_local\r
-* NAME\r
-*      ib_gid_is_site_local\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the unicast GID scoping indicates site local,\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_gid_is_site_local(IN const ib_gid_t * const p_gid)\r
-{\r
-       return ((ib_gid_get_subnet_prefix(p_gid) &\r
-                CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==\r
-               CL_HTON64(0xFEC0000000000000ULL));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the unicast GID scoping indicates site local,\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_gid_get_guid\r
-* NAME\r
-*      ib_gid_get_guid\r
-*\r
-* DESCRIPTION\r
-*      Gets the guid from a GID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t OSM_API\r
-ib_gid_get_guid(IN const ib_gid_t * const p_gid)\r
-{\r
-       return (p_gid->unicast.interface_id);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_gid\r
-*              [in] Pointer to the GID object.\r
-*\r
-* RETURN VALUES\r
-*      64-bit GUID value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_path_rec_t\r
-* NAME\r
-*      ib_path_rec_t\r
-*\r
-* DESCRIPTION\r
-*      Path records encapsulate the properties of a given\r
-*      route between two end-points on a subnet.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_path_rec {\r
-       ib_net64_t service_id;\r
-       ib_gid_t dgid;\r
-       ib_gid_t sgid;\r
-       ib_net16_t dlid;\r
-       ib_net16_t slid;\r
-       ib_net32_t hop_flow_raw;\r
-       uint8_t tclass;\r
-       uint8_t num_path;\r
-       ib_net16_t pkey;\r
-       ib_net16_t qos_class_sl;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t pkt_life;\r
-       uint8_t preference;\r
-       uint8_t resv2[6];\r
-} PACK_SUFFIX ib_path_rec_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      service_id\r
-*              Service ID for QoS.\r
-*\r
-*      dgid\r
-*              GID of destination port.\r
-*\r
-*      sgid\r
-*              GID of source port.\r
-*\r
-*      dlid\r
-*              LID of destination port.\r
-*\r
-*      slid\r
-*              LID of source port.\r
-*\r
-*      hop_flow_raw\r
-*              Global routing parameters: hop count, flow label and raw bit.\r
-*\r
-*      tclass\r
-*              Another global routing parameter.\r
-*\r
-*      num_path\r
-*     Reversible path - 1 bit to say if path is reversible.\r
-*              num_path [6:0] In queries, maximum number of paths to return.\r
-*              In responses, undefined.\r
-*\r
-*      pkey\r
-*              Partition key (P_Key) to use on this path.\r
-*\r
-*      qos_class_sl\r
-*              QoS class and service level to use on this path.\r
-*\r
-*      mtu\r
-*              MTU and MTU selector fields to use on this path\r
-*\r
-*      rate\r
-*              Rate and rate selector fields to use on this path.\r
-*\r
-*      pkt_life\r
-*              Packet lifetime\r
-*\r
-*      preference\r
-*              Indicates the relative merit of this path versus other path\r
-*              records returned from the SA.  Lower numbers are better.\r
-*\r
-*      resv2\r
-*              Reserved bytes.\r
-* SEE ALSO\r
-*********/\r
-\r
-/* Path Record Component Masks */\r
-#define  IB_PR_COMPMASK_SERVICEID_MSB     (CL_HTON64(((uint64_t)1)<<0))\r
-#define  IB_PR_COMPMASK_SERVICEID_LSB     (CL_HTON64(((uint64_t)1)<<1))\r
-#define  IB_PR_COMPMASK_DGID              (CL_HTON64(((uint64_t)1)<<2))\r
-#define  IB_PR_COMPMASK_SGID              (CL_HTON64(((uint64_t)1)<<3))\r
-#define  IB_PR_COMPMASK_DLID              (CL_HTON64(((uint64_t)1)<<4))\r
-#define  IB_PR_COMPMASK_SLID              (CL_HTON64(((uint64_t)1)<<5))\r
-#define  IB_PR_COMPMASK_RAWTRAFFIC        (CL_HTON64(((uint64_t)1)<<6))\r
-#define  IB_PR_COMPMASK_RESV0             (CL_HTON64(((uint64_t)1)<<7))\r
-#define  IB_PR_COMPMASK_FLOWLABEL         (CL_HTON64(((uint64_t)1)<<8))\r
-#define  IB_PR_COMPMASK_HOPLIMIT          (CL_HTON64(((uint64_t)1)<<9))\r
-#define  IB_PR_COMPMASK_TCLASS            (CL_HTON64(((uint64_t)1)<<10))\r
-#define  IB_PR_COMPMASK_REVERSIBLE        (CL_HTON64(((uint64_t)1)<<11))\r
-#define  IB_PR_COMPMASK_NUMBPATH          (CL_HTON64(((uint64_t)1)<<12))\r
-#define  IB_PR_COMPMASK_PKEY              (CL_HTON64(((uint64_t)1)<<13))\r
-#define  IB_PR_COMPMASK_QOS_CLASS         (CL_HTON64(((uint64_t)1)<<14))\r
-#define  IB_PR_COMPMASK_SL                (CL_HTON64(((uint64_t)1)<<15))\r
-#define  IB_PR_COMPMASK_MTUSELEC          (CL_HTON64(((uint64_t)1)<<16))\r
-#define  IB_PR_COMPMASK_MTU               (CL_HTON64(((uint64_t)1)<<17))\r
-#define  IB_PR_COMPMASK_RATESELEC         (CL_HTON64(((uint64_t)1)<<18))\r
-#define  IB_PR_COMPMASK_RATE              (CL_HTON64(((uint64_t)1)<<19))\r
-#define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))\r
-#define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))\r
-\r
-/* Link Record Component Masks */\r
-#define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_LR_COMPMASK_TO_PORT            (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_LR_COMPMASK_TO_LID             (CL_HTON64(((uint64_t)1)<<3))\r
-\r
-/* VL Arbitration Record Masks */\r
-#define IB_VLA_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_VLA_COMPMASK_OUT_PORT          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_VLA_COMPMASK_BLOCK             (CL_HTON64(((uint64_t)1)<<2))\r
-\r
-/* SLtoVL Mapping Record Masks */\r
-#define IB_SLVL_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_SLVL_COMPMASK_IN_PORT          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_SLVL_COMPMASK_OUT_PORT         (CL_HTON64(((uint64_t)1)<<2))\r
-\r
-/* P_Key Table Record Masks */\r
-#define IB_PKEY_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_PKEY_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_PKEY_COMPMASK_PORT             (CL_HTON64(((uint64_t)1)<<2))\r
-\r
-/* Switch Info Record Masks */\r
-#define IB_SWIR_COMPMASK_LID             (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_SWIR_COMPMASK_RESERVED1       (CL_HTON64(((uint64_t)1)<<1))\r
-\r
-/* LFT Record Masks */\r
-#define IB_LFTR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_LFTR_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))\r
-\r
-/* MFT Record Masks */\r
-#define IB_MFTR_COMPMASK_LID             (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_MFTR_COMPMASK_POSITION        (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_MFTR_COMPMASK_RESERVED1       (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_MFTR_COMPMASK_BLOCK           (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_MFTR_COMPMASK_RESERVED2       (CL_HTON64(((uint64_t)1)<<4))\r
-\r
-/* NodeInfo Record Masks */\r
-#define IB_NR_COMPMASK_LID                (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_NR_COMPMASK_RESERVED1          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_NR_COMPMASK_BASEVERSION        (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_NR_COMPMASK_CLASSVERSION       (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_NR_COMPMASK_NODETYPE           (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_NR_COMPMASK_NUMPORTS           (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_NR_COMPMASK_SYSIMAGEGUID       (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_NR_COMPMASK_NODEGUID           (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_NR_COMPMASK_PORTGUID           (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_NR_COMPMASK_PARTCAP            (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_NR_COMPMASK_DEVID              (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_NR_COMPMASK_REV                (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_NR_COMPMASK_PORTNUM            (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_NR_COMPMASK_VENDID             (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_NR_COMPMASK_NODEDESC           (CL_HTON64(((uint64_t)1)<<14))\r
-\r
-/* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/\r
-#define IB_SR_COMPMASK_SID                (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_SR_COMPMASK_SGID               (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_SR_COMPMASK_SPKEY              (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_SR_COMPMASK_RES1               (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_SR_COMPMASK_SLEASE             (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_SR_COMPMASK_SKEY               (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_SR_COMPMASK_SNAME              (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_SR_COMPMASK_SDATA8_0           (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_SR_COMPMASK_SDATA8_1           (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_SR_COMPMASK_SDATA8_2           (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_SR_COMPMASK_SDATA8_3           (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_SR_COMPMASK_SDATA8_4           (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_SR_COMPMASK_SDATA8_5           (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_SR_COMPMASK_SDATA8_6           (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_SR_COMPMASK_SDATA8_7           (CL_HTON64(((uint64_t)1)<<14))\r
-#define IB_SR_COMPMASK_SDATA8_8           (CL_HTON64(((uint64_t)1)<<15))\r
-#define IB_SR_COMPMASK_SDATA8_9           (CL_HTON64(((uint64_t)1)<<16))\r
-#define IB_SR_COMPMASK_SDATA8_10       (CL_HTON64(((uint64_t)1)<<17))\r
-#define IB_SR_COMPMASK_SDATA8_11       (CL_HTON64(((uint64_t)1)<<18))\r
-#define IB_SR_COMPMASK_SDATA8_12       (CL_HTON64(((uint64_t)1)<<19))\r
-#define IB_SR_COMPMASK_SDATA8_13       (CL_HTON64(((uint64_t)1)<<20))\r
-#define IB_SR_COMPMASK_SDATA8_14       (CL_HTON64(((uint64_t)1)<<21))\r
-#define IB_SR_COMPMASK_SDATA8_15       (CL_HTON64(((uint64_t)1)<<22))\r
-#define IB_SR_COMPMASK_SDATA16_0       (CL_HTON64(((uint64_t)1)<<23))\r
-#define IB_SR_COMPMASK_SDATA16_1       (CL_HTON64(((uint64_t)1)<<24))\r
-#define IB_SR_COMPMASK_SDATA16_2       (CL_HTON64(((uint64_t)1)<<25))\r
-#define IB_SR_COMPMASK_SDATA16_3       (CL_HTON64(((uint64_t)1)<<26))\r
-#define IB_SR_COMPMASK_SDATA16_4       (CL_HTON64(((uint64_t)1)<<27))\r
-#define IB_SR_COMPMASK_SDATA16_5       (CL_HTON64(((uint64_t)1)<<28))\r
-#define IB_SR_COMPMASK_SDATA16_6       (CL_HTON64(((uint64_t)1)<<29))\r
-#define IB_SR_COMPMASK_SDATA16_7       (CL_HTON64(((uint64_t)1)<<30))\r
-#define IB_SR_COMPMASK_SDATA32_0       (CL_HTON64(((uint64_t)1)<<31))\r
-#define IB_SR_COMPMASK_SDATA32_1       (CL_HTON64(((uint64_t)1)<<32))\r
-#define IB_SR_COMPMASK_SDATA32_2       (CL_HTON64(((uint64_t)1)<<33))\r
-#define IB_SR_COMPMASK_SDATA32_3       (CL_HTON64(((uint64_t)1)<<34))\r
-#define IB_SR_COMPMASK_SDATA64_0       (CL_HTON64(((uint64_t)1)<<35))\r
-#define IB_SR_COMPMASK_SDATA64_1       (CL_HTON64(((uint64_t)1)<<36))\r
-\r
-/* Port Info Record Component Masks */\r
-#define IB_PIR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_PIR_COMPMASK_PORTNUM          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_PIR_COMPMASK_RESV1            (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_PIR_COMPMASK_MKEY             (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_PIR_COMPMASK_SMLID            (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_PIR_COMPMASK_CAPMASK          (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_PIR_COMPMASK_DIAGCODE         (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_PIR_COMPMASK_MKEYLEASEPRD     (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_PIR_COMPMASK_LOCALPORTNUM     (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT  (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_PIR_COMPMASK_LNKWIDTHACTIVE   (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT  (CL_HTON64(((uint64_t)1)<<14))\r
-#define IB_PIR_COMPMASK_PORTSTATE        (CL_HTON64(((uint64_t)1)<<15))\r
-#define IB_PIR_COMPMASK_PORTPHYSTATE     (CL_HTON64(((uint64_t)1)<<16))\r
-#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))\r
-#define IB_PIR_COMPMASK_MKEYPROTBITS     (CL_HTON64(((uint64_t)1)<<18))\r
-#define IB_PIR_COMPMASK_RESV2            (CL_HTON64(((uint64_t)1)<<19))\r
-#define IB_PIR_COMPMASK_LMC              (CL_HTON64(((uint64_t)1)<<20))\r
-#define IB_PIR_COMPMASK_LINKSPEEDACTIVE  (CL_HTON64(((uint64_t)1)<<21))\r
-#define IB_PIR_COMPMASK_LINKSPEEDENABLE  (CL_HTON64(((uint64_t)1)<<22))\r
-#define IB_PIR_COMPMASK_NEIGHBORMTU      (CL_HTON64(((uint64_t)1)<<23))\r
-#define IB_PIR_COMPMASK_MASTERSMSL       (CL_HTON64(((uint64_t)1)<<24))\r
-#define IB_PIR_COMPMASK_VLCAP            (CL_HTON64(((uint64_t)1)<<25))\r
-#define IB_PIR_COMPMASK_INITTYPE         (CL_HTON64(((uint64_t)1)<<26))\r
-#define IB_PIR_COMPMASK_VLHIGHLIMIT      (CL_HTON64(((uint64_t)1)<<27))\r
-#define IB_PIR_COMPMASK_VLARBHIGHCAP     (CL_HTON64(((uint64_t)1)<<28))\r
-#define IB_PIR_COMPMASK_VLARBLOWCAP      (CL_HTON64(((uint64_t)1)<<29))\r
-#define IB_PIR_COMPMASK_INITTYPEREPLY    (CL_HTON64(((uint64_t)1)<<30))\r
-#define IB_PIR_COMPMASK_MTUCAP           (CL_HTON64(((uint64_t)1)<<31))\r
-#define IB_PIR_COMPMASK_VLSTALLCNT       (CL_HTON64(((uint64_t)1)<<32))\r
-#define IB_PIR_COMPMASK_HOQLIFE          (CL_HTON64(((uint64_t)1)<<33))\r
-#define IB_PIR_COMPMASK_OPVLS            (CL_HTON64(((uint64_t)1)<<34))\r
-#define IB_PIR_COMPMASK_PARENFIN         (CL_HTON64(((uint64_t)1)<<35))\r
-#define IB_PIR_COMPMASK_PARENFOUT        (CL_HTON64(((uint64_t)1)<<36))\r
-#define IB_PIR_COMPMASK_FILTERRAWIN      (CL_HTON64(((uint64_t)1)<<37))\r
-#define IB_PIR_COMPMASK_FILTERRAWOUT     (CL_HTON64(((uint64_t)1)<<38))\r
-#define IB_PIR_COMPMASK_MKEYVIO          (CL_HTON64(((uint64_t)1)<<39))\r
-#define IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))\r
-#define IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))\r
-#define IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))\r
-#define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<43))\r
-#define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<44))\r
-#define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<45))\r
-#define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<46))\r
-#define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<47))\r
-#define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<48))\r
-\r
-/* Multicast Member Record Component Masks */\r
-#define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_MCR_COMPMASK_MGID        (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_MCR_COMPMASK_PORT_GID    (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_MCR_COMPMASK_QKEY        (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_MCR_COMPMASK_MLID        (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_MCR_COMPMASK_MTU_SEL     (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_MCR_COMPMASK_MTU         (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_MCR_COMPMASK_TCLASS      (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_MCR_COMPMASK_PKEY        (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_MCR_COMPMASK_RATE_SEL    (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_MCR_COMPMASK_RATE        (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_MCR_COMPMASK_LIFE_SEL    (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_MCR_COMPMASK_LIFE        (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_MCR_COMPMASK_SL          (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_MCR_COMPMASK_FLOW        (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_MCR_COMPMASK_HOP         (CL_HTON64(((uint64_t)1)<<14))\r
-#define IB_MCR_COMPMASK_SCOPE       (CL_HTON64(((uint64_t)1)<<15))\r
-#define IB_MCR_COMPMASK_JOIN_STATE  (CL_HTON64(((uint64_t)1)<<16))\r
-#define IB_MCR_COMPMASK_PROXY       (CL_HTON64(((uint64_t)1)<<17))\r
-\r
-/* GUID Info Record Component Masks */\r
-#define IB_GIR_COMPMASK_LID            (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_GIR_COMPMASK_BLOCKNUM       (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_GIR_COMPMASK_RESV1          (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_GIR_COMPMASK_RESV2          (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_GIR_COMPMASK_GID0           (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_GIR_COMPMASK_GID1           (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_GIR_COMPMASK_GID2           (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_GIR_COMPMASK_GID3           (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_GIR_COMPMASK_GID4           (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_GIR_COMPMASK_GID5           (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_GIR_COMPMASK_GID6           (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_GIR_COMPMASK_GID7           (CL_HTON64(((uint64_t)1)<<11))\r
-\r
-/* MultiPath Record Component Masks */\r
-#define IB_MPR_COMPMASK_RAWTRAFFIC     (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_MPR_COMPMASK_RESV0          (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_MPR_COMPMASK_FLOWLABEL      (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_MPR_COMPMASK_HOPLIMIT       (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_MPR_COMPMASK_TCLASS         (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_MPR_COMPMASK_REVERSIBLE     (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_MPR_COMPMASK_NUMBPATH       (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_MPR_COMPMASK_PKEY           (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_MPR_COMPMASK_QOS_CLASS      (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_MPR_COMPMASK_SL             (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_MPR_COMPMASK_MTUSELEC       (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_MPR_COMPMASK_MTU            (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_MPR_COMPMASK_RATESELEC      (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_MPR_COMPMASK_RATE           (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14))\r
-#define IB_MPR_COMPMASK_PKTLIFETIME    (CL_HTON64(((uint64_t)1)<<15))\r
-#define IB_MPR_COMPMASK_SERVICEID_MSB  (CL_HTON64(((uint64_t)1)<<16))\r
-#define IB_MPR_COMPMASK_INDEPSELEC     (CL_HTON64(((uint64_t)1)<<17))\r
-#define IB_MPR_COMPMASK_RESV3          (CL_HTON64(((uint64_t)1)<<18))\r
-#define IB_MPR_COMPMASK_SGIDCOUNT      (CL_HTON64(((uint64_t)1)<<19))\r
-#define IB_MPR_COMPMASK_DGIDCOUNT      (CL_HTON64(((uint64_t)1)<<20))\r
-#define IB_MPR_COMPMASK_SERVICEID_LSB  (CL_HTON64(((uint64_t)1)<<21))\r
-\r
-/* SMInfo Record Component Masks */\r
-#define IB_SMIR_COMPMASK_LID           (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_SMIR_COMPMASK_RESV0         (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_SMIR_COMPMASK_GUID          (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_SMIR_COMPMASK_SMKEY         (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_SMIR_COMPMASK_ACTCOUNT      (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_SMIR_COMPMASK_PRIORITY      (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_SMIR_COMPMASK_SMSTATE       (CL_HTON64(((uint64_t)1)<<6))\r
-\r
-/* InformInfo Record Component Masks */\r
-#define IB_IIR_COMPMASK_SUBSCRIBERGID  (CL_HTON64(((uint64_t)1)<<0))\r
-#define IB_IIR_COMPMASK_ENUM           (CL_HTON64(((uint64_t)1)<<1))\r
-#define IB_IIR_COMPMASK_RESV0          (CL_HTON64(((uint64_t)1)<<2))\r
-#define IB_IIR_COMPMASK_GID            (CL_HTON64(((uint64_t)1)<<3))\r
-#define IB_IIR_COMPMASK_LIDRANGEBEGIN  (CL_HTON64(((uint64_t)1)<<4))\r
-#define IB_IIR_COMPMASK_LIDRANGEEND    (CL_HTON64(((uint64_t)1)<<5))\r
-#define IB_IIR_COMPMASK_RESV1          (CL_HTON64(((uint64_t)1)<<6))\r
-#define IB_IIR_COMPMASK_ISGENERIC      (CL_HTON64(((uint64_t)1)<<7))\r
-#define IB_IIR_COMPMASK_SUBSCRIBE      (CL_HTON64(((uint64_t)1)<<8))\r
-#define IB_IIR_COMPMASK_TYPE           (CL_HTON64(((uint64_t)1)<<9))\r
-#define IB_IIR_COMPMASK_TRAPNUMB       (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_IIR_COMPMASK_DEVICEID       (CL_HTON64(((uint64_t)1)<<10))\r
-#define IB_IIR_COMPMASK_QPN            (CL_HTON64(((uint64_t)1)<<11))\r
-#define IB_IIR_COMPMASK_RESV2          (CL_HTON64(((uint64_t)1)<<12))\r
-#define IB_IIR_COMPMASK_RESPTIME       (CL_HTON64(((uint64_t)1)<<13))\r
-#define IB_IIR_COMPMASK_RESV3          (CL_HTON64(((uint64_t)1)<<14))\r
-#define IB_IIR_COMPMASK_PRODTYPE       (CL_HTON64(((uint64_t)1)<<15))\r
-#define IB_IIR_COMPMASK_VENDID         (CL_HTON64(((uint64_t)1)<<15))\r
-\r
-/****f* IBA Base: Types/ib_path_rec_init_local\r
-* NAME\r
-*      ib_path_rec_init_local\r
-*\r
-* DESCRIPTION\r
-*      Initializes a subnet local path record.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_path_rec_init_local(IN ib_path_rec_t * const p_rec,\r
-                      IN ib_gid_t * const p_dgid,\r
-                      IN ib_gid_t * const p_sgid,\r
-                      IN ib_net16_t dlid,\r
-                      IN ib_net16_t slid,\r
-                      IN uint8_t num_path,\r
-                      IN ib_net16_t pkey,\r
-                      IN uint8_t sl,\r
-                      IN uint16_t qos_class,\r
-                      IN uint8_t mtu_selector,\r
-                      IN uint8_t mtu,\r
-                      IN uint8_t rate_selector,\r
-                      IN uint8_t rate,\r
-                      IN uint8_t pkt_life_selector,\r
-                      IN uint8_t pkt_life, IN uint8_t preference)\r
-{\r
-       p_rec->dgid = *p_dgid;\r
-       p_rec->sgid = *p_sgid;\r
-       p_rec->dlid = dlid;\r
-       p_rec->slid = slid;\r
-       p_rec->num_path = num_path;\r
-       p_rec->pkey = pkey;\r
-       p_rec->qos_class_sl = cl_hton16((sl & IB_PATH_REC_SL_MASK) |\r
-                                       (qos_class << 4));\r
-       p_rec->mtu = (uint8_t) ((mtu & IB_PATH_REC_BASE_MASK) |\r
-                               (uint8_t) (mtu_selector << 6));\r
-       p_rec->rate = (uint8_t) ((rate & IB_PATH_REC_BASE_MASK) |\r
-                                (uint8_t) (rate_selector << 6));\r
-       p_rec->pkt_life = (uint8_t) ((pkt_life & IB_PATH_REC_BASE_MASK) |\r
-                                    (uint8_t) (pkt_life_selector << 6));\r
-       p_rec->preference = preference;\r
-\r
-       /* Clear global routing fields for local path records */\r
-       p_rec->hop_flow_raw = 0;\r
-       p_rec->tclass = 0;\r
-       p_rec->service_id = 0;\r
-\r
-       memset(p_rec->resv2, 0, sizeof(p_rec->resv2));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-*      dgid\r
-*              [in] GID of destination port.\r
-*\r
-*      sgid\r
-*              [in] GID of source port.\r
-*\r
-*      dlid\r
-*              [in] LID of destination port.\r
-*\r
-*      slid\r
-*              [in] LID of source port.\r
-*\r
-*      num_path\r
-*     [in] Reversible path - 1 bit to say if path is reversible.\r
-*              num_path [6:0] In queries, maximum number of paths to return.\r
-*              In responses, undefined.\r
-*\r
-*      pkey\r
-*              [in] Partition key (P_Key) to use on this path.\r
-*\r
-*      qos_class\r
-*              [in] QoS class to use on this path.  Lower 12-bits are valid.\r
-*\r
-*      sl\r
-*              [in] Service level to use on this path.  Lower 4-bits are valid.\r
-*\r
-*      mtu_selector\r
-*              [in] Encoded MTU selector value to use on this path\r
-*\r
-*      mtu\r
-*              [in] Encoded MTU to use on this path\r
-*\r
-*      rate_selector\r
-*              [in] Encoded rate selector value to use on this path.\r
-*\r
-*      rate\r
-*              [in] Encoded rate to use on this path.\r
-*\r
-*      pkt_life_selector\r
-*              [in] Encoded Packet selector value lifetime for this path.\r
-*\r
-*      pkt_life\r
-*              [in] Encoded Packet lifetime for this path.\r
-*\r
-*      preference\r
-*              [in] Indicates the relative merit of this path versus other path\r
-*              records returned from the SA.  Lower numbers are better.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_num_path\r
-* NAME\r
-*      ib_path_rec_num_path\r
-*\r
-* DESCRIPTION\r
-*      Get max number of paths to return.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_num_path(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return (p_rec->num_path & 0x7F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Maximum number of paths to return for each unique SGID_DGID combination.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_set_sl\r
-* NAME\r
-*      ib_path_rec_set_sl\r
-*\r
-* DESCRIPTION\r
-*      Set path service level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_path_rec_set_sl(IN ib_path_rec_t * const p_rec, IN const uint8_t sl)\r
-{\r
-       p_rec->qos_class_sl =\r
-           (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_QOS_CLASS_MASK)) |\r
-           cl_hton16(sl & IB_PATH_REC_SL_MASK);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-*      sl\r
-*              [in] Service level to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_sl\r
-* NAME\r
-*      ib_path_rec_sl\r
-*\r
-* DESCRIPTION\r
-*      Get path service level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_sl(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return (uint8_t)(cl_ntoh16(p_rec->qos_class_sl) & IB_PATH_REC_SL_MASK);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      SL.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_set_qos_class\r
-* NAME\r
-*      ib_path_rec_set_qos_class\r
-*\r
-* DESCRIPTION\r
-*      Set path QoS class.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,\r
-                         IN const uint16_t qos_class)\r
-{\r
-       p_rec->qos_class_sl =\r
-           (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) |\r
-           cl_hton16(qos_class << 4);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-*      qos_class\r
-*              [in] QoS class to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_qos_class\r
-* NAME\r
-*      ib_path_rec_qos_class\r
-*\r
-* DESCRIPTION\r
-*      Get QoS class.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t OSM_API\r
-ib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return (cl_ntoh16(p_rec->qos_class_sl) >> 4);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      QoS class of the path record.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_mtu\r
-* NAME\r
-*      ib_path_rec_mtu\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path MTU.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_mtu(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->mtu & IB_PATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path MTU.\r
-*              1: 256\r
-*              2: 512\r
-*              3: 1024\r
-*              4: 2048\r
-*              5: 4096\r
-*              others: reserved\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_mtu_sel\r
-* NAME\r
-*      ib_path_rec_mtu_sel\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path MTU selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) ((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path MTU selector value (for queries).\r
-*              0: greater than MTU specified\r
-*              1: less than MTU specified\r
-*              2: exactly the MTU specified\r
-*              3: largest MTU available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_rate\r
-* NAME\r
-*      ib_path_rec_rate\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path rate.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_rate(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->rate & IB_PATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path rate.\r
-*              2: 2.5 Gb/sec.\r
-*              3: 10 Gb/sec.\r
-*              4: 30 Gb/sec.\r
-*              5: 5 Gb/sec.\r
-*              6: 20 Gb/sec.\r
-*              7: 40 Gb/sec.\r
-*              8: 60 Gb/sec.\r
-*              9: 80 Gb/sec.\r
-*              10: 120 Gb/sec.\r
-*              others: reserved\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_rate_sel\r
-* NAME\r
-*      ib_path_rec_rate_sel\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path rate selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) ((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path rate selector value (for queries).\r
-*              0: greater than rate specified\r
-*              1: less than rate specified\r
-*              2: exactly the rate specified\r
-*              3: largest rate available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_pkt_life\r
-* NAME\r
-*      ib_path_rec_pkt_life\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path pkt_life.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->pkt_life & IB_PATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path pkt_life = 4.096 usec * 2 ** PacketLifeTime.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_pkt_life_sel\r
-* NAME\r
-*      ib_path_rec_pkt_life_sel\r
-*\r
-* DESCRIPTION\r
-*      Get encoded path pkt_lifetime selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) ((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Encoded path pkt_lifetime selector value (for queries).\r
-*              0: greater than rate specified\r
-*              1: less than rate specified\r
-*              2: exactly the rate specified\r
-*              3: smallest packet lifetime available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_flow_lbl\r
-* NAME\r
-*      ib_path_rec_flow_lbl\r
-*\r
-* DESCRIPTION\r
-*      Get flow label.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint32_t OSM_API\r
-ib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return (((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Flow label of the path record.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_rec_hop_limit\r
-* NAME\r
-*      ib_path_rec_hop_limit\r
-*\r
-* DESCRIPTION\r
-*      Get hop limit.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (cl_ntoh32(p_rec->hop_flow_raw) & 0x000000FF));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the path record object.\r
-*\r
-* RETURN VALUES\r
-*      Hop limit of the path record.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_path_rec_t\r
-*********/\r
-\r
-/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP\r
-* NAME\r
-*      IB_CLASS_CAP_TRAP\r
-*\r
-* DESCRIPTION\r
-*      ClassPortInfo CapabilityMask bits.  This bit will be set\r
-*      if the class supports Trap() MADs (13.4.8.1).\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t, IB_CLASS_CAP_GETSET\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_CLASS_CAP_TRAP                                      0x0001\r
-/*********/\r
-\r
-/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET\r
-* NAME\r
-*      IB_CLASS_CAP_GETSET\r
-*\r
-* DESCRIPTION\r
-*      ClassPortInfo CapabilityMask bits.  This bit will be set\r
-*      if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t, IB_CLASS_CAP_TRAP\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_CLASS_CAP_GETSET                                    0x0002\r
-/*********/\r
-\r
-/****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK\r
-* NAME\r
-*      IB_CLASS_RESP_TIME_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask bits to extract the reponse time value from the\r
-*      resp_time_val field of ib_class_port_info_t.\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_CLASS_RESP_TIME_MASK                                0x1F\r
-/*********/\r
-\r
-/****s* IBA Base: Types/ib_class_port_info_t\r
-* NAME\r
-*      ib_class_port_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined ClassPortInfo attribute (13.4.8.1)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_class_port_info {\r
-       uint8_t base_ver;\r
-       uint8_t class_ver;\r
-       ib_net16_t cap_mask;\r
-       ib_net32_t cap_mask2_resp_time;\r
-       ib_gid_t redir_gid;\r
-       ib_net32_t redir_tc_sl_fl;\r
-       ib_net16_t redir_lid;\r
-       ib_net16_t redir_pkey;\r
-       ib_net32_t redir_qp;\r
-       ib_net32_t redir_qkey;\r
-       ib_gid_t trap_gid;\r
-       ib_net32_t trap_tc_sl_fl;\r
-       ib_net16_t trap_lid;\r
-       ib_net16_t trap_pkey;\r
-       ib_net32_t trap_hop_qp;\r
-       ib_net32_t trap_qkey;\r
-} PACK_SUFFIX ib_class_port_info_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      base_ver\r
-*              Maximum supported MAD Base Version.\r
-*\r
-*      class_ver\r
-*              Maximum supported management class version.\r
-*\r
-*      cap_mask\r
-*              Supported capabilities of this management class.\r
-*\r
-*      cap_mask2_resp_time\r
-*              Maximum expected response time and additional\r
-*              supported capabilities of this management class.\r
-*\r
-*      redir_gid\r
-*              GID to use for redirection, or zero\r
-*\r
-*      redir_tc_sl_fl\r
-*              Traffic class, service level and flow label the requester\r
-*              should use if the service is redirected.\r
-*\r
-*      redir_lid\r
-*              LID used for redirection, or zero\r
-*\r
-*      redir_pkey\r
-*              P_Key used for redirection\r
-*\r
-*      redir_qp\r
-*              QP number used for redirection\r
-*\r
-*      redir_qkey\r
-*              Q_Key associated with the redirected QP.  This shall be the\r
-*              well known Q_Key value.\r
-*\r
-*      trap_gid\r
-*              GID value used for trap messages from this service.\r
-*\r
-*      trap_tc_sl_fl\r
-*              Traffic class, service level and flow label used for\r
-*              trap messages originated by this service.\r
-*\r
-*      trap_lid\r
-*              LID used for trap messages, or zero\r
-*\r
-*      trap_pkey\r
-*              P_Key used for trap messages\r
-*\r
-*      trap_hop_qp\r
-*              Hop limit (upper 8 bits) and QP number used for trap messages\r
-*\r
-*      trap_qkey\r
-*              Q_Key associated with the trap messages QP.\r
-*\r
-* SEE ALSO\r
-*      IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP\r
-*\r
-*********/\r
-\r
-#define IB_PM_ALL_PORT_SELECT                  (CL_HTON16(((uint16_t)1)<<8))\r
-#define IB_PM_EXT_WIDTH_SUPPORTED              (CL_HTON16(((uint16_t)1)<<9))\r
-#define IB_PM_EXT_WIDTH_NOIETF_SUP             (CL_HTON16(((uint16_t)1)<<10))\r
-\r
-/****f* IBA Base: Types/ib_class_set_resp_time_val\r
-* NAME\r
-*      ib_class_set_resp_time_val\r
-*\r
-* DESCRIPTION\r
-*      Set maximum expected response time.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,\r
-                          IN const uint8_t val)\r
-{\r
-       p_cpi->cap_mask2_resp_time =\r
-           (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) |\r
-           cl_hton32(val & IB_CLASS_RESP_TIME_MASK);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_cpi\r
-*              [in] Pointer to the class port info object.\r
-*\r
-*      val\r
-*              [in] Response time value to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_resp_time_val\r
-* NAME\r
-*      ib_class_resp_time_val\r
-*\r
-* DESCRIPTION\r
-*      Get response time value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)\r
-{\r
-       return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &\r
-                        IB_CLASS_RESP_TIME_MASK);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_cpi\r
-*              [in] Pointer to the class port info object.\r
-*\r
-* RETURN VALUES\r
-*      Response time value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_set_cap_mask2\r
-* NAME\r
-*      ib_class_set_cap_mask2\r
-*\r
-* DESCRIPTION\r
-*      Set ClassPortInfo:CapabilityMask2.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,\r
-                      IN const uint32_t cap_mask2)\r
-{\r
-       p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &\r
-               CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |\r
-               cl_hton32(cap_mask2 << 5);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_cpi\r
-*              [in] Pointer to the class port info object.\r
-*\r
-*      cap_mask2\r
-*              [in] CapabilityMask2 value to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_class_cap_mask2\r
-* NAME\r
-*      ib_class_cap_mask2\r
-*\r
-* DESCRIPTION\r
-*      Get ClassPortInfo:CapabilityMask2.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint32_t OSM_API\r
-ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)\r
-{\r
-       return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> 5);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_cpi\r
-*              [in] Pointer to the class port info object.\r
-*\r
-* RETURN VALUES\r
-*      CapabilityMask2 of the ClassPortInfo.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_class_port_info_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_sm_info_t\r
-* NAME\r
-*      ib_sm_info_t\r
-*\r
-* DESCRIPTION\r
-*      SMInfo structure (14.2.5.13).\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_sm_info {\r
-       ib_net64_t guid;\r
-       ib_net64_t sm_key;\r
-       ib_net32_t act_count;\r
-       uint8_t pri_state;\r
-} PACK_SUFFIX ib_sm_info_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      guid\r
-*              Port GUID for this SM.\r
-*\r
-*      sm_key\r
-*              SM_Key of this SM.\r
-*\r
-*      act_count\r
-*              Activity counter used as a heartbeat.\r
-*\r
-*      pri_state\r
-*              Priority and State information\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_sminfo_get_priority\r
-* NAME\r
-*      ib_sminfo_get_priority\r
-*\r
-* DESCRIPTION\r
-*      Returns the priority value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi)\r
-{\r
-       return ((uint8_t) ((p_smi->pri_state & 0xF0) >> 4));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smi\r
-*              [in] Pointer to the SMInfo Attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the priority value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_sminfo_get_state\r
-* NAME\r
-*      ib_sminfo_get_state\r
-*\r
-* DESCRIPTION\r
-*      Returns the state value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_sminfo_get_state(IN const ib_sm_info_t * const p_smi)\r
-{\r
-       return ((uint8_t) (p_smi->pri_state & 0x0F));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smi\r
-*              [in] Pointer to the SMInfo Attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the state value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_mad_t\r
-* NAME\r
-*      ib_mad_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined MAD header (13.4.3)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_mad {\r
-       uint8_t base_ver;\r
-       uint8_t mgmt_class;\r
-       uint8_t class_ver;\r
-       uint8_t method;\r
-       ib_net16_t status;\r
-       ib_net16_t class_spec;\r
-       ib_net64_t trans_id;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t resv;\r
-       ib_net32_t attr_mod;\r
-} PACK_SUFFIX ib_mad_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      base_ver\r
-*              MAD base format.\r
-*\r
-*      mgmt_class\r
-*              Class of operation.\r
-*\r
-*      class_ver\r
-*              Version of MAD class-specific format.\r
-*\r
-*      method\r
-*              Method to perform, including 'R' bit.\r
-*\r
-*      status\r
-*              Status of operation.\r
-*\r
-*      class_spec\r
-*              Reserved for subnet management.\r
-*\r
-*      trans_id\r
-*              Transaction ID.\r
-*\r
-*      attr_id\r
-*              Attribute ID.\r
-*\r
-*      resv\r
-*              Reserved field.\r
-*\r
-*      attr_mod\r
-*              Attribute modifier.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_rmpp_mad_t\r
-* NAME\r
-*      ib_rmpp_mad_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined MAD RMPP header (13.6.2.1)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_rmpp_mad {\r
-       ib_mad_t common_hdr;\r
-       uint8_t rmpp_version;\r
-       uint8_t rmpp_type;\r
-       uint8_t rmpp_flags;\r
-       uint8_t rmpp_status;\r
-       ib_net32_t seg_num;\r
-       ib_net32_t paylen_newwin;\r
-} PACK_SUFFIX ib_rmpp_mad_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_mad_init_new\r
-* NAME\r
-*      ib_mad_init_new\r
-*\r
-* DESCRIPTION\r
-*      Initializes a MAD common header.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_mad_init_new(IN ib_mad_t * const p_mad,\r
-               IN const uint8_t mgmt_class,\r
-               IN const uint8_t class_ver,\r
-               IN const uint8_t method,\r
-               IN const ib_net64_t trans_id,\r
-               IN const ib_net16_t attr_id, IN const ib_net32_t attr_mod)\r
-{\r
-       CL_ASSERT(p_mad);\r
-       p_mad->base_ver = 1;\r
-       p_mad->mgmt_class = mgmt_class;\r
-       p_mad->class_ver = class_ver;\r
-       p_mad->method = method;\r
-       p_mad->status = 0;\r
-       p_mad->class_spec = 0;\r
-       p_mad->trans_id = trans_id;\r
-       p_mad->attr_id = attr_id;\r
-       p_mad->resv = 0;\r
-       p_mad->attr_mod = attr_mod;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mad\r
-*              [in] Pointer to the MAD common header.\r
-*\r
-*      mgmt_class\r
-*              [in] Class of operation.\r
-*\r
-*      class_ver\r
-*              [in] Version of MAD class-specific format.\r
-*\r
-*      method\r
-*              [in] Method to perform, including 'R' bit.\r
-*\r
-*      trans_Id\r
-*              [in] Transaction ID.\r
-*\r
-*      attr_id\r
-*              [in] Attribute ID.\r
-*\r
-*      attr_mod\r
-*              [in] Attribute modifier.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_mad_init_response\r
-* NAME\r
-*      ib_mad_init_response\r
-*\r
-* DESCRIPTION\r
-*      Initializes a MAD common header as a response.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_mad_init_response(IN const ib_mad_t * const p_req_mad,\r
-                    IN ib_mad_t * const p_mad, IN const ib_net16_t status)\r
-{\r
-       CL_ASSERT(p_req_mad);\r
-       CL_ASSERT(p_mad);\r
-       *p_mad = *p_req_mad;\r
-       p_mad->status = status;\r
-       if (p_mad->method == IB_MAD_METHOD_SET)\r
-               p_mad->method = IB_MAD_METHOD_GET;\r
-       p_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_req_mad\r
-*              [in] Pointer to the MAD common header in the original request MAD.\r
-*\r
-*      p_mad\r
-*              [in] Pointer to the MAD common header to initialize.\r
-*\r
-*      status\r
-*              [in] MAD Status value to return;\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*      p_req_mad and p_mad may point to the same MAD.\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_mad_is_response\r
-* NAME\r
-*      ib_mad_is_response\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the MAD is a response ('R' bit set)\r
-*      or if the MAD is a TRAP REPRESS,\r
-*      FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_mad_is_response(IN const ib_mad_t * const p_mad)\r
-{\r
-       CL_ASSERT(p_mad);\r
-       return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||\r
-               p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mad\r
-*              [in] Pointer to the MAD.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the MAD is a response ('R' bit set),\r
-*      FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-#define IB_RMPP_TYPE_DATA              1\r
-#define IB_RMPP_TYPE_ACK               2\r
-#define IB_RMPP_TYPE_STOP              3\r
-#define IB_RMPP_TYPE_ABORT             4\r
-\r
-#define IB_RMPP_NO_RESP_TIME           0x1F\r
-#define IB_RMPP_FLAG_ACTIVE            0x01\r
-#define IB_RMPP_FLAG_FIRST             0x02\r
-#define IB_RMPP_FLAG_LAST              0x04\r
-\r
-#define IB_RMPP_STATUS_SUCCESS         0\r
-#define IB_RMPP_STATUS_RESX            1       /* resources exhausted */\r
-#define IB_RMPP_STATUS_T2L             118     /* time too long */\r
-#define IB_RMPP_STATUS_BAD_LEN         119     /* incon. last and payload len */\r
-#define IB_RMPP_STATUS_BAD_SEG         120     /* incon. first and segment no */\r
-#define IB_RMPP_STATUS_BADT            121     /* bad rmpp type */\r
-#define IB_RMPP_STATUS_W2S             122     /* newwindowlast too small */\r
-#define IB_RMPP_STATUS_S2B             123     /* segment no too big */\r
-#define IB_RMPP_STATUS_BAD_STATUS      124     /* illegal status */\r
-#define IB_RMPP_STATUS_UNV             125     /* unsupported version */\r
-#define IB_RMPP_STATUS_TMR             126     /* too many retries */\r
-#define IB_RMPP_STATUS_UNSPEC          127     /* unspecified */\r
-\r
-/****f* IBA Base: Types/ib_rmpp_is_flag_set\r
-* NAME\r
-*      ib_rmpp_is_flag_set\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the MAD has the given RMPP flag set.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad,\r
-                   IN const uint8_t flag)\r
-{\r
-       CL_ASSERT(p_rmpp_mad);\r
-       return ((p_rmpp_mad->rmpp_flags & flag) == flag);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      ib_rmpp_mad_t\r
-*              [in] Pointer to a MAD with an RMPP header.\r
-*\r
-*      flag\r
-*              [in] The RMPP flag being examined.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the MAD has the given RMPP flag set.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t, ib_rmpp_mad_t\r
-*********/\r
-\r
-static inline void OSM_API\r
-ib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad,\r
-                     IN const uint8_t resp_time)\r
-{\r
-       CL_ASSERT(p_rmpp_mad);\r
-       p_rmpp_mad->rmpp_flags |= (resp_time << 3);\r
-}\r
-\r
-static inline uint8_t OSM_API\r
-ib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad)\r
-{\r
-       CL_ASSERT(p_rmpp_mad);\r
-       return ((uint8_t) (p_rmpp_mad->rmpp_flags >> 3));\r
-}\r
-\r
-/****d* IBA Base: Constants/IB_SMP_DIRECTION\r
-* NAME\r
-*      IB_SMP_DIRECTION\r
-*\r
-* DESCRIPTION\r
-*      The Direction bit for directed route SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMP_DIRECTION_HO            0x8000\r
-#define IB_SMP_DIRECTION               (CL_HTON16(IB_SMP_DIRECTION_HO))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMP_STATUS_MASK\r
-* NAME\r
-*      IB_SMP_STATUS_MASK\r
-*\r
-* DESCRIPTION\r
-*      Mask value for extracting status from a directed route SMP.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMP_STATUS_MASK_HO          0x7FFF\r
-#define IB_SMP_STATUS_MASK             (CL_HTON16(IB_SMP_STATUS_MASK_HO))\r
-/**********/\r
-\r
-/****s* IBA Base: Types/ib_smp_t\r
-* NAME\r
-*      ib_smp_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined SMP. (14.2.1.2)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define IB_SMP_DATA_SIZE 64\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_smp {\r
-       uint8_t base_ver;\r
-       uint8_t mgmt_class;\r
-       uint8_t class_ver;\r
-       uint8_t method;\r
-       ib_net16_t status;\r
-       uint8_t hop_ptr;\r
-       uint8_t hop_count;\r
-       ib_net64_t trans_id;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t resv;\r
-       ib_net32_t attr_mod;\r
-       ib_net64_t m_key;\r
-       ib_net16_t dr_slid;\r
-       ib_net16_t dr_dlid;\r
-       uint32_t resv1[7];\r
-       uint8_t data[IB_SMP_DATA_SIZE];\r
-       uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];\r
-       uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];\r
-} PACK_SUFFIX ib_smp_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      base_ver\r
-*              MAD base format.\r
-*\r
-*      mgmt_class\r
-*              Class of operation.\r
-*\r
-*      class_ver\r
-*              Version of MAD class-specific format.\r
-*\r
-*      method\r
-*              Method to perform, including 'R' bit.\r
-*\r
-*      status\r
-*              Status of operation.\r
-*\r
-*      hop_ptr\r
-*              Hop pointer for directed route MADs.\r
-*\r
-*      hop_count\r
-*              Hop count for directed route MADs.\r
-*\r
-*      trans_Id\r
-*              Transaction ID.\r
-*\r
-*      attr_id\r
-*              Attribute ID.\r
-*\r
-*      resv\r
-*              Reserved field.\r
-*\r
-*      attr_mod\r
-*              Attribute modifier.\r
-*\r
-*      m_key\r
-*              Management key value.\r
-*\r
-*      dr_slid\r
-*              Directed route source LID.\r
-*\r
-*      dr_dlid\r
-*              Directed route destination LID.\r
-*\r
-*      resv0\r
-*              Reserved for 64 byte alignment.\r
-*\r
-*      data\r
-*              MAD data payload.\r
-*\r
-*      initial_path\r
-*              Outbound port list.\r
-*\r
-*      return_path\r
-*              Inbound port list.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_smp_get_status\r
-* NAME\r
-*      ib_smp_get_status\r
-*\r
-* DESCRIPTION\r
-*      Returns the SMP status value in network order.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net16_t OSM_API\r
-ib_smp_get_status(IN const ib_smp_t * const p_smp)\r
-{\r
-       return ((ib_net16_t) (p_smp->status & IB_SMP_STATUS_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smp\r
-*              [in] Pointer to the SMP packet.\r
-*\r
-* RETURN VALUES\r
-*      Returns the SMP status value in network order.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_smp_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_smp_is_response\r
-* NAME\r
-*      ib_smp_is_response\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_smp_is_response(IN const ib_smp_t * const p_smp)\r
-{\r
-       return (ib_mad_is_response((const ib_mad_t *)p_smp));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smp\r
-*              [in] Pointer to the SMP packet.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_smp_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_smp_is_d\r
-* NAME\r
-*      ib_smp_is_d\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the SMP 'D' (direction) bit is set.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)\r
-{\r
-       return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smp\r
-*              [in] Pointer to the SMP packet.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the SMP 'D' (direction) bit is set.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_smp_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_smp_init_new\r
-* NAME\r
-*      ib_smp_init_new\r
-*\r
-* DESCRIPTION\r
-*      Initializes a MAD common header.\r
-*\r
-* TODO\r
-*      This is too big for inlining, but leave it here for now\r
-*      since there is not yet another convenient spot.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_smp_init_new(IN ib_smp_t * const p_smp,\r
-               IN const uint8_t method,\r
-               IN const ib_net64_t trans_id,\r
-               IN const ib_net16_t attr_id,\r
-               IN const ib_net32_t attr_mod,\r
-               IN const uint8_t hop_count,\r
-               IN const ib_net64_t m_key,\r
-               IN const uint8_t * path_out,\r
-               IN const ib_net16_t dr_slid, IN const ib_net16_t dr_dlid)\r
-{\r
-       CL_ASSERT(p_smp);\r
-       CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);\r
-       p_smp->base_ver = 1;\r
-       p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;\r
-       p_smp->class_ver = 1;\r
-       p_smp->method = method;\r
-       p_smp->status = 0;\r
-       p_smp->hop_ptr = 0;\r
-       p_smp->hop_count = hop_count;\r
-       p_smp->trans_id = trans_id;\r
-       p_smp->attr_id = attr_id;\r
-       p_smp->resv = 0;\r
-       p_smp->attr_mod = attr_mod;\r
-       p_smp->m_key = m_key;\r
-       p_smp->dr_slid = dr_slid;\r
-       p_smp->dr_dlid = dr_dlid;\r
-\r
-       memset(p_smp->resv1, 0,\r
-              sizeof(p_smp->resv1) +\r
-              sizeof(p_smp->data) +\r
-              sizeof(p_smp->initial_path) + sizeof(p_smp->return_path));\r
-\r
-       /* copy the path */\r
-       memcpy(&p_smp->initial_path, path_out, sizeof(p_smp->initial_path));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smp\r
-*              [in] Pointer to the SMP packet.\r
-*\r
-*      method\r
-*              [in] Method to perform, including 'R' bit.\r
-*\r
-*      trans_Id\r
-*              [in] Transaction ID.\r
-*\r
-*      attr_id\r
-*              [in] Attribute ID.\r
-*\r
-*      attr_mod\r
-*              [in] Attribute modifier.\r
-*\r
-*      hop_count\r
-*              [in] Number of hops in the path.\r
-*\r
-*      m_key\r
-*              [in] Management key for this SMP.\r
-*\r
-*      path_out\r
-*              [in] Port array for outbound path.\r
-*\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*      Payload area is initialized to zero.\r
-*\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_smp_get_payload_ptr\r
-* NAME\r
-*      ib_smp_get_payload_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SMP payload area.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void *OSM_API\r
-ib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp)\r
-{\r
-       return ((void *)p_smp->data);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_smp\r
-*              [in] Pointer to the SMP packet.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to SMP payload area.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_node_info_t\r
-* NAME\r
-*      ib_node_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined NodeInfo. (14.2.5.3)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_node_info {\r
-       uint8_t base_version;\r
-       uint8_t class_version;\r
-       uint8_t node_type;\r
-       uint8_t num_ports;\r
-       ib_net64_t sys_guid;\r
-       ib_net64_t node_guid;\r
-       ib_net64_t port_guid;\r
-       ib_net16_t partition_cap;\r
-       ib_net16_t device_id;\r
-       ib_net32_t revision;\r
-       ib_net32_t port_num_vendor_id;\r
-} PACK_SUFFIX ib_node_info_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_sa_mad_t\r
-* NAME\r
-*      ib_sa_mad_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined SA MAD format. (15.2.1)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define IB_SA_DATA_SIZE 200\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_sa_mad {\r
-       uint8_t base_ver;\r
-       uint8_t mgmt_class;\r
-       uint8_t class_ver;\r
-       uint8_t method;\r
-       ib_net16_t status;\r
-       ib_net16_t resv;\r
-       ib_net64_t trans_id;\r
-       ib_net16_t attr_id;\r
-       ib_net16_t resv1;\r
-       ib_net32_t attr_mod;\r
-       uint8_t rmpp_version;\r
-       uint8_t rmpp_type;\r
-       uint8_t rmpp_flags;\r
-       uint8_t rmpp_status;\r
-       ib_net32_t seg_num;\r
-       ib_net32_t paylen_newwin;\r
-       ib_net64_t sm_key;\r
-       ib_net16_t attr_offset;\r
-       ib_net16_t resv3;\r
-       ib_net64_t comp_mask;\r
-       uint8_t data[IB_SA_DATA_SIZE];\r
-} PACK_SUFFIX ib_sa_mad_t;\r
-#include <complib/cl_packoff.h>\r
-/**********/\r
-#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)\r
-\r
-static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)\r
-{\r
-       return (((uint32_t) cl_ntoh16(attr_offset)) << 3);\r
-}\r
-\r
-static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)\r
-{\r
-       return (cl_hton16((uint16_t) (attr_size >> 3)));\r
-}\r
-\r
-/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr\r
-* NAME\r
-*      ib_sa_mad_get_payload_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets a pointer to the SA MAD's payload area.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void *OSM_API\r
-ib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)\r
-{\r
-       return ((void *)p_sa_mad->data);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_sa_mad\r
-*              [in] Pointer to the SA MAD packet.\r
-*\r
-* RETURN VALUES\r
-*      Pointer to SA MAD payload area.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_mad_t\r
-*********/\r
-\r
-#define IB_NODE_INFO_PORT_NUM_MASK             (CL_HTON32(0xFF000000))\r
-#define IB_NODE_INFO_VEND_ID_MASK              (CL_HTON32(0x00FFFFFF))\r
-#if CPU_LE\r
-#define IB_NODE_INFO_PORT_NUM_SHIFT 0\r
-#else\r
-#define IB_NODE_INFO_PORT_NUM_SHIFT 24\r
-#endif\r
-\r
-/****f* IBA Base: Types/ib_node_info_get_local_port_num\r
-* NAME\r
-*      ib_node_info_get_local_port_num\r
-*\r
-* DESCRIPTION\r
-*      Gets a the local port number from the NodeInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni)\r
-{\r
-       return ((uint8_t) ((p_ni->port_num_vendor_id &\r
-                           IB_NODE_INFO_PORT_NUM_MASK)\r
-                          >> IB_NODE_INFO_PORT_NUM_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ni\r
-*              [in] Pointer to a NodeInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Local port number that returned the attribute.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_node_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_node_info_get_vendor_id\r
-* NAME\r
-*      ib_node_info_get_vendor_id\r
-*\r
-* DESCRIPTION\r
-*      Gets the VendorID from the NodeInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)\r
-{\r
-       return ((ib_net32_t) (p_ni->port_num_vendor_id &\r
-                             IB_NODE_INFO_VEND_ID_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ni\r
-*              [in] Pointer to a NodeInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      VendorID that returned the attribute.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_node_info_t\r
-*********/\r
-\r
-#define IB_NODE_DESCRIPTION_SIZE 64\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_node_desc {\r
-       // Node String is an array of UTF-8 characters\r
-       // that describe the node in text format\r
-       // Note that this string is NOT NULL TERMINATED!\r
-       uint8_t description[IB_NODE_DESCRIPTION_SIZE];\r
-} PACK_SUFFIX ib_node_desc_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_node_record_t {\r
-       ib_net16_t lid;\r
-       ib_net16_t resv;\r
-       ib_node_info_t node_info;\r
-       ib_node_desc_t node_desc;\r
-       uint8_t pad[4];\r
-} PACK_SUFFIX ib_node_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_port_info_t\r
-* NAME\r
-*      ib_port_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortInfo. (14.2.5.6)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_info {\r
-       ib_net64_t m_key;\r
-       ib_net64_t subnet_prefix;\r
-       ib_net16_t base_lid;\r
-       ib_net16_t master_sm_base_lid;\r
-       ib_net32_t capability_mask;\r
-       ib_net16_t diag_code;\r
-       ib_net16_t m_key_lease_period;\r
-       uint8_t local_port_num;\r
-       uint8_t link_width_enabled;\r
-       uint8_t link_width_supported;\r
-       uint8_t link_width_active;\r
-       uint8_t state_info1;    /* LinkSpeedSupported and PortState */\r
-       uint8_t state_info2;    /* PortPhysState and LinkDownDefaultState */\r
-       uint8_t mkey_lmc;\r
-       uint8_t link_speed;     /* LinkSpeedEnabled and LinkSpeedActive */\r
-       uint8_t mtu_smsl;\r
-       uint8_t vl_cap;         /* VLCap and InitType */\r
-       uint8_t vl_high_limit;\r
-       uint8_t vl_arb_high_cap;\r
-       uint8_t vl_arb_low_cap;\r
-       uint8_t mtu_cap;\r
-       uint8_t vl_stall_life;\r
-       uint8_t vl_enforce;\r
-       ib_net16_t m_key_violations;\r
-       ib_net16_t p_key_violations;\r
-       ib_net16_t q_key_violations;\r
-       uint8_t guid_cap;\r
-       uint8_t subnet_timeout; /* cli_rereg(1b), mcast_pkey_trap_suppr(1b), resrv(1b), timeout(5b) */\r
-       uint8_t resp_time_value;\r
-       uint8_t error_threshold; /* local phy errors(4b), overrun errors(4b) */\r
-       ib_net16_t max_credit_hint;\r
-       ib_net32_t link_rt_latency; /* reserv(8b), link round trip lat(24b) */\r
-} PACK_SUFFIX ib_port_info_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-#define IB_PORT_STATE_MASK                     0x0F\r
-#define IB_PORT_LMC_MASK                       0x07\r
-#define IB_PORT_LMC_MAX                                0x07\r
-#define IB_PORT_MPB_MASK                       0xC0\r
-#define IB_PORT_MPB_SHIFT                      6\r
-#define IB_PORT_LINK_SPEED_SHIFT               4\r
-#define IB_PORT_LINK_SPEED_SUPPORTED_MASK      0xF0\r
-#define IB_PORT_LINK_SPEED_ACTIVE_MASK         0xF0\r
-#define IB_PORT_LINK_SPEED_ENABLED_MASK                0x0F\r
-#define IB_PORT_PHYS_STATE_MASK                        0xF0\r
-#define IB_PORT_PHYS_STATE_SHIFT               4\r
-#define IB_PORT_PHYS_STATE_NO_CHANGE           0\r
-#define IB_PORT_PHYS_STATE_SLEEP               1\r
-#define IB_PORT_PHYS_STATE_POLLING             2\r
-#define IB_PORT_PHYS_STATE_DISABLED            3\r
-#define IB_PORT_PHYS_STATE_PORTCONFTRAIN       4\r
-#define IB_PORT_PHYS_STATE_LINKUP              5\r
-#define IB_PORT_PHYS_STATE_LINKERRRECOVER      6\r
-#define IB_PORT_PHYS_STATE_PHYTEST             7\r
-#define IB_PORT_LNKDWNDFTSTATE_MASK            0x0F\r
-\r
-#define IB_PORT_CAP_RESV0         (CL_HTON32(0x00000001))\r
-#define IB_PORT_CAP_IS_SM         (CL_HTON32(0x00000002))\r
-#define IB_PORT_CAP_HAS_NOTICE    (CL_HTON32(0x00000004))\r
-#define IB_PORT_CAP_HAS_TRAP      (CL_HTON32(0x00000008))\r
-#define IB_PORT_CAP_HAS_IPD       (CL_HTON32(0x00000010))\r
-#define IB_PORT_CAP_HAS_AUTO_MIG  (CL_HTON32(0x00000020))\r
-#define IB_PORT_CAP_HAS_SL_MAP    (CL_HTON32(0x00000040))\r
-#define IB_PORT_CAP_HAS_NV_MKEY   (CL_HTON32(0x00000080))\r
-#define IB_PORT_CAP_HAS_NV_PKEY   (CL_HTON32(0x00000100))\r
-#define IB_PORT_CAP_HAS_LED_INFO  (CL_HTON32(0x00000200))\r
-#define IB_PORT_CAP_SM_DISAB      (CL_HTON32(0x00000400))\r
-#define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_HTON32(0x00000800))\r
-#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000))\r
-#define IB_PORT_CAP_RESV13        (CL_HTON32(0x00002000))\r
-#define IB_PORT_CAP_RESV14        (CL_HTON32(0x00004000))\r
-#define IB_PORT_CAP_RESV15        (CL_HTON32(0x00008000))\r
-#define IB_PORT_CAP_HAS_COM_MGT   (CL_HTON32(0x00010000))\r
-#define IB_PORT_CAP_HAS_SNMP      (CL_HTON32(0x00020000))\r
-#define IB_PORT_CAP_REINIT        (CL_HTON32(0x00040000))\r
-#define IB_PORT_CAP_HAS_DEV_MGT   (CL_HTON32(0x00080000))\r
-#define IB_PORT_CAP_HAS_VEND_CLS  (CL_HTON32(0x00100000))\r
-#define IB_PORT_CAP_HAS_DR_NTC    (CL_HTON32(0x00200000))\r
-#define IB_PORT_CAP_HAS_CAP_NTC   (CL_HTON32(0x00400000))\r
-#define IB_PORT_CAP_HAS_BM        (CL_HTON32(0x00800000))\r
-#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_HTON32(0x01000000))\r
-#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000))\r
-#define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000))\r
-#define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000))\r
-#define IB_PORT_CAP_HAS_VEND_MADS (CL_HTON32(0x10000000))\r
-#define IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS (CL_HTON32(0x20000000))\r
-#define IB_PORT_CAP_HAS_MCAST_FDB_TOP (CL_HTON32(0x40000000))\r
-#define IB_PORT_CAP_HAS_HIER_INFO (CL_HTON32(0x80000000))\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_port_state\r
-* NAME\r
-*      ib_port_info_get_port_state\r
-*\r
-* DESCRIPTION\r
-*      Returns the port state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_port_state(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->state_info1 & IB_PORT_STATE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Port state.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_port_state\r
-* NAME\r
-*      ib_port_info_set_port_state\r
-*\r
-* DESCRIPTION\r
-*      Sets the port state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_port_state(IN ib_port_info_t * const p_pi,\r
-                           IN const uint8_t port_state)\r
-{\r
-       p_pi->state_info1 = (uint8_t) ((p_pi->state_info1 & 0xF0) | port_state);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      port_state\r
-*              [in] Port state value to set.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_vl_cap\r
-* NAME\r
-*      ib_port_info_get_vl_cap\r
-*\r
-* DESCRIPTION\r
-*      Gets the VL Capability of a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((p_pi->vl_cap >> 4) & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      VL_CAP field\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_init_type\r
-* NAME\r
-*      ib_port_info_get_init_type\r
-*\r
-* DESCRIPTION\r
-*      Gets the init type of a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_init_type(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return (uint8_t) (p_pi->vl_cap & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      InitType field\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_op_vls\r
-* NAME\r
-*      ib_port_info_get_op_vls\r
-*\r
-* DESCRIPTION\r
-*      Gets the operational VLs on a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((p_pi->vl_enforce >> 4) & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      OP_VLS field\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_op_vls\r
-* NAME\r
-*      ib_port_info_set_op_vls\r
-*\r
-* DESCRIPTION\r
-*      Sets the operational VLs on a port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_op_vls(IN ib_port_info_t * const p_pi, IN const uint8_t op_vls)\r
-{\r
-       p_pi->vl_enforce =\r
-           (uint8_t) ((p_pi->vl_enforce & 0x0F) | (op_vls << 4));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      op_vls\r
-*              [in] Encoded operation VLs value.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_state_no_change\r
-* NAME\r
-*      ib_port_info_set_state_no_change\r
-*\r
-* DESCRIPTION\r
-*      Sets the port state fields to the value for "no change".\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi)\r
-{\r
-       ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);\r
-       p_pi->state_info2 = 0;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_link_speed_sup\r
-* NAME\r
-*      ib_port_info_get_link_speed_sup\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the link speed supported.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) ((p_pi->state_info1 &\r
-                           IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>\r
-                          IB_PORT_LINK_SPEED_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encoded value for the link speed supported.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_link_speed_sup\r
-* NAME\r
-*      ib_port_info_set_link_speed_sup\r
-*\r
-* DESCRIPTION\r
-*      Given an integer of the supported link speed supported.\r
-*      Set the appropriate bits in state_info1\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_link_speed_sup(IN uint8_t const speed,\r
-                               IN ib_port_info_t * p_pi)\r
-{\r
-       p_pi->state_info1 =\r
-           (~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1) |\r
-           (IB_PORT_LINK_SPEED_SUPPORTED_MASK &\r
-            (speed << IB_PORT_LINK_SPEED_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      speed\r
-*              [in] Supported Speeds Code.\r
-*\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_port_phys_state\r
-* NAME\r
-*      ib_port_info_get_port_phys_state\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the port physical state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) ((p_pi->state_info2 &\r
-                           IB_PORT_PHYS_STATE_MASK) >>\r
-                          IB_PORT_PHYS_STATE_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encoded value for the port physical state.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_port_phys_state\r
-* NAME\r
-*      ib_port_info_set_port_phys_state\r
-*\r
-* DESCRIPTION\r
-*      Given an integer of the port physical state,\r
-*      Set the appropriate bits in state_info2\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_port_phys_state(IN uint8_t const phys_state,\r
-                                IN ib_port_info_t * p_pi)\r
-{\r
-       p_pi->state_info2 =\r
-           (~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2) |\r
-           (IB_PORT_PHYS_STATE_MASK &\r
-            (phys_state << IB_PORT_PHYS_STATE_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      phys_state\r
-*              [in] port physical state.\r
-*\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      This function does not return a value.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_link_down_def_state\r
-* NAME\r
-*      ib_port_info_get_link_down_def_state\r
-*\r
-* DESCRIPTION\r
-*      Returns the link down default state.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      link down default state of the port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_link_down_def_state\r
-* NAME\r
-*      ib_port_info_set_link_down_def_state\r
-*\r
-* DESCRIPTION\r
-*      Sets the link down default state of the port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi,\r
-                                    IN const uint8_t link_dwn_state)\r
-{\r
-       p_pi->state_info2 =\r
-           (uint8_t) ((p_pi->state_info2 & 0xF0) | link_dwn_state);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      link_dwn_state\r
-*              [in] Link down default state of the port.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_link_speed_active\r
-* NAME\r
-*      ib_port_info_get_link_speed_active\r
-*\r
-* DESCRIPTION\r
-*      Returns the Link Speed Active value assigned to this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) ((p_pi->link_speed &\r
-                           IB_PORT_LINK_SPEED_ACTIVE_MASK) >>\r
-                          IB_PORT_LINK_SPEED_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the link speed active value assigned to this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-#define IB_LINK_WIDTH_ACTIVE_1X                        1\r
-#define IB_LINK_WIDTH_ACTIVE_4X                        2\r
-#define IB_LINK_WIDTH_ACTIVE_8X                        4\r
-#define IB_LINK_WIDTH_ACTIVE_12X               8\r
-#define IB_LINK_SPEED_ACTIVE_2_5               1\r
-#define IB_LINK_SPEED_ACTIVE_5                 2\r
-#define IB_LINK_SPEED_ACTIVE_10                        4\r
-\r
-/* following v1 ver1.2 p901 */\r
-#define IB_PATH_RECORD_RATE_2_5_GBS            2\r
-#define IB_PATH_RECORD_RATE_10_GBS             3\r
-#define IB_PATH_RECORD_RATE_30_GBS             4\r
-#define IB_PATH_RECORD_RATE_5_GBS              5\r
-#define IB_PATH_RECORD_RATE_20_GBS             6\r
-#define IB_PATH_RECORD_RATE_40_GBS             7\r
-#define IB_PATH_RECORD_RATE_60_GBS             8\r
-#define IB_PATH_RECORD_RATE_80_GBS             9\r
-#define IB_PATH_RECORD_RATE_120_GBS            10\r
-\r
-#define IB_MIN_RATE    IB_PATH_RECORD_RATE_2_5_GBS\r
-#define IB_MAX_RATE    IB_PATH_RECORD_RATE_120_GBS\r
-\r
-/****f* IBA Base: Types/ib_port_info_compute_rate\r
-* NAME\r
-*      ib_port_info_compute_rate\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the path rate.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi)\r
-{\r
-       uint8_t rate = 0;\r
-\r
-       switch (ib_port_info_get_link_speed_active(p_pi)) {\r
-       case IB_LINK_SPEED_ACTIVE_2_5:\r
-               switch (p_pi->link_width_active) {\r
-               case IB_LINK_WIDTH_ACTIVE_1X:\r
-                       rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_4X:\r
-                       rate = IB_PATH_RECORD_RATE_10_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_8X:\r
-                       rate = IB_PATH_RECORD_RATE_20_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_12X:\r
-                       rate = IB_PATH_RECORD_RATE_30_GBS;\r
-                       break;\r
-\r
-               default:\r
-                       rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
-                       break;\r
-               }\r
-               break;\r
-       case IB_LINK_SPEED_ACTIVE_5:\r
-               switch (p_pi->link_width_active) {\r
-               case IB_LINK_WIDTH_ACTIVE_1X:\r
-                       rate = IB_PATH_RECORD_RATE_5_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_4X:\r
-                       rate = IB_PATH_RECORD_RATE_20_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_8X:\r
-                       rate = IB_PATH_RECORD_RATE_40_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_12X:\r
-                       rate = IB_PATH_RECORD_RATE_60_GBS;\r
-                       break;\r
-\r
-               default:\r
-                       rate = IB_PATH_RECORD_RATE_5_GBS;\r
-                       break;\r
-               }\r
-               break;\r
-       case IB_LINK_SPEED_ACTIVE_10:\r
-               switch (p_pi->link_width_active) {\r
-               case IB_LINK_WIDTH_ACTIVE_1X:\r
-                       rate = IB_PATH_RECORD_RATE_10_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_4X:\r
-                       rate = IB_PATH_RECORD_RATE_40_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_8X:\r
-                       rate = IB_PATH_RECORD_RATE_80_GBS;\r
-                       break;\r
-\r
-               case IB_LINK_WIDTH_ACTIVE_12X:\r
-                       rate = IB_PATH_RECORD_RATE_120_GBS;\r
-                       break;\r
-\r
-               default:\r
-                       rate = IB_PATH_RECORD_RATE_10_GBS;\r
-                       break;\r
-               }\r
-               break;\r
-       default:\r
-               rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
-               break;\r
-       }\r
-\r
-       return rate;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encoded value for the link speed supported.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_path_get_ipd\r
-* NAME\r
-*      ib_path_get_ipd\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the inter packet delay.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_path_get_ipd(IN uint8_t local_link_width_supported, IN uint8_t path_rec_rate)\r
-{\r
-       uint8_t ipd = 0;\r
-\r
-       switch (local_link_width_supported) {\r
-               /* link_width_supported = 1: 1x */\r
-       case 1:\r
-               break;\r
-\r
-               /* link_width_supported = 3: 1x or 4x */\r
-       case 3:\r
-               switch (path_rec_rate & 0x3F) {\r
-               case IB_PATH_RECORD_RATE_2_5_GBS:\r
-                       ipd = 3;\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-               break;\r
-\r
-               /* link_width_supported = 11: 1x or 4x or 12x */\r
-       case 11:\r
-               switch (path_rec_rate & 0x3F) {\r
-               case IB_PATH_RECORD_RATE_2_5_GBS:\r
-                       ipd = 11;\r
-                       break;\r
-               case IB_PATH_RECORD_RATE_10_GBS:\r
-                       ipd = 2;\r
-                       break;\r
-               default:\r
-                       break;\r
-               }\r
-               break;\r
-\r
-       default:\r
-               break;\r
-       }\r
-\r
-       return ipd;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      local_link_width_supported\r
-*              [in] link with supported for this port\r
-*\r
-*      path_rec_rate\r
-*              [in] rate field of the path record\r
-*\r
-* RETURN VALUES\r
-*      Returns the ipd\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_mtu_cap\r
-* NAME\r
-*      ib_port_info_get_mtu_cap\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the maximum MTU supported by this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->mtu_cap & 0x0F));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encooded value for the maximum MTU supported by this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu\r
-* NAME\r
-*      ib_port_info_get_neighbor_mtu\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the neighbor MTU supported by this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) ((p_pi->mtu_smsl & 0xF0) >> 4));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encoded value for the neighbor MTU at this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu\r
-* NAME\r
-*      ib_port_info_set_neighbor_mtu\r
-*\r
-* DESCRIPTION\r
-*      Sets the Neighbor MTU value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi,\r
-                             IN const uint8_t mtu)\r
-{\r
-       CL_ASSERT(mtu <= 5);\r
-       CL_ASSERT(mtu != 0);\r
-       p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0x0F) | (mtu << 4));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      mtu\r
-*              [in] Encoded MTU value to set\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_master_smsl\r
-* NAME\r
-*      ib_port_info_get_master_smsl\r
-*\r
-* DESCRIPTION\r
-*      Returns the encoded value for the Master SMSL at this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return (uint8_t) (p_pi->mtu_smsl & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the encoded value for the Master SMSL at this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_master_smsl\r
-* NAME\r
-*      ib_port_info_set_master_smsl\r
-*\r
-* DESCRIPTION\r
-*      Sets the Master SMSL value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi,\r
-                            IN const uint8_t smsl)\r
-{\r
-       p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0xF0) | smsl);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      mtu\r
-*              [in] Encoded Master SMSL value to set\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_timeout\r
-* NAME\r
-*      ib_port_info_set_timeout\r
-*\r
-* DESCRIPTION\r
-*      Sets the encoded subnet timeout value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_timeout(IN ib_port_info_t * const p_pi,\r
-                        IN const uint8_t timeout)\r
-{\r
-       CL_ASSERT(timeout <= 0x1F);\r
-       p_pi->subnet_timeout =\r
-           (uint8_t) ((p_pi->subnet_timeout & 0xE0) | (timeout & 0x1F));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      timeout\r
-*              [in] Encoded timeout value to set\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_client_rereg\r
-* NAME\r
-*      ib_port_info_set_client_rereg\r
-*\r
-* DESCRIPTION\r
-*      Sets the encoded client reregistration bit value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,\r
-                             IN const uint8_t client_rereg)\r
-{\r
-       CL_ASSERT(client_rereg <= 0x1);\r
-       p_pi->subnet_timeout =\r
-           (uint8_t) ((p_pi->subnet_timeout & 0x7F) | (client_rereg << 7));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      client_rereg\r
-*              [in] Client reregistration value to set (either 1 or 0).\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_mcast_pkey_trap_suppress\r
-* NAME\r
-*      ib_port_info_set_mcast_pkey_trap_suppress\r
-*\r
-* DESCRIPTION\r
-*      Sets the encoded multicast pkey trap suppresion enabled bit value\r
-*      in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi,\r
-                                         IN const uint8_t trap_suppress)\r
-{\r
-       CL_ASSERT(trap_suppress <= 0x1);\r
-       p_pi->subnet_timeout =\r
-           (uint8_t) ((p_pi->subnet_timeout & 0xBF) | (trap_suppress << 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      trap_suppress\r
-*              [in] Multicast pkey trap suppresion enabled value to set\r
-*                   (either 1 or 0).\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_timeout\r
-* NAME\r
-*      ib_port_info_get_timeout\r
-*\r
-* DESCRIPTION\r
-*      Gets the encoded subnet timeout value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_timeout(IN ib_port_info_t const *p_pi)\r
-{\r
-       return (p_pi->subnet_timeout & 0x1F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      The encoded timeout value\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_client_rereg\r
-* NAME\r
-*      ib_port_info_get_client_rereg\r
-*\r
-* DESCRIPTION\r
-*      Gets the encoded client reregistration bit value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)\r
-{\r
-       return ((p_pi->subnet_timeout & 0x80) >> 7);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Client reregistration value (either 1 or 0).\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_mcast_pkey_trap_suppress\r
-* NAME\r
-*      ib_port_info_get_mcast_pkey_trap_suppress\r
-*\r
-* DESCRIPTION\r
-*      Gets the encoded multicast pkey trap suppresion enabled bit value\r
-*      in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const *p_pi)\r
-{\r
-       return ((p_pi->subnet_timeout & 0x40) >> 6);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Multicast PKey trap suppression enabled value (either 1 or 0).\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime\r
-* NAME\r
-*      ib_port_info_set_hoq_lifetime\r
-*\r
-* DESCRIPTION\r
-*      Sets the Head of Queue Lifetime for which a packet can live in the head\r
-*  of VL queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,\r
-                             IN const uint8_t hoq_life)\r
-{\r
-       p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |\r
-                                        (p_pi->vl_stall_life & 0xe0));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      hoq_life\r
-*              [in] Encoded lifetime value to set\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime\r
-* NAME\r
-*      ib_port_info_get_hoq_lifetime\r
-*\r
-* DESCRIPTION\r
-*      Gets the Head of Queue Lifetime for which a packet can live in the head\r
-*  of VL queue\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->vl_stall_life & 0x1f));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*     Encoded lifetime value\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_vl_stall_count\r
-* NAME\r
-*      ib_port_info_set_vl_stall_count\r
-*\r
-* DESCRIPTION\r
-*      Sets the VL Stall Count which define the number of contiguous\r
-*  HLL (hoq) drops that will put the VL into stalled mode.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,\r
-                               IN const uint8_t vl_stall_count)\r
-{\r
-       p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |\r
-                                        ((vl_stall_count << 5) & 0xe0));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      vl_stall_count\r
-*              [in] value to set\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_vl_stall_count\r
-* NAME\r
-*      ib_port_info_get_vl_stall_count\r
-*\r
-* DESCRIPTION\r
-*      Gets the VL Stall Count which define the number of contiguous\r
-*  HLL (hoq) drops that will put the VL into stalled mode\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*     vl stall count\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_lmc\r
-* NAME\r
-*      ib_port_info_get_lmc\r
-*\r
-* DESCRIPTION\r
-*      Returns the LMC value assigned to this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the LMC value assigned to this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_lmc\r
-* NAME\r
-*      ib_port_info_set_lmc\r
-*\r
-* DESCRIPTION\r
-*      Sets the LMC value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)\r
-{\r
-       CL_ASSERT(lmc <= IB_PORT_LMC_MAX);\r
-       p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      lmc\r
-*              [in] LMC value to set, must be less than 7.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled\r
-* NAME\r
-*      ib_port_info_get_link_speed_enabled\r
-*\r
-* DESCRIPTION\r
-*      Returns the link speed enabled value assigned to this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Port state.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled\r
-* NAME\r
-*      ib_port_info_set_link_speed_enabled\r
-*\r
-* DESCRIPTION\r
-*      Sets the link speed enabled value in the PortInfo attribute.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi,\r
-                                   IN const uint8_t link_speed_enabled)\r
-{\r
-       p_pi->link_speed =\r
-           (uint8_t) ((p_pi->link_speed & 0xF0) | link_speed_enabled);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      link_speed_enabled\r
-*              [in] link speed enabled value to set.\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_mpb\r
-* NAME\r
-*      ib_port_info_get_mpb\r
-*\r
-* DESCRIPTION\r
-*      Returns the M_Key protect bits assigned to this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_mpb(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return ((uint8_t) ((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>\r
-                          IB_PORT_MPB_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ni\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the M_Key protect bits assigned to this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_mpb\r
-* NAME\r
-*      ib_port_info_set_mpb\r
-*\r
-* DESCRIPTION\r
-*      Set the M_Key protect bits of this port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_mpb(IN ib_port_info_t * p_pi, IN uint8_t mpb)\r
-{\r
-       p_pi->mkey_lmc =\r
-           (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |\r
-           (IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      mpb\r
-*              [in] M_Key protect bits\r
-*      p_ni\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd\r
-* NAME\r
-*      ib_port_info_get_local_phy_err_thd\r
-*\r
-* DESCRIPTION\r
-*      Returns the Phy Link Threshold\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return (uint8_t) ((p_pi->error_threshold & 0xF0) >> 4);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the Phy Link error threshold assigned to this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd\r
-* NAME\r
-*      ib_port_info_get_local_overrun_err_thd\r
-*\r
-* DESCRIPTION\r
-*      Returns the Credits Overrun Errors Threshold\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi)\r
-{\r
-       return (uint8_t) (p_pi->error_threshold & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the Credits Overrun errors threshold assigned to this port.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd\r
-* NAME\r
-*      ib_port_info_set_phy_and_overrun_err_thd\r
-*\r
-* DESCRIPTION\r
-*      Sets the Phy Link and Credits Overrun Errors Threshold\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,\r
-                                        IN uint8_t phy_threshold,\r
-                                        IN uint8_t overrun_threshold)\r
-{\r
-       p_pi->error_threshold =\r
-           (uint8_t) (((phy_threshold & 0x0F) << 4) |\r
-                      (overrun_threshold & 0x0F));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_pi\r
-*              [in] Pointer to a PortInfo attribute.\r
-*\r
-*      phy_threshold\r
-*              [in] Physical Link Errors Threshold above which Trap 129 is generated\r
-*\r
-*  overrun_threshold\r
-*     [in] Credits overrun Errors Threshold above which Trap 129 is generated\r
-*\r
-* RETURN VALUES\r
-*      None.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-typedef uint8_t ib_svc_name_t[64];\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_service_record {\r
-       ib_net64_t service_id;\r
-       ib_gid_t service_gid;\r
-       ib_net16_t service_pkey;\r
-       ib_net16_t resv;\r
-       ib_net32_t service_lease;\r
-       uint8_t service_key[16];\r
-       ib_svc_name_t service_name;\r
-       uint8_t service_data8[16];\r
-       ib_net16_t service_data16[8];\r
-       ib_net32_t service_data32[4];\r
-       ib_net64_t service_data64[2];\r
-} PACK_SUFFIX ib_service_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_portinfo_record {\r
-       ib_net16_t lid;\r
-       uint8_t port_num;\r
-       uint8_t resv;\r
-       ib_port_info_t port_info;\r
-} PACK_SUFFIX ib_portinfo_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_link_record {\r
-       ib_net16_t from_lid;\r
-       uint8_t from_port_num;\r
-       uint8_t to_port_num;\r
-       ib_net16_t to_lid;\r
-       uint8_t pad[2];\r
-} PACK_SUFFIX ib_link_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_sminfo_record {\r
-       ib_net16_t lid;\r
-       uint16_t resv0;\r
-       ib_sm_info_t sm_info;\r
-       uint8_t pad[7];\r
-} PACK_SUFFIX ib_sminfo_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_lft_record_t\r
-* NAME\r
-*      ib_lft_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined LinearForwardingTableRecord (15.2.5.6)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_lft_record {\r
-       ib_net16_t lid;\r
-       ib_net16_t block_num;\r
-       uint32_t resv0;\r
-       uint8_t lft[64];\r
-} PACK_SUFFIX ib_lft_record_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_mft_record_t\r
-* NAME\r
-*      ib_mft_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined MulticastForwardingTableRecord (15.2.5.8)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_mft_record {\r
-       ib_net16_t lid;\r
-       ib_net16_t position_block_num;\r
-       uint32_t resv0;\r
-       ib_net16_t mft[IB_MCAST_BLOCK_SIZE];\r
-} PACK_SUFFIX ib_mft_record_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_switch_info_t\r
-* NAME\r
-*      ib_switch_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined SwitchInfo. (14.2.5.4)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_switch_info {\r
-       ib_net16_t lin_cap;\r
-       ib_net16_t rand_cap;\r
-       ib_net16_t mcast_cap;\r
-       ib_net16_t lin_top;\r
-       uint8_t def_port;\r
-       uint8_t def_mcast_pri_port;\r
-       uint8_t def_mcast_not_port;\r
-       uint8_t life_state;\r
-       ib_net16_t lids_per_port;\r
-       ib_net16_t enforce_cap;\r
-       uint8_t flags;\r
-       uint8_t resvd;\r
-       ib_net16_t mcast_top;\r
-} PACK_SUFFIX ib_switch_info_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_switch_info_record {\r
-       ib_net16_t lid;\r
-       uint16_t resv0;\r
-       ib_switch_info_t switch_info;\r
-} PACK_SUFFIX ib_switch_info_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#define IB_SWITCH_PSC 0x04\r
-\r
-/****f* IBA Base: Types/ib_switch_info_get_state_change\r
-* NAME\r
-*      ib_switch_info_get_state_change\r
-*\r
-* DESCRIPTION\r
-*      Returns the value of the state change flag.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)\r
-{\r
-       return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_si\r
-*              [in] Pointer to a SwitchInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the value of the state change flag.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_switch_info_clear_state_change\r
-* NAME\r
-*      ib_switch_info_clear_state_change\r
-*\r
-* DESCRIPTION\r
-*      Clears the switch's state change bit.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)\r
-{\r
-       p_si->life_state = (uint8_t) (p_si->life_state & 0xFB);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_si\r
-*              [in] Pointer to a SwitchInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_switch_info_get_opt_sl2vlmapping\r
-* NAME\r
-*      ib_switch_info_get_state_opt_sl2vlmapping\r
-*\r
-* DESCRIPTION\r
-*       Returns the value of the optimized SLtoVLMapping programming flag.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)\r
-{\r
-        return ((p_si->life_state & 0x01) == 0x01);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_si\r
-*              [in] Pointer to a SwitchInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns the value of the optimized SLtoVLMapping programming flag.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0\r
-* NAME\r
-*      ib_switch_info_is_enhanced_port0\r
-*\r
-* DESCRIPTION\r
-*      Returns TRUE if the enhancedPort0 bit is on (meaning the switch\r
-*  port zero supports enhanced functions).\r
-*  Returns FALSE otherwise.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)\r
-{\r
-       return ((p_si->flags & 0x08) == 0x08);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_si\r
-*              [in] Pointer to a SwitchInfo attribute.\r
-*\r
-* RETURN VALUES\r
-*      Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_guid_info_t\r
-* NAME\r
-*      ib_guid_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined GuidInfo. (14.2.5.5)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define        GUID_TABLE_MAX_ENTRIES          8\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_guid_info {\r
-       ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];\r
-} PACK_SUFFIX ib_guid_info_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_guidinfo_record {\r
-       ib_net16_t lid;\r
-       uint8_t block_num;\r
-       uint8_t resv;\r
-       uint32_t reserved;\r
-       ib_guid_info_t guid_info;\r
-} PACK_SUFFIX ib_guidinfo_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#define IB_MULTIPATH_MAX_GIDS 11       /* Support max that can fit into first MAD (for now) */\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_multipath_rec_t {\r
-       ib_net32_t hop_flow_raw;\r
-       uint8_t tclass;\r
-       uint8_t num_path;\r
-       ib_net16_t pkey;\r
-       ib_net16_t qos_class_sl;\r
-       uint8_t mtu;\r
-       uint8_t rate;\r
-       uint8_t pkt_life;\r
-       uint8_t service_id_8msb;\r
-       uint8_t independence;   /* formerly resv2 */\r
-       uint8_t sgid_count;\r
-       uint8_t dgid_count;\r
-       uint8_t service_id_56lsb[7];\r
-       ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];\r
-} PACK_SUFFIX ib_multipath_rec_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*       hop_flow_raw\r
-*               Global routing parameters: hop count, flow label and raw bit.\r
-*\r
-*       tclass\r
-*               Another global routing parameter.\r
-*\r
-*       num_path\r
-*     Reversible path - 1 bit to say if path is reversible.\r
-*               num_path [6:0] In queries, maximum number of paths to return.\r
-*               In responses, undefined.\r
-*\r
-*       pkey\r
-*               Partition key (P_Key) to use on this path.\r
-*\r
-*       qos_class_sl\r
-*               QoS class and service level to use on this path.\r
-*\r
-*       mtu\r
-*               MTU and MTU selector fields to use on this path\r
-*       rate\r
-*               Rate and rate selector fields to use on this path.\r
-*\r
-*       pkt_life\r
-*               Packet lifetime\r
-*\r
-*      service_id_8msb\r
-*              8 most significant bits of Service ID\r
-*\r
-*      service_id_56lsb\r
-*              56 least significant bits of Service ID\r
-*\r
-*       preference\r
-*               Indicates the relative merit of this path versus other path\r
-*               records returned from the SA.  Lower numbers are better.\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_num_path\r
-* NAME\r
-*       ib_multipath_rec_num_path\r
-*\r
-* DESCRIPTION\r
-*       Get max number of paths to return.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return (p_rec->num_path & 0x7F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Maximum number of paths to return for each unique SGID_DGID combination.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_set_sl\r
-* NAME\r
-*      ib_multipath_rec_set_sl\r
-*\r
-* DESCRIPTION\r
-*      Set path service level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_multipath_rec_set_sl(\r
-       IN ib_multipath_rec_t* const p_rec,\r
-       IN const uint8_t sl )\r
-{\r
-       p_rec->qos_class_sl =\r
-               (p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_QOS_CLASS_MASK)) |\r
-                       cl_hton16(sl & IB_MULTIPATH_REC_SL_MASK);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the MultiPath record object.\r
-*\r
-*      sl\r
-*              [in] Service level to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_sl\r
-* NAME\r
-*       ib_multipath_rec_sl\r
-*\r
-* DESCRIPTION\r
-*       Get multipath service level.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) ((cl_ntoh16(p_rec->qos_class_sl)) & IB_MULTIPATH_REC_SL_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*      SL.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_set_qos_class\r
-* NAME\r
-*      ib_multipath_rec_set_qos_class\r
-*\r
-* DESCRIPTION\r
-*      Set path QoS class.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void     OSM_API\r
-ib_multipath_rec_set_qos_class(\r
-       IN ib_multipath_rec_t* const p_rec,\r
-       IN const uint16_t qos_class )\r
-{\r
-       p_rec->qos_class_sl =\r
-               (p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_SL_MASK)) |\r
-                       cl_hton16(qos_class << 4);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the MultiPath record object.\r
-*\r
-*      qos_class\r
-*              [in] QoS class to set.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_qos_class\r
-* NAME\r
-*      ib_multipath_rec_qos_class\r
-*\r
-* DESCRIPTION\r
-*      Get QoS class.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint16_t OSM_API\r
-ib_multipath_rec_qos_class(\r
-       IN      const   ib_multipath_rec_t* const       p_rec )\r
-{\r
-       return (cl_ntoh16( p_rec->qos_class_sl ) >> 4);\r
-}\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the MultiPath record object.\r
-*\r
-* RETURN VALUES\r
-*      QoS class of the MultiPath record.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_mtu\r
-* NAME\r
-*       ib_multipath_rec_mtu\r
-*\r
-* DESCRIPTION\r
-*       Get encoded path MTU.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded path MTU.\r
-*               1: 256\r
-*               2: 512\r
-*               3: 1024\r
-*               4: 2048\r
-*               5: 4096\r
-*               others: reserved\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_mtu_sel\r
-* NAME\r
-*       ib_multipath_rec_mtu_sel\r
-*\r
-* DESCRIPTION\r
-*       Get encoded multipath MTU selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) ((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded path MTU selector value (for queries).\r
-*               0: greater than MTU specified\r
-*               1: less than MTU specified\r
-*               2: exactly the MTU specified\r
-*               3: largest MTU available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_rate\r
-* NAME\r
-*       ib_multipath_rec_rate\r
-*\r
-* DESCRIPTION\r
-*       Get encoded multipath rate.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->rate & IB_MULTIPATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded multipath rate.\r
-*               2: 2.5 Gb/sec.\r
-*               3: 10 Gb/sec.\r
-*               4: 30 Gb/sec.\r
-*               others: reserved\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_rate_sel\r
-* NAME\r
-*       ib_multipath_rec_rate_sel\r
-*\r
-* DESCRIPTION\r
-*       Get encoded multipath rate selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t)\r
-               ((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded path rate selector value (for queries).\r
-*               0: greater than rate specified\r
-*               1: less than rate specified\r
-*               2: exactly the rate specified\r
-*               3: largest rate available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_pkt_life\r
-* NAME\r
-*       ib_multipath_rec_pkt_life\r
-*\r
-* DESCRIPTION\r
-*       Get encoded multipath pkt_life.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t) (p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded multipath pkt_life = 4.096 usec * 2 ** PacketLifeTime.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel\r
-* NAME\r
-*       ib_multipath_rec_pkt_life_sel\r
-*\r
-* DESCRIPTION\r
-*       Get encoded multipath pkt_lifetime selector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       return ((uint8_t)\r
-               ((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*       p_rec\r
-*               [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*       Encoded path pkt_lifetime selector value (for queries).\r
-*               0: greater than rate specified\r
-*               1: less than rate specified\r
-*               2: exactly the rate specified\r
-*               3: smallest packet lifetime available\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*       ib_multipath_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_multipath_rec_service_id\r
-* NAME\r
-*      ib_multipath_rec_service_id\r
-*\r
-* DESCRIPTION\r
-*      Get multipath service id.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net64_t OSM_API\r
-ib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)\r
-{\r
-       union {\r
-               ib_net64_t sid;\r
-               uint8_t sid_arr[8];\r
-       } sid_union;\r
-       sid_union.sid_arr[0] = p_rec->service_id_8msb;\r
-       memcpy(&sid_union.sid_arr[1], p_rec->service_id_56lsb, 7);\r
-       return sid_union.sid;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_rec\r
-*              [in] Pointer to the multipath record object.\r
-*\r
-* RETURN VALUES\r
-*      Service ID\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_multipath_rec_t\r
-*********/\r
-\r
-#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK          32\r
-/****s* IBA Base: Types/ib_pkey_table_t\r
-* NAME\r
-*      ib_pkey_table_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PKey table. (14.2.5.7)\r
-*\r
-* SYNOPSIS\r
-*/\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_pkey_table {\r
-       ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];\r
-} PACK_SUFFIX ib_pkey_table_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_pkey_table_record_t\r
-* NAME\r
-*      ib_pkey_table_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined P_Key Table Record for SA Query. (15.2.5.11)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_pkey_table_record {\r
-       ib_net16_t lid;         // for CA: lid of port, for switch lid of port 0\r
-       uint16_t block_num;\r
-       uint8_t port_num;       // for switch: port number, for CA: reserved\r
-       uint8_t reserved1;\r
-       uint16_t reserved2;\r
-       ib_pkey_table_t pkey_tbl;\r
-} PACK_SUFFIX ib_pkey_table_record_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-#define IB_DROP_VL 15\r
-#define IB_MAX_NUM_VLS 16\r
-/****s* IBA Base: Types/ib_slvl_table_t\r
-* NAME\r
-*      ib_slvl_table_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_slvl_table {\r
-       uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS / 2];\r
-} PACK_SUFFIX ib_slvl_table_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_slvl_table_record_t\r
-* NAME\r
-*      ib_slvl_table_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_slvl_table_record {\r
-       ib_net16_t lid;         // for CA: lid of port, for switch lid of port 0\r
-       uint8_t in_port_num;    // reserved for CAs\r
-       uint8_t out_port_num;   // reserved for CAs\r
-       uint32_t resv;\r
-       ib_slvl_table_t slvl_tbl;\r
-} PACK_SUFFIX ib_slvl_table_record_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****f* IBA Base: Types/ib_slvl_table_set\r
-* NAME\r
-*      ib_slvl_table_set\r
-*\r
-* DESCRIPTION\r
-*      Set slvl table entry.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,\r
-                 IN uint8_t sl_index, IN uint8_t vl)\r
-{\r
-       uint8_t idx = sl_index / 2;\r
-       CL_ASSERT(vl <= 15);\r
-       CL_ASSERT(sl_index <= 15);\r
-\r
-       if (sl_index % 2)\r
-               /* this is an odd sl. Need to update the ls bits */\r
-               p_slvl_tbl->raw_vl_by_sl[idx] =\r
-                   (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl;\r
-       else\r
-               /* this is an even sl. Need to update the ms bits */\r
-               p_slvl_tbl->raw_vl_by_sl[idx] =\r
-                   (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_slvl_tbl\r
-*              [in] pointer to ib_slvl_table_t object.\r
-*\r
-*      sl_index\r
-*              [in] the sl index in the table to be updated.\r
-*\r
-*      vl\r
-*              [in] the vl value to update for that sl.\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_slvl_table_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_slvl_table_get\r
-* NAME\r
-*      ib_slvl_table_get\r
-*\r
-* DESCRIPTION\r
-*      Get slvl table entry.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index)\r
-{\r
-       uint8_t idx = sl_index / 2;\r
-       CL_ASSERT(sl_index <= 15);\r
-\r
-       if (sl_index % 2)\r
-               /* this is an odd sl. Need to return the ls bits. */\r
-               return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);\r
-       else\r
-               /* this is an even sl. Need to return the ms bits. */\r
-               return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_slvl_tbl\r
-*              [in] pointer to ib_slvl_table_t object.\r
-*\r
-*      sl_index\r
-*              [in] the sl index in the table whose value should be returned.\r
-*\r
-* RETURN VALUES\r
-*      vl for the requested sl_index.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_slvl_table_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_vl_arb_element_t\r
-* NAME\r
-*      ib_vl_arb_element_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined VL Arbitration Table Element. (14.2.5.9)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_vl_arb_element {\r
-       uint8_t vl;\r
-       uint8_t weight;\r
-} PACK_SUFFIX ib_vl_arb_element_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32\r
-\r
-/****s* IBA Base: Types/ib_vl_arb_table_t\r
-* NAME\r
-*      ib_vl_arb_table_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined VL Arbitration Table. (14.2.5.9)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_vl_arb_table {\r
-       ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];\r
-} PACK_SUFFIX ib_vl_arb_table_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/****s* IBA Base: Types/ib_vl_arb_table_record_t\r
-* NAME\r
-*      ib_vl_arb_table_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_vl_arb_table_record {\r
-       ib_net16_t lid;         // for CA: lid of port, for switch lid of port 0\r
-       uint8_t port_num;\r
-       uint8_t block_num;\r
-       uint32_t reserved;\r
-       ib_vl_arb_table_t vl_arb_tbl;\r
-} PACK_SUFFIX ib_vl_arb_table_record_t;\r
-#include <complib/cl_packoff.h>\r
-/************/\r
-\r
-/*\r
- *     Global route header information received with unreliable datagram messages\r
- */\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_grh {\r
-       ib_net32_t ver_class_flow;\r
-       ib_net16_t resv1;\r
-       uint8_t resv2;\r
-       uint8_t hop_limit;\r
-       ib_gid_t src_gid;\r
-       ib_gid_t dest_gid;\r
-} PACK_SUFFIX ib_grh_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****f* IBA Base: Types/ib_grh_get_ver_class_flow\r
-* NAME\r
-*      ib_grh_get_ver_class_flow\r
-*\r
-* DESCRIPTION\r
-*      Get encoded version, traffic class and flow label in grh\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow,\r
-                         OUT uint8_t * const p_ver,\r
-                         OUT uint8_t * const p_tclass,\r
-                         OUT uint32_t * const p_flow_lbl)\r
-{\r
-       ib_net32_t tmp_ver_class_flow;\r
-\r
-       if (p_ver)\r
-               *p_ver = (uint8_t) (ver_class_flow & 0x0f);\r
-\r
-       tmp_ver_class_flow = ver_class_flow >> 4;\r
-\r
-       if (p_tclass)\r
-               *p_tclass = (uint8_t) (tmp_ver_class_flow & 0xff);\r
-\r
-       tmp_ver_class_flow = tmp_ver_class_flow >> 8;\r
-\r
-       if (p_flow_lbl)\r
-               *p_flow_lbl = tmp_ver_class_flow & 0xfffff;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      ver_class_flow\r
-*              [in] the version, traffic class and flow label info.\r
-*\r
-* RETURN VALUES\r
-*      p_ver\r
-*              [out] pointer to the version info.\r
-*\r
-*      p_tclass\r
-*              [out] pointer to the traffic class info.\r
-*\r
-*      p_flow_lbl\r
-*              [out] pointer to the flow label info\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_grh_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_grh_set_ver_class_flow\r
-* NAME\r
-*      ib_grh_set_ver_class_flow\r
-*\r
-* DESCRIPTION\r
-*      Set encoded version, traffic class and flow label in grh\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_grh_set_ver_class_flow(IN const uint8_t ver,\r
-                         IN const uint8_t tclass, IN const uint32_t flow_lbl)\r
-{\r
-       ib_net32_t ver_class_flow;\r
-\r
-       ver_class_flow = flow_lbl;\r
-       ver_class_flow = ver_class_flow << 8;\r
-       ver_class_flow = ver_class_flow | tclass;\r
-       ver_class_flow = ver_class_flow << 4;\r
-       ver_class_flow = ver_class_flow | ver;\r
-       return (ver_class_flow);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      ver\r
-*              [in] the version info.\r
-*\r
-*      tclass\r
-*              [in] the traffic class info.\r
-*\r
-*      flow_lbl\r
-*              [in] the flow label info\r
-*\r
-* RETURN VALUES\r
-*      ver_class_flow\r
-*              [out] the version, traffic class and flow label info.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_grh_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_member_rec_t\r
-* NAME\r
-*      ib_member_rec_t\r
-*\r
-* DESCRIPTION\r
-*      Multicast member record, used to create, join, and leave multicast\r
-*      groups.\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_member_rec {\r
-       ib_gid_t mgid;\r
-       ib_gid_t port_gid;\r
-       ib_net32_t qkey;\r
-       ib_net16_t mlid;\r
-       uint8_t mtu;\r
-       uint8_t tclass;\r
-       ib_net16_t pkey;\r
-       uint8_t rate;\r
-       uint8_t pkt_life;\r
-       ib_net32_t sl_flow_hop;\r
-       uint8_t scope_state;\r
-       uint8_t proxy_join:1;\r
-       uint8_t reserved[2];\r
-       uint8_t pad[4];\r
-} PACK_SUFFIX ib_member_rec_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      mgid\r
-*              Multicast GID address for this multicast group.\r
-*\r
-*      port_gid\r
-*              Valid GID of the endpoint joining this multicast group.\r
-*\r
-*      qkey\r
-*              Q_Key to be sued by this multicast group.\r
-*\r
-*      mlid\r
-*              Multicast LID for this multicast group.\r
-*\r
-*      mtu\r
-*              MTU and MTU selector fields to use on this path\r
-*\r
-*      tclass\r
-*              Another global routing parameter.\r
-*\r
-*      pkey\r
-*              Partition key (P_Key) to use for this member.\r
-*\r
-*      rate\r
-*              Rate and rate selector fields to use on this path.\r
-*\r
-*      pkt_life\r
-*              Packet lifetime\r
-*\r
-*      sl_flow_hop\r
-*              Global routing parameters: service level, hop count, and flow label.\r
-*\r
-*      scope_state\r
-*              MGID scope and JoinState of multicast request.\r
-*\r
-*      proxy_join\r
-*              Enables others in the Partition to proxy add/remove from the group\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_member_get_sl_flow_hop\r
-* NAME\r
-*      ib_member_get_sl_flow_hop\r
-*\r
-* DESCRIPTION\r
-*      Get encoded sl, flow label, and hop limit\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop,\r
-                         OUT uint8_t * const p_sl,\r
-                         OUT uint32_t * const p_flow_lbl,\r
-                         OUT uint8_t * const p_hop)\r
-{\r
-       uint32_t tmp;\r
-\r
-       tmp = cl_ntoh32(sl_flow_hop);\r
-       if (p_hop)\r
-               *p_hop = (uint8_t) tmp;\r
-       tmp >>= 8;\r
-\r
-       if (p_flow_lbl)\r
-               *p_flow_lbl = (uint32_t) (tmp & 0xfffff);\r
-       tmp >>= 20;\r
-\r
-       if (p_sl)\r
-               *p_sl = (uint8_t) tmp;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      sl_flow_hop\r
-*              [in] the sl, flow label, and hop limit of MC Group\r
-*\r
-* RETURN VALUES\r
-*      p_sl\r
-*              [out] pointer to the service level\r
-*\r
-*      p_flow_lbl\r
-*              [out] pointer to the flow label info\r
-*\r
-*      p_hop\r
-*              [out] pointer to the hop count limit.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_member_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_member_set_sl_flow_hop\r
-* NAME\r
-*      ib_member_set_sl_flow_hop\r
-*\r
-* DESCRIPTION\r
-*      Set encoded sl, flow label, and hop limit\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_member_set_sl_flow_hop(IN const uint8_t sl,\r
-                         IN const uint32_t flow_label,\r
-                         IN const uint8_t hop_limit)\r
-{\r
-       uint32_t tmp;\r
-\r
-       tmp = (sl << 28) | ((flow_label & 0xfffff) << 8) | hop_limit;\r
-       return cl_hton32(tmp);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      sl\r
-*              [in] the service level.\r
-*\r
-*      flow_lbl\r
-*              [in] the flow label info\r
-*\r
-*      hop_limit\r
-*              [in] the hop limit.\r
-*\r
-* RETURN VALUES\r
-*      sl_flow_hop\r
-*              [out] the encoded sl, flow label, and hop limit\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_member_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_member_get_scope_state\r
-* NAME\r
-*      ib_member_get_scope_state\r
-*\r
-* DESCRIPTION\r
-*      Get encoded MGID scope and JoinState\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_member_get_scope_state(IN const uint8_t scope_state,\r
-                         OUT uint8_t * const p_scope,\r
-                         OUT uint8_t * const p_state)\r
-{\r
-       uint8_t tmp_scope_state;\r
-\r
-       if (p_state)\r
-               *p_state = (uint8_t) (scope_state & 0x0f);\r
-\r
-       tmp_scope_state = scope_state >> 4;\r
-\r
-       if (p_scope)\r
-               *p_scope = (uint8_t) (tmp_scope_state & 0x0f);\r
-\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      scope_state\r
-*              [in] the scope and state\r
-*\r
-* RETURN VALUES\r
-*      p_scope\r
-*              [out] pointer to the MGID scope\r
-*\r
-*      p_state\r
-*              [out] pointer to the join state\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_member_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_member_set_scope_state\r
-* NAME\r
-*      ib_member_set_scope_state\r
-*\r
-* DESCRIPTION\r
-*      Set encoded version, MGID scope and JoinState\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_member_set_scope_state(IN const uint8_t scope, IN const uint8_t state)\r
-{\r
-       uint8_t scope_state;\r
-\r
-       scope_state = scope;\r
-       scope_state = scope_state << 4;\r
-       scope_state = scope_state | state;\r
-       return (scope_state);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      scope\r
-*              [in] the MGID scope\r
-*\r
-*      state\r
-*              [in] the JoinState\r
-*\r
-* RETURN VALUES\r
-*      scope_state\r
-*              [out] the encoded one\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_member_rec_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_member_set_join_state\r
-* NAME\r
-*      ib_member_set_join_state\r
-*\r
-* DESCRIPTION\r
-*      Set JoinState\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,\r
-                        IN const uint8_t state)\r
-{\r
-       /* keep the scope as it is */\r
-       p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_mc_rec\r
-*              [in] pointer to the member record\r
-*\r
-*      state\r
-*              [in] the JoinState\r
-*\r
-* RETURN VALUES\r
-*      NONE\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_member_rec_t\r
-*********/\r
-\r
-/*\r
- * Join State Codes:\r
- */\r
-#define IB_MC_REC_STATE_FULL_MEMBER 0x01\r
-#define IB_MC_REC_STATE_NON_MEMBER 0x02\r
-#define IB_MC_REC_STATE_SEND_ONLY_NON_MEMBER 0x04\r
-\r
-/*\r
- *     Generic MAD notice types\r
- */\r
-#define IB_NOTICE_TYPE_FATAL                           0x00\r
-#define IB_NOTICE_TYPE_URGENT                          0x01\r
-#define IB_NOTICE_TYPE_SECURITY                                0x02\r
-#define IB_NOTICE_TYPE_SUBN_MGMT                       0x03\r
-#define IB_NOTICE_TYPE_INFO                            0x04\r
-#define IB_NOTICE_TYPE_EMPTY                           0x7F\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_mad_notice_attr     // Total Size calc  Accumulated\r
-{\r
-       uint8_t generic_type;   // 1                1\r
-       union _notice_g_or_v {\r
-               struct _notice_generic  // 5                6\r
-               {\r
-                       uint8_t prod_type_msb;\r
-                       ib_net16_t prod_type_lsb;\r
-                       ib_net16_t trap_num;\r
-               } PACK_SUFFIX generic;\r
-               struct _notice_vend {\r
-                       uint8_t vend_id_msb;\r
-                       ib_net16_t vend_id_lsb;\r
-                       ib_net16_t dev_id;\r
-               } PACK_SUFFIX vend;\r
-       } g_or_v;\r
-       ib_net16_t issuer_lid;  // 2                 8\r
-       ib_net16_t toggle_count;        // 2                 10\r
-       union _data_details     // 54                64\r
-       {\r
-               struct _raw_data {\r
-                       uint8_t details[54];\r
-               } PACK_SUFFIX raw_data;\r
-               struct _ntc_64_67 {\r
-                       uint8_t res[6];\r
-                       ib_gid_t gid;   // the Node or Multicast Group that came in/out\r
-               } PACK_SUFFIX ntc_64_67;\r
-               struct _ntc_128 {\r
-                       ib_net16_t sw_lid;      // the sw lid of which link state changed\r
-               } PACK_SUFFIX ntc_128;\r
-               struct _ntc_129_131 {\r
-                       ib_net16_t pad;\r
-                       ib_net16_t lid; // lid and port number of the violation\r
-                       uint8_t port_num;\r
-               } PACK_SUFFIX ntc_129_131;\r
-               struct _ntc_144 {\r
-                       ib_net16_t pad1;\r
-                       ib_net16_t lid;             // lid where change occured\r
-                       uint8_t    pad2;            // reserved\r
-                       uint8_t    local_changes;   // 7b reserved 1b local changes\r
-                       ib_net32_t new_cap_mask;    // new capability mask\r
-                       ib_net16_t change_flgs;     // 13b reserved 3b change flags\r
-               } PACK_SUFFIX ntc_144;\r
-               struct _ntc_145 {\r
-                       ib_net16_t pad1;\r
-                       ib_net16_t lid; // lid where sys guid changed\r
-                       ib_net16_t pad2;\r
-                       ib_net64_t new_sys_guid;        // new system image guid\r
-               } PACK_SUFFIX ntc_145;\r
-               struct _ntc_256 {       // total: 54\r
-                       ib_net16_t pad1;        // 2\r
-                       ib_net16_t lid; // 2\r
-                       ib_net16_t dr_slid;     // 2\r
-                       uint8_t method; // 1\r
-                       uint8_t pad2;   // 1\r
-                       ib_net16_t attr_id;     // 2\r
-                       ib_net32_t attr_mod;    // 4\r
-                       ib_net64_t mkey;        // 8\r
-                       uint8_t pad3;   // 1\r
-                       uint8_t dr_trunc_hop;   // 1\r
-                       uint8_t dr_rtn_path[30];        // 30\r
-               } PACK_SUFFIX ntc_256;\r
-               struct _ntc_257_258     // violation of p/q_key // 49\r
-               {\r
-                       ib_net16_t pad1;        // 2\r
-                       ib_net16_t lid1;        // 2\r
-                       ib_net16_t lid2;        // 2\r
-                       ib_net32_t key; // 4\r
-                       ib_net32_t qp1; // 4b sl, 4b pad, 24b qp1\r
-                       ib_net32_t qp2; // 8b pad, 24b qp2\r
-                       ib_gid_t gid1;  // 16\r
-                       ib_gid_t gid2;  // 16\r
-               } PACK_SUFFIX ntc_257_258;\r
-               struct _ntc_259 // pkey violation from switch 51\r
-               {\r
-                       ib_net16_t data_valid;  // 2\r
-                       ib_net16_t lid1;        // 2\r
-                       ib_net16_t lid2;        // 2\r
-                       ib_net16_t pkey;        // 2\r
-                       ib_net32_t sl_qp1; // 4b sl, 4b pad, 24b qp1\r
-                       ib_net32_t qp2; // 8b pad, 24b qp2\r
-                       ib_gid_t gid1;  // 16\r
-                       ib_gid_t gid2;  // 16\r
-                       ib_net16_t sw_lid;      // 2\r
-                       uint8_t port_no;        // 1\r
-               } PACK_SUFFIX ntc_259;\r
-               struct _ntc_bkey_259    // bkey violation\r
-               {\r
-                       ib_net16_t lidaddr;\r
-                       uint8_t method;\r
-                       uint8_t reserved;\r
-                       ib_net16_t attribute_id;\r
-                       ib_net32_t attribute_modifier;\r
-                       ib_net32_t qp;          // qp is low 24 bits\r
-                       ib_net64_t bkey;\r
-                       ib_gid_t gid;\r
-               } PACK_SUFFIX ntc_bkey_259;\r
-       } data_details;\r
-       ib_gid_t issuer_gid;    // 16          80\r
-} PACK_SUFFIX ib_mad_notice_attr_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/**\r
- * Trap 259 masks\r
- */\r
-#define TRAP_259_MASK_SL (CL_HTON32(0xF0000000))\r
-#define TRAP_259_MASK_QP (CL_HTON32(0x00FFFFFF))\r
-\r
-/**\r
- * Trap 144 masks\r
- */\r
-#define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01\r
-#define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))\r
-#define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))\r
-#define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))\r
-#define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))\r
-\r
-/****f* IBA Base: Types/ib_notice_is_generic\r
-* NAME\r
-*      ib_notice_is_generic\r
-*\r
-* DESCRIPTION\r
-*      Check if the notice is generic\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline boolean_t OSM_API\r
-ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)\r
-{\r
-       return (p_ntc->generic_type & 0x80);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to  the notice MAD attribute\r
-*\r
-* RETURN VALUES\r
-*      TRUE if mad is generic\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_get_type\r
-* NAME\r
-*      ib_notice_get_type\r
-*\r
-* DESCRIPTION\r
-*      Get the notice type\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc)\r
-{\r
-       return p_ntc->generic_type & 0x7f;\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to  the notice MAD attribute\r
-*\r
-* RETURN VALUES\r
-*      TRUE if mad is generic\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_get_prod_type\r
-* NAME\r
-*      ib_notice_get_prod_type\r
-*\r
-* DESCRIPTION\r
-*      Get the notice Producer Type of Generic Notice\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc)\r
-{\r
-       uint32_t pt;\r
-\r
-       pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) |\r
-           (p_ntc->g_or_v.generic.prod_type_msb << 16);\r
-       return cl_hton32(pt);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-* RETURN VALUES\r
-*      The producer type\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_set_prod_type\r
-* NAME\r
-*      ib_notice_set_prod_type\r
-*\r
-* DESCRIPTION\r
-*      Set the notice Producer Type of Generic Notice\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc,\r
-                       IN ib_net32_t prod_type_val)\r
-{\r
-       uint32_t ptv = cl_ntoh32(prod_type_val);\r
-       p_ntc->g_or_v.generic.prod_type_lsb =\r
-           cl_hton16((uint16_t) (ptv & 0x0000ffff));\r
-       p_ntc->g_or_v.generic.prod_type_msb =\r
-           (uint8_t) ((ptv & 0x00ff0000) >> 16);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-*  prod_type\r
-*     [in] The producer Type code\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_set_prod_type_ho\r
-* NAME\r
-*      ib_notice_set_prod_type_ho\r
-*\r
-* DESCRIPTION\r
-*      Set the notice Producer Type of Generic Notice given Host Order\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc,\r
-                          IN uint32_t prod_type_val_ho)\r
-{\r
-       p_ntc->g_or_v.generic.prod_type_lsb =\r
-           cl_hton16((uint16_t) (prod_type_val_ho & 0x0000ffff));\r
-       p_ntc->g_or_v.generic.prod_type_msb =\r
-           (uint8_t) ((prod_type_val_ho & 0x00ff0000) >> 16);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-*      prod_type\r
-*              [in] The producer Type code in host order\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_get_vend_id\r
-* NAME\r
-*      ib_notice_get_vend_id\r
-*\r
-* DESCRIPTION\r
-*      Get the Vendor Id of Vendor type Notice\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc)\r
-{\r
-       uint32_t vi;\r
-\r
-       vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) |\r
-           (p_ntc->g_or_v.vend.vend_id_msb << 16);\r
-       return cl_hton32(vi);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-* RETURN VALUES\r
-*      The Vendor Id of Vendor type Notice\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_set_vend_id\r
-* NAME\r
-*      ib_notice_set_vend_id\r
-*\r
-* DESCRIPTION\r
-*      Set the notice Producer Type of Generic Notice\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc, IN ib_net32_t vend_id)\r
-{\r
-       uint32_t vi = cl_ntoh32(vend_id);\r
-       p_ntc->g_or_v.vend.vend_id_lsb =\r
-           cl_hton16((uint16_t) (vi & 0x0000ffff));\r
-       p_ntc->g_or_v.vend.vend_id_msb = (uint8_t) ((vi & 0x00ff0000) >> 16);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-*      vend_id\r
-*              [in] The producer Type code\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_notice_set_vend_id_ho\r
-* NAME\r
-*      ib_notice_set_vend_id_ho\r
-*\r
-* DESCRIPTION\r
-*      Set the notice Producer Type of Generic Notice given a host order value\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc,\r
-                        IN uint32_t vend_id_ho)\r
-{\r
-       p_ntc->g_or_v.vend.vend_id_lsb =\r
-           cl_hton16((uint16_t) (vend_id_ho & 0x0000ffff));\r
-       p_ntc->g_or_v.vend.vend_id_msb =\r
-           (uint8_t) ((vend_id_ho & 0x00ff0000) >> 16);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_ntc\r
-*              [in] Pointer to the notice MAD attribute\r
-*\r
-*      vend_id_ho\r
-*              [in] The producer Type code in host order\r
-*\r
-* RETURN VALUES\r
-*      None\r
-*\r
-* SEE ALSO\r
-*      ib_mad_notice_attr_t\r
-*********/\r
-\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_inform_info {\r
-       ib_gid_t gid;\r
-       ib_net16_t lid_range_begin;\r
-       ib_net16_t lid_range_end;\r
-       ib_net16_t reserved1;\r
-       uint8_t is_generic;\r
-       uint8_t subscribe;\r
-       ib_net16_t trap_type;\r
-       union _inform_g_or_v {\r
-               struct _inform_generic {\r
-                       ib_net16_t trap_num;\r
-                       ib_net32_t qpn_resp_time_val;\r
-                       uint8_t reserved2;\r
-                       uint8_t node_type_msb;\r
-                       ib_net16_t node_type_lsb;\r
-               } PACK_SUFFIX generic;\r
-               struct _inform_vend {\r
-                       ib_net16_t dev_id;\r
-                       ib_net32_t qpn_resp_time_val;\r
-                       uint8_t reserved2;\r
-                       uint8_t vendor_id_msb;\r
-                       ib_net16_t vendor_id_lsb;\r
-               } PACK_SUFFIX vend;\r
-       } PACK_SUFFIX g_or_v;\r
-} PACK_SUFFIX ib_inform_info_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time\r
-* NAME\r
-*      ib_inform_info_get_qpn_resp_time\r
-*\r
-* DESCRIPTION\r
-*      Get QPN of the inform info\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,\r
-                                OUT ib_net32_t * const p_qpn,\r
-                                OUT uint8_t * const p_resp_time_val)\r
-{\r
-       uint32_t tmp = cl_ntoh32(qpn_resp_time_val);\r
-\r
-       if (p_qpn)\r
-               *p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);\r
-       if (p_resp_time_val)\r
-               *p_resp_time_val = (uint8_t) (tmp & 0x0000001f);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      qpn_resp_time_val\r
-*              [in] the  qpn and resp time val from the mad\r
-*\r
-* RETURN VALUES\r
-*      p_qpn\r
-*              [out] pointer to the qpn\r
-*\r
-*      p_state\r
-*              [out] pointer to the resp time val\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_inform_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_inform_info_set_qpn\r
-* NAME\r
-*      ib_inform_info_set_qpn\r
-*\r
-* DESCRIPTION\r
-*      Set the QPN of the inform info\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline void OSM_API\r
-ib_inform_info_set_qpn(IN ib_inform_info_t * p_ii, IN ib_net32_t const qpn)\r
-{\r
-       uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val);\r
-\r
-       p_ii->g_or_v.generic.qpn_resp_time_val =\r
-           cl_hton32((tmp & 0x000000ff) | ((cl_ntoh32(qpn) << 8) & 0xffffff00)\r
-           );\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_inform_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_inform_info_get_prod_type\r
-* NAME\r
-*      ib_inform_info_get_prod_type\r
-*\r
-* DESCRIPTION\r
-*      Get Producer Type of the Inform Info\r
-*      13.4.8.3 InformInfo\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)\r
-{\r
-       uint32_t nt;\r
-\r
-       nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |\r
-           (p_inf->g_or_v.generic.node_type_msb << 16);\r
-       return cl_hton32(nt);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_inf\r
-*              [in] pointer to an inform info\r
-*\r
-* RETURN VALUES\r
-*     The producer type\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_inform_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_inform_info_get_vend_id\r
-* NAME\r
-*      ib_inform_info_get_vend_id\r
-*\r
-* DESCRIPTION\r
-*      Get Node Type of the Inform Info\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline ib_net32_t OSM_API\r
-ib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf)\r
-{\r
-       uint32_t vi;\r
-\r
-       vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) |\r
-           (p_inf->g_or_v.vend.vendor_id_msb << 16);\r
-       return cl_hton32(vi);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_inf\r
-*              [in] pointer to an inform info\r
-*\r
-* RETURN VALUES\r
-*     The node type\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_inform_info_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_inform_info_record_t\r
-* NAME\r
-*      ib_inform_info_record_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined InformInfo Record. (15.2.5.12)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_inform_info_record {\r
-       ib_gid_t subscriber_gid;\r
-       ib_net16_t subscriber_enum;\r
-       uint8_t reserved[6];\r
-       ib_inform_info_t inform_info;\r
-       uint8_t pad[4];\r
-} PACK_SUFFIX ib_inform_info_record_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_perfmgt_mad_t\r
-* NAME\r
-*      ib_perfmgt_mad_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined Perf Management MAD (16.3.1)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_perfmgt_mad {\r
-       ib_mad_t header;\r
-       uint8_t resv[40];\r
-#define        IB_PM_DATA_SIZE         192\r
-       uint8_t data[IB_PM_DATA_SIZE];\r
-} PACK_SUFFIX ib_perfmgt_mad_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      header\r
-*              Common MAD header.\r
-*\r
-*      resv\r
-*              Reserved.\r
-*\r
-*      data\r
-*              Performance Management payload.  The structure and content of this field\r
-*              depends upon the method, attr_id, and attr_mod fields in the header.\r
-*\r
-* SEE ALSO\r
-* ib_mad_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_port_counters\r
-* NAME\r
-*      ib_port_counters_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortCounters Attribute. (16.1.3.5)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_counters {\r
-       uint8_t reserved;\r
-       uint8_t port_select;\r
-       ib_net16_t counter_select;\r
-       ib_net16_t symbol_err_cnt;\r
-       uint8_t link_err_recover;\r
-       uint8_t link_downed;\r
-       ib_net16_t rcv_err;\r
-       ib_net16_t rcv_rem_phys_err;\r
-       ib_net16_t rcv_switch_relay_err;\r
-       ib_net16_t xmit_discards;\r
-       uint8_t xmit_constraint_err;\r
-       uint8_t rcv_constraint_err;\r
-       uint8_t counter_select2;\r
-       uint8_t link_int_buffer_overrun;\r
-       ib_net16_t resv;\r
-       ib_net16_t vl15_dropped;\r
-       ib_net32_t xmit_data;\r
-       ib_net32_t rcv_data;\r
-       ib_net32_t xmit_pkts;\r
-       ib_net32_t rcv_pkts;\r
-       ib_net32_t xmit_wait;\r
-} PACK_SUFFIX ib_port_counters_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-#define PC_LINK_INT(integ_buf_over) ((integ_buf_over & 0xF0) >> 4)\r
-#define PC_BUF_OVERRUN(integ_buf_over) (integ_buf_over & 0x0F)\r
-\r
-/****s* IBA Base: Types/ib_port_counters_ext\r
-* NAME\r
-*      ib_port_counters_ext_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortCounters Extended Attribute. (16.1.4.11)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_counters_ext {\r
-       uint8_t reserved;\r
-       uint8_t port_select;\r
-       ib_net16_t counter_select;\r
-       ib_net32_t reserved2;\r
-       ib_net64_t xmit_data;\r
-       ib_net64_t rcv_data;\r
-       ib_net64_t xmit_pkts;\r
-       ib_net64_t rcv_pkts;\r
-       ib_net64_t unicast_xmit_pkts;\r
-       ib_net64_t unicast_rcv_pkts;\r
-       ib_net64_t multicast_xmit_pkts;\r
-       ib_net64_t multicast_rcv_pkts;\r
-} PACK_SUFFIX ib_port_counters_ext_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_port_samples_control\r
-* NAME\r
-*      ib_port_samples_control_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortSamplesControl Attribute. (16.1.3.2)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_samples_control {\r
-       uint8_t op_code;\r
-       uint8_t port_select;\r
-       uint8_t tick;\r
-       uint8_t counter_width;  /* 5 bits res : 3bits counter_width */\r
-       ib_net32_t counter_mask;        /* 2 bits res : 3 bits counter_mask : 27 bits counter_masks_1to9 */\r
-       ib_net16_t counter_mask_10to14; /* 1 bits res : 15 bits counter_masks_10to14 */\r
-       uint8_t sample_mech;\r
-       uint8_t sample_status;  /* 6 bits res : 2 bits sample_status */\r
-       ib_net64_t option_mask;\r
-       ib_net64_t vendor_mask;\r
-       ib_net32_t sample_start;\r
-       ib_net32_t sample_interval;\r
-       ib_net16_t tag;\r
-       ib_net16_t counter_select0;\r
-       ib_net16_t counter_select1;\r
-       ib_net16_t counter_select2;\r
-       ib_net16_t counter_select3;\r
-       ib_net16_t counter_select4;\r
-       ib_net16_t counter_select5;\r
-       ib_net16_t counter_select6;\r
-       ib_net16_t counter_select7;\r
-       ib_net16_t counter_select8;\r
-       ib_net16_t counter_select9;\r
-       ib_net16_t counter_select10;\r
-       ib_net16_t counter_select11;\r
-       ib_net16_t counter_select12;\r
-       ib_net16_t counter_select13;\r
-       ib_net16_t counter_select14;\r
-} PACK_SUFFIX ib_port_samples_control_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****d* IBA Base: Types/CounterSelect values\r
-* NAME\r
-*       Counter select values\r
-*\r
-* DESCRIPTION\r
-*      Mandatory counter select values (16.1.3.3)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define IB_CS_PORT_XMIT_DATA (CL_HTON16(0x0001))\r
-#define IB_CS_PORT_RCV_DATA  (CL_HTON16(0x0002))\r
-#define IB_CS_PORT_XMIT_PKTS (CL_HTON16(0x0003))\r
-#define IB_CS_PORT_RCV_PKTS  (CL_HTON16(0x0004))\r
-#define IB_CS_PORT_XMIT_WAIT (CL_HTON16(0x0005))\r
-\r
-/****s* IBA Base: Types/ib_port_samples_result\r
-* NAME\r
-*      ib_port_samples_result_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortSamplesControl Attribute. (16.1.3.2)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_samples_result {\r
-       ib_net16_t tag;\r
-       ib_net16_t sample_status;       /* 14 bits res : 2 bits sample_status */\r
-       ib_net32_t counter0;\r
-       ib_net32_t counter1;\r
-       ib_net32_t counter2;\r
-       ib_net32_t counter3;\r
-       ib_net32_t counter4;\r
-       ib_net32_t counter5;\r
-       ib_net32_t counter6;\r
-       ib_net32_t counter7;\r
-       ib_net32_t counter8;\r
-       ib_net32_t counter9;\r
-       ib_net32_t counter10;\r
-       ib_net32_t counter11;\r
-       ib_net32_t counter12;\r
-       ib_net32_t counter13;\r
-       ib_net32_t counter14;\r
-} PACK_SUFFIX ib_port_samples_result_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_port_xmit_data_sl\r
-* NAME\r
-*      ib_port_xmit_data_sl_t\r
-*\r
-* DESCRIPTION\r
-*       IBA defined PortXmitDataSL Attribute. (A13.6.4)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_xmit_data_sl {\r
-       uint8_t reserved;\r
-       uint8_t port_select;\r
-       ib_net16_t counter_select;\r
-       ib_net32_t port_xmit_data_sl[16];\r
-       uint8_t resv[124];\r
-} PACK_SUFFIX ib_port_xmit_data_sl_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****s* IBA Base: Types/ib_port_rcv_data_sl\r
-* NAME\r
-*      ib_port_rcv_data_sl_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined PortRcvDataSL Attribute. (A13.6.4)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_port_rcv_data_sl {\r
-       uint8_t reserved;\r
-       uint8_t port_select;\r
-       ib_net16_t counter_select;\r
-       ib_net32_t port_rcv_data_sl[16];\r
-       uint8_t resv[124];\r
-} PACK_SUFFIX ib_port_rcv_data_sl_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/****d* IBA Base: Types/DM_SVC_NAME\r
-* NAME\r
-*      DM_SVC_NAME\r
-*\r
-* DESCRIPTION\r
-*      IBA defined Device Management service name (16.3)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#define        DM_SVC_NAME                             "DeviceManager.IBTA"\r
-/*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_dm_mad_t\r
-* NAME\r
-*      ib_dm_mad_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined Device Management MAD (16.3.1)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_dm_mad {\r
-       ib_mad_t header;\r
-       uint8_t resv[40];\r
-#define        IB_DM_DATA_SIZE         192\r
-       uint8_t data[IB_DM_DATA_SIZE];\r
-} PACK_SUFFIX ib_dm_mad_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      header\r
-*              Common MAD header.\r
-*\r
-*      resv\r
-*              Reserved.\r
-*\r
-*      data\r
-*              Device Management payload.  The structure and content of this field\r
-*              depend upon the method, attr_id, and attr_mod fields in the header.\r
-*\r
-* SEE ALSO\r
-* ib_mad_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_iou_info_t\r
-* NAME\r
-*      ib_iou_info_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined IO Unit information structure (16.3.3.3)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_iou_info {\r
-       ib_net16_t change_id;\r
-       uint8_t max_controllers;\r
-       uint8_t diag_rom;\r
-#define        IB_DM_CTRL_LIST_SIZE    128\r
-       uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];\r
-#define        IOC_NOT_INSTALLED               0x0\r
-#define        IOC_INSTALLED                   0x1\r
-//              Reserved values                         0x02-0xE\r
-#define        SLOT_DOES_NOT_EXIST             0xF\r
-} PACK_SUFFIX ib_iou_info_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      change_id\r
-*              Value incremented, with rollover, by any change to the controller_list.\r
-*\r
-*      max_controllers\r
-*              Number of slots in controller_list.\r
-*\r
-*      diag_rom\r
-*              A byte containing two fields: DiagDeviceID and OptionROM.\r
-*              These fields may be read using the ib_iou_info_diag_dev_id\r
-*              and ib_iou_info_option_rom functions.\r
-*\r
-*      controller_list\r
-*              A series of 4-bit nibbles, with each nibble representing a slot\r
-*              in the IO Unit.  Individual nibbles may be read using the\r
-*              ioc_at_slot function.\r
-*\r
-* SEE ALSO\r
-* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_iou_info_diag_dev_id\r
-* NAME\r
-*      ib_iou_info_diag_dev_id\r
-*\r
-* DESCRIPTION\r
-*      Returns the DiagDeviceID.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info)\r
-{\r
-       return ((uint8_t) (p_iou_info->diag_rom >> 6 & 1));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_iou_info\r
-*              [in] Pointer to the IO Unit information structure.\r
-*\r
-* RETURN VALUES\r
-*      DiagDeviceID field of the IO Unit information.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_iou_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ib_iou_info_option_rom\r
-* NAME\r
-*      ib_iou_info_option_rom\r
-*\r
-* DESCRIPTION\r
-*      Returns the OptionROM.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info)\r
-{\r
-       return ((uint8_t) (p_iou_info->diag_rom >> 7));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_iou_info\r
-*              [in] Pointer to the IO Unit information structure.\r
-*\r
-* RETURN VALUES\r
-*      OptionROM field of the IO Unit information.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_iou_info_t\r
-*********/\r
-\r
-/****f* IBA Base: Types/ioc_at_slot\r
-* NAME\r
-*      ioc_at_slot\r
-*\r
-* DESCRIPTION\r
-*      Returns the IOC value at the specified slot.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline uint8_t OSM_API\r
-ioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot)\r
-{\r
-       if (slot >= IB_DM_CTRL_LIST_SIZE)\r
-               return SLOT_DOES_NOT_EXIST;\r
-       else\r
-               return (int8_t)\r
-                   ((slot % 2) ?\r
-                    ((p_iou_info->controller_list[slot / 2] & 0xf0) >> 4) :\r
-                    (p_iou_info->controller_list[slot / 2] & 0x0f));\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      p_iou_info\r
-*              [in] Pointer to the IO Unit information structure.\r
-*\r
-*      slot\r
-*              [in] Pointer to the IO Unit information structure.\r
-*\r
-* RETURN VALUES\r
-*      OptionROM field of the IO Unit information.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*      ib_iou_info_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_ioc_profile_t\r
-* NAME\r
-*      ib_ioc_profile_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined IO Controller profile structure (16.3.3.4)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_ioc_profile {\r
-       ib_net64_t ioc_guid;\r
-       ib_net32_t vend_id;\r
-       ib_net32_t dev_id;\r
-       ib_net16_t dev_ver;\r
-       ib_net16_t resv2;\r
-       ib_net32_t subsys_vend_id;\r
-       ib_net32_t subsys_id;\r
-       ib_net16_t io_class;\r
-       ib_net16_t io_subclass;\r
-       ib_net16_t protocol;\r
-       ib_net16_t protocol_ver;\r
-       ib_net32_t resv3;\r
-       ib_net16_t send_msg_depth;\r
-       uint8_t resv4;\r
-       uint8_t rdma_read_depth;\r
-       ib_net32_t send_msg_size;\r
-       ib_net32_t rdma_size;\r
-       uint8_t ctrl_ops_cap;\r
-#define        CTRL_OPS_CAP_ST         0x01\r
-#define        CTRL_OPS_CAP_SF         0x02\r
-#define        CTRL_OPS_CAP_RT         0x04\r
-#define        CTRL_OPS_CAP_RF         0x08\r
-#define        CTRL_OPS_CAP_WT         0x10\r
-#define        CTRL_OPS_CAP_WF         0x20\r
-#define        CTRL_OPS_CAP_AT         0x40\r
-#define        CTRL_OPS_CAP_AF         0x80\r
-       uint8_t resv5;\r
-       uint8_t num_svc_entries;\r
-#define        MAX_NUM_SVC_ENTRIES     0xff\r
-       uint8_t resv6[9];\r
-#define        CTRL_ID_STRING_LEN      64\r
-       char id_string[CTRL_ID_STRING_LEN];\r
-} PACK_SUFFIX ib_ioc_profile_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      ioc_guid\r
-*              An EUI-64 GUID used to uniquely identify the IO controller.\r
-*\r
-*      vend_id\r
-*              IO controller vendor ID, IEEE format.\r
-*\r
-*      dev_id\r
-*              A number assigned by the vendor to identify the type of controller.\r
-*\r
-*      dev_ver\r
-*              A number assigned by the vendor to identify the divice version.\r
-*\r
-*      subsys_vend_id\r
-*              ID of the vendor of the enclosure, if any, in which the IO controller\r
-*              resides in IEEE format; otherwise zero.\r
-*\r
-*      subsys_id\r
-*              A number identifying the subsystem where the controller resides.\r
-*\r
-*      io_class\r
-*              0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand\r
-*              Architecture.  0xffff = Vendor specific.\r
-*\r
-*      io_subclass\r
-*              0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand\r
-*              Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff\r
-*              if the io_class component is 0xffff.\r
-*\r
-*      protocol\r
-*              0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand\r
-*              Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff\r
-*              if the io_class component is 0xffff.\r
-*\r
-*      protocol_ver\r
-*              Protocol specific.\r
-*\r
-*      send_msg_depth\r
-*              Maximum depth of the send message queue.\r
-*\r
-*      rdma_read_depth\r
-*              Maximum depth of the per-channel RDMA read queue.\r
-*\r
-*      send_msg_size\r
-*              Maximum size of send messages.\r
-*\r
-*      ctrl_ops_cap\r
-*              Supported operation types of this IO controller.  A bit set to one\r
-*              for affirmation of supported capability.\r
-*\r
-*      num_svc_entries\r
-*              Number of entries in the service entries table.\r
-*\r
-*      id_string\r
-*              UTF-8 encoded string for identifying the controller to an operator.\r
-*\r
-* SEE ALSO\r
-* ib_dm_mad_t\r
-*********/\r
-\r
-static inline uint32_t OSM_API\r
-ib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile)\r
-{\r
-       return (cl_ntoh32(p_ioc_profile->vend_id) >> 8);\r
-}\r
-\r
-static inline void OSM_API\r
-ib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,\r
-                          IN const uint32_t vend_id)\r
-{\r
-       p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);\r
-}\r
-\r
-/****s* IBA Base: Types/ib_svc_entry_t\r
-* NAME\r
-*      ib_svc_entry_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined IO Controller service entry structure (16.3.3.5)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_svc_entry {\r
-#define        MAX_SVC_ENTRY_NAME_LEN          40\r
-       char name[MAX_SVC_ENTRY_NAME_LEN];\r
-       ib_net64_t id;\r
-} PACK_SUFFIX ib_svc_entry_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      name\r
-*              UTF-8 encoded, null-terminated name of the service.\r
-*\r
-*      id\r
-*              An identifier of the associated Service.\r
-*\r
-* SEE ALSO\r
-* ib_svc_entries_t\r
-*********/\r
-\r
-/****s* IBA Base: Types/ib_svc_entries_t\r
-* NAME\r
-*      ib_svc_entries_t\r
-*\r
-* DESCRIPTION\r
-*      IBA defined IO Controller service entry array (16.3.3.5)\r
-*\r
-* SYNOPSIS\r
-*/\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_svc_entries {\r
-#define        SVC_ENTRY_COUNT                 4\r
-       ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];\r
-} PACK_SUFFIX ib_svc_entries_t;\r
-#include <complib/cl_packoff.h>\r
-/*\r
-* FIELDS\r
-*      service_entry\r
-*              An array of IO controller service entries.\r
-*\r
-* SEE ALSO\r
-* ib_dm_mad_t, ib_svc_entry_t\r
-*********/\r
-\r
-static inline void OSM_API\r
-ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,\r
-                    OUT uint8_t * const p_slot,\r
-                    OUT uint8_t * const p_lo, OUT uint8_t * const p_hi)\r
-{\r
-       ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi);\r
-\r
-       if (p_slot)\r
-               *p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);\r
-       if (p_hi)\r
-               *p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);\r
-       if (p_lo)\r
-               *p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);\r
-}\r
-\r
-/*\r
- *     IBA defined information describing an I/O controller\r
- */\r
-#include <complib/cl_packon.h>\r
-typedef struct _ib_ioc_info {\r
-       ib_net64_t module_guid;\r
-       ib_net64_t iou_guid;\r
-       ib_ioc_profile_t ioc_profile;\r
-       ib_net64_t access_key;\r
-       uint16_t initiators_conf;\r
-       uint8_t resv[38];\r
-} PACK_SUFFIX ib_ioc_info_t;\r
-#include <complib/cl_packoff.h>\r
-\r
-/*\r
- *     The following definitions are shared between the Access Layer and VPD\r
- */\r
-typedef struct _ib_ca *__ptr64 ib_ca_handle_t;\r
-typedef struct _ib_pd *__ptr64 ib_pd_handle_t;\r
-typedef struct _ib_rdd *__ptr64 ib_rdd_handle_t;\r
-typedef struct _ib_mr *__ptr64 ib_mr_handle_t;\r
-typedef struct _ib_mw *__ptr64 ib_mw_handle_t;\r
-typedef struct _ib_qp *__ptr64 ib_qp_handle_t;\r
-typedef struct _ib_eec *__ptr64 ib_eec_handle_t;\r
-typedef struct _ib_cq *__ptr64 ib_cq_handle_t;\r
-typedef struct _ib_av *__ptr64 ib_av_handle_t;\r
-typedef struct _ib_mcast *__ptr64 ib_mcast_handle_t;\r
-\r
-/* Currently for windows branch, use the extended version of ib special verbs struct\r
-       in order to be compliant with Infinicon ib_types; later we'll change it to support\r
-       OpenSM ib_types.h */\r
-\r
-#ifndef __WIN__\r
-/****d* Access Layer/ib_api_status_t\r
-* NAME\r
-*      ib_api_status_t\r
-*\r
-* DESCRIPTION\r
-*      Function return codes indicating the success or failure of an API call.\r
-*      Note that success is indicated by the return value IB_SUCCESS, which\r
-*      is always zero.\r
-*\r
-* NOTES\r
-*      IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call\r
-*      in the pre-ioctl step itself.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_api_status_t {\r
-       IB_SUCCESS,\r
-       IB_INSUFFICIENT_RESOURCES,\r
-       IB_INSUFFICIENT_MEMORY,\r
-       IB_INVALID_PARAMETER,\r
-       IB_INVALID_SETTING,\r
-       IB_NOT_FOUND,\r
-       IB_TIMEOUT,\r
-       IB_CANCELED,\r
-       IB_INTERRUPTED,\r
-       IB_INVALID_PERMISSION,\r
-       IB_UNSUPPORTED,\r
-       IB_OVERFLOW,\r
-       IB_MAX_MCAST_QPS_REACHED,\r
-       IB_INVALID_QP_STATE,\r
-       IB_INVALID_EEC_STATE,\r
-       IB_INVALID_APM_STATE,\r
-       IB_INVALID_PORT_STATE,\r
-       IB_INVALID_STATE,\r
-       IB_RESOURCE_BUSY,\r
-       IB_INVALID_PKEY,\r
-       IB_INVALID_LKEY,\r
-       IB_INVALID_RKEY,\r
-       IB_INVALID_MAX_WRS,\r
-       IB_INVALID_MAX_SGE,\r
-       IB_INVALID_CQ_SIZE,\r
-       IB_INVALID_SERVICE_TYPE,\r
-       IB_INVALID_GID,\r
-       IB_INVALID_LID,\r
-       IB_INVALID_GUID,\r
-       IB_INVALID_CA_HANDLE,\r
-       IB_INVALID_AV_HANDLE,\r
-       IB_INVALID_CQ_HANDLE,\r
-       IB_INVALID_EEC_HANDLE,\r
-       IB_INVALID_QP_HANDLE,\r
-       IB_INVALID_PD_HANDLE,\r
-       IB_INVALID_MR_HANDLE,\r
-       IB_INVALID_MW_HANDLE,\r
-       IB_INVALID_RDD_HANDLE,\r
-       IB_INVALID_MCAST_HANDLE,\r
-       IB_INVALID_CALLBACK,\r
-       IB_INVALID_AL_HANDLE,   /* InfiniBand Access Layer */\r
-       IB_INVALID_HANDLE,      /* InfiniBand Access Layer */\r
-       IB_ERROR,               /* InfiniBand Access Layer */\r
-       IB_REMOTE_ERROR,        /* Infiniband Access Layer */\r
-       IB_VERBS_PROCESSING_DONE,       /* See Notes above         */\r
-       IB_INVALID_WR_TYPE,\r
-       IB_QP_IN_TIMEWAIT,\r
-       IB_EE_IN_TIMEWAIT,\r
-       IB_INVALID_PORT,\r
-       IB_NOT_DONE,\r
-       IB_UNKNOWN_ERROR        /* ALWAYS LAST ENUM VALUE! */\r
-} ib_api_status_t;\r
-/*****/\r
-\r
-OSM_EXPORT const char *ib_error_str[];\r
-\r
-/****f* IBA Base: Types/ib_get_err_str\r
-* NAME\r
-*      ib_get_err_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified status value.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API ib_get_err_str(IN ib_api_status_t status)\r
-{\r
-       if (status > IB_UNKNOWN_ERROR)\r
-               status = IB_UNKNOWN_ERROR;\r
-       return (ib_error_str[status]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      status\r
-*              [in] status value\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the status description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****d* Verbs/ib_async_event_t\r
-* NAME\r
-*      ib_async_event_t -- Async event types\r
-*\r
-* DESCRIPTION\r
-*      This type indicates the reason the async callback was called.\r
-*      The context in the ib_event_rec_t indicates the resource context\r
-*      that associated with the callback.  For example, for IB_AE_CQ_ERROR\r
-*      the context provided during the ib_create_cq is returned in the event.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_async_event_t {\r
-       IB_AE_SQ_ERROR = 1,\r
-       IB_AE_SQ_DRAINED,\r
-       IB_AE_RQ_ERROR,\r
-       IB_AE_CQ_ERROR,\r
-       IB_AE_QP_FATAL,\r
-       IB_AE_QP_COMM,\r
-       IB_AE_QP_APM,\r
-       IB_AE_EEC_FATAL,\r
-       IB_AE_EEC_COMM,\r
-       IB_AE_EEC_APM,\r
-       IB_AE_LOCAL_FATAL,\r
-       IB_AE_PKEY_TRAP,\r
-       IB_AE_QKEY_TRAP,\r
-       IB_AE_MKEY_TRAP,\r
-       IB_AE_PORT_TRAP,\r
-       IB_AE_SYSIMG_GUID_TRAP,\r
-       IB_AE_BUF_OVERRUN,\r
-       IB_AE_LINK_INTEGRITY,\r
-       IB_AE_FLOW_CTRL_ERROR,\r
-       IB_AE_BKEY_TRAP,\r
-       IB_AE_QP_APM_ERROR,\r
-       IB_AE_EEC_APM_ERROR,\r
-       IB_AE_WQ_REQ_ERROR,\r
-       IB_AE_WQ_ACCESS_ERROR,\r
-       IB_AE_PORT_ACTIVE,\r
-       IB_AE_PORT_DOWN,\r
-       IB_AE_UNKNOWN           /* ALWAYS LAST ENUM VALUE */\r
-} ib_async_event_t;\r
-/*\r
-* VALUES\r
-*      IB_AE_SQ_ERROR\r
-*              An error occurred when accessing the send queue of the QP or EEC.\r
-*              This event is optional.\r
-*\r
-*      IB_AE_SQ_DRAINED\r
-*              The send queue of the specified QP has completed the outstanding\r
-*              messages in progress when the state change was requested and, if\r
-*              applicable, has received all acknowledgements for those messages.\r
-*\r
-*      IB_AE_RQ_ERROR\r
-*              An error occurred when accessing the receive queue of the QP or EEC.\r
-*              This event is optional.\r
-*\r
-*      IB_AE_CQ_ERROR\r
-*              An error occurred when writing an entry to the CQ.\r
-*\r
-*      IB_AE_QP_FATAL\r
-*              A catastrophic error occurred while accessing or processing the\r
-*              work queue that prevents reporting of completions.\r
-*\r
-*      IB_AE_QP_COMM\r
-*              The first packet has arrived for the receive work queue where the\r
-*              QP is still in the RTR state.\r
-*\r
-*      IB_AE_QP_APM\r
-*              If alternate path migration is supported, this event indicates that\r
-*              the QP connection has migrated to the alternate path.\r
-*\r
-*      IB_AE_EEC_FATAL\r
-*              If reliable datagram service is supported, this event indicates that\r
-*              a catastrophic error occurred while accessing or processing the EEC\r
-*              that prevents reporting of completions.\r
-*\r
-*      IB_AE_EEC_COMM\r
-*              If reliable datagram service is supported, this event indicates that\r
-*              the first packet has arrived for the receive work queue where the\r
-*              EEC is still in the RTR state.\r
-*\r
-*      IB_AE_EEC_APM\r
-*              If reliable datagram service and alternate path migration is supported,\r
-*              this event indicates that the EEC connection has migrated to the\r
-*              alternate path.\r
-*\r
-*      IB_AE_LOCAL_FATAL\r
-*              A catastrophic HCA error occurred which cannot be attributed to\r
-*              any resource; behavior is indeterminate.\r
-*\r
-*      IB_AE_PKEY_TRAP\r
-*              A PKEY violation was detected.  This event is optional.\r
-*\r
-*      IB_AE_QKEY_TRAP\r
-*              A QKEY violation was detected.  This event is optional.\r
-*\r
-*      IB_AE_MKEY_TRAP\r
-*              A MKEY violation was detected.  This event is optional.\r
-*\r
-*      IB_AE_PORT_TRAP\r
-*              A port capability change was detected.  This event is optional.\r
-*\r
-*      IB_AE_SYSIMG_GUID_TRAP\r
-*              If the system image GUID is supported, this event indicates that\r
-*              the system image GUID of this HCA has been changed.  This event\r
-*              is optional.\r
-*\r
-*      IB_AE_BUF_OVERRUN\r
-*              The number of consecutive flow control update periods with at least\r
-*              one overrun error in each period has exceeded the threshold specified\r
-*              in the port info attributes.  This event is optional.\r
-*\r
-*      IB_AE_LINK_INTEGRITY\r
-*              The detection of excessively frequent local physical errors has\r
-*              exceeded the threshold specified in the port info attributes.  This\r
-*              event is optional.\r
-*\r
-*      IB_AE_FLOW_CTRL_ERROR\r
-*              An HCA watchdog timer monitoring the arrival of flow control updates\r
-*              has expired without receiving an update.  This event is optional.\r
-*\r
-*      IB_AE_BKEY_TRAP\r
-*              An BKEY violation was detected.  This event is optional.\r
-*\r
-*      IB_AE_QP_APM_ERROR\r
-*              If alternate path migration is supported, this event indicates that\r
-*              an incoming path migration request to this QP was not accepted.\r
-*\r
-*      IB_AE_EEC_APM_ERROR\r
-*              If reliable datagram service and alternate path migration is supported,\r
-*              this event indicates that an incoming path migration request to this\r
-*              EEC was not accepted.\r
-*\r
-*      IB_AE_WQ_REQ_ERROR\r
-*              An OpCode violation was detected at the responder.\r
-*\r
-*      IB_AE_WQ_ACCESS_ERROR\r
-*              An access violation was detected at the responder.\r
-*\r
-*      IB_AE_PORT_ACTIVE\r
-*              If the port active event is supported, this event is generated\r
-*              when the link becomes active: IB_LINK_ACTIVE.\r
-*\r
-*      IB_AE_PORT_DOWN\r
-*              The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,\r
-*              IB_LINK_DOWN.\r
-*\r
-*      IB_AE_UNKNOWN\r
-*              An unknown error occurred which cannot be attributed to any\r
-*              resource; behavior is indeterminate.\r
-*\r
-*****/\r
-\r
-OSM_EXPORT const char *ib_async_event_str[];\r
-\r
-/****f* IBA Base: Types/ib_get_async_event_str\r
-* NAME\r
-*      ib_get_async_event_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified asynchronous event.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API\r
-ib_get_async_event_str(IN ib_async_event_t event)\r
-{\r
-       if (event > IB_AE_UNKNOWN)\r
-               event = IB_AE_UNKNOWN;\r
-       return (ib_async_event_str[event]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      event\r
-*              [in] event value\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the asynchronous event description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****s* Verbs/ib_event_rec_t\r
-* NAME\r
-*      ib_event_rec_t -- Async event notification record\r
-*\r
-* DESCRIPTION\r
-*      When an async event callback is made, this structure is passed to indicate\r
-*      the type of event, the source of event that caused it, and the context\r
-*      associated with this event.\r
-*\r
-*      context -- Context of the resource that caused the event.\r
-*              -- ca_context if this is a port/adapter event.\r
-*              -- qp_context if the source is a QP event\r
-*              -- cq_context if the source is a CQ event.\r
-*              -- ee_context if the source is an EE event.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_event_rec {\r
-       void *context;\r
-       ib_async_event_t type;\r
-       /* HCA vendor specific event information. */\r
-       uint64_t vendor_specific;\r
-       /* The following structures are valid only for trap types. */\r
-       union _trap {\r
-               struct {\r
-                       uint16_t lid;\r
-                       ib_net64_t port_guid;\r
-                       uint8_t port_num;\r
-                       /*\r
-                        * The following structure is valid only for\r
-                        * P_KEY, Q_KEY, and M_KEY violation traps.\r
-                        */\r
-                       struct {\r
-                               uint8_t sl;\r
-                               uint16_t src_lid;\r
-                               uint16_t dest_lid;\r
-                               union _key {\r
-                                       uint16_t pkey;\r
-                                       uint32_t qkey;\r
-                                       uint64_t mkey;\r
-                               } key;\r
-                               uint32_t src_qp;\r
-                               uint32_t dest_qp;\r
-                               ib_gid_t src_gid;\r
-                               ib_gid_t dest_gid;\r
-                       } violation;\r
-               } info;\r
-               ib_net64_t sysimg_guid;\r
-       } trap;\r
-} ib_event_rec_t;\r
-/*******/\r
-\r
-/****d* Access Layer/ib_atomic_t\r
-* NAME\r
-*      ib_atomic_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates atomicity levels supported by an adapter.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_atomic_t {\r
-       IB_ATOMIC_NONE,\r
-       IB_ATOMIC_LOCAL,\r
-       IB_ATOMIC_GLOBAL\r
-} ib_atomic_t;\r
-/*\r
-* VALUES\r
-*      IB_ATOMIC_NONE\r
-*              Atomic operations not supported.\r
-*\r
-*      IB_ATOMIC_LOCAL\r
-*              Atomic operations guaranteed between QPs of a single CA.\r
-*\r
-*      IB_ATOMIC_GLOBAL\r
-*              Atomic operations are guaranteed between CA and any other entity\r
-*              in the system.\r
-*****/\r
-\r
-/****s* Access Layer/ib_port_cap_t\r
-* NAME\r
-*      ib_port_cap_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates which management agents are currently available on the specified\r
-*      port.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_port_cap {\r
-       boolean_t cm;\r
-       boolean_t snmp;\r
-       boolean_t dev_mgmt;\r
-       boolean_t vend;\r
-       boolean_t sm;\r
-       boolean_t sm_disable;\r
-       boolean_t qkey_ctr;\r
-       boolean_t pkey_ctr;\r
-       boolean_t notice;\r
-       boolean_t trap;\r
-       boolean_t apm;\r
-       boolean_t slmap;\r
-       boolean_t pkey_nvram;\r
-       boolean_t mkey_nvram;\r
-       boolean_t sysguid;\r
-       boolean_t dr_notice;\r
-       boolean_t boot_mgmt;\r
-       boolean_t capm_notice;\r
-       boolean_t reinit;\r
-       boolean_t ledinfo;\r
-       boolean_t port_active;\r
-} ib_port_cap_t;\r
-/*****/\r
-\r
-/****d* Access Layer/ib_init_type_t\r
-* NAME\r
-*      ib_init_type_t\r
-*\r
-* DESCRIPTION\r
-*      If supported by the HCA, the type of initialization requested by\r
-*      this port before SM moves it to the active or armed state.  If the\r
-*      SM implements reinitialization, it shall set these bits to indicate\r
-*      the type of initialization performed prior to activating the port.\r
-*      Otherwise, these bits shall be set to 0.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint8_t ib_init_type_t;\r
-#define IB_INIT_TYPE_NO_LOAD                   0x01\r
-#define IB_INIT_TYPE_PRESERVE_CONTENT          0x02\r
-#define IB_INIT_TYPE_PRESERVE_PRESENCE         0x04\r
-#define IB_INIT_TYPE_DO_NOT_RESUSCITATE                0x08\r
-/*****/\r
-\r
-/****s* Access Layer/ib_port_attr_mod_t\r
-* NAME\r
-*      ib_port_attr_mod_t\r
-*\r
-* DESCRIPTION\r
-*      Port attributes that may be modified.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_port_attr_mod {\r
-       ib_port_cap_t cap;\r
-       uint16_t pkey_ctr;\r
-       uint16_t qkey_ctr;\r
-       ib_init_type_t init_type;\r
-       ib_net64_t system_image_guid;\r
-} ib_port_attr_mod_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_port_cap_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_port_attr_t\r
-* NAME\r
-*      ib_port_attr_t\r
-*\r
-* DESCRIPTION\r
-*      Information about a port on a given channel adapter.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_port_attr {\r
-       ib_net64_t port_guid;\r
-       uint8_t port_num;\r
-       uint8_t mtu;\r
-       uint64_t max_msg_size;\r
-       ib_net16_t lid;\r
-       uint8_t lmc;\r
-       /*\r
-        * LinkWidthSupported as defined in PortInfo.  Required to calculate\r
-        * inter-packet delay (a.k.a. static rate).\r
-        */\r
-       uint8_t link_width_supported;\r
-       uint16_t max_vls;\r
-       ib_net16_t sm_lid;\r
-       uint8_t sm_sl;\r
-       uint8_t link_state;\r
-       ib_init_type_t init_type_reply; /* Optional */\r
-       /*\r
-        * subnet_timeout:\r
-        * The maximum expected subnet propagation delay to reach any port on\r
-        * the subnet.  This value also determines the rate at which traps can\r
-        * be generated from this node.\r
-        *\r
-        * timeout = 4.096 microseconds * 2^subnet_timeout\r
-        */\r
-       uint8_t subnet_timeout;\r
-       ib_port_cap_t cap;\r
-       uint16_t pkey_ctr;\r
-       uint16_t qkey_ctr;\r
-       uint16_t num_gids;\r
-       uint16_t num_pkeys;\r
-       /*\r
-        * Pointers at the end of the structure to allow doing a simple\r
-        * memory comparison of contents up to the first pointer.\r
-        */\r
-       ib_gid_t *p_gid_table;\r
-       ib_net16_t *p_pkey_table;\r
-} ib_port_attr_t;\r
-/*\r
-* SEE ALSO\r
-*      uint8_t, ib_port_cap_t, ib_link_states_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_ca_attr_t\r
-* NAME\r
-*      ib_ca_attr_t\r
-*\r
-* DESCRIPTION\r
-*      Information about a channel adapter.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_ca_attr {\r
-       ib_net64_t ca_guid;\r
-       uint32_t vend_id;\r
-       uint16_t dev_id;\r
-       uint16_t revision;\r
-       uint64_t fw_ver;\r
-       /*\r
-        * Total size of the ca attributes in bytes\r
-        */\r
-       uint32_t size;\r
-       uint32_t max_qps;\r
-       uint32_t max_wrs;\r
-       uint32_t max_sges;\r
-       uint32_t max_rd_sges;\r
-       uint32_t max_cqs;\r
-       uint32_t max_cqes;\r
-       uint32_t max_pds;\r
-       uint32_t init_regions;\r
-       uint64_t init_region_size;\r
-       uint32_t init_windows;\r
-       uint32_t max_addr_handles;\r
-       uint32_t max_partitions;\r
-       ib_atomic_t atomicity;\r
-       uint8_t max_qp_resp_res;\r
-       uint8_t max_eec_resp_res;\r
-       uint8_t max_resp_res;\r
-       uint8_t max_qp_init_depth;\r
-       uint8_t max_eec_init_depth;\r
-       uint32_t max_eecs;\r
-       uint32_t max_rdds;\r
-       uint32_t max_ipv6_qps;\r
-       uint32_t max_ether_qps;\r
-       uint32_t max_mcast_grps;\r
-       uint32_t max_mcast_qps;\r
-       uint32_t max_qps_per_mcast_grp;\r
-       uint32_t max_fmr;\r
-       uint32_t max_map_per_fmr;\r
-       /*\r
-        * local_ack_delay:\r
-        * Specifies the maximum time interval between the local CA receiving\r
-        * a message and the transmission of the associated ACK or NAK.\r
-        *\r
-        * timeout = 4.096 microseconds * 2^local_ack_delay\r
-        */\r
-       uint8_t local_ack_delay;\r
-       boolean_t bad_pkey_ctr_support;\r
-       boolean_t bad_qkey_ctr_support;\r
-       boolean_t raw_mcast_support;\r
-       boolean_t apm_support;\r
-       boolean_t av_port_check;\r
-       boolean_t change_primary_port;\r
-       boolean_t modify_wr_depth;\r
-       boolean_t current_qp_state_support;\r
-       boolean_t shutdown_port_capability;\r
-       boolean_t init_type_support;\r
-       boolean_t port_active_event_support;\r
-       boolean_t system_image_guid_support;\r
-       boolean_t hw_agents;\r
-       ib_net64_t system_image_guid;\r
-       uint32_t num_page_sizes;\r
-       uint8_t num_ports;\r
-       uint32_t *p_page_size;\r
-       ib_port_attr_t *p_port_attr;\r
-} ib_ca_attr_t;\r
-/*\r
-* FIELDS\r
-*      ca_guid\r
-*              GUID for this adapter.\r
-*\r
-*      vend_id\r
-*              IEEE vendor ID for this adapter\r
-*\r
-*      dev_id\r
-*              Device ID of this adapter. (typically from PCI device ID)\r
-*\r
-*      revision\r
-*              Revision ID of this adapter\r
-*\r
-*      fw_ver\r
-*              Device Firmware version.\r
-*\r
-*      size\r
-*              Total size in bytes for the HCA attributes.  This size includes total\r
-*              size required for all the variable members of the structure.  If a\r
-*              vendor requires to pass vendor specific fields beyond this structure,\r
-*              the HCA vendor can choose to report a larger size.  If a vendor is\r
-*              reporting extended vendor specific features, they should also provide\r
-*              appropriate access functions to aid with the required interpretation.\r
-*\r
-*      max_qps\r
-*              Maximum number of QP's supported by this HCA.\r
-*\r
-*      max_wrs\r
-*              Maximum number of work requests supported by this HCA.\r
-*\r
-*      max_sges\r
-*              Maximum number of scatter gather elements supported per work request.\r
-*\r
-*      max_rd_sges\r
-*              Maximum number of scatter gather elements supported for READ work\r
-*              requests for a Reliable Datagram QP.  This value must be zero if RD\r
-*              service is not supported.\r
-*\r
-*      max_cqs\r
-*              Maximum number of Completion Queues supported.\r
-*\r
-*      max_cqes\r
-*              Maximum number of CQ elements supported per CQ.\r
-*\r
-*      max_pds\r
-*              Maximum number of protection domains supported.\r
-*\r
-*      init_regions\r
-*              Initial number of memory regions supported.  These are only informative\r
-*              values.  HCA vendors can extended and grow these limits on demand.\r
-*\r
-*      init_region_size\r
-*              Initial limit on the size of the registered memory region.\r
-*\r
-*      init_windows\r
-*              Initial number of window entries supported.\r
-*\r
-*      max_addr_handles\r
-*              Maximum number of address handles supported.\r
-*\r
-*      max_partitions\r
-*              Maximum number of partitions supported.\r
-*\r
-*      atomicity\r
-*              Indicates level of atomic operations supported by this HCA.\r
-*\r
-*      max_qp_resp_res\r
-*      max_eec_resp_res\r
-*              Maximum limit on number of responder resources for incoming RDMA\r
-*              operations, on QPs and EEC's respectively.\r
-*\r
-*      max_resp_res\r
-*              Maximum number of responder resources per HCA, with this HCA used as\r
-*              the target.\r
-*\r
-*      max_qp_init_depth\r
-*      max_eec_init_depth\r
-*              Maximimum initiator depth per QP or EEC for initiating RDMA reads and\r
-*              atomic operations.\r
-*\r
-*      max_eecs\r
-*              Maximimum number of EEC's supported by the HCA.\r
-*\r
-*      max_rdds\r
-*              Maximum number of Reliable datagram domains supported.\r
-*\r
-*      max_ipv6_qps\r
-*      max_ether_qps\r
-*              Maximum number of IPV6 and raw ether QP's supported by this HCA.\r
-*\r
-*      max_mcast_grps\r
-*              Maximum number of multicast groups supported.\r
-*\r
-*      max_mcast_qps\r
-*              Maximum number of QP's that can support multicast operations.\r
-*\r
-*      max_qps_per_mcast_grp\r
-*              Maximum number of multicast QP's per multicast group.\r
-*\r
-*      local_ack_delay\r
-*              Specifies the maximum time interval between the local CA receiving\r
-*              a message and the transmission of the associated ACK or NAK.\r
-*              timeout = 4.096 microseconds * 2^local_ack_delay\r
-*\r
-*      bad_pkey_ctr_support\r
-*      bad_qkey_ctr_support\r
-*              Indicates support for the bad pkey and qkey counters.\r
-*\r
-*      raw_mcast_support\r
-*              Indicates support for raw packet multicast.\r
-*\r
-*      apm_support\r
-*              Indicates support for Automatic Path Migration.\r
-*\r
-*      av_port_check\r
-*              Indicates ability to check port number in address handles.\r
-*\r
-*      change_primary_port\r
-*              Indicates ability to change primary port for a QP or EEC during a\r
-*              SQD->RTS transition.\r
-*\r
-*      modify_wr_depth\r
-*              Indicates ability to modify QP depth during a modify QP operation.\r
-*              Check the verb specification for permitted states.\r
-*\r
-*      current_qp_state_support\r
-*              Indicates ability of the HCA to support the current QP state modifier\r
-*              during a modify QP operation.\r
-*\r
-*      shutdown_port_capability\r
-*              Shutdown port capability support indicator.\r
-*\r
-*      init_type_support\r
-*              Indicates init_type_reply and ability to set init_type is supported.\r
-*\r
-*      port_active_event_support\r
-*              Port active event support indicator.\r
-*\r
-*      system_image_guid_support\r
-*              System image GUID support indicator.\r
-*\r
-*      hw_agents\r
-*              Indicates SMA is implemented in HW.\r
-*\r
-*      system_image_guid\r
-*              Optional system image GUID.  This field is valid only if the\r
-*              system_image_guid_support flag is set.\r
-*\r
-*      num_page_sizes\r
-*              Indicates support for different page sizes supported by the HCA.\r
-*              The variable size array can be obtained from p_page_size.\r
-*\r
-*      num_ports\r
-*              Number of physical ports supported on this HCA.\r
-*\r
-*      p_page_size\r
-*              Array holding different page size supported.\r
-*\r
-*      p_port_attr\r
-*              Array holding port attributes.\r
-*\r
-* NOTES\r
-*      This structure contains the attributes of a channel adapter.  Users must\r
-*      call ib_copy_ca_attr to copy the contents of this structure to a new\r
-*      memory region.\r
-*\r
-* SEE ALSO\r
-*      ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr\r
-*****/\r
-\r
-/****f* Access layer/ib_copy_ca_attr\r
-* NAME\r
-*      ib_copy_ca_attr\r
-*\r
-* DESCRIPTION\r
-*      Copies CA attributes.\r
-*\r
-* SYNOPSIS\r
-*/\r
-ib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest,\r
-                             IN const ib_ca_attr_t * const p_src);\r
-/*\r
-* PARAMETERS\r
-*      p_dest\r
-*              Pointer to the buffer that is the destination of the copy.\r
-*\r
-*      p_src\r
-*              Pointer to the CA attributes to copy.\r
-*\r
-* RETURN VALUE\r
-*      Pointer to the copied CA attributes.\r
-*\r
-* NOTES\r
-*      The buffer pointed to by the p_dest parameter must be at least the size\r
-*      specified in the size field of the buffer pointed to by p_src.\r
-*\r
-* SEE ALSO\r
-*      ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr\r
-*****/\r
-\r
-/****s* Access Layer/ib_av_attr_t\r
-* NAME\r
-*      ib_av_attr_t\r
-*\r
-* DESCRIPTION\r
-*      IBA address vector.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_av_attr {\r
-       uint8_t port_num;\r
-       uint8_t sl;\r
-       ib_net16_t dlid;\r
-       boolean_t grh_valid;\r
-       ib_grh_t grh;\r
-       uint8_t static_rate;\r
-       uint8_t path_bits;\r
-       struct _av_conn {\r
-               uint8_t path_mtu;\r
-               uint8_t local_ack_timeout;\r
-               uint8_t seq_err_retry_cnt;\r
-               uint8_t rnr_retry_cnt;\r
-       } conn;\r
-} ib_av_attr_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_gid_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_qp_type_t\r
-* NAME\r
-*      ib_qp_type_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates the type of queue pair being created.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_qp_type {\r
-       IB_QPT_RELIABLE_CONN = 0,       /* Matches CM REQ transport type */\r
-       IB_QPT_UNRELIABLE_CONN = 1,     /* Matches CM REQ transport type */\r
-       IB_QPT_RELIABLE_DGRM = 2,       /* Matches CM REQ transport type */\r
-       IB_QPT_UNRELIABLE_DGRM,\r
-       IB_QPT_QP0,\r
-       IB_QPT_QP1,\r
-       IB_QPT_RAW_IPV6,\r
-       IB_QPT_RAW_ETHER,\r
-       IB_QPT_MAD,             /* InfiniBand Access Layer */\r
-       IB_QPT_QP0_ALIAS,       /* InfiniBand Access Layer */\r
-       IB_QPT_QP1_ALIAS        /* InfiniBand Access Layer */\r
-} ib_qp_type_t;\r
-/*\r
-* VALUES\r
-*      IB_QPT_RELIABLE_CONN\r
-*              Reliable, connected queue pair.\r
-*\r
-*      IB_QPT_UNRELIABLE_CONN\r
-*              Unreliable, connected queue pair.\r
-*\r
-*      IB_QPT_RELIABLE_DGRM\r
-*              Reliable, datagram queue pair.\r
-*\r
-*      IB_QPT_UNRELIABLE_DGRM\r
-*              Unreliable, datagram queue pair.\r
-*\r
-*      IB_QPT_QP0\r
-*              Queue pair 0.\r
-*\r
-*      IB_QPT_QP1\r
-*              Queue pair 1.\r
-*\r
-*      IB_QPT_RAW_DGRM\r
-*              Raw datagram queue pair.\r
-*\r
-*      IB_QPT_RAW_IPV6\r
-*              Raw IP version 6 queue pair.\r
-*\r
-*      IB_QPT_RAW_ETHER\r
-*              Raw Ethernet queue pair.\r
-*\r
-*      IB_QPT_MAD\r
-*              Unreliable, datagram queue pair that will send and receive management\r
-*              datagrams with assistance from the access layer.\r
-*\r
-*      IB_QPT_QP0_ALIAS\r
-*              Alias to queue pair 0.  Aliased QPs can only be created on an aliased\r
-*              protection domain.\r
-*\r
-*      IB_QPT_QP1_ALIAS\r
-*              Alias to queue pair 1.  Aliased QPs can only be created on an aliased\r
-*              protection domain.\r
-*****/\r
-\r
-/****d* Access Layer/ib_access_t\r
-* NAME\r
-*      ib_access_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates the type of access is permitted on resources such as QPs,\r
-*      memory regions and memory windows.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_access_t;\r
-#define IB_AC_RDMA_READ                                0x00000001\r
-#define IB_AC_RDMA_WRITE                       0x00000002\r
-#define IB_AC_ATOMIC                           0x00000004\r
-#define IB_AC_LOCAL_WRITE                      0x00000008\r
-#define IB_AC_MW_BIND                          0x00000010\r
-/*\r
-* NOTES\r
-*      Users may combine access rights using a bit-wise or operation to specify\r
-*      additional access.  For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants\r
-*      RDMA read and write access.\r
-*****/\r
-\r
-/****d* Access Layer/ib_qp_state_t\r
-* NAME\r
-*      ib_qp_state_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates or sets the state of a queue pair.  The current state of a queue\r
-*      pair is returned through the ib_qp_query call and set via the\r
-*      ib_qp_modify call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_qp_state_t;\r
-#define IB_QPS_RESET                           0x00000001\r
-#define IB_QPS_INIT                            0x00000002\r
-#define IB_QPS_RTR                             0x00000004\r
-#define IB_QPS_RTS                             0x00000008\r
-#define IB_QPS_SQD                             0x00000010\r
-#define IB_QPS_SQD_DRAINING                    0x00000030\r
-#define IB_QPS_SQD_DRAINED                     0x00000050\r
-#define IB_QPS_SQERR                           0x00000080\r
-#define IB_QPS_ERROR                           0x00000100\r
-#define IB_QPS_TIME_WAIT                       0xDEAD0000      /* InfiniBand Access Layer */\r
-/*****/\r
-\r
-/****d* Access Layer/ib_apm_state_t\r
-* NAME\r
-*      ib_apm_state_t\r
-*\r
-* DESCRIPTION\r
-*      The current automatic path migration state of a queue pair\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_apm_state {\r
-       IB_APM_MIGRATED = 1,\r
-       IB_APM_REARM,\r
-       IB_APM_ARMED\r
-} ib_apm_state_t;\r
-/*****/\r
-\r
-/****s* Access Layer/ib_qp_create_t\r
-* NAME\r
-*      ib_qp_create_t\r
-*\r
-* DESCRIPTION\r
-*      Attributes used to initialize a queue pair at creation time.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_qp_create {\r
-       ib_qp_type_t qp_type;\r
-       ib_rdd_handle_t h_rdd;\r
-       uint32_t sq_depth;\r
-       uint32_t rq_depth;\r
-       uint32_t sq_sge;\r
-       uint32_t rq_sge;\r
-       ib_cq_handle_t h_sq_cq;\r
-       ib_cq_handle_t h_rq_cq;\r
-       boolean_t sq_signaled;\r
-} ib_qp_create_t;\r
-/*\r
-* FIELDS\r
-*      type\r
-*              Specifies the type of queue pair to create.\r
-*\r
-*      h_rdd\r
-*              A handle to a reliable datagram domain to associate with the queue\r
-*              pair.  This field is ignored if the queue pair is not a reliable\r
-*              datagram type queue pair.\r
-*\r
-*      sq_depth\r
-*              Indicates the requested maximum number of work requests that may be\r
-*              outstanding on the queue pair's send queue.  This value must be less\r
-*              than or equal to the maximum reported by the channel adapter associated\r
-*              with the queue pair.\r
-*\r
-*      rq_depth\r
-*              Indicates the requested maximum number of work requests that may be\r
-*              outstanding on the queue pair's receive queue.  This value must be less\r
-*              than or equal to the maximum reported by the channel adapter associated\r
-*              with the queue pair.\r
-*\r
-*      sq_sge\r
-*              Indicates the maximum number scatter-gather elements that may be\r
-*              given in a send work request.  This value must be less\r
-*              than or equal to the maximum reported by the channel adapter associated\r
-*              with the queue pair.\r
-*\r
-*      rq_sge\r
-*              Indicates the maximum number scatter-gather elements that may be\r
-*              given in a receive work request.  This value must be less\r
-*              than or equal to the maximum reported by the channel adapter associated\r
-*              with the queue pair.\r
-*\r
-*      h_sq_cq\r
-*              A handle to the completion queue that will be used to report send work\r
-*              request completions.  This handle must be NULL if the type is\r
-*              IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.\r
-*\r
-*      h_rq_cq\r
-*              A handle to the completion queue that will be used to report receive\r
-*              work request completions.  This handle must be NULL if the type is\r
-*              IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.\r
-*\r
-*      sq_signaled\r
-*              A flag that is used to indicate whether the queue pair will signal\r
-*              an event upon completion of a send work request.  If set to\r
-*              TRUE, send work requests will always generate a completion\r
-*              event.  If set to FALSE, a completion event will only be\r
-*              generated if the send_opt field of the send work request has the\r
-*              IB_SEND_OPT_SIGNALED flag set.\r
-*\r
-* SEE ALSO\r
-*      ib_qp_type_t, ib_qp_attr_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_qp_attr_t\r
-* NAME\r
-*      ib_qp_attr_t\r
-*\r
-* DESCRIPTION\r
-*      Queue pair attributes returned through ib_query_qp.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_qp_attr {\r
-       ib_pd_handle_t h_pd;\r
-       ib_qp_type_t qp_type;\r
-       ib_access_t access_ctrl;\r
-       uint16_t pkey_index;\r
-       uint32_t sq_depth;\r
-       uint32_t rq_depth;\r
-       uint32_t sq_sge;\r
-       uint32_t rq_sge;\r
-       uint8_t init_depth;\r
-       uint8_t resp_res;\r
-       ib_cq_handle_t h_sq_cq;\r
-       ib_cq_handle_t h_rq_cq;\r
-       ib_rdd_handle_t h_rdd;\r
-       boolean_t sq_signaled;\r
-       ib_qp_state_t state;\r
-       ib_net32_t num;\r
-       ib_net32_t dest_num;\r
-       ib_net32_t qkey;\r
-       ib_net32_t sq_psn;\r
-       ib_net32_t rq_psn;\r
-       uint8_t primary_port;\r
-       uint8_t alternate_port;\r
-       ib_av_attr_t primary_av;\r
-       ib_av_attr_t alternate_av;\r
-       ib_apm_state_t apm_state;\r
-} ib_qp_attr_t;\r
-/*\r
-* FIELDS\r
-*      h_pd\r
-*              This is a handle to a protection domain associated with the queue\r
-*              pair, or NULL if the queue pair is type IB_QPT_RELIABLE_DGRM.\r
-*\r
-* NOTES\r
-*      Other fields are defined by the Infiniband specification.\r
-*\r
-* SEE ALSO\r
-*      ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_qp_opts_t\r
-* NAME\r
-*      ib_qp_opts_t\r
-*\r
-* DESCRIPTION\r
-*      Optional fields supplied in the modify QP operation.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_qp_opts_t;\r
-#define IB_MOD_QP_ALTERNATE_AV                 0x00000001\r
-#define IB_MOD_QP_PKEY                         0x00000002\r
-#define IB_MOD_QP_APM_STATE                    0x00000004\r
-#define IB_MOD_QP_PRIMARY_AV                   0x00000008\r
-#define IB_MOD_QP_RNR_NAK_TIMEOUT              0x00000010\r
-#define IB_MOD_QP_RESP_RES                     0x00000020\r
-#define IB_MOD_QP_INIT_DEPTH                   0x00000040\r
-#define IB_MOD_QP_PRIMARY_PORT                 0x00000080\r
-#define IB_MOD_QP_ACCESS_CTRL                  0x00000100\r
-#define IB_MOD_QP_QKEY                         0x00000200\r
-#define IB_MOD_QP_SQ_DEPTH                     0x00000400\r
-#define IB_MOD_QP_RQ_DEPTH                     0x00000800\r
-#define IB_MOD_QP_CURRENT_STATE                        0x00001000\r
-#define IB_MOD_QP_RETRY_CNT                    0x00002000\r
-#define IB_MOD_QP_LOCAL_ACK_TIMEOUT            0x00004000\r
-#define IB_MOD_QP_RNR_RETRY_CNT                        0x00008000\r
-/*\r
-* SEE ALSO\r
-*      ib_qp_mod_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_qp_mod_t\r
-* NAME\r
-*      ib_qp_mod_t\r
-*\r
-* DESCRIPTION\r
-*      Information needed to change the state of a queue pair through the\r
-*      ib_modify_qp call.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_qp_mod {\r
-       ib_qp_state_t req_state;\r
-       union _qp_state {\r
-               struct _qp_reset {\r
-                       /*\r
-                        * Time, in milliseconds, that the QP needs to spend in\r
-                        * the time wait state before being reused.\r
-                        */\r
-                       uint32_t timewait;\r
-               } reset;\r
-               struct _qp_init {\r
-                       ib_qp_opts_t opts;\r
-                       uint8_t primary_port;\r
-                       ib_net32_t qkey;\r
-                       uint16_t pkey_index;\r
-                       ib_access_t access_ctrl;\r
-               } init;\r
-               struct _qp_rtr {\r
-                       ib_net32_t rq_psn;\r
-                       ib_net32_t dest_qp;\r
-                       ib_av_attr_t primary_av;\r
-                       uint8_t resp_res;\r
-                       ib_qp_opts_t opts;\r
-                       ib_av_attr_t alternate_av;\r
-                       ib_net32_t qkey;\r
-                       uint16_t pkey_index;\r
-                       ib_access_t access_ctrl;\r
-                       uint32_t sq_depth;\r
-                       uint32_t rq_depth;\r
-                       uint8_t rnr_nak_timeout;\r
-               } rtr;\r
-               struct _qp_rts {\r
-                       ib_net32_t sq_psn;\r
-                       uint8_t retry_cnt;\r
-                       uint8_t rnr_retry_cnt;\r
-                       uint8_t rnr_nak_timeout;\r
-                       uint8_t local_ack_timeout;\r
-                       uint8_t init_depth;\r
-                       ib_qp_opts_t opts;\r
-                       ib_qp_state_t current_state;\r
-                       ib_net32_t qkey;\r
-                       ib_access_t access_ctrl;\r
-                       uint8_t resp_res;\r
-                       ib_av_attr_t primary_av;\r
-                       ib_av_attr_t alternate_av;\r
-                       uint32_t sq_depth;\r
-                       uint32_t rq_depth;\r
-                       ib_apm_state_t apm_state;\r
-                       uint8_t primary_port;\r
-                       uint16_t pkey_index;\r
-               } rts;\r
-               struct _qp_sqd {\r
-                       boolean_t sqd_event;\r
-               } sqd;\r
-       } state;\r
-} ib_qp_mod_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_eec_attr_t\r
-* NAME\r
-*      ib_eec_attr_t\r
-*\r
-* DESCRIPTION\r
-*      Information about an end-to-end context.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_eec_attr {\r
-       ib_qp_state_t state;\r
-       ib_rdd_handle_t h_rdd;\r
-       ib_net32_t local_eecn;\r
-       ib_net32_t sq_psn;\r
-       ib_net32_t rq_psn;\r
-       uint8_t primary_port;\r
-       uint16_t pkey_index;\r
-       uint32_t resp_res;\r
-       ib_net32_t remote_eecn;\r
-       uint32_t init_depth;\r
-       uint32_t dest_num;      // ??? What is this?\r
-       ib_av_attr_t primary_av;\r
-       ib_av_attr_t alternate_av;\r
-       ib_apm_state_t apm_state;\r
-} ib_eec_attr_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_qp_state_t, ib_av_attr_t, ib_apm_state_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_eec_opts_t\r
-* NAME\r
-*      ib_eec_opts_t\r
-*\r
-* DESCRIPTION\r
-*      Optional fields supplied in the modify EEC operation.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_eec_opts_t;\r
-#define IB_MOD_EEC_ALTERNATE_AV                        0x00000001\r
-#define IB_MOD_EEC_PKEY                                0x00000002\r
-#define IB_MOD_EEC_APM_STATE                   0x00000004\r
-#define IB_MOD_EEC_PRIMARY_AV                  0x00000008\r
-#define IB_MOD_EEC_RNR                         0x00000010\r
-#define IB_MOD_EEC_RESP_RES                    0x00000020\r
-#define IB_MOD_EEC_OUTSTANDING                 0x00000040\r
-#define IB_MOD_EEC_PRIMARY_PORT                        0x00000080\r
-/*\r
-* NOTES\r
-*\r
-*\r
-*****/\r
-\r
-/****s* Access Layer/ib_eec_mod_t\r
-* NAME\r
-*      ib_eec_mod_t\r
-*\r
-* DESCRIPTION\r
-*      Information needed to change the state of an end-to-end context through\r
-*      the ib_modify_eec function.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_eec_mod {\r
-       ib_qp_state_t req_state;\r
-       union _eec_state {\r
-               struct _eec_init {\r
-                       uint8_t primary_port;\r
-                       uint16_t pkey_index;\r
-               } init;\r
-               struct _eec_rtr {\r
-                       ib_net32_t rq_psn;\r
-                       ib_net32_t remote_eecn;\r
-                       ib_av_attr_t primary_av;\r
-                       uint8_t resp_res;\r
-                       ib_eec_opts_t opts;\r
-                       ib_av_attr_t alternate_av;\r
-                       uint16_t pkey_index;\r
-               } rtr;\r
-               struct _eec_rts {\r
-                       ib_net32_t sq_psn;\r
-                       uint8_t retry_cnt;\r
-                       uint8_t rnr_retry_cnt;\r
-                       uint8_t local_ack_timeout;\r
-                       uint8_t init_depth;\r
-                       ib_eec_opts_t opts;\r
-                       ib_av_attr_t alternate_av;\r
-                       ib_apm_state_t apm_state;\r
-                       ib_av_attr_t primary_av;\r
-                       uint16_t pkey_index;\r
-                       uint8_t primary_port;\r
-               } rts;\r
-               struct _eec_sqd {\r
-                       boolean_t sqd_event;\r
-               } sqd;\r
-       } state;\r
-} ib_eec_mod_t;\r
-/*\r
-* SEE ALSO\r
-*      ib_qp_state_t, ib_av_attr_t, ib_apm_state_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_wr_type_t\r
-* NAME\r
-*      ib_wr_type_t\r
-*\r
-* DESCRIPTION\r
-*      Identifies the type of work request posted to a queue pair.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_wr_type_t {\r
-       WR_SEND = 1,\r
-       WR_RDMA_WRITE,\r
-       WR_RDMA_READ,\r
-       WR_COMPARE_SWAP,\r
-       WR_FETCH_ADD\r
-} ib_wr_type_t;\r
-/*****/\r
-\r
-/****s* Access Layer/ib_local_ds_t\r
-* NAME\r
-*      ib_local_ds_t\r
-*\r
-* DESCRIPTION\r
-*      Local data segment information referenced by send and receive work\r
-*      requests.  This is used to specify local data buffers used as part of a\r
-*      work request.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_local_ds {\r
-       void *vaddr;\r
-       uint32_t length;\r
-       uint32_t lkey;\r
-} ib_local_ds_t;\r
-/*****/\r
-\r
-/****d* Access Layer/ib_send_opt_t\r
-* NAME\r
-*      ib_send_opt_t\r
-*\r
-* DESCRIPTION\r
-*      Optional flags used when posting send work requests.  These flags\r
-*      indicate specific processing for the send operation.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_send_opt_t;\r
-#define IB_SEND_OPT_IMMEDIATE          0x00000001\r
-#define IB_SEND_OPT_FENCE              0x00000002\r
-#define IB_SEND_OPT_SIGNALED           0x00000004\r
-#define IB_SEND_OPT_SOLICITED          0x00000008\r
-#define IB_SEND_OPT_INLINE             0x00000010\r
-#define IB_SEND_OPT_LOCAL              0x00000020\r
-#define IB_SEND_OPT_VEND_MASK          0xFFFF0000\r
-/*\r
-* VALUES\r
-*      The following flags determine the behavior of a work request when\r
-*      posted to the send side.\r
-*\r
-*      IB_SEND_OPT_IMMEDIATE\r
-*              Send immediate data with the given request.\r
-*\r
-*      IB_SEND_OPT_FENCE\r
-*              The operation is fenced.  Complete all pending send operations\r
-*              before processing this request.\r
-*\r
-*      IB_SEND_OPT_SIGNALED\r
-*              If the queue pair is configured for signaled completion, then\r
-*              generate a completion queue entry when this request completes.\r
-*\r
-*      IB_SEND_OPT_SOLICITED\r
-*              Set the solicited bit on the last packet of this request.\r
-*\r
-*      IB_SEND_OPT_INLINE\r
-*              Indicates that the requested send data should be copied into a VPD\r
-*              owned data buffer.  This flag permits the user to issue send operations\r
-*              without first needing to register the buffer(s) associated with the\r
-*              send operation.  Verb providers that support this operation may place\r
-*              vendor specific restrictions on the size of send operation that may\r
-*              be performed as inline.\r
-*\r
-*\r
-*  IB_SEND_OPT_LOCAL\r
-*     Indicates that a sent MAD request should be given to the local VPD for\r
-*     processing.  MADs sent using this option are not placed on the wire.\r
-*     This send option is only valid for MAD send operations.\r
-*\r
-*\r
-*      IB_SEND_OPT_VEND_MASK\r
-*              This mask indicates bits reserved in the send options that may be used\r
-*              by the verbs provider to indicate vendor specific options.  Bits set\r
-*              in this area of the send options are ignored by the Access Layer, but\r
-*              may have specific meaning to the underlying VPD.\r
-*\r
-*****/\r
-\r
-/****s* Access Layer/ib_send_wr_t\r
-* NAME\r
-*      ib_send_wr_t\r
-*\r
-* DESCRIPTION\r
-*      Information used to submit a work request to the send queue of a queue\r
-*      pair.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_send_wr {\r
-       struct _ib_send_wr *p_next;\r
-       uint64_t wr_id;\r
-       ib_wr_type_t wr_type;\r
-       ib_send_opt_t send_opt;\r
-       uint32_t num_ds;\r
-       ib_local_ds_t *ds_array;\r
-       ib_net32_t immediate_data;\r
-       union _send_dgrm {\r
-               struct _send_ud {\r
-                       ib_net32_t remote_qp;\r
-                       ib_net32_t remote_qkey;\r
-                       ib_av_handle_t h_av;\r
-               } ud;\r
-               struct _send_rd {\r
-                       ib_net32_t remote_qp;\r
-                       ib_net32_t remote_qkey;\r
-                       ib_net32_t eecn;\r
-               } rd;\r
-               struct _send_raw_ether {\r
-                       ib_net16_t dest_lid;\r
-                       uint8_t path_bits;\r
-                       uint8_t sl;\r
-                       uint8_t max_static_rate;\r
-                       ib_net16_t ether_type;\r
-               } raw_ether;\r
-               struct _send_raw_ipv6 {\r
-                       ib_net16_t dest_lid;\r
-                       uint8_t path_bits;\r
-                       uint8_t sl;\r
-                       uint8_t max_static_rate;\r
-               } raw_ipv6;\r
-       } dgrm;\r
-       struct _send_remote_ops {\r
-               uint64_t vaddr;\r
-               uint32_t rkey;\r
-               ib_net64_t atomic1;\r
-               ib_net64_t atomic2;\r
-       } remote_ops;\r
-} ib_send_wr_t;\r
-/*\r
-* FIELDS\r
-*      p_next\r
-*              A pointer used to chain work requests together.  This permits multiple\r
-*              work requests to be posted to a queue pair through a single function\r
-*              call.  This value is set to NULL to mark the end of the chain.\r
-*\r
-*      wr_id\r
-*              A 64-bit work request identifier that is returned to the consumer\r
-*              as part of the work completion.\r
-*\r
-*      wr_type\r
-*              The type of work request being submitted to the send queue.\r
-*\r
-*      send_opt\r
-*              Optional send control parameters.\r
-*\r
-*      num_ds\r
-*              Number of local data segments specified by this work request.\r
-*\r
-*      ds_array\r
-*              A reference to an array of local data segments used by the send\r
-*              operation.\r
-*\r
-*      immediate_data\r
-*              32-bit field sent as part of a message send or RDMA write operation.\r
-*              This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE\r
-*              has been set.\r
-*\r
-*      dgrm.ud.remote_qp\r
-*              Identifies the destination queue pair of an unreliable datagram send\r
-*              operation.\r
-*\r
-*      dgrm.ud.remote_qkey\r
-*              The qkey for the destination queue pair.\r
-*\r
-*      dgrm.ud.h_av\r
-*              An address vector that specifies the path information used to route\r
-*              the outbound datagram to the destination queue pair.\r
-*\r
-*      dgrm.rd.remote_qp\r
-*              Identifies the destination queue pair of a reliable datagram send\r
-*              operation.\r
-*\r
-*      dgrm.rd.remote_qkey\r
-*              The qkey for the destination queue pair.\r
-*\r
-*      dgrm.rd.eecn\r
-*              The local end-to-end context number to use with the reliable datagram\r
-*              send operation.\r
-*\r
-*      dgrm.raw_ether.dest_lid\r
-*              The destination LID that will receive this raw ether send.\r
-*\r
-*      dgrm.raw_ether.path_bits\r
-*              path bits...\r
-*\r
-*      dgrm.raw_ether.sl\r
-*              service level...\r
-*\r
-*      dgrm.raw_ether.max_static_rate\r
-*              static rate...\r
-*\r
-*      dgrm.raw_ether.ether_type\r
-*              ether type...\r
-*\r
-*      dgrm.raw_ipv6.dest_lid\r
-*              The destination LID that will receive this raw ether send.\r
-*\r
-*      dgrm.raw_ipv6.path_bits\r
-*              path bits...\r
-*\r
-*      dgrm.raw_ipv6.sl\r
-*              service level...\r
-*\r
-*      dgrm.raw_ipv6.max_static_rate\r
-*              static rate...\r
-*\r
-*      remote_ops.vaddr\r
-*              The registered virtual memory address of the remote memory to access\r
-*              with an RDMA or atomic operation.\r
-*\r
-*      remote_ops.rkey\r
-*              The rkey associated with the specified remote vaddr. This data must\r
-*              be presented exactly as obtained from the remote node. No swapping\r
-*              of data must be performed.\r
-*\r
-*      atomic1\r
-*              The first operand for an atomic operation.\r
-*\r
-*      atomic2\r
-*              The second operand for an atomic operation.\r
-*\r
-* NOTES\r
-*      The format of data sent over the fabric is user-defined and is considered\r
-*      opaque to the access layer.  The sole exception to this are MADs posted\r
-*      to a MAD QP service.  MADs are expected to match the format defined by\r
-*      the Infiniband specification and must be in network-byte order when posted\r
-*      to the MAD QP service.\r
-*\r
-* SEE ALSO\r
-*      ib_wr_type_t, ib_local_ds_t, ib_send_opt_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_recv_wr_t\r
-* NAME\r
-*      ib_recv_wr_t\r
-*\r
-* DESCRIPTION\r
-*      Information used to submit a work request to the receive queue of a queue\r
-*      pair.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_recv_wr {\r
-       struct _ib_recv_wr *p_next;\r
-       uint64_t wr_id;\r
-       uint32_t num_ds;\r
-       ib_local_ds_t *ds_array;\r
-} ib_recv_wr_t;\r
-/*\r
-* FIELDS\r
-*      p_next\r
-*              A pointer used to chain work requests together.  This permits multiple\r
-*              work requests to be posted to a queue pair through a single function\r
-*              call.  This value is set to NULL to mark the end of the chain.\r
-*\r
-*      wr_id\r
-*              A 64-bit work request identifier that is returned to the consumer\r
-*              as part of the work completion.\r
-*\r
-*      num_ds\r
-*              Number of local data segments specified by this work request.\r
-*\r
-*      ds_array\r
-*              A reference to an array of local data segments used by the send\r
-*              operation.\r
-*\r
-* SEE ALSO\r
-*      ib_local_ds_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_bind_wr_t\r
-* NAME\r
-*      ib_bind_wr_t\r
-*\r
-* DESCRIPTION\r
-*      Information used to submit a memory window bind work request to the send\r
-*      queue of a queue pair.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_bind_wr {\r
-       uint64_t wr_id;\r
-       ib_send_opt_t send_opt;\r
-       ib_mr_handle_t h_mr;\r
-       ib_access_t access_ctrl;\r
-       uint32_t current_rkey;\r
-       ib_local_ds_t local_ds;\r
-} ib_bind_wr_t;\r
-/*\r
-* FIELDS\r
-*      wr_id\r
-*              A 64-bit work request identifier that is returned to the consumer\r
-*              as part of the work completion.\r
-*\r
-*      send_opt\r
-*              Optional send control parameters.\r
-*\r
-*      h_mr\r
-*              Handle to the memory region to which this window is being bound.\r
-*\r
-*      access_ctrl\r
-*              Access rights for this memory window.\r
-*\r
-*      current_rkey\r
-*              The current rkey assigned to this window for remote access.\r
-*\r
-*      local_ds\r
-*              A reference to a local data segment used by the bind operation.\r
-*\r
-* SEE ALSO\r
-*      ib_send_opt_t, ib_access_t, ib_local_ds_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_wc_status_t\r
-* NAME\r
-*      ib_wc_status_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates the status of a completed work request.  These VALUES are\r
-*      returned to the user when retrieving completions.  Note that success is\r
-*      identified as IB_WCS_SUCCESS, which is always zero.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_wc_status_t {\r
-       IB_WCS_SUCCESS,\r
-       IB_WCS_LOCAL_LEN_ERR,\r
-       IB_WCS_LOCAL_OP_ERR,\r
-       IB_WCS_LOCAL_EEC_OP_ERR,\r
-       IB_WCS_LOCAL_PROTECTION_ERR,\r
-       IB_WCS_WR_FLUSHED_ERR,\r
-       IB_WCS_MEM_WINDOW_BIND_ERR,\r
-       IB_WCS_REM_ACCESS_ERR,\r
-       IB_WCS_REM_OP_ERR,\r
-       IB_WCS_RNR_RETRY_ERR,\r
-       IB_WCS_TIMEOUT_RETRY_ERR,\r
-       IB_WCS_REM_INVALID_REQ_ERR,\r
-       IB_WCS_REM_INVALID_RD_REQ_ERR,\r
-       IB_WCS_INVALID_EECN,\r
-       IB_WCS_INVALID_EEC_STATE,\r
-       IB_WCS_UNMATCHED_RESPONSE,      /* InfiniBand Access Layer */\r
-       IB_WCS_CANCELED,        /* InfiniBand Access Layer */\r
-       IB_WCS_UNKNOWN          /* Must be last. */\r
-} ib_wc_status_t;\r
-/*\r
-* VALUES\r
-*      IB_WCS_SUCCESS\r
-*              Work request completed successfully.\r
-*\r
-*      IB_WCS_MAD\r
-*              The completed work request was associated with a managmenet datagram\r
-*              that requires post processing.  The MAD will be returned to the user\r
-*              through a callback once all post processing has completed.\r
-*\r
-*      IB_WCS_LOCAL_LEN_ERR\r
-*              Generated for a work request posted to the send queue when the\r
-*              total of the data segment lengths exceeds the message length of the\r
-*              channel.  Generated for a work request posted to the receive queue when\r
-*              the total of the data segment lengths is too small for a\r
-*              valid incoming message.\r
-*\r
-*      IB_WCS_LOCAL_OP_ERR\r
-*              An internal QP consistency error was generated while processing this\r
-*              work request.  This may indicate that the QP was in an incorrect state\r
-*              for the requested operation.\r
-*\r
-*      IB_WCS_LOCAL_EEC_OP_ERR\r
-*              An internal EEC consistency error was generated while processing\r
-*              this work request.  This may indicate that the EEC was in an incorrect\r
-*              state for the requested operation.\r
-*\r
-*      IB_WCS_LOCAL_PROTECTION_ERR\r
-*              The data segments of the locally posted work request did not refer to\r
-*              a valid memory region.  The memory may not have been properly\r
-*              registered for the requested operation.\r
-*\r
-*      IB_WCS_WR_FLUSHED_ERR\r
-*              The work request was flushed from the QP before being completed.\r
-*\r
-*      IB_WCS_MEM_WINDOW_BIND_ERR\r
-*              A memory window bind operation failed due to insufficient access\r
-*              rights.\r
-*\r
-*      IB_WCS_REM_ACCESS_ERR,\r
-*              A protection error was detected at the remote node for a RDMA or atomic\r
-*              operation.\r
-*\r
-*      IB_WCS_REM_OP_ERR,\r
-*              The operation could not be successfully completed at the remote node.\r
-*              This may indicate that the remote QP was in an invalid state or\r
-*              contained an invalid work request.\r
-*\r
-*      IB_WCS_RNR_RETRY_ERR,\r
-*              The RNR retry count was exceeded while trying to send this message.\r
-*\r
-*      IB_WCS_TIMEOUT_RETRY_ERR\r
-*              The local transport timeout counter expired while trying to send this\r
-*              message.\r
-*\r
-*      IB_WCS_REM_INVALID_REQ_ERR,\r
-*              The remote node detected an invalid message on the channel.  This error\r
-*              is usually a result of one of the following:\r
-*                      - The operation was not supported on receive queue.\r
-*                      - There was insufficient buffers to receive a new RDMA request.\r
-*                      - There was insufficient buffers to receive a new atomic operation.\r
-*                      - An RDMA request was larger than 2^31 bytes.\r
-*\r
-*      IB_WCS_REM_INVALID_RD_REQ_ERR,\r
-*              Responder detected an invalid RD message.  This may be the result of an\r
-*              invalid qkey or an RDD mismatch.\r
-*\r
-*      IB_WCS_INVALID_EECN\r
-*              An invalid EE context number was detected.\r
-*\r
-*      IB_WCS_INVALID_EEC_STATE\r
-*              The EEC was in an invalid state for the specified request.\r
-*\r
-*      IB_WCS_UNMATCHED_RESPONSE\r
-*              A response MAD was received for which there was no matching send.  The\r
-*              send operation may have been canceled by the user or may have timed\r
-*              out.\r
-*\r
-*      IB_WCS_CANCELED\r
-*              The completed work request was canceled by the user.\r
-*****/\r
-\r
-OSM_EXPORT const char *ib_wc_status_str[];\r
-\r
-/****f* IBA Base: Types/ib_get_wc_status_str\r
-* NAME\r
-*      ib_get_wc_status_str\r
-*\r
-* DESCRIPTION\r
-*      Returns a string for the specified work completion status.\r
-*\r
-* SYNOPSIS\r
-*/\r
-static inline const char *OSM_API\r
-ib_get_wc_status_str(IN ib_wc_status_t wc_status)\r
-{\r
-       if (wc_status > IB_WCS_UNKNOWN)\r
-               wc_status = IB_WCS_UNKNOWN;\r
-       return (ib_wc_status_str[wc_status]);\r
-}\r
-\r
-/*\r
-* PARAMETERS\r
-*      wc_status\r
-*              [in] work completion status value\r
-*\r
-* RETURN VALUES\r
-*      Pointer to the work completion status description string.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
-*********/\r
-\r
-/****d* Access Layer/ib_wc_type_t\r
-* NAME\r
-*      ib_wc_type_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates the type of work completion.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef enum _ib_wc_type_t {\r
-       IB_WC_SEND,\r
-       IB_WC_RDMA_WRITE,\r
-       IB_WC_RECV,\r
-       IB_WC_RDMA_READ,\r
-       IB_WC_MW_BIND,\r
-       IB_WC_FETCH_ADD,\r
-       IB_WC_COMPARE_SWAP,\r
-       IB_WC_RECV_RDMA_WRITE\r
-} ib_wc_type_t;\r
-/*****/\r
-\r
-/****d* Access Layer/ib_recv_opt_t\r
-* NAME\r
-*      ib_recv_opt_t\r
-*\r
-* DESCRIPTION\r
-*      Indicates optional fields valid in a receive work completion.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_recv_opt_t;\r
-#define        IB_RECV_OPT_IMMEDIATE           0x00000001\r
-#define IB_RECV_OPT_FORWARD            0x00000002\r
-#define IB_RECV_OPT_GRH_VALID          0x00000004\r
-#define IB_RECV_OPT_VEND_MASK          0xFFFF0000\r
-/*\r
-* VALUES\r
-*      IB_RECV_OPT_IMMEDIATE\r
-*              Indicates that immediate data is valid for this work completion.\r
-*\r
-*      IB_RECV_OPT_FORWARD\r
-*              Indicates that the received trap should be forwarded to the SM.\r
-*\r
-*      IB_RECV_OPT_GRH_VALID\r
-*              Indicates presence of the global route header. When set, the\r
-*              first 40 bytes received are the GRH.\r
-*\r
-*      IB_RECV_OPT_VEND_MASK\r
-*              This mask indicates bits reserved in the receive options that may be\r
-*              used by the verbs provider to indicate vendor specific options.  Bits\r
-*              set in this area of the receive options are ignored by the Access Layer,\r
-*              but may have specific meaning to the underlying VPD.\r
-*****/\r
-\r
-/****s* Access Layer/ib_wc_t\r
-* NAME\r
-*      ib_wc_t\r
-*\r
-* DESCRIPTION\r
-*      Work completion information.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_wc {\r
-       struct _ib_wc *p_next;\r
-       uint64_t wr_id;\r
-       ib_wc_type_t wc_type;\r
-       uint32_t length;\r
-       ib_wc_status_t status;\r
-       uint64_t vendor_specific;\r
-       union _wc_recv {\r
-               struct _wc_conn {\r
-                       ib_recv_opt_t recv_opt;\r
-                       ib_net32_t immediate_data;\r
-               } conn;\r
-               struct _wc_ud {\r
-                       ib_recv_opt_t recv_opt;\r
-                       ib_net32_t immediate_data;\r
-                       ib_net32_t remote_qp;\r
-                       uint16_t pkey_index;\r
-                       ib_net16_t remote_lid;\r
-                       uint8_t remote_sl;\r
-                       uint8_t path_bits;\r
-               } ud;\r
-               struct _wc_rd {\r
-                       ib_net32_t remote_eecn;\r
-                       ib_net32_t remote_qp;\r
-                       ib_net16_t remote_lid;\r
-                       uint8_t remote_sl;\r
-                       uint32_t free_cnt;\r
-\r
-               } rd;\r
-               struct _wc_raw_ipv6 {\r
-                       ib_net16_t remote_lid;\r
-                       uint8_t remote_sl;\r
-                       uint8_t path_bits;\r
-               } raw_ipv6;\r
-               struct _wc_raw_ether {\r
-                       ib_net16_t remote_lid;\r
-                       uint8_t remote_sl;\r
-                       uint8_t path_bits;\r
-                       ib_net16_t ether_type;\r
-               } raw_ether;\r
-       } recv;\r
-} ib_wc_t;\r
-/*\r
-* FIELDS\r
-*      p_next\r
-*              A pointer used to chain work completions.  This permits multiple\r
-*              work completions to be retrieved from a completion queue through a\r
-*              single function call.  This value is set to NULL to mark the end of\r
-*              the chain.\r
-*\r
-*      wr_id\r
-*              The 64-bit work request identifier that was specified when posting the\r
-*              work request.\r
-*\r
-*      wc_type\r
-*              Indicates the type of work completion.\r
-*\r
-*\r
-*      length\r
-*              The total length of the data sent or received with the work request.\r
-*\r
-*      status\r
-*              The result of the work request.\r
-*\r
-*      vendor_specific\r
-*              HCA vendor specific information returned as part of the completion.\r
-*\r
-*      recv.conn.recv_opt\r
-*              Indicates optional fields valid as part of a work request that\r
-*              completed on a connected (reliable or unreliable) queue pair.\r
-*\r
-*      recv.conn.immediate_data\r
-*              32-bit field received as part of an inbound message on a connected\r
-*              queue pair.  This field is only valid if the recv_opt flag\r
-*              IB_RECV_OPT_IMMEDIATE has been set.\r
-*\r
-*      recv.ud.recv_opt\r
-*              Indicates optional fields valid as part of a work request that\r
-*              completed on an unreliable datagram queue pair.\r
-*\r
-*      recv.ud.immediate_data\r
-*              32-bit field received as part of an inbound message on a unreliable\r
-*              datagram queue pair.  This field is only valid if the recv_opt flag\r
-*              IB_RECV_OPT_IMMEDIATE has been set.\r
-*\r
-*      recv.ud.remote_qp\r
-*              Identifies the source queue pair of a received datagram.\r
-*\r
-*      recv.ud.pkey_index\r
-*              The pkey index for the source queue pair. This is valid only for\r
-*              GSI type QP's.\r
-*\r
-*      recv.ud.remote_lid\r
-*              The source LID of the received datagram.\r
-*\r
-*      recv.ud.remote_sl\r
-*              The service level used by the source of the received datagram.\r
-*\r
-*      recv.ud.path_bits\r
-*              path bits...\r
-*\r
-*      recv.rd.remote_eecn\r
-*              The remote end-to-end context number that sent the received message.\r
-*\r
-*      recv.rd.remote_qp\r
-*              Identifies the source queue pair of a received message.\r
-*\r
-*      recv.rd.remote_lid\r
-*              The source LID of the received message.\r
-*\r
-*      recv.rd.remote_sl\r
-*              The service level used by the source of the received message.\r
-*\r
-*      recv.rd.free_cnt\r
-*              The number of available entries in the completion queue.  Reliable\r
-*              datagrams may complete out of order, so this field may be used to\r
-*              determine the number of additional completions that may occur.\r
-*\r
-*      recv.raw_ipv6.remote_lid\r
-*              The source LID of the received message.\r
-*\r
-*      recv.raw_ipv6.remote_sl\r
-*              The service level used by the source of the received message.\r
-*\r
-*      recv.raw_ipv6.path_bits\r
-*              path bits...\r
-*\r
-*      recv.raw_ether.remote_lid\r
-*              The source LID of the received message.\r
-*\r
-*      recv.raw_ether.remote_sl\r
-*              The service level used by the source of the received message.\r
-*\r
-*      recv.raw_ether.path_bits\r
-*              path bits...\r
-*\r
-*      recv.raw_ether.ether_type\r
-*              ether type...\r
-* NOTES\r
-*      When the work request completes with error, the only values that the\r
-*      consumer can depend on are the wr_id field, and the status of the\r
-*      operation.\r
-*\r
-*      If the consumer is using the same CQ for completions from more than\r
-*      one type of QP (i.e Reliable Connected, Datagram etc), then the consumer\r
-*      must have additional information to decide what fields of the union are\r
-*      valid.\r
-* SEE ALSO\r
-*      ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_mr_create_t\r
-* NAME\r
-*      ib_mr_create_t\r
-*\r
-* DESCRIPTION\r
-*      Information required to create a registered memory region.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_mr_create {\r
-       void *vaddr;\r
-       uint64_t length;\r
-       ib_access_t access_ctrl;\r
-} ib_mr_create_t;\r
-/*\r
-* FIELDS\r
-*      vaddr\r
-*              Starting virtual address of the region being registered.\r
-*\r
-*      length\r
-*              Length of the buffer to register.\r
-*\r
-*      access_ctrl\r
-*              Access rights of the registered region.\r
-*\r
-* SEE ALSO\r
-*      ib_access_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_phys_create_t\r
-* NAME\r
-*      ib_phys_create_t\r
-*\r
-* DESCRIPTION\r
-*      Information required to create a physical memory region.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_phys_create {\r
-       uint64_t length;\r
-       uint32_t num_bufs;\r
-       uint64_t *buf_array;\r
-       uint32_t buf_offset;\r
-       uint32_t page_size;\r
-       ib_access_t access_ctrl;\r
-} ib_phys_create_t;\r
-/*\r
-*      length\r
-*              The length of the memory region in bytes.\r
-*\r
-*      num_bufs\r
-*              Number of buffers listed in the specified buffer array.\r
-*\r
-*      buf_array\r
-*              An array of physical buffers to be registered as a single memory\r
-*              region.\r
-*\r
-*      buf_offset\r
-*              The offset into the first physical page of the specified memory\r
-*              region to start the virtual address.\r
-*\r
-*      page_size\r
-*              The physical page size of the memory being registered.\r
-*\r
-*      access_ctrl\r
-*              Access rights of the registered region.\r
-*\r
-* SEE ALSO\r
-*      ib_access_t\r
-*****/\r
-\r
-/****s* Access Layer/ib_mr_attr_t\r
-* NAME\r
-*      ib_mr_attr_t\r
-*\r
-* DESCRIPTION\r
-*      Attributes of a registered memory region.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_mr_attr {\r
-       ib_pd_handle_t h_pd;\r
-       void *local_lb;\r
-       void *local_ub;\r
-       void *remote_lb;\r
-       void *remote_ub;\r
-       ib_access_t access_ctrl;\r
-       uint32_t lkey;\r
-       uint32_t rkey;\r
-} ib_mr_attr_t;\r
-/*\r
-* DESCRIPTION\r
-*      h_pd\r
-*              Handle to the protection domain for this memory region.\r
-*\r
-*      local_lb\r
-*              The virtual address of the lower bound of protection for local\r
-*              memory access.\r
-*\r
-*      local_ub\r
-*              The virtual address of the upper bound of protection for local\r
-*              memory access.\r
-*\r
-*      remote_lb\r
-*              The virtual address of the lower bound of protection for remote\r
-*              memory access.\r
-*\r
-*      remote_ub\r
-*              The virtual address of the upper bound of protection for remote\r
-*              memory access.\r
-*\r
-*      access_ctrl\r
-*              Access rights for the specified memory region.\r
-*\r
-*      lkey\r
-*              The lkey associated with this memory region.\r
-*\r
-*      rkey\r
-*              The rkey associated with this memory region.\r
-*\r
-* NOTES\r
-*      The remote_lb, remote_ub, and rkey are only valid if remote memory access\r
-*      is enabled for this memory region.\r
-*\r
-* SEE ALSO\r
-*      ib_access_t\r
-*****/\r
-\r
-/****d* Access Layer/ib_ca_mod_t\r
-* NAME\r
-*      ib_ca_mod_t -- Modify port attributes and error counters\r
-*\r
-* DESCRIPTION\r
-*      Specifies modifications to the port attributes of a channel adapter.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_ca_mod_t;\r
-#define IB_CA_MOD_IS_CM_SUPPORTED              0x00000001\r
-#define IB_CA_MOD_IS_SNMP_SUPPORTED            0x00000002\r
-#define        IB_CA_MOD_IS_DEV_MGMT_SUPPORTED         0x00000004\r
-#define        IB_CA_MOD_IS_VEND_SUPPORTED             0x00000008\r
-#define        IB_CA_MOD_IS_SM                         0x00000010\r
-#define IB_CA_MOD_IS_SM_DISABLED               0x00000020\r
-#define IB_CA_MOD_QKEY_CTR                     0x00000040\r
-#define IB_CA_MOD_PKEY_CTR                     0x00000080\r
-#define IB_CA_MOD_IS_NOTICE_SUPPORTED          0x00000100\r
-#define IB_CA_MOD_IS_TRAP_SUPPORTED            0x00000200\r
-#define IB_CA_MOD_IS_APM_SUPPORTED             0x00000400\r
-#define IB_CA_MOD_IS_SLMAP_SUPPORTED           0x00000800\r
-#define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED      0x00001000\r
-#define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED      0x00002000\r
-#define IB_CA_MOD_IS_SYSGUID_SUPPORTED         0x00004000\r
-#define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED       0x00008000\r
-#define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED       0x00010000\r
-#define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED     0x00020000\r
-#define IB_CA_MOD_IS_REINIT_SUPORTED           0x00040000\r
-#define IB_CA_MOD_IS_LEDINFO_SUPPORTED         0x00080000\r
-#define IB_CA_MOD_SHUTDOWN_PORT                        0x00100000\r
-#define IB_CA_MOD_INIT_TYPE_VALUE              0x00200000\r
-#define IB_CA_MOD_SYSTEM_IMAGE_GUID            0x00400000\r
-/*\r
-* VALUES\r
-*      IB_CA_MOD_IS_CM_SUPPORTED\r
-*              Indicates if there is a communication manager accessible through\r
-*              the port.\r
-*\r
-*      IB_CA_MOD_IS_SNMP_SUPPORTED\r
-*              Indicates if there is an SNMP agent accessible through the port.\r
-*\r
-*      IB_CA_MOD_IS_DEV_MGMT_SUPPORTED\r
-*              Indicates if there is a device management agent accessible\r
-*              through the port.\r
-*\r
-*      IB_CA_MOD_IS_VEND_SUPPORTED\r
-*              Indicates if there is a vendor supported agent accessible\r
-*              through the port.\r
-*\r
-*      IB_CA_MOD_IS_SM\r
-*              Indicates if there is a subnet manager accessible through\r
-*              the port.\r
-*\r
-*      IB_CA_MOD_IS_SM_DISABLED\r
-*              Indicates if the port has been disabled for configuration by the\r
-*              subnet manager.\r
-*\r
-*      IB_CA_MOD_QKEY_CTR\r
-*              Used to reset the qkey violation counter associated with the\r
-*              port.\r
-*\r
-*      IB_CA_MOD_PKEY_CTR\r
-*              Used to reset the pkey violation counter associated with the\r
-*              port.\r
-*\r
-*      IB_CA_MOD_IS_NOTICE_SUPPORTED\r
-*              Indicates that this CA supports ability to generate Notices for\r
-*              Port State changes. (only applicable to switches)\r
-*\r
-*      IB_CA_MOD_IS_TRAP_SUPPORTED\r
-*              Indicates that this management port supports ability to generate\r
-*              trap messages. (only applicable to switches)\r
-*\r
-*      IB_CA_MOD_IS_APM_SUPPORTED\r
-*              Indicates that this port is capable of performing Automatic\r
-*              Path Migration.\r
-*\r
-*      IB_CA_MOD_IS_SLMAP_SUPPORTED\r
-*              Indicates this port supports SLMAP capability.\r
-*\r
-*      IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED\r
-*              Indicates that PKEY is supported in NVRAM\r
-*\r
-*      IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED\r
-*              Indicates that MKEY is supported in NVRAM\r
-*\r
-*      IB_CA_MOD_IS_SYSGUID_SUPPORTED\r
-*              Indicates System Image GUID support.\r
-*\r
-*      IB_CA_MOD_IS_DR_NOTICE_SUPPORTED\r
-*              Indicate support for generating Direct Routed Notices\r
-*\r
-*      IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED\r
-*              Indicates support for Boot Management\r
-*\r
-*      IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED\r
-*              Indicates capability to generate notices for changes to CAPMASK\r
-*\r
-*      IB_CA_MOD_IS_REINIT_SUPORTED\r
-*              Indicates type of node init supported. Refer to Chapter 14 for\r
-*              Initialization actions.\r
-*\r
-*      IB_CA_MOD_IS_LEDINFO_SUPPORTED\r
-*              Indicates support for LED info.\r
-*\r
-*      IB_CA_MOD_SHUTDOWN_PORT\r
-*              Used to modify the port active indicator.\r
-*\r
-*      IB_CA_MOD_INIT_TYPE_VALUE\r
-*              Used to modify the init_type value for the port.\r
-*\r
-*      IB_CA_MOD_SYSTEM_IMAGE_GUID\r
-*              Used to modify the system image GUID for the port.\r
-*****/\r
-\r
-/****d* Access Layer/ib_mr_mod_t\r
-* NAME\r
-*      ib_mr_mod_t\r
-*\r
-* DESCRIPTION\r
-*      Mask used to specify which attributes of a registered memory region are\r
-*      being modified.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef uint32_t ib_mr_mod_t;\r
-#define IB_MR_MOD_ADDR                                 0x00000001\r
-#define IB_MR_MOD_PD                                   0x00000002\r
-#define IB_MR_MOD_ACCESS                               0x00000004\r
-/*\r
-* PARAMETERS\r
-*      IB_MEM_MOD_ADDR\r
-*              The address of the memory region is being modified.\r
-*\r
-*      IB_MEM_MOD_PD\r
-*              The protection domain associated with the memory region is being\r
-*              modified.\r
-*\r
-*      IB_MEM_MOD_ACCESS\r
-*              The access rights the memory region are being modified.\r
-*****/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER\r
-* NAME\r
-*      IB_SMINFO_ATTR_MOD_HANDOVER\r
-*\r
-* DESCRIPTION\r
-*      Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_ATTR_MOD_HANDOVER            (CL_HTON32(0x000001))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE\r
-* NAME\r
-*      IB_SMINFO_ATTR_MOD_ACKNOWLEDGE\r
-*\r
-* DESCRIPTION\r
-*      Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE         (CL_HTON32(0x000002))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE\r
-* NAME\r
-*      IB_SMINFO_ATTR_MOD_DISABLE\r
-*\r
-* DESCRIPTION\r
-*      Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_ATTR_MOD_DISABLE                     (CL_HTON32(0x000003))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY\r
-* NAME\r
-*      IB_SMINFO_ATTR_MOD_STANDBY\r
-*\r
-* DESCRIPTION\r
-*      Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_ATTR_MOD_STANDBY                     (CL_HTON32(0x000004))\r
-/**********/\r
-\r
-/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER\r
-* NAME\r
-*      IB_SMINFO_ATTR_MOD_DISCOVER\r
-*\r
-* DESCRIPTION\r
-*      Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
-*\r
-* SOURCE\r
-*/\r
-#define IB_SMINFO_ATTR_MOD_DISCOVER                    (CL_HTON32(0x000005))\r
-/**********/\r
-\r
-/****s* Access Layer/ib_ci_op_t\r
-* NAME\r
-*      ib_ci_op_t\r
-*\r
-* DESCRIPTION\r
-*      A structure used for vendor specific CA interface communication.\r
-*\r
-* SYNOPSIS\r
-*/\r
-typedef struct _ib_ci_op {\r
-       IN uint32_t command;\r
-       IN OUT void *p_buf OPTIONAL;\r
-       IN uint32_t buf_size;\r
-       IN OUT uint32_t num_bytes_ret;\r
-       IN OUT int32_t status;\r
-} ib_ci_op_t;\r
-/*\r
-* FIELDS\r
-*      command\r
-*              A command code that is understood by the verbs provider.\r
-*\r
-*      p_buf\r
-*              A reference to a buffer containing vendor specific data.  The verbs\r
-*              provider must not access pointers in the p_buf between user-mode and\r
-*              kernel-mode.  Any pointers embedded in the p_buf are invalidated by\r
-*              the user-mode/kernel-mode transition.\r
-*\r
-*      buf_size\r
-*              The size of the buffer in bytes.\r
-*\r
-*      num_bytes_ret\r
-*              The size in bytes of the vendor specific data returned in the buffer.\r
-*              This field is set by the verbs provider.  The verbs provider should\r
-*              verify that the buffer size is sufficient to hold the data being\r
-*              returned.\r
-*\r
-*      status\r
-*              The completion status from the verbs provider.  This field should be\r
-*              initialize to indicate an error to allow detection and cleanup in\r
-*              case a communication error occurs between user-mode and kernel-mode.\r
-*\r
-* NOTES\r
-*      This structure is provided to allow the exchange of vendor specific\r
-*      data between the originator and the verbs provider.  Users of this\r
-*      structure are expected to know the format of data in the p_buf based\r
-*      on the structure command field or the usage context.\r
-*****/\r
-\r
-END_C_DECLS\r
-#else                          /* ndef __WIN__ */\r
-#include <iba/ib_types_extended.h>\r
-#endif\r
-#endif                         /* __IB_TYPES_H__ */\r
index 64c635d4eb009274bda6191cad96455572a4fc14..6f34f848b1a0dc39c700e928bbc4e7db4d448fc6 100644 (file)
@@ -192,14 +192,13 @@ BEGIN_C_DECLS
 *\r
 * DESCRIPTION\r
 *      Specifies the default cache directory for the db files.\r
-*      Note that the directory must appear with "/" ("\\" for windows) at the end.\r
 *\r
 * SYNOPSIS\r
 */\r
 #ifdef __WIN__\r
-#define OSM_DEFAULT_CACHE_DIR "%TEMP%\\"\r
+#define OSM_DEFAULT_CACHE_DIR OPENSM_CONFIG_DIR\r
 #else\r
-#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm/"\r
+#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm"\r
 #endif\r
 /***********/\r
 /****d* OpenSM: Base/OSM_DEFAULT_LOG_FILE\r
@@ -212,7 +211,7 @@ BEGIN_C_DECLS
 * SYNOPSIS\r
 */\r
 #ifdef __WIN__\r
-#define OSM_DEFAULT_LOG_FILE "%TEMP%\\osm.log"\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
@@ -227,15 +226,13 @@ BEGIN_C_DECLS
 *\r
 * SYNOPSIS\r
 */\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_CONFIG_FILE "%TEMP%\\opensm.conf"\r
-#elif defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE)\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 /* __WIN__ */\r
+#endif\r
 /***********/\r
 \r
 /****d* OpenSM: Base/OSM_DEFAULT_PARTITION_CONFIG_FILE\r
@@ -247,15 +244,13 @@ BEGIN_C_DECLS
 *\r
 * SYNOPSIS\r
 */\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_PARTITION_CONFIG_FILE "%TEMP%\\osm-partitions.conf"\r
-#elif defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE)\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 /* __WIN__ */\r
+#endif\r
 /***********/\r
 \r
 /****d* OpenSM: Base/OSM_DEFAULT_QOS_POLICY_FILE\r
@@ -267,15 +262,13 @@ BEGIN_C_DECLS
 *\r
 * SYNOPSIS\r
 */\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_QOS_POLICY_FILE "%TEMP%\\osm-qos-policy.conf"\r
-#elif defined(HAVE_DEFAULT_QOS_POLICY_FILE)\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 /* __WIN__ */\r
+#endif\r
 /***********/\r
 \r
 /****d* OpenSM: Base/OSM_DEFAULT_PREFIX_ROUTES_FILE\r
@@ -287,9 +280,7 @@ BEGIN_C_DECLS
 *\r
 * SYNOPSIS\r
 */\r
-#ifdef __WIN__\r
-#define OSM_DEFAULT_PREFIX_ROUTES_FILE "%TEMP%\\osm-prefix-routes.conf"\r
-#elif defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE)\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
@@ -668,7 +659,7 @@ typedef enum _osm_thread_state {
 /***********/\r
 \r
 /*\r
- * OSM_CAP are from Table 117 and C15-0.1.7 Table 186\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
index 4a6daf43faa5a9f2abf14ecb7b98ed1a9153605d..2b94098953bdffbb362e3a747e25be3e6ad0d0c9 100644 (file)
 /* 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 "%TEMP%\\ib-node-name-map"\r
+#define HAVE_DEFAULT_NODENAME_MAP OPENSM_CONFIG_DIR "\\ib-node-name-map"\r
 \r
 /* Define a default OpenSM config file */\r
-#undef HAVE_DEFAULT_OPENSM_CONFIG_FILE\r
+#define HAVE_DEFAULT_OPENSM_CONFIG_FILE OPENSM_CONFIG_DIR "\\opensm.conf"\r
 \r
 /* Define a Partition config file */\r
-#undef HAVE_DEFAULT_PARTITION_CONFIG_FILE\r
+#define HAVE_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "\\partitions.conf"\r
 \r
 /* Define a Prefix Routes config file */\r
-#undef HAVE_DEFAULT_PREFIX_ROUTES_FILE\r
+#define HAVE_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "\\prefix-routes.conf"\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
+#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
index 5550a67b95b7eebc1dec6bf354ba223626563323..1ba26593cccdaebc5f99789e733a64226e8fe849 100644 (file)
@@ -142,8 +142,8 @@ typedef struct osm_event_plugin {
        const char *osm_version;\r
        void *(*create) (struct osm_opensm *osm);\r
        void (*delete) (void *plugin_data);\r
-       void (*report) (void *plugin_data,\r
-                       osm_epi_event_id_t event_id, void *event_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
index 93acdcbba2b39799278e7b741ff9db0064715d4b..b115e91873bb4cb7917df96046a346bc1f9d8e46 100644 (file)
@@ -120,6 +120,7 @@ typedef struct osm_log {
        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
index 55f65288717d207534c78c7a2882ac3f8e7d6349..9f65f13977fba8eac49acb46c9ea99d7f730be32 100644 (file)
@@ -76,7 +76,7 @@ typedef struct osm_mcast_fwdbl {
        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];\r
+       uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];\r
 } osm_mcast_tbl_t;\r
 /*\r
 * FIELDS\r
@@ -106,7 +106,7 @@ typedef struct osm_mcast_fwdbl {
 *\r
 *      p_mask_tbl\r
 *              Pointer to a two dimensional array of port_masks for this switch.\r
-*              The first dimension is MLID, the second dimension is mask position.\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
index 144685e75f541d93c5b462d165d537e1747b1e90..c869342b59498fff46e1bb1f58208984fb7ae931 100644 (file)
@@ -97,8 +97,8 @@ BEGIN_C_DECLS
 */\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
-       osm_mtree_node_t *p_root;\r
        cl_qmap_t mcm_port_tbl;\r
        ib_member_rec_t mcmember_rec;\r
        boolean_t well_known;\r
@@ -109,15 +109,13 @@ typedef struct osm_mgrp {
 *      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
-*      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
 *      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
@@ -133,56 +131,66 @@ typedef struct osm_mgrp {
 * SEE ALSO\r
 *********/\r
 \r
-/****f* OpenSM: Multicast Group/osm_mgrp_new\r
+/****s* OpenSM: Multicast Group/osm_mgrp_box_t\r
 * NAME\r
-*      osm_mgrp_new\r
+*      osm_mgrp_box_t\r
 *\r
 * DESCRIPTION\r
-*      Allocates and initializes a Multicast Group for use.\r
+*      Multicast structure which holds all multicast groups with same MLID.\r
 *\r
 * SYNOPSIS\r
 */\r
-osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr);\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
-* PARAMETERS\r
+* FIELDS\r
 *      mlid\r
-*              [in] Multicast LID for this multicast group.\r
-*\r
-*      mcmr\r
-*              [in] MCMember Record for this multicast group.\r
+*              The host ordered LID of this Multicast Group (must be\r
+*              >= 0xC000).\r
 *\r
-* RETURN VALUES\r
-*      IB_SUCCESS if initialization was successful.\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
-* NOTES\r
-*      Allows calling other Multicast Group methods.\r
+*      mgrp_list\r
+*              List of multicast groups (mpgr object) having same MLID value.\r
 *\r
 * SEE ALSO\r
-*      Multicast Group, osm_mgrp_delete\r
 *********/\r
 \r
-/****f* OpenSM: Multicast Group/osm_mgrp_delete\r
+/****f* OpenSM: Multicast Group/osm_mgrp_new\r
 * NAME\r
-*      osm_mgrp_delete\r
+*      osm_mgrp_new\r
 *\r
 * DESCRIPTION\r
-*      Destroys and deallocates a Multicast Group.\r
+*      Allocates and initializes a Multicast Group for use.\r
 *\r
 * SYNOPSIS\r
 */\r
-void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp);\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
-*      p_mgrp\r
-*              [in] Pointer to an osm_mgrp_t object.\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
-*      None.\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_new\r
+*      Multicast Group, osm_mgrp_delete\r
 *********/\r
 \r
 /****f* OpenSM: Multicast Group/osm_mgrp_is_guid\r
@@ -375,6 +383,7 @@ void osm_mgrp_delete_port(IN osm_subn_t * subn, IN osm_log_t * log,
 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
index 869fce43fd6ab0e0706c013f0027b0ea2dca7346..201802b91afa9be993d58d7fb73f4c2a28be8ffc 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -48,6 +48,7 @@
 #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
@@ -92,8 +93,8 @@ BEGIN_C_DECLS
 typedef struct osm_prtn {\r
        cl_map_item_t map_item;\r
        ib_net16_t pkey;\r
-       ib_net16_t mlid;\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
@@ -106,13 +107,13 @@ typedef struct osm_prtn {
 *      pkey\r
 *              The IBA defined P_KEY of this Partition.\r
 *\r
-*      mlid\r
-*              The network ordered LID of the well known Multicast Group\r
-*              that was created for 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
index d9d1425adcdf008ed25f48a04aeb174c4762a84d..28d4fa8d70cf65405b1ee622fc6d0201dea4461a 100644 (file)
@@ -1,4 +1,5 @@
 /*\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
@@ -211,9 +212,9 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl);
 *\r
 *********/\r
 \r
-/****f* OpenSM: osm_pkey_get_num_blocks\r
+/****f* OpenSM: osm_pkey_tbl_get_num_blocks\r
 * NAME\r
-*  osm_pkey_get_num_blocks\r
+*  osm_pkey_tbl_get_num_blocks\r
 *\r
 * DESCRIPTION\r
 *  Obtain the number of blocks in IB PKey table\r
index ed042be68058c8fa14f6bd8fd229b1f6d9a346c1..b59995865aabf3284e3b8436f73dd1f329f1fe51 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index 304a79b36f23ca7bb085b54ebe0c2af3bd3ba325..ba08b10519376a70c6d1c8916beec072e4dc1d86 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index 5cfa482dc3c92d91b82da9b71a1e97d96db0283c..864ed91c77cbcb57b13c9e2c2cd3784adff40218 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index 774e67d0dbafdcef5f39bb1a6d650406aa1b52f9..722e601567015532a6dc66f1f4edcf474102ef72 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index a35db6b6f79ff4159a66dba92d1088f30b4ec992..ccaddd24e86a5e70418a84b62eaf5f1e254d998f 100644 (file)
@@ -125,6 +125,7 @@ typedef struct osm_sa {
        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
@@ -178,6 +179,10 @@ typedef struct osm_sa {
 *      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
@@ -431,7 +436,9 @@ int osm_sa_db_file_dump(struct osm_opensm *p_osm);
 *              [in] Pointer to an osm_opensm_t object.\r
 *\r
 * RETURN VALUES\r
-*      None\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
@@ -484,7 +491,5 @@ osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa, IN ib_net64_t comp_mask,
 *\r
 *********/\r
 \r
-osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid);\r
-\r
 END_C_DECLS\r
 #endif                         /* _OSM_SA_H_ */\r
index 8c256a4418310b995b3d4484a7caf3174f23a0bf..eeff0d518b0f0cc87e91123411d25c80aabfaf34 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index 4e9ddf44335679c88eebbef32d0fb4caa5fae71b..94079f1c79fd0377878e459906b7be6fd6a65c7b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. 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
@@ -186,6 +186,7 @@ typedef struct osm_subn_opt {
        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
@@ -200,12 +201,14 @@ typedef struct osm_subn_opt {
        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
@@ -221,8 +224,10 @@ typedef struct osm_subn_opt {
        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
@@ -374,8 +379,8 @@ typedef struct osm_subn_opt {
 *\r
 *      connect_roots\r
 *              The option which will enforce root to root connectivity with\r
-*              up/down routing engine (even if this violates "pure" deadlock\r
-*              free up/down algorithm)\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
@@ -411,6 +416,10 @@ typedef struct osm_subn_opt {
 *      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
@@ -433,6 +442,10 @@ typedef struct osm_subn_opt {
 *      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
@@ -445,8 +458,11 @@ typedef struct osm_subn_opt {
 *       event_db_dump_file\r
 *               File to dump the event database to\r
 *\r
-*       event_db_plugin\r
-*               Specify the name of the event plugin\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
@@ -518,7 +534,7 @@ typedef struct osm_subn {
        boolean_t coming_out_of_standby;\r
        unsigned need_update;\r
        cl_fmap_t mgrp_mgid_tbl;\r
-       void *mgroups[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];\r
+       void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];\r
 } osm_subn_t;\r
 /*\r
 * FIELDS\r
@@ -643,9 +659,9 @@ typedef struct osm_subn {
 *              Container of pointers to all Multicast group objects in\r
 *              the subnet. Indexed by MGID.\r
 *\r
-*      mgroups\r
-*              Array of pointers to all Multicast Group objects in the subnet.\r
-*              Indexed by MLID offset from base MLID.\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
@@ -942,6 +958,31 @@ struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
 *      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
@@ -951,14 +992,18 @@ struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
 *\r
 * SYNOPSIS\r
 */\r
-struct osm_port *osm_get_port_by_lid(const osm_subn_t * subn, ib_net16_t lid);\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.\r
+*              [in] LID requested in network byte order.\r
 *\r
 * RETURN VALUES\r
 *      The port structure pointer if found. NULL otherwise.\r
@@ -967,67 +1012,55 @@ struct osm_port *osm_get_port_by_lid(const osm_subn_t * subn, ib_net16_t lid);
 *       Subnet object, osm_port_t\r
 *********/\r
 \r
-/****f* OpenSM: Subnet/osm_get_mgrp_by_mlid\r
+/****f* OpenSM: Subnet/osm_get_mgrp_by_mgid\r
 * NAME\r
-*      osm_get_mgrp_by_mlid\r
+*      osm_get_mgrp_by_mgid\r
 *\r
 * DESCRIPTION\r
-*      The looks for the given multicast group in the subnet table by mlid.\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
-static inline\r
-struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)\r
-{\r
-       return p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];\r
-}\r
+struct osm_mgrp *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid);\r
 /*\r
 * PARAMETERS\r
-*      p_subn\r
+*      subn\r
 *              [in] Pointer to an osm_subn_t object\r
 *\r
-*      mlid\r
-*              [in] The multicast group mlid in network order\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: Helper/osm_get_physp_by_mad_addr\r
+/****f* OpenSM: Subnet/osm_get_mbox_by_mlid\r
 * NAME\r
-*      osm_get_physp_by_mad_addr\r
+*      osm_get_mbox_by_mlid\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
+*      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
-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
+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_log\r
-*              [in] Pointer to a log object.\r
-*\r
 *      p_subn\r
-*              [in] Pointer to subnet object.\r
+*              [in] Pointer to an osm_subn_t object\r
 *\r
-*      p_mad_addr\r
-*              [in] Pointer to mad address object.\r
+*      mlid\r
+*              [in] The multicast group mlid in network order\r
 *\r
 * RETURN VALUES\r
-*      Pointer to requester physical port object if found. Null otherwise.\r
-*\r
-* NOTES\r
-*\r
-* SEE ALSO\r
+*      The multicast group structure pointer if found. NULL otherwise.\r
 *********/\r
 \r
 /****f* OpenSM: Subnet/osm_subn_set_default_opt\r
index 8b5ffd358b3f831d3dcce01a6a29fe71295b3c5b..7fe114265f253bca95f8c824d4d97852234ebc9b 100644 (file)
@@ -100,6 +100,7 @@ typedef struct osm_switch {
        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
@@ -109,6 +110,9 @@ typedef struct osm_switch {
        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
@@ -151,6 +155,15 @@ typedef struct osm_switch {
 *              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
@@ -427,37 +440,6 @@ static inline uint8_t osm_switch_get_port_by_lid(IN const osm_switch_t * p_sw,
 *      Switch object\r
 *********/\r
 \r
-/****f* OpenSM: Switch/osm_switch_get_physp_ptr\r
-* NAME\r
-*      osm_switch_get_physp_ptr\r
-*\r
-* DESCRIPTION\r
-*      Gets the Physical Port Object at the specified port number.\r
-*\r
-* SYNOPSIS\r
-*/\r
-osm_physp_t *osm_switch_get_physp_ptr(IN const osm_switch_t * p_sw,\r
-                                     IN uint32_t port_num);\r
-/*\r
-* PARAMETERS\r
-*      p_sw\r
-*              [in] Pointer to an osm_switch_t object.\r
-*\r
-*      port_num\r
-*              [in] Port number for which to retrieve the Physical Port Object.\r
-*\r
-* RETURN VALUES\r
-*      Returns a pointer to the Physical Port Object object at the specified\r
-*      port number.\r
-*      A return value of zero means the port number was out of range.\r
-*\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
@@ -890,6 +872,35 @@ static inline uint8_t osm_switch_get_mft_max_position(IN osm_switch_t * p_sw)
 * 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
index 6dbef5b3066e84842a91c4de8cb23985ebed70d2..af17bb20051521e90385b425755a6a96f5900619 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008      Mellanox Technologies LTD. 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
index 8f614085be4cbc60371e29f07122a6d1693370b1..5f354110f6689e4a56a999b096c5faf22800652e 100644 (file)
 *\r
 * SYNOPSIS\r
 */\r
-#define OSM_VERSION "OpenSM 3.3.3"\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
index a286324f1327c651b678a35cb2e077429673992e..a2dfa8f873098234db595fd0ce3d1ff976872834 100644 (file)
@@ -36,7 +36,7 @@
 /*\r
  * Abstract:\r
  *     Declaration of osm_vl15_t.\r
- *     This object represents an IBA subnet.\r
+ *     This object represents a VL15 interface object.\r
  *     This object is part of the OpenSM family of objects.\r
  */\r
 \r
index 95f802be052f2b39eed9b0a68b4ccfdf1ee9aa75..9c6a41063200ba7d04af8df9fc92c421f45d604d 100644 (file)
@@ -370,8 +370,8 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 *\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 immediatly after\r
-*      being sent.\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
index 3651911e29d06de14c0df11f80872e64bc6a2a90..2b105acd8fc4cc5d39fe40d97abfd1fda8e9d374 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -92,5 +92,8 @@ typedef struct _osm_vend_wrap {
 #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
index 625cd3b6603b6745949b8d99fc9cf431d8012c7f..7bb93432ccf5cdc9719beb4efe467b07f4358b30 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -52,8 +52,6 @@
 BEGIN_C_DECLS\r
 /* The maximum number of outstanding MADs an RMPP sender can transmit */\r
 #define OSMV_RMPP_RECV_WIN       16\r
-/* The maximum number of retransmissions of the same MAD */\r
-#define OSMV_MAX_RETRANSMIT      3\r
 /* Transaction Timeout = OSMV_TXN_TIMEOUT_FACTOR * Response Timeout */\r
 #define OSMV_TXN_TIMEOUT_FACTOR  128\r
 /************/\r
index e65eb4f8df96ae3373b9d92267dc8afa70d64439..d6325368826fa5a324251ed144378d717c10c600 100644 (file)
@@ -95,11 +95,17 @@ getopt_long_only(int argc, char *const*argv,
 #define ETIMEDOUT              (10060)\r
 #endif\r
 \r
-extern char *osm_strdup(const char *);\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
-#define openlog(a,b,c)\r
-#define closelog()\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
@@ -172,21 +178,9 @@ GetOsmCachePath(void);
 * SYNOPSIS\r
 */\r
 \r
-/* XXX STAN verify this runtime works, it doesn't...*/\r
-#if 1\r
-#define cl_item_objX(item_ptr, obj_ptr, item_field) (void *) \\r
-       ((uint8_t*)item_ptr - \\r
-               ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)&(obj_ptr)))\r
-#else\r
-#define cl_item_objX(item_ptr, obj_ptr, item_field) (void *) \\r
-       ((uint8_t*)item_ptr - \\r
-               ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)(&(obj_ptr))))\r
-#endif\r
-\r
-\r
-#define cl_item_obj(item_ptr, obj_ptr, item_field, TypeOF_Obj) TypeOF_Obj \\r
-    ((uint8_t *)item_ptr - (uint8_t *)&( TypeOF_Obj 0)->item_field)\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
index 38d485a3038fedaf33140cbdeccd7fc318dc34b1..e6c9cd56567ef305313b382586c2e94017152875 100644 (file)
@@ -12,8 +12,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)
 TARGETPATH=$(LIBPATH)\r
 !endif\r
 \r
-!include vendor-ibal.inc\r
-#!include vendor-umad.inc\r
+!INCLUDE ..\mad-vendor.inc\r
 \r
 TARGETNAME=$(VENDOR_LIB)\r
 TARGETTYPE=LIBRARY\r
@@ -54,6 +53,7 @@ C_DEFINES=$(C_DEFINES) -D__WIN__ -DHAVE_CONFIG_H -D$(VENDOR_IF)
 \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
diff --git a/branches/opensm_3/user/libvendor/libosmvendor.map b/branches/opensm_3/user/libvendor/libosmvendor.map
deleted file mode 100644 (file)
index e951e6d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-OSMVENDOR_2.0 {\r
-       global:\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
-       local: *;\r
-};\r
index ce47b668c7a2310335567c99140cc1a231f0d8e2..132452ae03294ead0ccc1bae956580e8edfc40b9 100644 (file)
@@ -6,4 +6,4 @@
 # 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:0:0\r
+LIBVERSION=3:3:0\r
index 8ff8f4d7714923899c988b0966e6528574a22143..6a690e9b5a915dbe89567572b3111bd44598a9f4 100644 (file)
@@ -217,8 +217,6 @@ Exit:
        return res;\r
 }\r
 \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
@@ -253,8 +251,6 @@ Exit:
        return res;\r
 }\r
 \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
@@ -313,8 +309,6 @@ Exit:
        return (res);\r
 }\r
 \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
index 32a2d142fecf9cf94c5ed80853bda2e8872dc0f2..d6bad9064b5b7c1c6d6a9b99702df24c24d558b9 100644 (file)
@@ -44,8 +44,6 @@
  * $Revision: 1.8 $\r
  */\r
 \r
-// XXX #include <vendor/osm_vendor_select.h>\r
-\r
 #ifdef OSM_VENDOR_INTF_AL\r
 /*\r
   Next available error code: 0x300\r
@@ -153,8 +151,7 @@ __osm_set_vend_wrap( IN  osm_al_bind_info_t* const p_bind,
             \r
 \r
 static void AL_API\r
-__osm_al_ca_err_callback(\r
-  IN ib_async_event_rec_t *p_async_rec )\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
@@ -170,8 +167,7 @@ __osm_al_ca_err_callback(
 /**********************************************************************\r
  **********************************************************************/\r
 static void AL_API\r
-__osm_al_ca_destroy_callback(\r
-  IN void *context )\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
@@ -188,8 +184,7 @@ __osm_al_ca_destroy_callback(
  **********************************************************************/\r
 \r
 static void AL_API\r
-__osm_al_err_callback(\r
-  IN ib_async_event_rec_t *p_async_rec )\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
@@ -367,7 +362,9 @@ __osm_al_rcv_callback(
     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 = FALSE;\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
@@ -387,7 +384,7 @@ __osm_al_rcv_callback(
     */\r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
                "__osm_al_rcv_callback: "\r
-               "The Mad is a response , thus handeled in __osm_al_send_callback\n");\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
@@ -407,7 +404,7 @@ __osm_al_rcv_callback(
   {\r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
                  "__osm_al_rcv_callback: "\r
-                 "The Mad is a request , thus handeled in __osm_al_rcv_callback\n");\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
@@ -1052,15 +1049,15 @@ osm_vendor_bind(
 \r
   port_guid = p_user_bind->port_guid;\r
   osm_log( p_vend->p_log, OSM_LOG_INFO,\r
-           "osm_vendor_bind: "\r
-           "Binding to port 0x%" PRIx64 ".\n",\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", cl_ntoh64( port_guid ));\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
@@ -1113,14 +1110,13 @@ osm_vendor_bind(
   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(\r
-    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
+  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
@@ -1144,17 +1140,28 @@ osm_vendor_bind(
   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
-\r
-  status = ib_reg_mad_svc(\r
-    p_bind->h_qp,\r
-    &mad_svc,\r
-    &p_bind->h_svc );\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
@@ -1172,19 +1179,19 @@ osm_vendor_bind(
   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_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
+       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_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
index 06602c4056ec4d3cb85c71c6511b6e240fd38bf2..79af5b44036b3beea0dae2420a39778b2251277c 100644 (file)
@@ -1,8 +1,9 @@
 /*\r
- * Copyright (c) 2004-2008 Voltaire, 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
  * 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
@@ -325,26 +326,28 @@ static void * OSM_API umad_receiver(void *p_ptr)
 \r
                /* if status != 0 then we are handling recv timeout on send */\r
                if (umad_status(p_madw->vend_wrap.umad)) {\r
-                       OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5409: "\r
-                               "send completed with error"\r
-                               " (method=0x%X attr=0x%X trans_id=0x%" PRIx64\r
-                               ") -- dropping\n",\r
-                               mad->method, cl_ntoh16(mad->attr_id),\r
-                               cl_ntoh64(mad->trans_id));\r
+\r
                        if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
                                /* LID routed */\r
-                               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,\r
-                                       "ERR 5410: class 0x%x LID 0x%x\n",\r
-                                       mad->mgmt_class,\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,\r
-                                       "ERR 5411: DR SMP Hop Ptr: 0x%X\n",\r
-                                       smp->hop_ptr);\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
@@ -353,7 +356,7 @@ static void * OSM_API umad_receiver(void *p_ptr)
                                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
+                                       " (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
@@ -437,6 +440,7 @@ static int umad_receiver_start(osm_vendor_t * p_vend)
 #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
@@ -472,8 +476,6 @@ static void umad_receiver_stop(umad_receiver_t * p_ur)
        p_ur->p_log = NULL;\r
 }\r
 \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
@@ -536,8 +538,6 @@ Exit:
        return (r);\r
 }\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
@@ -570,8 +570,6 @@ Exit:
        return (p_vend);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)\r
 {\r
        osm_vendor_close_port(*pp_vend);\r
@@ -587,8 +585,6 @@ void osm_vendor_delete(IN osm_vendor_t ** const pp_vend)
        *pp_vend = NULL;\r
 }\r
 \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
@@ -654,8 +650,6 @@ Exit:
        return r;\r
 }\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
@@ -682,9 +676,8 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend,
        }\r
 \r
        for (ca = 0; ca < p_vend->ca_count; ca++) {\r
-               if ((r = umad_get_ca_portguids(p_vend->ca_names[ca],\r
-                                              portguids,\r
-                                              OSM_UMAD_MAX_CAS)) < 0) {\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
@@ -800,8 +793,6 @@ static int set_bit(int nr, void *method_mask)
        return retval;\r
 }\r
 \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
@@ -952,8 +943,6 @@ Exit:
        return ((osm_bind_handle_t) p_bind);\r
 }\r
 \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
@@ -964,8 +953,6 @@ __osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw,
 #endif\r
 }\r
 \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
@@ -976,8 +963,6 @@ __osm_vendor_send_err_dummy_cb(IN void *bind_context,
 #endif\r
 }\r
 \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
@@ -993,8 +978,6 @@ void osm_vendor_unbind(IN osm_bind_handle_t h_bind)
        OSM_LOG_EXIT(p_vend->p_log);\r
 }\r
 \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
@@ -1020,8 +1003,6 @@ ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind,
        return (p_vw->umad ? umad_get_mad(p_vw->umad) : NULL);\r
 }\r
 \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
@@ -1049,8 +1030,6 @@ osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw)
        OSM_LOG_EXIT(p_vend->p_log);\r
 }\r
 \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
@@ -1133,8 +1112,8 @@ Resp:
                             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 failed %d (%m)\n",\r
-                       p_madw, sent_mad_size, ret);\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
@@ -1156,8 +1135,6 @@ Exit:
        return (ret);\r
 }\r
 \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
@@ -1169,9 +1146,6 @@ ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind)
        return (0);\r
 }\r
 \r
-/**********************************************************************\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
@@ -1210,7 +1184,7 @@ void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val)
 \r
        OSM_LOG_EXIT(p_vend->p_log);\r
 }\r
-#endif /* ! __GNUC__ */\r
+#endif /* ! __WIN__ */\r
 \r
 void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)\r
 {\r
index 3a00865dda21423c7b19752b24b2bac3c891f32b..83b44bf5e9478d4f4b4f3de5a1fa4b9e8bdf15c6 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\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
@@ -45,9 +45,6 @@
 #include <vendor/osm_vendor_sa_api.h>\r
 #include <complib/cl_event.h>\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\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
@@ -58,9 +55,6 @@ typedef struct _osmv_sa_bind_info {
        time_t last_lids_update_sec;\r
 } osmv_sa_bind_info_t;\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
-\r
 /*\r
   Call back on new mad received:\r
 \r
@@ -137,9 +131,9 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
                                   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
+                                   ib_get_attr_size(p_sa_mad->attr_offset));\r
                                OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG,\r
-                                       "Count = %u = %zu / %u (%zu)\n",\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
@@ -172,8 +166,6 @@ Exit:
        OSM_LOG_EXIT(p_bind->p_log);\r
 }\r
 \r
-/*****************************************************************************\r
- ****************************************************************************/\r
 /*\r
   Send Error Callback:\r
 \r
@@ -227,8 +219,6 @@ static ib_api_status_t update_umad_port(osm_vendor_t * p_vend)
        return IB_SUCCESS;\r
 }\r
 \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
@@ -251,6 +241,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
        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
@@ -296,9 +288,6 @@ Exit:
        return (p_sa_bind_info);\r
 }\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
-\r
 /****t* OSM Vendor SA Client/osmv_sa_mad_data\r
  * NAME\r
  *    osmv_sa_mad_data\r
@@ -339,8 +328,6 @@ typedef struct _osmv_sa_mad_data {
  *\r
  *****/\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
@@ -469,8 +456,6 @@ Exit:
        return status;\r
 }\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
 /*\r
  * Query the SA based on the user's request.\r
  */\r
@@ -738,7 +723,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
 #endif\r
 \r
        default:\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 UNKNOWN\n");\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
index 15571a74de3e32352e21725f800141e271b388cc..4486f00b69428a288b8b498b5c06b050ec4459dd 100644 (file)
@@ -762,8 +762,6 @@ get_send_txn_done:
        return ret;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level)\r
 {\r
 \r
index 580584e5fd1e23029a7758d092edb834841fc730..fa168ced58c9f317c8999f8899541b9637dab318 100644 (file)
@@ -262,8 +262,6 @@ Exit:
        return (status);\r
 }\r
 \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
index d7364626c77664e9d678343ba7d8c9bd7d938cb5..91efafaea89cbdbacbf7f4774e429e21ff2d1f83 100644 (file)
@@ -593,8 +593,6 @@ Exit:
        return (status);\r
 }\r
 \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
index 40c95bf5e6e1ad05cf4e568bc795e8e7046b6df8..461ad27e6f1e6609a376a7c94e083d76d166bb00 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\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
@@ -46,9 +46,6 @@
 #include <vendor/osm_vendor_api.h>\r
 #include <vendor/osm_vendor_sa_api.h>\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\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
@@ -62,9 +59,6 @@ typedef struct _osmv_sa_bind_info {
        uint16_t sm_lid;\r
 } osmv_sa_bind_info_t;\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
-\r
 /*\r
   Call back on new mad received:\r
 \r
@@ -147,12 +141,12 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
                                        "__osmv_sa_mad_rcv_cb: Count = 0\n");\r
                        }\r
                        else {\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
+                               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 = %zu / %u (%zu)\n",\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
@@ -183,8 +177,6 @@ Exit:
        OSM_LOG_EXIT(p_bind->p_log);\r
 }\r
 \r
-/*****************************************************************************\r
- ****************************************************************************/\r
 /*\r
   Send Error Callback:\r
 \r
@@ -314,8 +306,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -338,8 +328,10 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend,
        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 = 256;\r
-       bind_info.recv_q_size = 256;\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
@@ -404,9 +396,6 @@ Exit:
        return (p_sa_bind_info);\r
 }\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
-\r
 /****t* OSM Vendor SA Client/osmv_sa_mad_data\r
  * NAME\r
  *    osmv_sa_mad_data\r
@@ -447,8 +436,6 @@ typedef struct _osmv_sa_mad_data {
  *\r
  *****/\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
@@ -584,8 +571,6 @@ Exit:
        return status;\r
 }\r
 \r
-/*****************************************************************************\r
- *****************************************************************************/\r
 /*\r
  * Query the SA based on the user's request.\r
  */\r
@@ -593,14 +578,23 @@ ib_api_status_t
 osmv_query_sa(IN osm_bind_handle_t h_bind,\r
              IN const osmv_query_req_t * const p_query_req)\r
 {\r
-       osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind;\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
-       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
-       ib_class_port_info_t class_port_info;\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
@@ -610,6 +604,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        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
@@ -629,12 +625,11 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        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.method = IB_MAD_METHOD_GETTABLE;\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 = &svc_rec;\r
+               sa_mad_data.p_attr = &u.svc_rec;\r
                break;\r
 \r
        case OSMV_QUERY_SVC_REC_BY_NAME:\r
@@ -645,8 +640,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
                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 = &svc_rec;\r
-               memcpy(svc_rec.service_name, p_query_req->p_query_input,\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
@@ -657,8 +652,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
                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 = &svc_rec;\r
-               svc_rec.service_id =\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
@@ -670,20 +665,19 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
                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 = &class_port_info;\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.method = IB_MAD_METHOD_GETTABLE;\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 = &node_rec;\r
-               node_rec.node_info.node_guid =\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
@@ -695,8 +689,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
                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 = &port_info;\r
-               port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input);\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
@@ -746,39 +740,37 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        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(&path_rec, 0, sizeof(ib_path_rec_t));\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
-               path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &path_rec;\r
-               ib_gid_set_default(&path_rec.dgid,\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(&path_rec.sgid,\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))->\r
-                                  src_guid);\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(&path_rec, 0, sizeof(ib_path_rec_t));\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
-               path_rec.num_path = 0x7f;\r
-               sa_mad_data.p_attr = &path_rec;\r
-               memcpy(&path_rec.dgid,\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(&path_rec.sgid,\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
@@ -786,18 +778,18 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        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(&path_rec, 0, sizeof(ib_path_rec_t));\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 = &path_rec;\r
-               path_rec.dlid =\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
-               path_rec.slid =\r
+               u.path_rec.slid =\r
                    ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid;\r
                break;\r
 \r
@@ -827,9 +819,50 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
                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 %s", "UNKNOWN\n");\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
@@ -839,6 +872,3 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        OSM_LOG_EXIT(p_log);\r
        return status;\r
 }\r
-\r
-/*****************************************************************************\r
- *****************************************************************************/\r
index d837c8eb11d34ee5b939859f8cfba6ded7f56be5..55c312a3ab529726a6af15ff9b41831e7c98d074 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -76,7 +76,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind,
        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%llX (key=0x%llX)\n", tid, key);\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
@@ -95,7 +96,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind,
        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%llX (key=0x%llX) to manager DB\n",\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
@@ -371,7 +373,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,
 \r
        osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
                "__osmv_txnmgr_lookup: "\r
-               "Looking for key: 0x%llX in map ptr:%p\n", key,\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
@@ -379,7 +381,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,
                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%llX \n", tmp_key);\r
+                       "Found key 0x%016" PRIx64 "\n", tmp_key);\r
                p_item = cl_qmap_next(p_item);\r
        }\r
 \r
@@ -413,7 +415,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,
 \r
        osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,\r
                "__osmv_txnmgr_insert_txn: "\r
-               "Inserting key: 0x%llX to map ptr:%p\n", key,\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
@@ -427,7 +429,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr,
                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%llX \n", tmp_key);\r
+                       "Found key 0x%016" PRIx64 "\n", tmp_key);\r
                p_item = cl_qmap_next(p_item);\r
        }\r
 \r
@@ -452,7 +454,7 @@ __osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr,
 \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%llX - "\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
@@ -556,14 +558,14 @@ __osmv_txn_timeout_cb(IN uint64_t key,
        switch (osmv_txn_get_rmpp_state(p_txn)) {\r
 \r
        case OSMV_TXN_RMPP_NONE:\r
-               if (num_regs <= OSMV_MAX_RETRANSMIT) {\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%llX) timed out %d times. "\r
-                               "Retrying the send.\n",\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
@@ -572,7 +574,8 @@ __osmv_txn_timeout_cb(IN uint64_t key,
                        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 request (tid=0x%llX).\n",\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
@@ -599,7 +602,8 @@ __osmv_txn_timeout_cb(IN uint64_t key,
                } else {\r
                        osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,\r
                                "__osmv_txn_timeout_cb: ERR 6702: "\r
-                               "The transaction request (tid=0x%llX) timed out (after %d retries). "\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
@@ -613,12 +617,12 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 \r
        case OSMV_TXN_RMPP_SENDER:\r
                osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,\r
-                       "RMPP sender (tid=0x%llX) did not receive ACK "\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 <= OSMV_MAX_RETRANSMIT) {\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
@@ -643,8 +647,9 @@ __osmv_txn_timeout_cb(IN uint64_t key,
 \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 (tid=0x%llX). "\r
-                       "Dropping the transaction.\n", osmv_txn_get_tid(p_txn));\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
index eaf8b12865f41241c886dd0311912d5f7f1b6aea..517ef543cd1172bccdee0052d4192388bd3b1590 100644 (file)
 #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];
-       va_list argptr;
-       va_start(argptr,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;
+       }
 
-       _vsnprintf(Buffer, 1024, (LPSTR)fmt, argptr); 
-       OutputDebugStringA(Buffer);
+       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)
        {
@@ -43,12 +117,11 @@ GetOsmTempPath(void)
 char*
 GetOsmCachePath(void)
 {
-       char* cache_path;
+   char* cache_path;
    char* tmp_file_name;
    char* winib_home, tmp;
    HANDLE hFile;
 
-   winib_home = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE);
    winib_home = getenv("WinIB_HOME");
    if (winib_home == NULL)
    {
@@ -56,11 +129,11 @@ GetOsmCachePath(void)
         default temp path */
      return GetOsmTempPath();
    }
-       cache_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE);
+   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);
+   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,
@@ -78,7 +151,7 @@ GetOsmCachePath(void)
    /* Such file exists. This means the directory is usable */
    CloseHandle(hFile);
 
-       return cache_path;
+   return cache_path;
 }
 #endif
 
@@ -89,7 +162,7 @@ GetOsmCachePath(void)
  * Multiple Env vars are supported.
  */
 
-char *osm_strdup(const char *base)
+char *strdup_expand(const char *base)
 {
        char *str,*p,*s,*es,*xs,*rc,*n;
        char p_env[80];
@@ -105,7 +178,7 @@ char *osm_strdup(const char *base)
                memcpy(p_env,s,p-s);
                p_env[p-s] = '\0';
                
-               es = getenv(p_env);
+               es = getenv(p_env);
                if (!es)
                        return str;
 
@@ -123,185 +196,12 @@ char *osm_strdup(const char *base)
 
 /****************************************************************************/
 
-int optind=1;
-int opterr=1;
-int optopt='?';
-char *optarg;
-
-static int iArg=1;
+#include <..\..\..\etc\user\getopt.c>
 
 int getopt_long_only(int argc, char *const*argv, const char *optstring,
                        const struct option *longopts, int *longindex)
 {
-  char chOpt;
-  char tmp_str[256];
-  char* tmp_arg = NULL;
-  char* tok=NULL;
-  int i;
-  char tokens[2] = {'='};
-
-    if (optind == 0) {
-       optind = iArg = opterr = 1;
-       optopt='?';
-    }
-
-    if (iArg == argc)
-        return (EOF);
-
-    if (argv[iArg][0] != '-')
-    {
-        /* Does not start with a '-' we are done scanning */
-        return (EOF);
-    }
-  
-    /*termination of scanning */
-    if (!strcmp("--",argv[iArg])) {
-        return EOF;
-    }
-    
-  
-    /* char option : -d 5 */
-    if ((argv[iArg][0] == '-') && (argv[iArg][1] != '-') ) {
-        optarg = get_char_option(optstring, argv, argc, iArg, &optind, &chOpt);
-        iArg = optind;
-        return chOpt;
-    }
-      
-    /* Look for this string in longopts */
-    strcpy(tmp_str,&(argv[iArg][2]));
-    
-    /*get the option */
-    tok = strtok(tmp_str,tokens);
-    
-    for (i = 0; longopts[i].name; i++)
-       {
-        if (strcmp (tok, longopts[i].name) == 0)
-               {
-            /* We have a match */             
-             if (longindex != NULL )
-                *longindex = i;
-              
-                if (longopts[i].flag != NULL) {
-                 *(longopts[i].flag) = longopts[i].val;
-                }
-              
-                
-                
-                if (longopts[i].has_arg != no_argument) 
-                  {
-                    /*get the argument */
-                    
-                    if (strchr(argv[iArg],'=') != NULL)
-                    {
-                        optarg = strtok(NULL,tokens);
-                    }else { /*the next arg in cmd line is the param */ 
-                        tmp_arg = argv[iArg+1];
-                        if (*tmp_arg == '-') {
-                        
-                            /*no param is found */
-                            chOpt = '?';
-                            if ((longopts[i].has_arg == required_argument) && opterr)
-                           {
-                             fprintf (stderr, "Option %s requires argument\n",tok);       
-                           }
-
-                        }else 
-                        {
-                            optarg = tmp_arg;
-                            iArg++;
-                            optind++;
-                        }
-                    }
-                                     
-                 }/*longopts */
-                                
-                iArg++;
-                optind++;
-                if (longopts[i].flag == 0)
-                    return (longopts[i].val);
-                else return 0; 
-              
-            }/*end if strcmp */
-           }
-
-  return ('?');
-}
-/******************************************************************************/
-static char* get_char_option(const char* optstring, char*const* argv, int argc, 
-                             int iArg, int* opt_ind, char* opt_p)   
- {
-     char chOpt;
-     char* tmp_str;
-     char* prm = NULL;
-
-    chOpt = argv[iArg][1];
-    
-    /*non valid argument*/
-    if (!isalpha(chOpt))
-    {
-        chOpt = EOF; 
-        goto end;
-    }
-    tmp_str = strchr(optstring, chOpt);
-    
-    /*the argument wasn't found in optstring */
-    if (tmp_str == NULL){
-        chOpt = EOF; 
-        optopt = chOpt; 
-        goto end;
-    }
-        
-    /* don't need argument */
-    if (tmp_str[1] != ':' ) {
-        goto end; 
-    }
-
-     if (argv[iArg][2] != '\0')
-     {
-       // param is attached to option: -po8889
-        prm = &(argv[iArg][2]);
-        goto end;
-      }
-         
-      /* must look at next argv for param at the end of arg list */ 
-     if ((iArg)+1 == argc) {
-      /* no param will be found */
-        if (tmp_str[2]== ':' ) {
-            /* optional argument ::*/
-            goto end; 
-        }
-        else
-        {   
-            chOpt = EOF; 
-            goto end;
-        }
-      }
-
-      prm = &(argv[(iArg)+1][0]);
-      if (*prm == '-' )
-      {   
-         // next argv is a new option, so param
-         // not given for current option
-          if (tmp_str[2]== ':' ) {
-              /* optional argument ::*/
-              goto end; 
-          }
-          else
-          {
-              chOpt = EOF; 
-              goto end;
-          }
-      }
-      
-      // next argv is the param
-      (*opt_ind)++;
-end:
-    (*opt_ind)++;
-    *opt_p = chOpt;
-
-    return prm;
+       return getopt_long( argc, argv, optstring, longopts, longindex );
 }
 
 /* getimeofday() */
diff --git a/branches/opensm_3/user/man/opensm.8 b/branches/opensm_3/user/man/opensm.8
new file mode 100644 (file)
index 0000000..a45d678
--- /dev/null
@@ -0,0 +1,1105 @@
+.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/opensm.8.in b/branches/opensm_3/user/man/opensm.8.in
deleted file mode 100644 (file)
index 5a584e2..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\% @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\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 a routing engine (currently up/down\r
-only) 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\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\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\%@OPENSM_CONFIG_DIR@/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\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\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
-Consolidate IPv6 Solicited Node Multicast group join requests into one\r
-multicast group per MGID PKey.\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\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\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 @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\r
-default OpenSM config file.\r
-\r
-.TP\r
-.B @OPENSM_CONFIG_DIR@/@NODENAMEMAPFILE@\r
-default node name map file.  See ibnetdiscover for more information on format.\r
-\r
-.TP\r
-.B @OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\r
-default partition config file\r
-\r
-.TP\r
-.B @OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\r
-default QOS policy config file\r
-\r
-.TP\r
-.B @OPENSM_CONFIG_DIR@/@PREFIX_ROUTES_FILE@\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
index 14c136a6989164c06b086120d256aa6424025125..1f0ad9404d63c878eafcff90d451574583a08cb5 100644 (file)
@@ -13,9 +13,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)
 TARGETPATH=$(LIBPATH)\r
 !endif\r
 \r
-# include one Vendor or the other; not both!\r
-!include vendor-ibal.inc\r
-#!include vendor-umad.inc\r
+!include ..\mad-vendor.inc\r
 \r
 TARGETTYPE=PROGRAM\r
 UMTYPE=console\r
@@ -25,92 +23,11 @@ USE_MSVCRT=1
 SOURCES=\\r
        osm.mc \\r
        opensm.rc \\r
-       main.c \\r
-       osm_console.c \\r
-       osm_console_io.c \\r
-       osm_db_files.c \\r
-       osm_helper.c \\r
-       osm_db_pack.c \\r
-       osm_drop_mgr.c \\r
-       osm_dump.c \\r
-       osm_event_plugin.c \\r
-       osm_inform.c \\r
-       osm_lid_mgr.c \\r
-       osm_link_mgr.c \\r
-       osm_lin_fwd_rcv.c \\r
-       osm_log.c \\r
-       osm_mad_pool.c \\r
-       osm_mcast_fwd_rcv.c \\r
-       osm_mcast_mgr.c \\r
-       osm_mcast_tbl.c \\r
-       osm_mcm_port.c \\r
-       osm_mesh.c \\r
-       osm_mtree.c \\r
-       osm_multicast.c \\r
-       osm_node.c \\r
-       osm_node_desc_rcv.c \\r
-       osm_node_info_rcv.c \\r
-       osm_opensm.c \\r
-       osm_perfmgr.c \\r
-       osm_perfmgr_db.c \\r
-       osm_pkey.c \\r
-       osm_pkey_mgr.c \\r
-       osm_pkey_rcv.c \\r
-       osm_port.c \\r
-       osm_port_info_rcv.c \\r
-       osm_prtn.c \\r
-       osm_prtn_config.c \\r
-       osm_qos.c \\r
        osm_qos_parser_y.c \\r
        osm_qos_parser_l.c \\r
-       osm_qos_policy.c \\r
-       osm_remote_sm.c \\r
-       osm_req.c \\r
-       osm_resp.c \\r
-       osm_router.c \\r
-       osm_sa.c \\r
-       osm_sa_class_port_info.c \\r
-       osm_sa_guidinfo_record.c \\r
-       osm_sa_informinfo.c \\r
-       osm_sa_lft_record.c \\r
-       osm_sa_link_record.c \\r
-       osm_sa_mad_ctrl.c \\r
        osm_sa_mcmember_record.c \\r
-       osm_sa_mft_record.c \\r
-       osm_sa_multipath_record.c \\r
-       osm_sa_node_record.c \\r
        osm_sa_path_record.c \\r
-       osm_sa_pkey_record.c \\r
-       osm_sa_portinfo_record.c \\r
-       osm_sa_service_record.c \\r
-       osm_sa_slvl_record.c \\r
-       osm_sa_sminfo_record.c \\r
-       osm_sa_sw_info_record.c \\r
-       osm_sa_vlarb_record.c \\r
-       osm_service.c \\r
-       osm_slvl_map_rcv.c \\r
-       osm_sm.c \\r
-       osm_sminfo_rcv.c \\r
-       osm_sm_mad_ctrl.c \\r
-       osm_sm_state_mgr.c \\r
-       osm_state_mgr.c \\r
-       osm_subnet.c \\r
-       osm_switch.c \\r
-       osm_sw_info_rcv.c \\r
-       osm_trap_rcv.c \\r
-       osm_ucast_cache.c \\r
-       osm_ucast_file.c \\r
-       osm_ucast_ftree.c \\r
-       osm_ucast_lash.c \\r
-       osm_ucast_mgr.c \\r
-       osm_ucast_updn.c \\r
-       osm_vl15intf.c \\r
-       osm_vl_arb_rcv.c \\r
-       st.c \\r
-       osm_drop_mgr.c \\r
-       osm_prtn_config.c \\r
-       osm_sa_mcmember_record.c \\r
-       osm_sa_path_record.c\r
+       osm_files.c\r
 \r
 OSM_HOME=..\r
 \r
index e3303a6047d9828209b0397c34656d5fa02bb6e6..a04beb5c6f863a23d7d336160c3109a2a8be2b8f 100644 (file)
@@ -6,4 +6,4 @@
 # 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:4:1\r
+LIBVERSION=4:0:0\r
index bbbc269c0ca4fcf17252eb252e9f499495569f46..b377dd0319554abfab89f88f095b72fabd44ca75 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. 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
@@ -234,8 +234,8 @@ static void show_usage(void)
        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 a routing engine (currently\n"\r
-              "          up/down only) to make connectivity between root switches\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
@@ -323,6 +323,10 @@ static void show_usage(void)
               "          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
@@ -370,8 +374,10 @@ static void show_usage(void)
               "          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
-              "          Consolidate IPv6 Solicited Node Multicast group joins\n"\r
-              "          into 1 IB multicast group.\n\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
@@ -428,8 +434,6 @@ static void show_usage(void)
        exit(2);\r
 }\r
 \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
@@ -448,20 +452,20 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
        if (status != IB_SUCCESS) {\r
                printf("\nError from osm_vendor_get_all_port_attr (%x)\n",\r
                       status);\r
-               return (0);\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
+               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
+               return attr_array[0].port_guid;\r
        }\r
        /* If port_guid is 0 - use the first connected port */\r
        if (port_guid == 0) {\r
@@ -472,7 +476,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
                        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
+               return attr_array[i].port_guid;\r
        }\r
 \r
        if (p_osm->subn.opt.daemon)\r
@@ -489,25 +493,25 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
                               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("\nEnter choice (1-%u): ", i);\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 && choice <= num_ports)\r
+               } else if (choice == 0)\r
+                       return 0;\r
+               else if (choice <= num_ports)\r
                        break;\r
-               printf("\nError: Lame choice!\n");\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
+       return attr_array[choice].port_guid;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 #ifndef __WIN__\r
 \r
 static int daemonize(osm_opensm_t * osm)\r
@@ -592,8 +596,6 @@ int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 #define SET_STR_OPT(opt, val) do { \\r
        opt = val ? strdup(val) : NULL ; \\r
 } while (0)\r
@@ -616,7 +618,10 @@ opensm_main(void *OsmMainArgs)
        char *conf_template = NULL, *config_file = NULL;\r
        uint32_t val;\r
        const char *const short_option =\r
-           "F:c:i:w: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
+#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
@@ -633,6 +638,7 @@ opensm_main(void *OsmMainArgs)
                {"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
@@ -683,6 +689,7 @@ opensm_main(void *OsmMainArgs)
                {"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
@@ -696,6 +703,7 @@ opensm_main(void *OsmMainArgs)
                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
@@ -704,6 +712,10 @@ opensm_main(void *OsmMainArgs)
                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
@@ -775,6 +787,12 @@ opensm_main(void *OsmMainArgs)
                               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
@@ -803,8 +821,8 @@ opensm_main(void *OsmMainArgs)
                        break;\r
 \r
                case 't':\r
-                       opt.transaction_timeout = strtol(optarg, NULL, 0);\r
-                       printf(" Transaction timeout = %d\n",\r
+                       opt.transaction_timeout = strtoul(optarg, NULL, 0);\r
+                       printf(" Transaction timeout = %u\n",\r
                               opt.transaction_timeout);\r
                        break;\r
 \r
@@ -872,7 +890,7 @@ opensm_main(void *OsmMainArgs)
                        if (temp > 7) {\r
                                fprintf(stderr,\r
                                        "ERROR: LMC must be 7 or less.\n");\r
-                               return (-1);\r
+                               return -1;\r
                        }\r
                        opt.lmc = (uint8_t) temp;\r
                        printf(" LMC = %d\n", temp);\r
@@ -937,7 +955,7 @@ opensm_main(void *OsmMainArgs)
                        if (0 > temp || 15 < temp) {\r
                                fprintf(stderr,\r
                                        "ERROR: priority must be between 0 and 15\n");\r
-                               return (-1);\r
+                               return -1;\r
                        }\r
                        opt.sm_priority = (uint8_t) temp;\r
                        printf(" Priority = %d\n", temp);\r
@@ -1047,7 +1065,7 @@ opensm_main(void *OsmMainArgs)
                        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
+                               return -1;\r
                        }\r
                        opt.lash_start_vl = (uint8_t) temp;\r
                        printf(" LASH starting VL = %d\n", opt.lash_start_vl);\r
@@ -1057,7 +1075,7 @@ opensm_main(void *OsmMainArgs)
                        if (temp < 0 || temp > 15) {\r
                                fprintf(stderr,\r
                                        "ERROR: SM's SL must be between 0 and 15\n");\r
-                               return (-1);\r
+                               return -1;\r
                        }\r
                        opt.sm_sl = (uint8_t) temp;\r
                        printf(" SMSL = %d\n", opt.sm_sl);\r
@@ -1067,6 +1085,10 @@ opensm_main(void *OsmMainArgs)
                        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
@@ -1121,7 +1143,7 @@ opensm_main(void *OsmMainArgs)
                /* 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
+               return status;\r
        }\r
 \r
        /*\r
@@ -1131,6 +1153,9 @@ opensm_main(void *OsmMainArgs)
        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
@@ -1194,9 +1219,7 @@ main(int argc, char **argv)
     osm_main_args.argc = argc;\r
     osm_main_args.argv = argv;\r
 \r
-    /* If there are arguments that the executable is ran with, then this is \r
-       not running as service - just run the opensm_main.\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
@@ -1219,7 +1242,7 @@ main(int argc, char **argv)
        return opensm_main( (void*)&osm_main_args );\r
     }\r
 \r
-    /* Running as service */\r
+    /* Running as a Windows service */\r
    \r
     i = 0;\r
     if (!StartServiceCtrlDispatcher( DispatchTable )) { \r
@@ -1230,34 +1253,54 @@ main(int argc, char **argv)
     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
+    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() here.\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
-       || !strcmp(p_str, "Errors on subnet. Duplicate GUID found ""by link from a port to itself. ""See osm log for more details\n")\r
-       || !strcmp(p_str, "Errors on subnet. SM found duplicated guids or 12x ""link with lane reversal badly configured. ""See osm log for more details\n")\r
-       || !strcmp(p_str, "Fatal: Error restoring Guid-to-Lid persistent database\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
@@ -1305,10 +1348,11 @@ static char *WinErrorStr(DWORD err)
 void SvcDebugOut(LPSTR fmt, ... ) \r
 { \r
        CHAR Buffer[1024];\r
-       va_list argptr;\r
-       va_start(argptr,fmt);\r
+       va_list args;\r
 \r
-       _vsnprintf(Buffer, 1024, fmt, argptr); \r
+       va_start(args,fmt);\r
+       _vsnprintf(Buffer, 1024, fmt, args); \r
+       va_end(args);\r
        OutputDebugStringA(Buffer); \r
 }\r
 \r
@@ -1323,11 +1367,18 @@ void SvcDebugOut(LPSTR fmt, ... )
 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
@@ -1342,8 +1393,7 @@ void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode )
             status = GetLastError(); \r
          } \r
          SvcDebugOut(" [OSM_SERVICE] Exit SERVICE_CONTROL_%s (%ld) '%s'\n",\r
-               (Opcode == SERVICE_CONTROL_SHUTDOWN ?  "SHUTDOWN" : "STOP"),\r
-               status, WinErrorStr(status)); \r
+               ctl, status, WinErrorStr(status)); \r
          return; \r
  \r
       case SERVICE_CONTROL_INTERROGATE: \r
@@ -1361,11 +1411,13 @@ void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode )
       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
+         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
index 5ddd4560f4a12eff68820e08204889b474b94a05..1a088a571ad282332d747e19a2e92221b3ad403e 100644 (file)
 \r
 #include <oib_ver.h>\r
 \r
-#define VER_FILETYPE                           VFT_APP\r
-#define VER_FILESUBTYPE                                VFT2_UNKNOWN\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.3 (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.3"\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
index 592f0263d96e19fac49055dc133aa67623e58631..1df89271972452f22b643c44e1ee09ee7050ce69 100644 (file)
@@ -58,6 +58,8 @@
 #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
@@ -220,6 +222,14 @@ static void help_dump_conf(FILE *out, int detail)
        }\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
@@ -318,30 +328,30 @@ static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
        }\r
 }\r
 \r
-static char *sm_state_str(int state)\r
+static const char *sm_state_str(int state)\r
 {\r
        switch (state) {\r
        case IB_SMINFO_STATE_DISCOVERING:\r
-               return ("Discovering");\r
+               return "Discovering";\r
        case IB_SMINFO_STATE_STANDBY:\r
-               return ("Standby    ");\r
+               return "Standby    ";\r
        case IB_SMINFO_STATE_NOTACTIVE:\r
-               return ("Not Active ");\r
+               return "Not Active ";\r
        case IB_SMINFO_STATE_MASTER:\r
-               return ("Master     ");\r
+               return "Master     ";\r
        }\r
-       return ("UNKNOWN    ");\r
+       return "UNKNOWN    ";\r
 }\r
 \r
-static char *sa_state_str(osm_sa_state_t state)\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
+               return "Init";\r
        case OSM_SA_STATE_READY:\r
-               return ("Ready");\r
+               return "Ready";\r
        }\r
-       return ("UNKNOWN");\r
+       return "UNKNOWN";\r
 }\r
 \r
 static void dump_sms(osm_opensm_t * p_osm, FILE * out)\r
@@ -451,9 +461,9 @@ static int loop_command_check_time(void)
        time_t cur = time(NULL);\r
        if ((loop_command.previous + loop_command.delay_s) < cur) {\r
                loop_command.previous = cur;\r
-               return (1);\r
+               return 1;\r
        }\r
-       return (0);\r
+       return 0;\r
 }\r
 \r
 static void status_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
@@ -518,9 +528,7 @@ static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 \r
        lid = (uint16_t) strtoul(p_cmd, NULL, 0);\r
        cl_plock_acquire(&p_osm->lock);\r
-       if (lid > cl_ptr_vector_get_capacity(&(p_osm->subn.port_lid_tbl)))\r
-               goto invalid_lid;\r
-       p_port = cl_ptr_vector_get(&(p_osm->subn.port_lid_tbl), lid);\r
+       p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);\r
        if (!p_port)\r
                goto invalid_lid;\r
 \r
@@ -1149,6 +1157,11 @@ static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
        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
@@ -1232,6 +1245,7 @@ static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 \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
@@ -1272,12 +1286,12 @@ static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
                        } 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
+                       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
+                               " Skipping\n", p_cmd);\r
                        free(p_regexp);\r
                        continue;\r
                } else {\r
@@ -1293,7 +1307,7 @@ static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
        }\r
 \r
        if (p_osm->sm.p_subn->need_update != 0) {\r
-               fprintf(out, "Subnet is not ready yet. Try again later.\n");\r
+               fprintf(out, "Subnet is not ready yet. Try again later\n");\r
                return;\r
        }\r
 \r
@@ -1365,6 +1379,7 @@ const struct command console_cmds[] = {
        {"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
index 343a4b3b96b933cd06b9bf339216bb15c8c87415..5b4dedd0f790635faeea3cfc98a027dd43cdc4df 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -117,16 +117,12 @@ typedef struct osm_db_imp {
  * osm_db_t\r
  *********/\r
 \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
-/***************************************************************************\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
@@ -141,8 +137,6 @@ void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain)
        free(p_domain_imp);\r
 }\r
 \r
-/***************************************************************************\r
- ***************************************************************************/\r
 void osm_db_destroy(IN osm_db_t * p_db)\r
 {\r
        osm_db_domain_t *p_domain;\r
@@ -155,8 +149,6 @@ void osm_db_destroy(IN osm_db_t * p_db)
        free(p_db->p_db_imp);\r
 }\r
 \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
@@ -169,7 +161,7 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
 \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 = osm_strdup(OSM_DEFAULT_CACHE_DIR);\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
@@ -199,36 +191,36 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
        return 0;\r
 }\r
 \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
-       int dir_name_len;\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 = (osm_db_domain_t *) malloc(sizeof(osm_db_domain_t));\r
+       p_domain = malloc(sizeof(osm_db_domain_t));\r
        CL_ASSERT(p_domain != NULL);\r
 \r
-       p_domain_imp =\r
-           (osm_db_domain_imp_t *) malloc(sizeof(osm_db_domain_imp_t));\r
+       p_domain_imp = malloc(sizeof(osm_db_domain_imp_t));\r
        CL_ASSERT(p_domain_imp != NULL);\r
 \r
-       dir_name_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name);\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 =\r
-           (char *)malloc(sizeof(char) * (dir_name_len) + strlen(domain_name) +\r
-                          2);\r
+       p_domain_imp->file_name = malloc(path_len);\r
        CL_ASSERT(p_domain_imp->file_name != NULL);\r
-       strcpy(p_domain_imp->file_name,\r
-              ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name);\r
-       strcat(p_domain_imp->file_name, domain_name);\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
@@ -258,8 +250,6 @@ Exit:
        return p_domain;\r
 }\r
 \r
-/***************************************************************************\r
- ***************************************************************************/\r
 int osm_db_restore(IN osm_db_domain_t * p_domain)\r
 {\r
 \r
@@ -338,21 +328,17 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
                                        goto EndParsing;\r
                                }\r
 \r
-                               p_key =\r
-                                   (char *)malloc(sizeof(char) *\r
-                                                  (strlen(p_first_word) + 1));\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 =\r
-                                           (char *)malloc(sizeof(char) *\r
-                                                          (strlen\r
-                                                           (p_rest_of_line) +\r
-                                                           1));\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 = (char *)malloc(2);\r
+                                       p_accum_val = malloc(2);\r
                                        strcpy(p_accum_val, "\0");\r
                                }\r
                        } else if (sLine[0] != '\n') {\r
@@ -404,9 +390,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
                        } else {\r
                                /* accumulate into the value */\r
                                p_prev_val = p_accum_val;\r
-                               p_accum_val =\r
-                                   (char *)malloc(strlen(p_prev_val) +\r
-                                                  strlen(sLine) + 1);\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
@@ -423,8 +408,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -446,9 +429,8 @@ int osm_db_store(IN osm_db_domain_t * p_domain)
        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 =\r
-           (char *)malloc(sizeof(char) *\r
-                          (strlen(p_domain_imp->file_name) + 8));\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
@@ -488,8 +470,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -511,8 +491,6 @@ int osm_db_clear(IN osm_db_domain_t * p_domain)
        return 0;\r
 }\r
 \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
@@ -535,8 +513,6 @@ int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list)
        return 0;\r
 }\r
 \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
@@ -553,8 +529,6 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key)
        return p_val;\r
 }\r
 \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
@@ -593,8 +567,6 @@ int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val)
        return 0;\r
 }\r
 \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
index 1112fff97f0a8bc87837bd6bcd7da7463c9b846b..a1b61a794f9bacc8d930ce71fb06ea29cbba31f7 100644 (file)
@@ -140,12 +140,12 @@ int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid,
        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
+       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
+       return osm_db_delete(p_g2l, guid_str);\r
 }\r
index 4ebde8826f19b89ae09d69ffb5ea986d11b43434..d8d3e5638ed411585ab7a682778da8e7480ec0b2 100644 (file)
@@ -62,8 +62,6 @@
 #include <opensm/osm_inform.h>\r
 #include <opensm/osm_ucast_mgr.h>\r
 \r
-/**********************************************************************\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
@@ -79,8 +77,6 @@ static void drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid)
        }\r
 }\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
@@ -92,11 +88,13 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
                                                     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 (both ports\r
-                          weren't recognized), or a "hiccup" in the subnet - in which case\r
-                          the remote port was recognized, and its state is ACTIVE.\r
-                          If this is just a "hiccup" - force a heavy sweep in the next sweep.\r
-                          We don't want to lose that part of the subnet. */\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
@@ -109,9 +107,10 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
                                sm->p_subn->force_heavy_sweep = TRUE;\r
                        }\r
 \r
-                       /* If the remote node is ca or router - need to remove the remote port,\r
-                          since it is no longer reachable. This can be done if we reset the\r
-                          discovery count of the remote port. */\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
@@ -134,8 +133,8 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
                        p_remote_physp->port_num);\r
 \r
                if (sm->ucast_mgr.cache_valid)\r
-                       osm_ucast_cache_add_link(&sm->ucast_mgr,\r
-                                                p_physp, p_remote_physp);\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
@@ -149,8 +148,6 @@ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp)
        osm_physp_destroy(p_physp);\r
 }\r
 \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
@@ -183,6 +180,33 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
                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
@@ -209,13 +233,8 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
        drop_mgr_clean_physp(sm, p_port->p_physp);\r
 \r
        while (!cl_is_qlist_empty(&p_port->mcm_list)) {\r
-#ifndef __WIN__\r
                mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),\r
                                       mcm_port, list_item);\r
-#else\r
-               mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),\r
-                                      mcm_port, list_item, (osm_mcm_port_t*));\r
-#endif\r
                osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,\r
                                     p_port->guid);\r
        }\r
@@ -225,35 +244,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 \r
        osm_port_delete(&p_port);\r
 \r
-       /* issue a notice - trap 65 */\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 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
-               goto Exit;\r
-       }\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
@@ -265,8 +255,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -291,8 +279,6 @@ static void drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node)
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -349,11 +335,9 @@ static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
        osm_node_delete(&p_node);\r
 \r
        OSM_LOG_EXIT(sm->p_log);\r
-       return (return_val);\r
+       return return_val;\r
 }\r
 \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
@@ -421,16 +405,11 @@ Exit:
        return;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_drop_mgr_process(osm_sm_t * sm)\r
 {\r
-       cl_qmap_t *p_node_guid_tbl;\r
-       cl_qmap_t *p_port_guid_tbl;\r
-       osm_port_t *p_port;\r
-       osm_port_t *p_next_port;\r
-       osm_node_t *p_node;\r
-       osm_node_t *p_next_node;\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
index 15442afc1b3c0c7b2ef23e75687e8554e8b0fbdc..a5c7127d8386500fce1c20b64e173c876408f98d 100644 (file)
@@ -140,7 +140,7 @@ static void dump_ucast_routes(cl_map_item_t * item, FILE * file, void *cxt)
        for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++) {\r
                fprintf(file, "0x%04X : ", lid_ho);\r
 \r
-               p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid_ho);\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
@@ -313,7 +313,7 @@ static void dump_lid_matrix(cl_map_item_t * item, FILE * file, void *cxt)
                for (port = 0; port < max_port; port++)\r
                        fprintf(file, " %02x",\r
                                osm_switch_get_hop_count(p_sw, lid, port));\r
-               p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid);\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
@@ -344,7 +344,7 @@ static void dump_ucast_lfts(cl_map_item_t * item, FILE * file, void *cxt)
 \r
                fprintf(file, "0x%04x %03u # ", lid, port);\r
 \r
-               p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid);\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
@@ -541,8 +541,6 @@ static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)
                "------------------------------------------------\n");\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 struct dump_context {\r
        osm_opensm_t *p_osm;\r
        FILE *file;\r
@@ -593,8 +591,6 @@ void osm_dump_qmap_to_file(osm_opensm_t * p_osm, const char *file_name,
        fclose(file);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 \r
 static void print_report(osm_opensm_t * osm, FILE * file)\r
 {\r
index 72dd93edfee49b5cd348b772d4ee239f27b8ee50..dbf5a641dc48153551aca25afa9418a85aa133bc 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\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
@@ -70,14 +70,14 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name)
        osm_epi_plugin_t *rc = NULL;\r
 \r
        if (!plugin_name || !*plugin_name)\r
-               return (NULL);\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
+               return NULL;\r
 \r
        rc->handle = dlopen(lib_name, RTLD_LAZY);\r
        if (!rc->handle) {\r
@@ -129,13 +129,13 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name)
                goto Exit;\r
 \r
        rc->plugin_name = strdup(plugin_name);\r
-       return (rc);\r
+       return rc;\r
 \r
 Exit:\r
        dlclose(rc->handle);\r
 DLOPENFAIL:\r
        free(rc);\r
-       return (NULL);\r
+       return NULL;\r
 }\r
 \r
 void osm_epi_destroy(osm_epi_plugin_t * plugin)\r
diff --git a/branches/opensm_3/user/opensm/osm_files.c b/branches/opensm_3/user/opensm/osm_files.c
new file mode 100644 (file)
index 0000000..0540861
--- /dev/null
@@ -0,0 +1,86 @@
+/*\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
index 53aa84b2031e32e32c9e6c65f5b2acee06896c92..15b6a2a6354d5b6a432fe64ae9ff4f65e7e2301c 100644 (file)
@@ -58,7 +58,7 @@
 #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
+static const char *ib_sa_method_str[] = {\r
        "RESERVED",             /* 0 */\r
        "SubnAdmGet",           /* 1 */\r
        "SubnAdmSet",           /* 2 */\r
@@ -84,7 +84,7 @@ static const char *__ib_sa_method_str[] = {
        "UNKNOWN"               /* 16 */\r
 };\r
 \r
-static const char *__ib_sa_resp_method_str[] = {\r
+static const char *ib_sa_resp_method_str[] = {\r
        "RESERVED",             /* 80 */\r
        "SubnAdmGetResp",       /* 81 */\r
        "RESERVED (SetResp?)",  /* 82 */\r
@@ -112,7 +112,7 @@ static const char *__ib_sa_resp_method_str[] = {
 \r
 #define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16\r
 \r
-static const char *__ib_sm_method_str[] = {\r
+static const char *ib_sm_method_str[] = {\r
        "RESERVED0",            /* 0 */\r
        "SubnGet",              /* 1 */\r
        "SubnSet",              /* 2 */\r
@@ -150,7 +150,7 @@ static const char *__ib_sm_method_str[] = {
 \r
 #define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21\r
 \r
-static const char *__ib_sm_attr_str[] = {\r
+static const char *ib_sm_attr_str[] = {\r
        "RESERVED",             /* 0 */\r
        "ClassPortInfo",        /* 1 */\r
        "Notice",               /* 2 */\r
@@ -189,7 +189,7 @@ static const char *__ib_sm_attr_str[] = {
 \r
 #define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21\r
 \r
-static const char *__ib_sa_attr_str[] = {\r
+static const char *ib_sa_attr_str[] = {\r
        "RESERVED",             /* 0 */\r
        "ClassPortInfo",        /* 1 */\r
        "Notice",               /* 2 */\r
@@ -452,8 +452,6 @@ static int sprint_uint8_arr(char *buf, size_t size,
        return n;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 const char *ib_get_sa_method_str(IN uint8_t method)\r
 {\r
        if (method & 0x80) {\r
@@ -461,27 +459,23 @@ const char *ib_get_sa_method_str(IN uint8_t method)
                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
+               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
+               return ib_sa_method_str[method];\r
        }\r
 }\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
+       return ib_sm_method_str[method];\r
 }\r
 \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
@@ -489,11 +483,9 @@ const char *ib_get_sm_attr_str(IN ib_net16_t attr)
        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
+       return ib_sm_attr_str[host_attr];\r
 }\r
 \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
@@ -501,11 +493,9 @@ const char *ib_get_sa_attr_str(IN ib_net16_t attr)
        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
+       return ib_sa_attr_str[host_attr];\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 const char *ib_get_trap_str(ib_net16_t trap_num)\r
 {\r
        switch (cl_ntoh16(trap_num)) {\r
@@ -550,8 +540,6 @@ const char *ib_get_trap_str(ib_net16_t trap_num)
 \r
 const ib_gid_t ib_zero_gid = { {0} };\r
 \r
-/**********************************************************************\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
@@ -571,8 +559,6 @@ static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size,
        return IB_SUCCESS;\r
 }\r
 \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
@@ -777,8 +763,6 @@ static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size,
        }\r
 }\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
@@ -863,8 +847,6 @@ void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
        }\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
@@ -944,8 +926,6 @@ void osm_dump_portinfo_record(IN osm_log_t * p_log,
        }\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
@@ -978,8 +958,6 @@ void osm_dump_guidinfo_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1009,8 +987,6 @@ void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
        }\r
 }\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
@@ -1054,8 +1030,6 @@ void osm_dump_node_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1103,8 +1077,6 @@ void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
        }\r
 }\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
@@ -1164,8 +1136,6 @@ void osm_dump_multipath_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1198,8 +1168,6 @@ void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
        }\r
 }\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
@@ -1291,8 +1259,6 @@ void osm_dump_service_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1352,8 +1318,6 @@ void osm_dump_inform_info(IN osm_log_t * p_log,
        }\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
@@ -1435,8 +1399,6 @@ void osm_dump_inform_info_record(IN osm_log_t * p_log,
        }\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
@@ -1454,8 +1416,6 @@ void osm_dump_link_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1485,8 +1445,6 @@ void osm_dump_switch_info(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1523,8 +1481,6 @@ void osm_dump_switch_info_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1547,8 +1503,6 @@ void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
        }\r
 }\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
@@ -1574,8 +1528,6 @@ void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
        }\r
 }\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
@@ -1600,8 +1552,6 @@ void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
        }\r
 }\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
@@ -1620,8 +1570,6 @@ void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
        }\r
 }\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
@@ -1647,8 +1595,6 @@ void osm_dump_sm_info_record(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1842,8 +1788,6 @@ void osm_dump_notice(IN osm_log_t * p_log,
        }\r
 }\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
@@ -1949,8 +1893,6 @@ void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
        }\r
 }\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
@@ -2004,8 +1946,6 @@ void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
        }\r
 }\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
@@ -2013,8 +1953,8 @@ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
                char buf[BUF_SIZE];\r
                unsigned n = 0;\r
 \r
-               n = sprintf(buf, "Directed Path Dump of %u hop path:"\r
-                           "\n\t\t\t\tPath = ", p_path->hop_count);\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
@@ -2022,8 +1962,6 @@ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
        }\r
 }\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
@@ -2031,13 +1969,13 @@ void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
                char buf[BUF_SIZE];\r
                unsigned n;\r
 \r
-               n = sprintf(buf, "Received SMP on a %u hop path:"\r
-                           "\n\t\t\t\tInitial path = ", p_smp->hop_count);\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, "\n\t\t\t\tReturn path  = ");\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
@@ -2054,18 +1992,13 @@ static const char *sm_signal_str[] = {
        "UNKNOWN SIGNAL!!"      /* 5 */\r
 };\r
 \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
+       return sm_signal_str[signal];\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static const char *disp_msg_str[] = {\r
        "OSM_MSG_NONE",\r
        "OSM_MSG_MAD_NODE_INFO",\r
@@ -2102,13 +2035,11 @@ static const char *disp_msg_str[] = {
        "UNKNOWN!!"\r
 };\r
 \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
+       return disp_msg_str[msg];\r
 }\r
 \r
 static const char *port_state_str_fixed_width[] = {\r
@@ -2120,13 +2051,11 @@ static const char *port_state_str_fixed_width[] = {
        "???"\r
 };\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
+       return port_state_str_fixed_width[port_state];\r
 }\r
 \r
 static const char *node_type_str_fixed_width[] = {\r
@@ -2136,17 +2065,13 @@ static const char *node_type_str_fixed_width[] = {
        "RT",\r
 };\r
 \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
+       return node_type_str_fixed_width[node_type];\r
 }\r
 \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
@@ -2179,62 +2104,62 @@ const char *osm_get_manufacturer_str(IN uint64_t guid_ho)
 \r
        switch ((uint32_t) (guid_ho >> (5 * 8))) {\r
        case OSM_VENDOR_ID_INTEL:\r
-               return (intel_str);\r
+               return intel_str;\r
        case OSM_VENDOR_ID_MELLANOX:\r
-               return (mellanox_str);\r
+               return mellanox_str;\r
        case OSM_VENDOR_ID_REDSWITCH:\r
-               return (redswitch_str);\r
+               return redswitch_str;\r
        case OSM_VENDOR_ID_SILVERSTORM:\r
-               return (silverstorm_str);\r
+               return silverstorm_str;\r
        case OSM_VENDOR_ID_TOPSPIN:\r
-               return (topspin_str);\r
+               return topspin_str;\r
        case OSM_VENDOR_ID_FUJITSU:\r
        case OSM_VENDOR_ID_FUJITSU2:\r
-               return (fujitsu_str);\r
+               return fujitsu_str;\r
        case OSM_VENDOR_ID_VOLTAIRE:\r
-               return (voltaire_str);\r
+               return voltaire_str;\r
        case OSM_VENDOR_ID_YOTTAYOTTA:\r
-               return (yotta_str);\r
+               return yotta_str;\r
        case OSM_VENDOR_ID_PATHSCALE:\r
-               return (pathscale_str);\r
+               return pathscale_str;\r
        case OSM_VENDOR_ID_IBM:\r
-               return (ibm_str);\r
+               return ibm_str;\r
        case OSM_VENDOR_ID_DIVERGENET:\r
-               return (divergenet_str);\r
+               return divergenet_str;\r
        case OSM_VENDOR_ID_FLEXTRONICS:\r
-               return (flextronics_str);\r
+               return flextronics_str;\r
        case OSM_VENDOR_ID_AGILENT:\r
-               return (agilent_str);\r
+               return agilent_str;\r
        case OSM_VENDOR_ID_OBSIDIAN:\r
-               return (obsidian_str);\r
+               return obsidian_str;\r
        case OSM_VENDOR_ID_BAYMICRO:\r
-               return (baymicro_str);\r
+               return baymicro_str;\r
        case OSM_VENDOR_ID_LSILOGIC:\r
-               return (lsilogic_str);\r
+               return lsilogic_str;\r
        case OSM_VENDOR_ID_DDN:\r
-               return (ddn_str);\r
+               return ddn_str;\r
        case OSM_VENDOR_ID_PANTA:\r
-               return (panta_str);\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
+               return hp_str;\r
        case OSM_VENDOR_ID_RIOWORKS:\r
-               return (rioworks_str);\r
+               return rioworks_str;\r
        case OSM_VENDOR_ID_SUN:\r
        case OSM_VENDOR_ID_SUN2:\r
-               return (sun_str);\r
+               return sun_str;\r
        case OSM_VENDOR_ID_3LEAFNTWKS:\r
-               return (leafntwks_str);\r
+               return leafntwks_str;\r
        case OSM_VENDOR_ID_XSIGO:\r
-               return (xsigo_str);\r
+               return xsigo_str;\r
        case OSM_VENDOR_ID_DELL:\r
-               return (dell_str);\r
+               return dell_str;\r
        case OSM_VENDOR_ID_SUPERMICRO:\r
-               return (supermicro_str);\r
+               return supermicro_str;\r
        default:\r
-               return (unknown_str);\r
+               return unknown_str;\r
        }\r
 }\r
 \r
@@ -2247,14 +2172,12 @@ static const char *mtu_str_fixed_width[] = {
        "4096"\r
 };\r
 \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
+               return mtu_str_fixed_width[0];\r
        else\r
-               return (mtu_str_fixed_width[mtu]);\r
+               return mtu_str_fixed_width[mtu];\r
 }\r
 \r
 static const char *lwa_str_fixed_width[] = {\r
@@ -2269,18 +2192,14 @@ static const char *lwa_str_fixed_width[] = {
        "12x"\r
 };\r
 \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
+               return lwa_str_fixed_width[0];\r
        else\r
-               return (lwa_str_fixed_width[lwa]);\r
+               return lwa_str_fixed_width[lwa];\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static const char *lsa_str_fixed_width[] = {\r
        "???",\r
        "2.5",\r
@@ -2292,14 +2211,11 @@ static const char *lsa_str_fixed_width[] = {
 const char *osm_get_lsa_str(IN uint8_t lsa)\r
 {\r
        if (lsa > 4)\r
-               return (lsa_str_fixed_width[0]);\r
+               return lsa_str_fixed_width[0];\r
        else\r
-               return (lsa_str_fixed_width[lsa]);\r
+               return lsa_str_fixed_width[lsa];\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static const char *sm_mgr_signal_str[] = {\r
        "OSM_SM_SIGNAL_NONE",   /* 0 */\r
        "OSM_SM_SIGNAL_DISCOVERY_COMPLETED",    /* 2 */\r
@@ -2315,13 +2231,11 @@ static const char *sm_mgr_signal_str[] = {
        "UNKNOWN STATE!!"       /* 12 */\r
 };\r
 \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
+       return sm_mgr_signal_str[signal];\r
 }\r
 \r
 static const char *sm_mgr_state_str[] = {\r
index 3c14fb229737da3433170bc0628542aa92695d7b..2cdf456c5cabf0a0a12899babccba3b714d2ad0c 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -59,15 +59,11 @@ typedef struct osm_infr_match_ctxt {
        ib_mad_notice_attr_t *p_ntc;\r
 } osm_infr_match_ctxt_t;\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_infr_delete(IN osm_infr_t * p_infr)\r
 {\r
        free(p_infr);\r
 }\r
 \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
@@ -78,11 +74,9 @@ osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec)
        if (p_infr)\r
                memcpy(p_infr, p_infr_rec, sizeof(osm_infr_t));\r
 \r
-       return (p_infr);\r
+       return p_infr;\r
 }\r
 \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
@@ -210,8 +204,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -238,8 +230,6 @@ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
        return (osm_infr_t *) p_list_item;\r
 }\r
 \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
@@ -258,6 +248,7 @@ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
 #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
@@ -265,8 +256,6 @@ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
        OSM_LOG_EXIT(p_log);\r
 }\r
 \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
@@ -283,6 +272,7 @@ void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
                             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
@@ -348,7 +338,7 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec,      /* the informinfo
 \r
 Exit:\r
        OSM_LOG_EXIT(p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 /**********************************************************************\r
@@ -495,9 +485,8 @@ static void match_notice_to_inf_rec(IN cl_list_item_t * p_list_item,
                goto Exit;\r
        }\r
 \r
-       p_dest_port =\r
-           cl_ptr_vector_get(&p_subn->port_lid_tbl,\r
-                             cl_ntoh16(p_infr_rec->report_addr.dest_lid));\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
@@ -590,7 +579,7 @@ ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
        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
+               return IB_ERROR;\r
        }\r
 \r
        if (osm_log_is_active(p_log, OSM_LOG_INFO))\r
@@ -624,5 +613,5 @@ ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
 \r
        OSM_LOG_EXIT(p_log);\r
 \r
-       return (IB_SUCCESS);\r
+       return IB_SUCCESS;\r
 }\r
index 2cfa16234da822f121294d1299ee198412f5550e..50860040e46bf62cf216e0f437b6fb594cb927dc 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -104,26 +104,20 @@ typedef struct osm_lid_mgr_range {
        uint16_t max_lid;\r
 } osm_lid_mgr_range_t;\r
 \r
-/**********************************************************************\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
-/**********************************************************************\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
-       p_item = cl_qlist_remove_head(&p_mgr->free_ranges);\r
-       while (p_item != cl_qlist_end(&p_mgr->free_ranges)) {\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
-               p_item = cl_qlist_remove_head(&p_mgr->free_ranges);\r
-       }\r
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
@@ -154,8 +148,8 @@ static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
                goto Exit;\r
        }\r
 \r
-       p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids);\r
-       while ((cl_list_item_t *) p_item != cl_qlist_end(&guids)) {\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
@@ -201,29 +195,23 @@ static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
                                }\r
                        }\r
 \r
-                       if (!lids_ok) {\r
-                               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: "\r
-                                               "failed to delete entry for "\r
-                                               "guid:0x%016" PRIx64 "\n",\r
-                                               p_item->guid);\r
-                       } else {\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
-                       }\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
-               p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids);\r
        }                       /* all guids */\r
 Exit:\r
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \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
@@ -278,7 +266,7 @@ ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm)
 \r
 Exit:\r
        OSM_LOG_EXIT(p_mgr->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 static uint16_t trim_lid(IN uint16_t lid)\r
@@ -297,14 +285,8 @@ static uint16_t trim_lid(IN uint16_t lid)
 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;\r
-       uint16_t max_persistent_lid;\r
-       uint16_t max_discovered_lid;\r
-       uint16_t lid;\r
-       uint16_t disc_min_lid;\r
-       uint16_t disc_max_lid;\r
-       uint16_t db_min_lid;\r
-       uint16_t db_max_lid;\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
@@ -312,8 +294,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
        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;\r
-       uint16_t req_lid, num_lids;\r
+       uint16_t lmc_mask, req_lid, num_lids, lid;\r
 \r
        OSM_LOG_ENTER(p_mgr->p_log);\r
 \r
@@ -324,30 +305,28 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
           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
-               if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) {\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
-                       osm_db_clear(p_mgr->p_g2l);\r
-                       memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));\r
-               } else {\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
-                       osm_db_clear(p_mgr->p_g2l);\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
-       p_item = cl_qlist_remove_head(&p_mgr->free_ranges);\r
-       while (p_item != cl_qlist_end(&p_mgr->free_ranges)) {\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
-               p_item = cl_qlist_remove_head(&p_mgr->free_ranges);\r
-       }\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
@@ -360,8 +339,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
            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 =\r
-                   (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t));\r
+               p_range = malloc(sizeof(osm_lid_mgr_range_t));\r
                if (p_range)\r
                        p_range->min_lid = 1;\r
                goto AfterScanningLids;\r
@@ -448,10 +426,9 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
                                "persistent db\n", lid);\r
                        is_free = FALSE;\r
                        /* check this is a discovered port */\r
-               } else if (lid <= max_discovered_lid && (p_port = (osm_port_t *)\r
-                                                        cl_ptr_vector_get\r
-                                                        (p_discovered_vec,\r
-                                                         lid))) {\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
@@ -533,23 +510,20 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
                        if (p_range)\r
                                p_range->max_lid = lid;\r
                        else {\r
-                               p_range = (osm_lid_mgr_range_t *)\r
-                                   malloc(sizeof(osm_lid_mgr_range_t));\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
-               } else {\r
-                       /* this lid is used so we need to finalize the previous free range */\r
-                       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
+               /* 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
@@ -557,8 +531,7 @@ AfterScanningLids:
        /* 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 =\r
-                   (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t));\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
@@ -642,11 +615,12 @@ static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr,
                /* 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
+                       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
-                       else\r
+                               free(p_item);\r
+                       } else\r
                                /* only update the available range */\r
                                p_range->min_lid = lid + num_lids;\r
 \r
@@ -667,8 +641,6 @@ static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr,
        CL_ASSERT(0);\r
 }\r
 \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
@@ -680,12 +652,10 @@ static void lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr,
        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 ==\r
-                    (osm_port_t *) cl_ptr_vector_get(p_discovered_vec, 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
 /**********************************************************************\r
@@ -727,11 +697,10 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
        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
+               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
-                       goto Exit;\r
-               } else {\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
@@ -741,8 +710,8 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
                                                                  p_port);\r
                        /* we still need to send the setting to the target port */\r
                        lid_changed = 1;\r
-                       goto Exit;\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
@@ -796,7 +765,6 @@ NewLidSet:
        for (lid = *p_min_lid; lid <= *p_max_lid; lid++)\r
                p_mgr->used_lids[lid] = 1;\r
 \r
-Exit:\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
@@ -820,8 +788,6 @@ static void lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * p_mgr,
        ib_port_info_set_port_state(&p_rem_physp->port_info, IB_LINK_INIT);\r
 }\r
 \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
@@ -875,8 +841,9 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
           Third, send the SMP to this physical port.\r
         */\r
 \r
-       memset(payload, 0, IB_SMP_DATA_SIZE);\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
@@ -951,9 +918,8 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
                        send_set = TRUE;\r
 \r
                /* calc new op_vls and mtu */\r
-               op_vls =\r
-                   osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn,\r
-                                              p_physp);\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
@@ -1143,8 +1109,6 @@ Exit:
        return ret;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)\r
 {\r
        int ret;\r
@@ -1223,9 +1187,8 @@ int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
                   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\r
-                       ", LID [%u,%u]\n", cl_ntoh64(port_guid),\r
-                       min_lid_ho, max_lid_ho);\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
index 909fcd337334ab876c63d5f55c68bea3f0bb0bdf..f2567d6e8ebc4a4ccc6c1a65379233a93e759700 100644 (file)
@@ -1,7 +1,8 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -49,8 +50,6 @@
 #include <opensm/osm_switch.h>\r
 #include <opensm/osm_sm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_lft_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
@@ -91,8 +90,9 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
                if (status != IB_SUCCESS) {\r
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: "\r
                                "Setting forwarding table block failed (%s)"\r
-                               "\n\t\t\t\tSwitch 0x%" PRIx64 "\n",\r
-                               ib_get_err_str(status), cl_ntoh64(node_guid));\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
index 67cb7a608b84631b7e49f4767762f2202017aaa9..75b44a3e4bdd3b73407b26079f17a92f63ec833d 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
 #include <opensm/osm_opensm.h>\r
 #include <opensm/osm_ucast_lash.h>\r
 \r
-/**********************************************************************\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;\r
-       const osm_port_t *p_src_port;\r
+       const osm_port_t *p_sm_port, *p_src_port;\r
        ib_net16_t slid;\r
-       ib_net16_t smlid;\r
        uint8_t sl;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
@@ -72,27 +68,22 @@ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp)
            || !(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
+               return sm->p_subn->opt.sm_sl;\r
        }\r
 \r
        /* Find osm_port of the SM itself = dest_port */\r
-       smlid = sm->p_subn->sm_base_lid;\r
-       p_sm_port =\r
-           cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(smlid));\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 =\r
-           cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(slid));\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
+       return sl;\r
 }\r
 \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
@@ -119,7 +110,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
                /*\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 (p822, table 145).\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
@@ -156,8 +148,9 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
                        esp0 = TRUE;\r
        }\r
 \r
-       memset(payload, 0, IB_SMP_DATA_SIZE);\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
@@ -402,8 +395,6 @@ Exit:
        return ret;\r
 }\r
 \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
@@ -458,8 +449,6 @@ static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
        return ret;\r
 }\r
 \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
index 696d23738c05e355552ee54fd602288dcbfd689f..d67a0b580afaac99f699f0e4e7185aab1662c826 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -125,11 +125,25 @@ void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
 #endif                         /* __WIN__ */\r
 \r
        /* If this is a call to syslog - always print it */\r
-       if (!(verbosity & (OSM_LOG_SYS | p_log->level)))\r
+       if (!(verbosity & p_log->level))\r
                return;\r
 \r
        va_start(args, p_str);\r
-       vsprintf(buffer, p_str, args);\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
@@ -307,7 +321,7 @@ ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush,
                                IN unsigned long max_size,\r
                                IN boolean_t accum_log_file)\r
 {\r
-       p_log->level = log_flags;\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
index 1250e71f88fa277fe39d44c59efd96a3d0eb5d55..62dff4168a4dd2eedba91b65b00dc6e3d5a59048 100644 (file)
@@ -50,8 +50,6 @@
 #include <opensm/osm_madw.h>\r
 #include <vendor/osm_vendor_api.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool)\r
 {\r
        CL_ASSERT(p_pool);\r
@@ -59,15 +57,11 @@ void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool)
        memset(p_pool, 0, sizeof(*p_pool));\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool)\r
 {\r
        CL_ASSERT(p_pool);\r
 }\r
 \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
@@ -75,8 +69,6 @@ ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool)
        return IB_SUCCESS;\r
 }\r
 \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
@@ -118,8 +110,6 @@ Exit:
        return p_madw;\r
 }\r
 \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
@@ -147,11 +137,9 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool,
        osm_madw_set_mad(p_madw, p_mad);\r
 \r
 Exit:\r
-       return (p_madw);\r
+       return p_madw;\r
 }\r
 \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
@@ -164,11 +152,9 @@ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool)
        osm_madw_set_mad(p_madw, 0);\r
        cl_atomic_inc(&p_pool->mads_out);\r
 \r
-       return (p_madw);\r
+       return p_madw;\r
 }\r
 \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
index fee5860b43220e87ebb85eeb01ae7bcdb29f27de..4e053323c1e39b72453ce3826798dcd3113b3ec8 100644 (file)
@@ -2,6 +2,7 @@
  * 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
@@ -55,8 +56,6 @@
 #include <opensm/osm_subnet.h>\r
 #include <opensm/osm_sm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mft_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
@@ -109,10 +108,10 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
                if (status != IB_SUCCESS) {\r
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0802: "\r
                                "Setting MFT block failed (%s)"\r
-                               "\n\t\t\t\tSwitch 0x%016" PRIx64\r
-                               ", block %u, position %u\n",\r
-                               ib_get_err_str(status),\r
-                               cl_ntoh64(node_guid), block_num, position);\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
index 095604d974c14fee7a9fde9e181ad14100cbf49d..32da52f50014de4aae7a128e721bb05a8c14ad12 100644 (file)
@@ -3,6 +3,7 @@
  * 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
 #include <opensm/osm_helper.h>\r
 #include <opensm/osm_msgdef.h>\r
 \r
-/**********************************************************************\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
-/**********************************************************************\r
- **********************************************************************/\r
-static osm_mcast_work_obj_t *mcast_work_obj_new(IN const osm_port_t * p_port)\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
@@ -77,19 +75,60 @@ static osm_mcast_work_obj_t *mcast_work_obj_new(IN const osm_port_t * p_port)
        p_obj = malloc(sizeof(*p_obj));\r
        if (p_obj) {\r
                memset(p_obj, 0, sizeof(*p_obj));\r
-               p_obj->p_port = (osm_port_t *) p_port;\r
+               p_obj->p_port = p_port;\r
        }\r
 \r
-       return (p_obj);\r
+       return p_obj;\r
 }\r
 \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
@@ -101,107 +140,133 @@ static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
                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
-\r
                p_mtn->child_array[i] = NULL;\r
-\r
        }\r
 \r
        free(p_mtn);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_t * p_mgrp)\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 (p_mgrp->p_root)\r
-               mcast_mgr_purge_tree_node(p_mgrp->p_root);\r
-\r
-       p_mgrp->p_root = NULL;\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
-static float osm_mcast_mgr_compute_avg_hops(osm_sm_t * sm,\r
-                                           const osm_mgrp_t * p_mgrp,\r
-                                           const osm_switch_t * p_sw)\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
-       const osm_mcm_port_t *p_mcm_port;\r
-       const cl_qmap_t *p_mcm_tbl;\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
-       p_mcm_tbl = &p_mgrp->mcm_port_tbl;\r
-\r
-       /*\r
-          For each member of the multicast group, compute the\r
-          number of hops to its base LID.\r
-        */\r
-       for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);\r
-            p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);\r
-            p_mcm_port =\r
-            (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {\r
-               hops += osm_switch_get_port_least_hops(p_sw, p_mcm_port->port);\r
-               num_ports++;\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
-       /*\r
-          We should be here if there aren't any ports in the group.\r
-        */\r
+       /* We shouldn't be here if there aren't any ports in the group. */\r
        CL_ASSERT(num_ports);\r
 \r
-       if (num_ports != 0)\r
-               avg_hops = (float)(hops / num_ports);\r
+       avg_hops = (float)(hops / num_ports);\r
 \r
        OSM_LOG_EXIT(sm->p_log);\r
        return avg_hops;\r
 }\r
-\r
-/**********************************************************************\r
- Calculate the maximal "min hops" from the given switch to any\r
- of the group HCAs\r
- **********************************************************************/\r
-static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,\r
-                                           const osm_mgrp_t * p_mgrp,\r
-                                           const osm_switch_t * p_sw)\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;\r
-       uint32_t hops = 0;\r
-       const osm_mcm_port_t *p_mcm_port;\r
-       const cl_qmap_t *p_mcm_tbl;\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
-       p_mcm_tbl = &p_mgrp->mcm_port_tbl;\r
-\r
        /*\r
           For each member of the multicast group, compute the\r
           number of hops to its base LID.\r
         */\r
-       for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);\r
-            p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);\r
-            p_mcm_port =\r
-            (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {\r
-               hops = osm_switch_get_port_least_hops(p_sw, p_mcm_port->port);\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
-       if (max_hops == 0)\r
-               /*\r
-                  We should be here if there aren't any ports in the group.\r
-                */\r
-               max_hops = 10001;       /* see later - we use it to realize no hops */\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
@@ -210,35 +275,30 @@ static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,
    of the multicast group.\r
 **********************************************************************/\r
 static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,\r
-                                                  const osm_mgrp_t * p_mgrp)\r
+                                                  cl_qlist_t * list)\r
 {\r
+       cl_qmap_t mgrp_sw_map;\r
        cl_qmap_t *p_sw_tbl;\r
-       const osm_switch_t *p_sw;\r
-       const osm_switch_t *p_best_sw = NULL;\r
+       osm_switch_t *p_sw, *p_best_sw = NULL;\r
        float hops = 0;\r
        float best_hops = 10000;        /* any big # will do */\r
-#ifdef OSM_VENDOR_INTF_ANAFA\r
-       boolean_t use_avg_hops = TRUE;  /* anafa2 - bug hca on switch *//* use max hops for root */\r
-#else\r
-       boolean_t use_avg_hops = FALSE; /* use max hops for root */\r
-#endif\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
 \r
        p_sw_tbl = &sm->p_subn->sw_guid_tbl;\r
 \r
-       CL_ASSERT(!osm_mgrp_is_empty(p_mgrp));\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
-               if (use_avg_hops)\r
-                       hops = osm_mcast_mgr_compute_avg_hops(sm, p_mgrp, p_sw);\r
-               else\r
-                       hops = osm_mcast_mgr_compute_max_hops(sm, p_mgrp, p_sw);\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
@@ -252,24 +312,24 @@ static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
 \r
        if (p_best_sw)\r
                OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                       "Best switch is 0x%" PRIx64 ", hops = %f\n",\r
+                       "Best switch is 0x%" PRIx64 " (%s), hops = %f\n",\r
                        cl_ntoh64(osm_node_get_node_guid(p_best_sw->p_node)),\r
-                       best_hops);\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 (osm_switch_t *) p_best_sw;\r
+       return p_best_sw;\r
 }\r
 \r
 /**********************************************************************\r
-   This function returns the existing or optimal root swtich for the tree.\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,\r
-                                               const osm_mgrp_t * p_mgrp)\r
+static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list)\r
 {\r
-       const osm_switch_t *p_sw = NULL;\r
+       osm_switch_t *p_sw = NULL;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
 \r
@@ -279,14 +339,12 @@ static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm,
           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, p_mgrp);\r
+       p_sw = mcast_mgr_find_optimal_switch(sm, list);\r
 \r
        OSM_LOG_EXIT(sm->p_log);\r
-       return (osm_switch_t *) p_sw;\r
+       return p_sw;\r
 }\r
 \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
@@ -324,23 +382,21 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
 \r
        if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num,\r
                                    (uint8_t) position, block)) {\r
-\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 "\n",\r
-                       block_num, position,\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
-\r
                if (status != IB_SUCCESS) {\r
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: "\r
-                               "Sending multicast fwd. tbl. block failed (%s)\n",\r
-                               ib_get_err_str(status));\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
@@ -354,19 +410,16 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
   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, osm_mgrp_t * p_mgrp,\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
-       uint16_t mlid_ho;\r
        boolean_t ignore_existing;\r
        osm_mcast_work_obj_t *p_wobj;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
 \r
-       mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));\r
-\r
        /*\r
           For Multicast Groups, we don't want to count on previous\r
           configurations - since we can easily generate a storm\r
@@ -384,40 +437,36 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                port_num =\r
                    osm_switch_recommend_mcast_path(p_sw, p_wobj->p_port,\r
                                                    mlid_ho, ignore_existing);\r
-\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
-                       uint64_t node_guid_ho =\r
-                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));\r
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A03: "\r
                                "Error routing MLID 0x%X through switch 0x%"\r
-                               PRIx64 "\n"\r
+                               PRIx64 " %s\n"\r
                                "\t\t\t\tNo multicast paths from this switch "\r
-                               "for port with LID %u\n", mlid_ho, node_guid_ho,\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
-\r
                        mcast_work_obj_delete(p_wobj);\r
                        continue;\r
                }\r
 \r
                if (port_num > array_size) {\r
-                       uint64_t node_guid_ho =\r
-                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));\r
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A04: "\r
                                "Error routing MLID 0x%X through switch 0x%"\r
-                               PRIx64 "\n"\r
+                               PRIx64 " %s\n"\r
                                "\t\t\t\tNo multicast paths from this switch "\r
-                               "to port with LID %u\n", mlid_ho, node_guid_ho,\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
-\r
                        mcast_work_obj_delete(p_wobj);\r
-\r
                        /* This is means OpenSM has a bug. */\r
                        CL_ASSERT(FALSE);\r
                        continue;\r
@@ -429,23 +478,20 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * p_list)\r
+static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * list)\r
 {\r
-       osm_mcast_work_obj_t *p_wobj;\r
-\r
-       OSM_LOG_ENTER(sm->p_log);\r
-\r
-       while ((p_wobj = (osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list))\r
-              != (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) {\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(p_wobj->p_port));\r
-               mcast_work_obj_delete(p_wobj);\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
-\r
-       OSM_LOG_EXIT(sm->p_log);\r
+       drop_port_list(list);\r
 }\r
 \r
 /**********************************************************************\r
@@ -455,7 +501,7 @@ static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * p_list)
 \r
   The function returns the newly created mtree node element.\r
 **********************************************************************/\r
-static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,\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
@@ -466,11 +512,9 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
        cl_qlist_t *list_array = NULL;\r
        uint8_t i;\r
        ib_net64_t node_guid;\r
-       uint64_t node_guid_ho;\r
        osm_mcast_work_obj_t *p_wobj;\r
        cl_qlist_t *p_port_list;\r
        size_t count;\r
-       uint16_t mlid_ho;\r
        osm_mcast_tbl_t *p_tbl;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
@@ -480,13 +524,12 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
        CL_ASSERT(p_max_depth);\r
 \r
        node_guid = osm_node_get_node_guid(p_sw->p_node);\r
-       node_guid_ho = cl_ntoh64(node_guid);\r
-       mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));\r
 \r
        OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
                "Routing MLID 0x%X through switch 0x%" PRIx64\r
-               ", %u nodes at depth %u\n",\r
-               mlid_ho, node_guid_ho, cl_qlist_count(p_list), depth);\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
@@ -510,8 +553,8 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                   This switch doesn't do multicast.  Clean-up.\r
                 */\r
                OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A14: "\r
-                       "Switch 0x%" PRIx64 " does not support multicast\n",\r
-                       node_guid_ho);\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
@@ -550,6 +593,8 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                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
@@ -558,7 +603,7 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
        for (i = 0; i < max_children; i++)\r
                cl_qlist_init(&list_array[i]);\r
 \r
-       mcast_mgr_subdivide(sm, p_mgrp, p_sw, p_list, list_array, max_children);\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
@@ -602,7 +647,7 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                        continue;       /* No routes down this port. */\r
 \r
                OSM_LOG(sm->p_log, OSM_LOG_DEBUG,\r
-                       "Routing %zu destinations via switch port %u\n",\r
+                       "Routing %u destinations via switch port %u\n",\r
                        count, i);\r
 \r
                /*\r
@@ -641,7 +686,7 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                        CL_ASSERT(p_remote_physp);\r
 \r
                        p_mtn->child_array[i] =\r
-                           mcast_mgr_branch(sm, p_mgrp, p_remote_node->sw,\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
@@ -663,7 +708,6 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
                                " on switch port %u\n",\r
                                cl_ntoh64(osm_port_get_guid(p_wobj->p_port)),\r
                                i);\r
-\r
                        mcast_work_obj_delete(p_wobj);\r
                }\r
        }\r
@@ -674,39 +718,38 @@ Exit:
        return p_mtn;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,\r
-                                                    osm_mgrp_t * p_mgrp)\r
+                                                    osm_mgrp_box_t * mbox)\r
 {\r
-       const cl_qmap_t *p_mcm_tbl;\r
-       const osm_mcm_port_t *p_mcm_port;\r
-       uint32_t num_ports;\r
        cl_qlist_t port_list;\r
+       uint32_t num_ports;\r
        osm_switch_t *p_sw;\r
-       osm_mcast_work_obj_t *p_wobj;\r
        ib_api_status_t status = IB_SUCCESS;\r
        uint8_t max_depth = 0;\r
-       uint32_t count;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
 \r
-       cl_qlist_init(&port_list);\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, p_mgrp);\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
-       p_mcm_tbl = &p_mgrp->mcm_port_tbl;\r
-       num_ports = cl_qmap_count(p_mcm_tbl);\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
-                       cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));\r
+                       mbox->mlid);\r
                goto Exit;\r
        }\r
 \r
@@ -726,46 +769,22 @@ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
           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, p_mgrp);\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
-                       cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));\r
+                       mbox->mlid);\r
+               drop_port_list(&port_list);\r
                status = IB_ERROR;\r
                goto Exit;\r
        }\r
 \r
-       /*\r
-          Build the first "subset" containing all member ports.\r
-        */\r
-       for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);\r
-            p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);\r
-            p_mcm_port =\r
-            (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) {\r
-               /*\r
-                  Acquire the port object for this port guid, then create\r
-                  the new worker object to build the list.\r
-                */\r
-               p_wobj = mcast_work_obj_new(p_mcm_port->port);\r
-               if (p_wobj == NULL) {\r
-                       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: "\r
-                               "Insufficient memory to route port 0x%016"\r
-                               PRIx64 "\n",\r
-                               cl_ntoh64(osm_port_get_guid(p_mcm_port->port)));\r
-                       continue;\r
-               }\r
-\r
-               cl_qlist_insert_tail(&port_list, &p_wobj->list_item);\r
-       }\r
-\r
-       count = cl_qlist_count(&port_list);\r
-       p_mgrp->p_root = mcast_mgr_branch(sm, p_mgrp, p_sw, &port_list, 0, 0,\r
-                                         &max_depth);\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
-               cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth);\r
-\r
+               mbox->mlid, num_ports, max_depth);\r
 Exit:\r
        OSM_LOG_EXIT(sm->p_log);\r
        return status;\r
@@ -773,8 +792,6 @@ Exit:
 \r
 #if 0\r
 /* unused */\r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -819,8 +836,6 @@ void osm_mcast_mgr_set_table(osm_sm_t * sm, IN const osm_mgrp_t * p_mgrp,
 }\r
 #endif\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void mcast_mgr_clear(osm_sm_t * sm, uint16_t mlid)\r
 {\r
        osm_switch_t *p_sw;\r
@@ -971,7 +986,7 @@ Exit:
 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_t *mgrp;\r
+       osm_mgrp_box_t *mbox;\r
 \r
        OSM_LOG_ENTER(sm->p_log);\r
 \r
@@ -983,9 +998,9 @@ static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)
           port in the group. */\r
        mcast_mgr_clear(sm, mlid);\r
 \r
-       mgrp = osm_get_mgrp_by_mlid(sm->p_subn, cl_hton16(mlid));\r
-       if (mgrp) {\r
-               status = mcast_mgr_build_spanning_tree(sm, mgrp);\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
@@ -996,8 +1011,6 @@ static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)
        return status;\r
 }\r
 \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
@@ -1051,7 +1064,7 @@ static int alloc_mfts(osm_sm_t * sm)
 \r
        for (i = sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i >= 0;\r
             i--)\r
-               if (sm->p_subn->mgroups[i])\r
+               if (sm->p_subn->mboxes[i])\r
                        break;\r
        if (i < 0)\r
                return 0;\r
@@ -1060,15 +1073,13 @@ static int alloc_mfts(osm_sm_t * sm)
        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
+               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
-/**********************************************************************\r
- **********************************************************************/\r
 int osm_mcast_mgr_process(osm_sm_t * sm)\r
 {\r
        int i, ret = 0;\r
@@ -1090,12 +1101,13 @@ int osm_mcast_mgr_process(osm_sm_t * sm)
        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->mgroups[i] || sm->mlids_req[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
@@ -1134,6 +1146,7 @@ int osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
        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
index 13df4c47420ac952ba1995479695c0ecd29f20b6..0121c58b6a5294461d442def483541db033bc7ab 100644 (file)
@@ -51,8 +51,6 @@
 #include <iba/ib_types.h>\r
 #include <opensm/osm_mcast_tbl.h>\r
 \r
-/**********************************************************************\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
@@ -82,15 +80,11 @@ void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,
                                        IB_MCAST_BLOCK_SIZE) - 1);\r
 }\r
 \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
-/**********************************************************************\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
@@ -112,12 +106,10 @@ void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,
                p_tbl->max_block_in_use = (uint16_t) block_num;\r
 }\r
 \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];\r
+       uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];\r
 \r
        if (mlid_offset < p_tbl->mft_depth)\r
                goto done;\r
@@ -147,8 +139,6 @@ done:
        return 0;\r
 }\r
 \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
@@ -174,8 +164,6 @@ boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,
        return FALSE;\r
 }\r
 \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
@@ -198,8 +186,6 @@ boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,
        return (result != 0);\r
 }\r
 \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
@@ -231,11 +217,8 @@ ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,
        return IB_SUCCESS;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho)\r
 {\r
-       uint8_t i;\r
        unsigned mlid_offset;\r
 \r
        CL_ASSERT(p_tbl);\r
@@ -243,12 +226,11 @@ void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho)
 \r
        mlid_offset = mlid_ho - IB_LID_MCAST_START_HO;\r
        if (p_tbl->p_mask_tbl && mlid_offset < p_tbl->mft_depth)\r
-               for (i = 0; i <= p_tbl->max_position; i++)\r
-                       (*p_tbl->p_mask_tbl)[mlid_offset][i] = 0;\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
-/**********************************************************************\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
index 7b36db91a5d0f9f60374a85787052e8aa4d18b6f..17a6117d516a98175384d7eeb723b54e338f6407 100644 (file)
@@ -49,8 +49,6 @@
 #include <opensm/osm_mcm_port.h>\r
 #include <opensm/osm_multicast.h>\r
 \r
-/**********************************************************************\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
@@ -66,11 +64,9 @@ osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp,
                p_mcm->proxy_join = proxy;\r
        }\r
 \r
-       return (p_mcm);\r
+       return p_mcm;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm)\r
 {\r
        CL_ASSERT(p_mcm);\r
index f4b9acf1a6f95f12578c5a438c41bd9b149db0ea..f36993c96b7657626a0c754761f845704ae62b4f 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -82,8 +82,6 @@ void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)
        free(p_mtn);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 #if 0\r
 static void mtree_dump(IN osm_mtree_node_t * p_mtn)\r
 {\r
index dfa9b24eba92ffb201d5eb1729777025e80e5e00..1dab4302f46edbb782cb8d8ad7350d20d531824d 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
 #include <opensm/osm_inform.h>\r
 #include <opensm/osm_opensm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp)\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
@@ -69,15 +86,26 @@ void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp)
                    (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item);\r
                osm_mcm_port_delete(p_mcm_port);\r
        }\r
-       /* destroy the mtree_node structure */\r
-       osm_mtree_destroy(p_mgrp->p_root);\r
 \r
        free(p_mgrp);\r
 }\r
 \r
-osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr)\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
@@ -88,21 +116,29 @@ osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr)
        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
-/**********************************************************************\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
-       osm_mtree_destroy(mgrp->p_root);\r
-       mgrp->p_root = NULL;\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
@@ -115,12 +151,16 @@ void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp)
                return;\r
 \r
        cl_fmap_remove_item(&subn->mgrp_mgid_tbl, &mgrp->map_item);\r
-       subn->mgroups[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL;\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
-/**********************************************************************\r
- **********************************************************************/\r
 static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log,\r
                             osm_mgrp_t * mgrp, unsigned num)\r
 {\r
@@ -148,8 +188,6 @@ static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log,
                        ib_get_err_str(status));\r
 }\r
 \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
@@ -205,6 +243,7 @@ osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,
            ++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
@@ -259,6 +298,8 @@ void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
                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
@@ -274,8 +315,6 @@ void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
        }\r
 }\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
index bc32ede9280eeba9822647c156cc693c1847ab7b..e6d7ccd3f1e1edb4dc5875ed649835746216275a 100644 (file)
@@ -49,8 +49,6 @@
 #include <opensm/osm_node.h>\r
 #include <opensm/osm_madw.h>\r
 \r
-/**********************************************************************\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
@@ -71,8 +69,6 @@ void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num,
                       p_smp->hop_count, p_smp->initial_path);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 osm_node_t *osm_node_new(IN const osm_madw_t * p_madw)\r
 {\r
        osm_node_t *p_node;\r
@@ -122,11 +118,9 @@ osm_node_t *osm_node_new(IN const osm_madw_t * p_madw)
                                    p_madw);\r
        p_node->print_desc = strdup(OSM_NODE_DESC_UNKNOWN);\r
 \r
-       return (p_node);\r
+       return p_node;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void node_destroy(IN osm_node_t * p_node)\r
 {\r
        uint16_t i;\r
@@ -138,13 +132,10 @@ static void node_destroy(IN osm_node_t * p_node)
                osm_physp_destroy(&p_node->physp_table[i]);\r
 \r
        /* cleanup printable node_desc field */\r
-       if (p_node->print_desc) {\r
+       if (p_node->print_desc)\r
                free(p_node->print_desc);\r
-       }\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_node_delete(IN OUT osm_node_t ** p_node)\r
 {\r
        CL_ASSERT(p_node && *p_node);\r
@@ -153,8 +144,6 @@ void osm_node_delete(IN OUT osm_node_t ** p_node)
        *p_node = NULL;\r
 }\r
 \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
@@ -175,8 +164,6 @@ void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num,
        osm_physp_link(p_physp, p_remote_physp);\r
 }\r
 \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
@@ -197,8 +184,6 @@ void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num,
        }\r
 }\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
@@ -212,11 +197,9 @@ boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num,
        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
+       return osm_physp_link_exists(p_physp, p_remote_physp);\r
 }\r
 \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
@@ -234,18 +217,14 @@ boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node,
        return (p_physp && p_remote_physp);\r
 }\r
 \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
+       return osm_physp_has_any_link(p_physp);\r
 }\r
 \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
@@ -256,13 +235,13 @@ osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node,
        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
+               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
+       return osm_physp_get_node_ptr(p_remote_physp);\r
 }\r
 \r
 /**********************************************************************\r
@@ -278,8 +257,8 @@ ib_net16_t osm_node_get_remote_base_lid(IN osm_node_t * p_node,
        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
+               return osm_physp_get_base_lid(p_remote_physp);\r
        }\r
 \r
-       return (0);\r
+       return 0;\r
 }\r
index f161290438ca6d74496073ecbc3b15bf44c73bbf..53161fa1da54b9cd8121659bbc07a28cb64739a6 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -55,8 +55,6 @@
 #include <opensm/osm_opensm.h>\r
 #include <opensm/osm_subnet.h>\r
 \r
-/**********************************************************************\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
@@ -86,8 +84,6 @@ static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_nd_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index 34cbf6ba04de292c06979c467064dc5a2e8255f5..3e18d0f20e50ce7580c5c17034003e6d1b8c8b71 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. 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
@@ -183,14 +183,14 @@ static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node,
                   (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) and\r
-                  back we will count up to 5.\r
-                  Some crazy reconnections (newly created switch loop right before\r
-                  targeted CA) will not be catched this way. So in worst case -\r
-                  report GUID duplication and request new discovery.\r
-                  When switch node is targeted NodeInfo querying will be done in\r
-                  opposite order, this is much stronger check, unfortunately it is\r
-                  impossible with CAs.\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
@@ -250,8 +250,6 @@ _exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -432,7 +430,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
                }\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
+                  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
@@ -460,8 +458,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -752,8 +748,6 @@ static void ni_rcv_process_existing(IN osm_sm_t * sm, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_ni_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index 708219261dd477a009943ef2d651014e46a11146..7c988d14188edf5e98290b82a7a889b91f32891f 100644 (file)
@@ -81,8 +81,6 @@ const static struct routing_engine_module routing_modules[] = {
        {NULL, NULL}\r
 };\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)\r
 {\r
        switch (type) {\r
@@ -106,8 +104,6 @@ const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type)
        return "unknown";\r
 }\r
 \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
@@ -132,8 +128,6 @@ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)
                return OSM_ROUTING_ENGINE_TYPE_UNKNOWN;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void append_routing_engine(osm_opensm_t *osm,\r
                                  struct osm_routing_engine *routing_engine)\r
 {\r
@@ -207,8 +201,6 @@ static void setup_routing_engines(osm_opensm_t *osm, const char *engine_names)
                setup_routing_engine(osm, "minhop");\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_opensm_construct(IN osm_opensm_t * p_osm)\r
 {\r
        memset(p_osm, 0, sizeof(*p_osm));\r
@@ -222,8 +214,6 @@ void osm_opensm_construct(IN osm_opensm_t * p_osm)
        osm_log_construct(&p_osm->log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void destroy_routing_engines(osm_opensm_t *osm)\r
 {\r
        struct osm_routing_engine *r, *next;\r
@@ -238,8 +228,6 @@ static void destroy_routing_engines(osm_opensm_t *osm)
        }\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void destroy_plugins(osm_opensm_t *osm)\r
 {\r
        osm_epi_plugin_t *p;\r
@@ -333,8 +321,6 @@ static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
        free(p_names);\r
 }\r
 \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
@@ -350,7 +336,8 @@ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
                                 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
+               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
@@ -448,11 +435,9 @@ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
 \r
 Exit:\r
        OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "]\n");     /* Format Waived */\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -480,11 +465,9 @@ ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid)
 \r
 Exit:\r
        OSM_LOG_EXIT(&p_osm->log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
index 50aa280d74b2a108624c895b032e002f80e056bc..ce271aa5ea455ee8c62bf5278a6ec605e8421227 100644 (file)
@@ -283,7 +283,7 @@ ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * pm, ib_net64_t port_guid)
 \r
 Exit:\r
        OSM_LOG_EXIT(pm->log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 /**********************************************************************\r
@@ -407,7 +407,7 @@ static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
        }\r
 \r
        OSM_LOG_EXIT(perfmgr->log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 /**********************************************************************\r
@@ -821,8 +821,6 @@ static void perfmgr_sweep(void *arg)
        cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_perfmgr_shutdown(osm_perfmgr_t * pm)\r
 {\r
        OSM_LOG_ENTER(pm->log);\r
@@ -832,8 +830,6 @@ void osm_perfmgr_shutdown(osm_perfmgr_t * pm)
        OSM_LOG_EXIT(pm->log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_perfmgr_destroy(osm_perfmgr_t * pm)\r
 {\r
        OSM_LOG_ENTER(pm->log);\r
index 256cce2f390ede9d4fd8885cb28dd939e5f4bec0..ee0a92a1edf4c502f10d9ac89669428378d81887 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2008 Voltaire, Inc. All rights reserved.\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
@@ -57,13 +57,13 @@ perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr)
 {\r
        perfmgr_db_t *db = malloc(sizeof(*db));\r
        if (!db)\r
-               return (NULL);\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 ((void *)db);\r
+       return db;\r
 }\r
 \r
 /** =========================================================================\r
@@ -93,17 +93,17 @@ static inline db_node_t *get(perfmgr_db_t * db, uint64_t guid)
        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
+               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
+               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
+               return PERFMGR_EVENT_DB_PORTNOTFOUND;\r
+       return PERFMGR_EVENT_DB_SUCCESS;\r
 }\r
 \r
 /** =========================================================================\r
@@ -115,7 +115,7 @@ static db_node_t *malloc_node(uint64_t guid, boolean_t esp0,
        time_t cur_time = 0;\r
        db_node_t *rc = malloc(sizeof(*rc));\r
        if (!rc)\r
-               return (NULL);\r
+               return NULL;\r
 \r
        rc->ports = calloc(num_ports, sizeof(db_port_t));\r
        if (!rc->ports)\r
@@ -132,11 +132,11 @@ static db_node_t *malloc_node(uint64_t guid, boolean_t esp0,
        }\r
        snprintf(rc->node_name, sizeof(rc->node_name), "%s", name);\r
 \r
-       return (rc);\r
+       return rc;\r
 \r
 free_rc:\r
        free(rc);\r
-       return (NULL);\r
+       return NULL;\r
 }\r
 \r
 /** =========================================================================\r
@@ -157,12 +157,10 @@ static perfmgr_db_err_t insert(perfmgr_db_t * db, db_node_t * node)
                                           (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
+               return PERFMGR_EVENT_DB_FAIL;\r
+       return PERFMGR_EVENT_DB_SUCCESS;\r
 }\r
 \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
@@ -185,7 +183,7 @@ perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0,
        }\r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 /**********************************************************************\r
@@ -326,7 +324,7 @@ perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid,\r
@@ -346,7 +344,7 @@ perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid,
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 perfmgr_db_err_t\r
@@ -368,7 +366,7 @@ perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 static inline void\r
@@ -451,7 +449,7 @@ perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,\r
@@ -471,7 +469,7 @@ perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 perfmgr_db_err_t\r
@@ -493,7 +491,7 @@ perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port)
 \r
 Exit:\r
        cl_plock_release(&db->lock);\r
-       return (rc);\r
+       return rc;\r
 }\r
 \r
 static void clear_counters(cl_map_item_t * const p_map_item, void *context)\r
@@ -678,8 +676,6 @@ typedef struct {
        perfmgr_db_dump_t dump_type;\r
 } dump_context_t;\r
 \r
-/**********************************************************************\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
@@ -753,14 +749,14 @@ perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type)
 \r
        context.fp = fopen(file, "w+");\r
        if (!context.fp)\r
-               return (PERFMGR_EVENT_DB_FAIL);\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
+       return PERFMGR_EVENT_DB_SUCCESS;\r
 }\r
 \r
 /**********************************************************************\r
index 21df9279a642b29020f1806c2be4cd27ac06b68a..de4fbb5a44edb7db0b4e7712dbdcfa1ba81efeb8 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -54,8 +54,6 @@
 #include <opensm/osm_switch.h>\r
 #include <opensm/osm_helper.h>\r
 \r
-/**********************************************************************\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
@@ -63,8 +61,6 @@ void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl)
        cl_map_construct(&p_pkey_tbl->keys);\r
 }\r
 \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
@@ -87,8 +83,6 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
        cl_map_destroy(&p_pkey_tbl->keys);\r
 }\r
 \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
@@ -100,8 +94,6 @@ ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)
        return IB_SUCCESS;\r
 }\r
 \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
@@ -112,8 +104,6 @@ void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)
                        memset(p_block, 0, sizeof(*p_block));\r
 }\r
 \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
@@ -124,8 +114,6 @@ void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl)
        }\r
 }\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
@@ -194,8 +182,6 @@ ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
        return IB_SUCCESS;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
   Store the given pkey in the "new" blocks array.\r
   Also, make sure the regular block exists.\r
@@ -222,8 +208,6 @@ ib_api_status_t osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
        return IB_SUCCESS;\r
 }\r
 \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
@@ -253,8 +237,6 @@ boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
        return FALSE;\r
 }\r
 \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
@@ -281,15 +263,13 @@ ib_api_status_t osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
        return IB_NOT_FOUND;\r
 }\r
 \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
+               return FALSE;\r
 \r
        /* compare if the bases are the same. if they are - then\r
           this is a match */\r
@@ -299,8 +279,6 @@ static boolean_t match_pkey(IN const ib_net16_t * pkey1,
        return TRUE;\r
 }\r
 \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
@@ -314,8 +292,6 @@ boolean_t osm_physp_share_this_pkey(IN const osm_physp_t * p_physp1,
        return (pkey1 && pkey2 && match_pkey(pkey1, pkey2));\r
 }\r
 \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
@@ -354,8 +330,6 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
        return 0;\r
 }\r
 \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
@@ -383,8 +357,6 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
                                (p_physp_1, p_physp_2));\r
 }\r
 \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
@@ -415,8 +387,6 @@ Exit:
        return ret;\r
 }\r
 \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
index 85162a60bcee06138ad409d703c4edef091ec4a0..379079c69e29984456a5af3145b12eb6ec0c06ad 100644 (file)
@@ -1,7 +1,8 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -52,8 +53,6 @@
 #include <opensm/osm_partition.h>\r
 #include <opensm/osm_opensm.h>\r
 \r
-/**********************************************************************\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
@@ -73,8 +72,6 @@ pkey_mgr_get_physp_max_blocks(IN const osm_subn_t * p_subn,
        return ((num_pkeys + 31) / 32);\r
 }\r
 \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
@@ -117,8 +114,8 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
                                                   &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 for node "\r
-                               "0x%016" PRIx64 " port %u\n",\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
@@ -136,8 +133,6 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
                osm_physp_get_port_num(p_physp));\r
 }\r
 \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
@@ -163,8 +158,6 @@ pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm,
        }\r
 }\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
@@ -187,8 +180,6 @@ pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,
                           cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);\r
 }\r
 \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
@@ -203,15 +194,17 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
        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\n",\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
+                       osm_physp_get_port_num(p_physp),\r
+                       p_physp->p_node->print_desc);\r
                return IB_SUCCESS;\r
        }\r
 \r
-       memset(payload, 0, IB_SMP_DATA_SIZE);\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
@@ -236,21 +229,21 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
        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\n",\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
+                       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\n",\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
+                       osm_physp_get_port_num(p_physp),\r
+                       p_physp->p_node->print_desc);\r
        return status;\r
 }\r
 \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
@@ -284,10 +277,11 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
        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\n",\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
+                       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
@@ -313,11 +307,12 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
                        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\n",\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
+                                       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
@@ -331,12 +326,13 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
                                                       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\n",\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
+                                       osm_physp_get_port_num(p_physp),\r
+                                       p_physp->p_node->print_desc);\r
                        }\r
                }\r
 \r
@@ -361,16 +357,18 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
                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\n", block_index,\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
+                               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\n", block_index,\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
+                               osm_physp_get_port_num(p_physp),\r
+                               p_physp->p_node->print_desc);\r
                        ret = -1;\r
                }\r
        }\r
@@ -378,8 +376,6 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
        return ret;\r
 }\r
 \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
@@ -416,10 +412,11 @@ static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
        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. Clearing Enforcement bit\n",\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
+                       osm_physp_get_port_num(peer),\r
+                       p_node->print_desc);\r
                enforce = FALSE;\r
                ret = -1;\r
        }\r
@@ -447,10 +444,11 @@ static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
                                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\n", block_index,\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
+                                       osm_physp_get_port_num(peer),\r
+                                       p_node->print_desc);\r
                                ret = -1;\r
                        }\r
                }\r
@@ -459,15 +457,13 @@ static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
        if (!ret)\r
                OSM_LOG(p_log, OSM_LOG_DEBUG,\r
                        "Pkey table was updated for node 0x%016" PRIx64\r
-                       " port %u\n",\r
+                       " port %u (%s)\n",\r
                        cl_ntoh64(osm_node_get_node_guid(p_node)),\r
-                       osm_physp_get_port_num(peer));\r
+                       osm_physp_get_port_num(peer), p_node->print_desc);\r
 \r
        return ret;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 int osm_pkey_mgr_process(IN osm_opensm_t * p_osm)\r
 {\r
        cl_qmap_t *p_tbl;\r
index 43991d9576ec1957eaa6ead6455438f0e30c474d..709ef0b46f3591d7bfb093ca3679f62e81b9f1cc 100644 (file)
@@ -48,8 +48,6 @@
 #include <opensm/osm_helper.h>\r
 #include <opensm/osm_sm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  * WE ONLY RECEIVE GET or SET responses\r
  */\r
@@ -90,8 +88,7 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
                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",\r
-                       cl_ntoh64(port_guid),\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
index f447ac03b3b4b3f2b98abfebac039880dbc2fefb..11cd01dd1352d551eea34535ffb8f00d7f3c6388 100644 (file)
@@ -53,8 +53,6 @@
 #include <opensm/osm_madw.h>\r
 #include <opensm/osm_switch.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_physp_construct(IN osm_physp_t * p_physp)\r
 {\r
        memset(p_physp, 0, sizeof(*p_physp));\r
@@ -63,8 +61,6 @@ void osm_physp_construct(IN osm_physp_t * p_physp)
        osm_pkey_tbl_construct(&p_physp->pkeys);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_physp_destroy(IN osm_physp_t * p_physp)\r
 {\r
        size_t num_slvl, i;\r
@@ -85,8 +81,6 @@ void osm_physp_destroy(IN osm_physp_t * p_physp)
        }\r
 }\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
@@ -127,16 +121,12 @@ void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid,
        osm_pkey_tbl_init(&p_physp->pkeys);\r
 }\r
 \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
-/**********************************************************************\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
@@ -170,8 +160,6 @@ osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni,
        return p_port;\r
 }\r
 \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
@@ -182,8 +170,6 @@ void osm_port_get_lid_range_ho(IN const osm_port_t * p_port,
        *p_max_lid = (uint16_t) (*p_min_lid + (1 << lmc) - 1);\r
 }\r
 \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
@@ -236,8 +222,6 @@ uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log,
        return mtu;\r
 }\r
 \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
@@ -386,8 +370,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -435,8 +417,6 @@ static void physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp,
        cl_list_destroy(&tmpPortsList);\r
 }\r
 \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
@@ -595,8 +575,6 @@ Exit:
        cl_map_destroy(&visited_map);\r
 }\r
 \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
@@ -609,8 +587,6 @@ boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp)
        return TRUE;\r
 }\r
 \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
index ae61978fbc3428292288cff8a6ebab9bffefaa22..ad3e81f68303e15e6eebabdb5291c627760f67a3 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. 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
@@ -46,6 +46,7 @@
 #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 <opensm/osm_opensm.h>\r
 #include <opensm/osm_ucast_mgr.h>\r
 \r
-/**********************************************************************\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
+                       "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
-/**********************************************************************\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
@@ -315,8 +312,6 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -336,8 +331,6 @@ static void pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,
 }\r
 \r
 #define IBM_VENDOR_ID  (0x5076)\r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -360,8 +353,8 @@ static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm,
        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 for CA,\r
-                  router, and switch management ports. */\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
@@ -405,8 +398,6 @@ Exit:
        OSM_LOG_EXIT(p_log);\r
 }\r
 \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
@@ -418,8 +409,6 @@ static void pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -477,8 +466,6 @@ static void pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_pi_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index cf91623593da721af201d83fd740d1815f9c2ee0..f2493ba5c5c329648a15d7f698e68461c74fbd0b 100644 (file)
@@ -145,7 +145,8 @@ ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
                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), full);\r
+                                                  osm_port_get_guid(p_port),\r
+                                                  full);\r
                        if (status != IB_SUCCESS)\r
                                goto _err;\r
                }\r
@@ -225,7 +226,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
                        cl_ntoh16(pkey));\r
        if (p_mgrp) {\r
                p_mgrp->well_known = TRUE;\r
-               p->mlid = p_mgrp->mlid;\r
+               p->mgrp = p_mgrp;\r
        }\r
 \r
        /* workaround for TS */\r
@@ -240,8 +241,8 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
                                                      &p_mgrp);\r
        if (p_mgrp) {\r
                p_mgrp->well_known = TRUE;\r
-               if (!p->mlid)\r
-                       p->mlid = p_mgrp->mlid;\r
+               if (!p->mgrp)\r
+                       p->mgrp = p_mgrp;\r
        }\r
 \r
        return status;\r
index 70be991ad585d7ca036d2f39562529bb290239bf..45991b425fe1d7a7cda22a39826ef6c80ed286f1 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -77,6 +78,7 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
        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
@@ -96,10 +98,17 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
        context.vla_context.set_method = TRUE;\r
        attr_mod = ((block_num + 1) << 16) | port_num;\r
 \r
-       return 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
+       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
@@ -149,14 +158,14 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm, osm_physp_t * p,
 }\r
 \r
 static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p,\r
-                                         uint8_t in_port, uint8_t out_port,\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
-       uint32_t attr_mod;\r
+       ib_api_status_t status;\r
        unsigned vl_mask;\r
        uint8_t vl1, vl2;\r
        int i;\r
@@ -180,79 +189,73 @@ static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p,
        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
-       attr_mod = in_port << 8 | out_port;\r
-       return 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
+       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 ib_api_status_t sl2vl_update(osm_sm_t * sm, osm_port_t * p_port,\r
-                                   osm_physp_t * p, uint8_t port_num,\r
-                                   unsigned force_update,\r
-                                   const struct qos_config *qcfg)\r
+static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node,\r
+                             const struct qos_config *qcfg)\r
 {\r
-       ib_api_status_t status;\r
-       uint8_t i, num_ports;\r
-       osm_physp_t *p_physp;\r
-\r
-       if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH) {\r
-               if (ib_port_info_get_vl_cap(&p->port_info) == 1) {\r
-                       /* Check port 0's capability mask */\r
-                       p_physp = p_port->p_physp;\r
-                       if (!\r
-                           (p_physp->port_info.\r
-                            capability_mask & IB_PORT_CAP_HAS_SL_MAP))\r
-                               return IB_SUCCESS;\r
-               }\r
-               num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));\r
-       } else {\r
-               if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))\r
-                       return IB_SUCCESS;\r
-               num_ports = 1;\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
-       for (i = 0; i < num_ports; i++) {\r
-               status = sl2vl_update_table(sm, p, i, port_num, force_update,\r
-                                           &qcfg->sl2vl);\r
-               if (status != IB_SUCCESS)\r
-                       return status;\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
-       return IB_SUCCESS;\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_physp_setup(osm_log_t * p_log, osm_sm_t * sm,\r
-                          osm_port_t * p_port, osm_physp_t * p,\r
-                          uint8_t port_num, unsigned force_update,\r
-                          const struct qos_config *qcfg)\r
+static int qos_endport_setup(osm_sm_t * sm, osm_physp_t * p,\r
+                            const struct qos_config *qcfg)\r
 {\r
-       ib_api_status_t status;\r
+       unsigned force_update = p->need_update || sm->p_subn->need_update;\r
 \r
-       /* OpVLs should be ok at this moment - just use it */\r
-\r
-       /* setup VL high limit on the physp later to be updated by link mgr */\r
        p->vl_high_limit = qcfg->vl_high_limit;\r
-\r
-       /* setup VLArbitration */\r
-       status = vlarb_update(sm, p, port_num, force_update, qcfg);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6202 : "\r
-                       "failed to update VLArbitration tables "\r
-                       "for port %" PRIx64 " #%d\n",\r
-                       cl_ntoh64(p->port_guid), port_num);\r
+       if (vlarb_update(sm, p, 0, force_update, qcfg))\r
                return -1;\r
-       }\r
 \r
-       /* setup SL2VL tables */\r
-       status = sl2vl_update(sm, p_port, p, port_num, force_update, qcfg);\r
-       if (status != IB_SUCCESS) {\r
-               OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6203 : "\r
-                       "failed to update SL2VLMapping tables "\r
-                       "for port %" PRIx64 " #%d\n",\r
-                       cl_ntoh64(p->port_guid), port_num);\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
 \r
        return 0;\r
 }\r
@@ -264,12 +267,8 @@ int osm_qos_setup(osm_opensm_t * p_osm)
        cl_qmap_t *p_tbl;\r
        cl_map_item_t *p_next;\r
        osm_port_t *p_port;\r
-       uint32_t num_physp;\r
-       osm_physp_t *p_physp;\r
        osm_node_t *p_node;\r
-       unsigned force_update;\r
        int ret = 0;\r
-       uint8_t i;\r
 \r
        if (!p_osm->subn.opt.qos)\r
                return 0;\r
@@ -298,18 +297,9 @@ int osm_qos_setup(osm_opensm_t * p_osm)
 \r
                p_node = p_port->p_node;\r
                if (p_node->sw) {\r
-                       num_physp = osm_node_get_num_physp(p_node);\r
-                       for (i = 1; i < num_physp; i++) {\r
-                               p_physp = osm_node_get_physp_ptr(p_node, i);\r
-                               if (!p_physp)\r
-                                       continue;\r
-                               force_update = p_physp->need_update ||\r
-                                   p_osm->subn.need_update;\r
-                               if (qos_physp_setup(&p_osm->log, &p_osm->sm,\r
-                                                   p_port, p_physp, i,\r
-                                                   force_update, &swe_config))\r
-                                       ret = -1;\r
-                       }\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
@@ -321,13 +311,7 @@ int osm_qos_setup(osm_opensm_t * p_osm)
                else\r
                        cfg = &ca_config;\r
 \r
-               p_physp = p_port->p_physp;\r
-               if (!p_physp)\r
-                       continue;\r
-\r
-               force_update = p_physp->need_update || p_osm->subn.need_update;\r
-               if (qos_physp_setup(&p_osm->log, &p_osm->sm, p_port, p_physp,\r
-                                   0, force_update, cfg))\r
+               if (qos_endport_setup(&p_osm->sm, p_port->p_physp, cfg))\r
                        ret = -1;\r
        }\r
 \r
index 88ae32f22164f4a4b6762c39f3479947add9c03e..e752661508583577d120648035cb15c315c5b560 100644 (file)
@@ -815,7 +815,7 @@ char *yytext;
 #line 2 "osm_qos_parser_l.l"\r
 /*\r
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index a2c475d010fb54d9de03e4f5a6b9fc8301087ffc..a31c79ee0681da2158ce4e3d01e0d9b9167aed00 100644 (file)
@@ -1,7 +1,7 @@
 %{\r
 /*\r
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
index 08488271f626a2b66b7ced1203d6627918f50435..68c325566a412b6b202a543c1095f8be6d1cf5c6 100644 (file)
@@ -72,7 +72,7 @@
 \r
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
 #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
index 1934bc5b58d8faa11694535a24263a53a2dc7895..f5c9ba0ddac69ae64ae8b9c0ff0db607ea08c731 100644 (file)
@@ -1,7 +1,7 @@
 %{\r
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -58,6 +58,7 @@
 #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
index 3bf6cda7682788e6d9446d3c1c3a65aaddafae88..8156c9df7a60164bde528debdb3c7e61cd36dda0 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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) 2008 Xsigo Systems Inc.  All rights reserved.\r
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.\r
@@ -772,7 +772,6 @@ static void __qos_policy_validate_pkey(
        uint8_t sl;\r
        uint32_t flow;\r
        uint8_t hop;\r
-       osm_mgrp_t * p_mgrp;\r
 \r
        if (!p_qos_policy || !p_qos_match_rule || !p_prtn)\r
                return;\r
@@ -792,31 +791,21 @@ static void __qos_policy_validate_pkey(
 \r
        /* If this partition is an IPoIB partition, there should\r
           be a matching MCast group. Fix this group's SL too */\r
-\r
-       if (!p_prtn->mlid)\r
-               return;\r
-\r
-       p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy->p_subn, p_prtn->mlid);\r
-       if (!p_mgrp) {\r
-               OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR,\r
-                       "ERR AC16: MCast group for partition with "\r
-                       "pkey 0x%04X not found\n",\r
-                       cl_ntoh16(p_prtn->pkey));\r
+       if (!p_prtn->mgrp)\r
                return;\r
-       }\r
 \r
-       CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) ==\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_mgrp->mcmember_rec.sl_flow_hop,\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_mgrp->mcmember_rec.mlid),\r
+                       cl_hton16(p_prtn->mgrp->mcmember_rec.mlid),\r
                        p_prtn->sl);\r
-               p_mgrp->mcmember_rec.sl_flow_hop =\r
+               p_prtn->mgrp->mcmember_rec.sl_flow_hop =\r
                        ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);\r
        }\r
 }\r
index c9ea8dae696e30f2e2a1ccb72a61fad5226a5fd0..6b8bd1c9ea2c840c34e8547e12aaa5d76cec9427 100644 (file)
 #include <string.h>\r
 #include <opensm/osm_remote_sm.h>\r
 \r
-/**********************************************************************\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
-/**********************************************************************\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
-/**********************************************************************\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
index bf3dd8a95a6096fc9d98268f8b4cbdcd0eb31bf4..fe7d134c83a7ce3d00113823c2fef333a2891b51 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -84,7 +84,6 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 \r
        p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind,\r
                                  MAD_BLOCK_SIZE, NULL);\r
-\r
        if (p_madw == NULL) {\r
                OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
                        "ERR 1101: Unable to acquire MAD\n");\r
@@ -155,7 +154,6 @@ ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 \r
        p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind,\r
                                  MAD_BLOCK_SIZE, NULL);\r
-\r
        if (p_madw == NULL) {\r
                OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
                        "ERR 1102: Unable to acquire MAD\n");\r
@@ -203,8 +201,7 @@ int osm_send_trap144(osm_sm_t * sm, ib_net16_t local)
        osm_madw_t *madw;\r
        ib_smp_t *smp;\r
        ib_mad_notice_attr_t *ntc;\r
-       osm_port_t *port;\r
-       osm_port_t *smport;\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
index bbce937f8d0eaf119f48efe08cd87632bcc2b875..22d5a808e301c7c5c8b6ac583e0a8be18265106e 100644 (file)
@@ -56,8 +56,6 @@
 #include <opensm/osm_msgdef.h>\r
 #include <opensm/osm_opensm.h>\r
 \r
-/**********************************************************************\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
@@ -94,8 +92,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
index d19dd6677a681391aa00f481d0d467a5c5a1df8c..c10b7beeecd3a2f1a49ed20ee635b8164d892385 100644 (file)
 #include <iba/ib_types.h>\r
 #include <opensm/osm_router.h>\r
 \r
-/**********************************************************************\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
-/**********************************************************************\r
- **********************************************************************/\r
 osm_router_t *osm_router_new(IN osm_port_t * p_port)\r
 {\r
        osm_router_t *p_rtr;\r
index dcc49ca89096458773dc0864d38803f9840d15b6..279fd953225b978a514e15c748b30e55d345beb5 100644 (file)
@@ -1,8 +1,9 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -90,8 +91,6 @@ extern void osm_sir_rcv_process(IN void *context, IN void *data);
 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
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sa_construct(IN osm_sa_t * p_sa)\r
 {\r
        memset(p_sa, 0, sizeof(*p_sa));\r
@@ -101,8 +100,6 @@ void osm_sa_construct(IN osm_sa_t * p_sa)
        cl_timer_construct(&p_sa->sr_timer);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sa_shutdown(IN osm_sa_t * p_sa)\r
 {\r
        ib_api_status_t status;\r
@@ -138,8 +135,6 @@ void osm_sa_shutdown(IN osm_sa_t * p_sa)
        OSM_LOG_EXIT(p_sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sa_destroy(IN osm_sa_t * p_sa)\r
 {\r
        OSM_LOG_ENTER(p_sa->p_log);\r
@@ -151,8 +146,6 @@ void osm_sa_destroy(IN osm_sa_t * p_sa)
        OSM_LOG_EXIT(p_sa->p_log);\r
 }\r
 \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
@@ -285,11 +278,9 @@ ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa,
        status = IB_SUCCESS;\r
 Exit:\r
        OSM_LOG_EXIT(p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -464,8 +455,15 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
        /* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */\r
        resp_sa_mad->sm_key = 0;\r
 \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
+#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
@@ -503,8 +501,6 @@ Exit:
        }\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  *  SA DB Dumper\r
  *\r
@@ -696,18 +692,15 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {\r
        struct opensm_dump_context dump_context;\r
        osm_mgrp_t *p_mgrp;\r
-       int i;\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 (i = 0; i <= p_osm->subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO;\r
-            i++) {\r
-               p_mgrp = p_osm->subn.mgroups[i];\r
-               if (p_mgrp)\r
-                       sa_dump_one_mgrp(p_mgrp, &dump_context);\r
-       }\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
@@ -719,7 +712,13 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 \r
 int osm_sa_db_file_dump(osm_opensm_t * p_osm)\r
 {\r
-       return opensm_dump_to_file(p_osm, "opensm-sa.dump", sa_dump_all_sa);\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
@@ -734,10 +733,9 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 \r
        cl_plock_excl_acquire(&p_osm->lock);\r
 \r
-       p_mgrp = osm_get_mgrp_by_mlid(&p_osm->subn, mlid);\r
+       p_mgrp = osm_get_mgrp_by_mgid(&p_osm->subn, &p_mcm_rec->mgid);\r
        if (p_mgrp) {\r
-               if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid,\r
-                           sizeof(ib_gid_t))) {\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
@@ -917,6 +915,12 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
        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
@@ -932,6 +936,10 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
                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
@@ -1108,8 +1116,16 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm)
                }\r
        }\r
 \r
-       if (!rereg_clients)\r
-               p_osm->subn.opt.no_clients_rereg = TRUE;\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
index 855a889eb528a53422c6c391970071644622d726..b3dd79799ed0127c055ba6fb4ae172a92a0233cc 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -66,8 +66,6 @@ const static uint32_t msecs_to_rtv_table[MAX_MSECS_TO_RTV] = {
        1099511, 2199023, 4398046, 8796093\r
 };\r
 \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
index 771c0a00c6fa110f6e4e41fffa70a127eb792180..b99cc2cf71eb281718fe5dc27b4578ad4a886874 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -70,8 +70,6 @@ typedef struct osm_gir_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_gir_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -109,11 +107,9 @@ static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -211,8 +207,6 @@ static void sa_gir_create_gir(IN osm_sa_t * sa, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -285,8 +279,6 @@ Exit:
        OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_gir_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 530273c0c8ae32a475d77e5e00dda5b006d7600d..4cfe5792ac5954748c250ae232d7b39c902b0d6c 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -89,12 +89,8 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,
        boolean_t valid = TRUE;\r
        osm_physp_t *p_requester_physp;\r
        osm_port_t *p_port;\r
-       osm_physp_t *p_physp;\r
        ib_net64_t portguid;\r
-       ib_net16_t lid_range_begin;\r
-       ib_net16_t lid_range_end;\r
-       ib_net16_t lid;\r
-       const cl_ptr_vector_t *p_tbl;\r
+       uint16_t lid_range_begin, lid_range_end, lid;\r
 \r
        OSM_LOG_ENTER(sa->p_log);\r
 \r
@@ -109,7 +105,6 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,
                    interface_id;\r
 \r
                p_port = osm_get_port_by_guid(sa->p_subn, portguid);\r
-\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
@@ -118,19 +113,18 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,
                        goto Exit;\r
                }\r
 \r
-               /* get the destination InformInfo physical port */\r
-               p_physp = p_port->p_physp;\r
-\r
-               /* make sure that the requester and destination port can access each other\r
-                  according to the current partitioning. */\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_physp, p_requester_physp)) {\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
@@ -143,33 +137,35 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa,
                    cl_ntoh16(p_infr_rec->inform_record.inform_info.\r
                              lid_range_end);\r
 \r
-               /* lid_range_end is set to zero if no range desired. In this case -\r
-                  just make it equal to the lid_range_begin. */\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_tbl = &sa->p_subn->port_lid_tbl;\r
-                       if (cl_ptr_vector_get_size(p_tbl) > lid)\r
-                               p_port = cl_ptr_vector_get(p_tbl, lid);\r
-                       else {\r
-                               /* lid requested is out of range */\r
-                               OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: "\r
-                                       "Given LID (%u) is out of range:%u\n",\r
-                                       lid, cl_ptr_vector_get_size(p_tbl));\r
-                               valid = FALSE;\r
-                               goto Exit;\r
-                       }\r
+                       p_port = osm_get_port_by_lid_ho(sa->p_subn, lid);\r
                        if (p_port == NULL)\r
                                continue;\r
 \r
-                       p_physp = p_port->p_physp;\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_physp, p_requester_physp)) {\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
@@ -183,8 +179,6 @@ Exit:
        return valid;\r
 }\r
 \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
@@ -237,8 +231,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -281,8 +273,8 @@ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 \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 other\r
-          according to the current partitioning. */\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
@@ -304,8 +296,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -549,8 +539,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/*********************************************************************\r
-**********************************************************************/\r
 void osm_infr_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
@@ -566,8 +554,7 @@ void osm_infr_rcv_process(IN void *context, IN void *data)
        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,\r
-                       "Unsupported Method (%s)\n",\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
@@ -579,8 +566,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/*********************************************************************\r
-**********************************************************************/\r
 void osm_infir_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
index d0812646299288907c857f4dca8ef4196d0d313d..96b86e2820d4a18f19572fedb1193ba99336d01b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -67,8 +67,6 @@ typedef struct osm_lftr_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_lftr_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -105,11 +103,9 @@ static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -176,8 +172,6 @@ static void lftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)
                                  osm_port_get_base_lid(p_port), block);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_lftr_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 8b9f5afa942f5b114e8755f556a1c2651eaaa7e4..966a3af775668fba539ac75dced79990ad5ef4da 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -60,8 +60,6 @@ typedef struct osm_lr_item {
        ib_link_record_t link_rec;\r
 } osm_lr_item_t;\r
 \r
-/**********************************************************************\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
@@ -88,8 +86,6 @@ static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,
        cl_qlist_insert_tail(p_list, &p_lr_item->list_item);\r
 }\r
 \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
@@ -97,8 +93,6 @@ static ib_net16_t get_base_lid(IN const osm_physp_t * p_physp)
        return osm_physp_get_base_lid(p_physp);\r
 }\r
 \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
@@ -198,8 +192,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -417,8 +409,6 @@ Exit:
        return sa_status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_lr_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
index 8fe30f31fb56a04e5fd61f401c9bc9c28caa50dc..81aa30d4ed974057dd1eb504572cd8298b40b533 100644 (file)
@@ -102,11 +102,11 @@ static void sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * p_ctrl,
 \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 provide\r
-          immediate response - IB_RESOURCE_BUSY\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 the\r
-          time the last message stayed in the queue.\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
@@ -447,8 +447,6 @@ static void sa_mad_ctrl_send_err_callback(IN void *context,
  * SEE ALSO\r
  *********/\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl)\r
 {\r
        CL_ASSERT(p_ctrl);\r
@@ -456,16 +454,12 @@ void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl)
        p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;\r
 }\r
 \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
-/**********************************************************************\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
@@ -504,8 +498,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -553,8 +545,6 @@ Exit:
        return status;\r
 }\r
 \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
index 5bb499dc06598f4270b09dc7914ec1408a8d95bb..6698d6fb81cf7f21b3b65368c6a1be4ecc67ce41 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -114,33 +114,69 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
 /*********************************************************************\r
  Get a new unused mlid by scanning all the used ones in the subnet.\r
 **********************************************************************/\r
-static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_net16_t requested_mlid)\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_mgrp_by_mlid(p_subn, requested_mlid))\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->mgroups[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
-/**********************************************************************\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
-/**********************************************************************\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
@@ -211,7 +247,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                switch (mtu_sel) {\r
                case 0: /* Greater than MTU specified */\r
                        if (mtu_mgrp <= mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -220,7 +256,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                        break;\r
                case 1: /* Less than MTU specified */\r
                        if (mtu_mgrp >= mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -229,7 +265,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                        break;\r
                case 2: /* Exactly MTU specified */\r
                        if (mtu_mgrp != mtu_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -250,7 +286,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                switch (rate_sel) {\r
                case 0: /* Greater than RATE specified */\r
                        if (rate_mgrp <= rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -259,7 +295,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                        break;\r
                case 1: /* Less than RATE specified */\r
                        if (rate_mgrp >= rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -268,7 +304,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log,
                        break;\r
                case 2: /* Exactly RATE specified */\r
                        if (rate_mgrp != rate_required) {\r
-                               OSM_LOG(p_log, OSM_LOG_DEBUG,\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
@@ -299,7 +335,7 @@ static boolean_t validate_port_caps(osm_log_t * p_log,
        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_DEBUG,\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
@@ -308,7 +344,7 @@ static boolean_t validate_port_caps(osm_log_t * p_log,
        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_DEBUG,\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
@@ -397,8 +433,6 @@ static boolean_t validate_modify(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
        return TRUE;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  * Check legality of the requested MGID DELETE\r
  * o15-0.1.14 = VALID DELETE:\r
@@ -469,8 +503,6 @@ static boolean_t validate_delete(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
        return TRUE;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  * Check legality of the requested MGID (note this does not hold for SA\r
  * created MGIDs)\r
@@ -590,7 +622,7 @@ static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (valid);\r
+       return valid;\r
 }\r
 \r
 /**********************************************************************\r
@@ -634,7 +666,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
                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_DEBUG,\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
@@ -662,7 +694,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
                }\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_DEBUG,\r
+                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
                                "Calculated MTU %x is out of range\n", mtu);\r
                        return FALSE;\r
                }\r
@@ -681,7 +713,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
                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_DEBUG,\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
@@ -709,7 +741,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
                }\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_DEBUG,\r
+                       OSM_LOG(p_log, OSM_LOG_VERBOSE,\r
                                "Calculated RATE %x is out of range\n", rate);\r
                        return FALSE;\r
                }\r
@@ -720,80 +752,73 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
        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
-                                               const p_recvd_mcmember_rec,\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
-       unsigned zero_mgid = 1;\r
-       uint8_t scope;\r
-       ib_gid_t *p_mgid;\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
-       /* but what if the given MGID was not 0 ? */\r
-       if (p_recvd_mcmember_rec->mgid.unicast.prefix != 0 ||\r
-           p_recvd_mcmember_rec->mgid.unicast.interface_id != 0)\r
-               zero_mgid = 0;\r
-\r
-       /*\r
-          we allocate a new mlid number before we might use it\r
-          for MGID ...\r
-        */\r
-       mlid = get_new_mlid(sa, mcm_rec.mlid);\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,\r
-               "Obtained new mlid 0x%X\n", cl_ntoh16(mlid));\r
-\r
        /* we need to create the new MGID if it was not defined */\r
-       if (zero_mgid) {\r
+       if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) {\r
                /* create a new MGID */\r
                char gid_str[INET6_ADDRSTRLEN];\r
 \r
-               /* use the given scope state only if requested! */\r
-               if (comp_mask & IB_MCR_COMPMASK_SCOPE)\r
-                       ib_member_get_scope_state(p_recvd_mcmember_rec->\r
-                                                 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
-               p_mgid = &(mcm_rec.mgid);\r
-               p_mgid->raw[0] = 0xFF;\r
-               p_mgid->raw[1] = 0x10 | scope;\r
-               p_mgid->raw[2] = 0xA0;\r
-               p_mgid->raw[3] = 0x1B;\r
-\r
-               /* HACK: use the SA port gid to make it globally unique */\r
-               memcpy((&p_mgid->raw[4]),\r
-                      &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));\r
-\r
-               /* HACK: how do we get a unique number - use the mlid twice */\r
-               memcpy(&p_mgid->raw[10], &mlid, sizeof(uint16_t));\r
-               memcpy(&p_mgid->raw[12], &mlid, sizeof(uint16_t));\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, p_mgid->raw, gid_str,\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
-               free_mlid(sa, mlid);\r
                status = IB_SA_MAD_STATUS_REQ_INVALID;\r
                goto Exit;\r
        }\r
@@ -803,14 +828,25 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
            FALSE) {\r
                OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B26: "\r
                        "Requested MGRP parameters are not realizable\n");\r
-               free_mlid(sa, mlid);\r
                status = IB_SA_MAD_STATUS_REQ_INVALID;\r
                goto Exit;\r
        }\r
 \r
-       /* create a new MC Group */\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
-       *pp_mgrp = osm_mgrp_new(mlid, &mcm_rec);\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
@@ -827,58 +863,11 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
        (*pp_mgrp)->mcmember_rec.pkt_life &= 0x3f;\r
        (*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6;    /* exactly */\r
 \r
-       /* Insert the new group in the data base */\r
-       cl_fmap_insert(&sa->p_subn->mgrp_mgid_tbl,\r
-                      &(*pp_mgrp)->mcmember_rec.mgid, &(*pp_mgrp)->map_item);\r
-       sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = *pp_mgrp;\r
-\r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
        return status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
-/* 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
-static unsigned match_and_update_ipv6_snm_mgid(ib_gid_t * mgid)\r
-{\r
-       if ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&\r
-           (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE) {\r
-               mgid->unicast.prefix &= PREFIX_MASK;\r
-               mgid->unicast.interface_id &= INT_ID_MASK;\r
-               return 1;\r
-       }\r
-       return 0;\r
-}\r
-\r
-osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid)\r
-{\r
-       osm_mgrp_t *mg;\r
-\r
-       if (sa->p_subn->opt.consolidate_ipv6_snm_req &&\r
-           match_and_update_ipv6_snm_mgid(p_mgid)) {\r
-               char gid_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, p_mgid->raw, gid_str,\r
-                                 sizeof gid_str));\r
-       }\r
-\r
-       mg = (osm_mgrp_t *)cl_fmap_get(&sa->p_subn->mgrp_mgid_tbl, p_mgid);\r
-       if (mg != (osm_mgrp_t *)cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl))\r
-               return mg;\r
-\r
-       return NULL;\r
-}\r
-\r
 /**********************************************************************\r
  Call this function to find or create a new mgrp.\r
 **********************************************************************/\r
@@ -890,7 +879,8 @@ ib_api_status_t osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
 {\r
        osm_mgrp_t *mgrp;\r
 \r
-       if ((mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid))) {\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
@@ -924,7 +914,7 @@ static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
        }\r
 \r
        CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);\r
-       p_mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid);\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
@@ -1023,21 +1013,21 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
                goto Exit;\r
        }\r
 \r
-       if (!osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) {\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_DEBUG,\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
-       proxy = (p_physp != p_request_physp);\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_recvd_mcmember_rec->mgid);\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
@@ -1206,7 +1196,7 @@ static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 /**********************************************************************\r
@@ -1377,7 +1367,6 @@ static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
        osm_physp_t *p_req_physp;\r
        boolean_t trusted_req;\r
        osm_mgrp_t *p_mgrp;\r
-       int i;\r
 \r
        OSM_LOG_ENTER(sa->p_log);\r
 \r
@@ -1406,13 +1395,11 @@ static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
        CL_PLOCK_ACQUIRE(sa->p_lock);\r
 \r
        /* simply go over all MCGs and match */\r
-       for (i = 0; i <= sa->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;\r
-            i++) {\r
-               p_mgrp = sa->p_subn->mgroups[i];\r
-               if (p_mgrp)\r
-                       mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,\r
-                                         p_req_physp, trusted_req, &rec_list);\r
-       }\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
@@ -1442,8 +1429,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mcmr_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
index 2e865dc6cbc76f55579ffd566fb61d13cc6deaee..a38ee51cd5e1a7805669362e07b5ac348cdff792 100644 (file)
@@ -67,8 +67,6 @@ typedef struct osm_mftr_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_mftr_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -110,11 +108,9 @@ static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -209,8 +205,6 @@ static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt)
                                          position);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mftr_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 70899672feb8afd012b6d854c4e0332485b11f85..9712bd5c1fbcbd1f89dd0c0a5566b4f3eb1808b1 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -81,8 +81,6 @@ typedef struct osm_path_parms {
        int hops;\r
 } osm_path_parms_t;\r
 \r
-/**********************************************************************\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
@@ -98,8 +96,6 @@ static boolean_t sa_multipath_rec_is_tavor_port(IN const osm_port_t * p_port)
                 (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));\r
 }\r
 \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
@@ -111,7 +107,7 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,
        /* 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
+               return FALSE;\r
 \r
        /*\r
           we can apply the patch if either:\r
@@ -127,7 +123,7 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,
                case 0: /* must be greater than */\r
                case 2: /* exact match */\r
                        if (IB_MTU_LEN_1024 < required_mtu)\r
-                               return (FALSE);\r
+                               return FALSE;\r
                        break;\r
 \r
                case 1: /* must be less than */\r
@@ -137,7 +133,7 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,
                case 3: /* largest available */\r
                        /* the ULP intentionally requested */\r
                        /* the largest MTU possible */\r
-                       return (FALSE);\r
+                       return FALSE;\r
                        break;\r
 \r
                default:\r
@@ -147,11 +143,9 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr,
                }\r
        }\r
 \r
-       return (TRUE);\r
+       return TRUE;\r
 }\r
 \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
@@ -735,11 +729,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -788,8 +780,6 @@ static void mpr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -861,11 +851,9 @@ static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (p_pr_item);\r
+       return p_pr_item;\r
 }\r
 \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
@@ -1049,8 +1037,6 @@ Exit:
 #undef min\r
 #define min(x,y)       (((x) < (y)) ? (x) : (y))\r
 \r
-/**********************************************************************\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
@@ -1129,8 +1115,6 @@ static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
        return p_pr_item;\r
 }\r
 \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
@@ -1188,8 +1172,6 @@ Exit:
        return ib_status;\r
 }\r
 \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
@@ -1239,14 +1221,12 @@ static ib_net16_t mpr_rcv_get_end_points(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (sa_status);\r
+       return sa_status;\r
 }\r
 \r
 #define hash_lids(a, b, lmc)   \\r
        (((((a) >> (lmc)) << 4) | ((b) >> (lmc))) % 103)\r
 \r
-/**********************************************************************\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
@@ -1360,8 +1340,6 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -1404,8 +1382,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_mpr_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
index b9d7f04ee24e2be9351f5cfaa82c439dae7aa287..8a2f83a44af47190511f357029702489573e4bf0 100644 (file)
@@ -67,8 +67,6 @@ typedef struct osm_nr_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_nr_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -105,11 +103,9 @@ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -183,8 +179,6 @@ static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -277,8 +271,6 @@ Exit:
        OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_nr_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 1b81bc8cbf6e4a67ec1e2e3c81c5351c77a435e2..203a191c7cc4c19513dc4e026b01ab94cb090454 100644 (file)
@@ -1,9 +1,10 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -69,6 +70,8 @@
 #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
@@ -83,8 +86,6 @@ typedef struct osm_path_parms {
        boolean_t reversible;\r
 } osm_path_parms_t;\r
 \r
-/**********************************************************************\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
@@ -100,8 +101,6 @@ static inline boolean_t sa_path_rec_is_tavor_port(IN const osm_port_t * p_port)
                 (vend_id == CL_HTON32(OSM_VENDOR_ID_VOLTAIRE))));\r
 }\r
 \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
@@ -113,7 +112,7 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,
        /* 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
+               return FALSE;\r
 \r
        /*\r
           we can apply the patch if either:\r
@@ -129,7 +128,7 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,
                case 0: /* must be greater than */\r
                case 2: /* exact match */\r
                        if (IB_MTU_LEN_1024 < required_mtu)\r
-                               return (FALSE);\r
+                               return FALSE;\r
                        break;\r
 \r
                case 1: /* must be less than */\r
@@ -139,7 +138,7 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,
                case 3: /* largest available */\r
                        /* the ULP intentionally requested */\r
                        /* the largest MTU possible */\r
-                       return (FALSE);\r
+                       return FALSE;\r
 \r
                default:\r
                        /* if we're here, there's a bug in ib_path_rec_mtu_sel() */\r
@@ -148,11 +147,9 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr,
                }\r
        }\r
 \r
-       return (TRUE);\r
+       return TRUE;\r
 }\r
 \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
@@ -184,6 +181,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
        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
@@ -375,6 +373,23 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
                                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
@@ -649,7 +664,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
        }\r
 \r
        /*\r
-        * Set PathRecord SL.\r
+        * Set PathRecord SL\r
         */\r
 \r
        is_lash = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_LASH);\r
@@ -746,11 +761,9 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
                mtu, rate, pkt_life, cl_ntoh16(pkey), sl);\r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -762,16 +775,12 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
 {\r
        const osm_physp_t *p_src_physp;\r
        const osm_physp_t *p_dest_physp;\r
-       boolean_t is_nonzero_gid = 0;\r
 \r
        OSM_LOG_ENTER(sa->p_log);\r
 \r
        p_src_physp = p_src_port->p_physp;\r
 \r
        if (p_dgid)\r
-               is_nonzero_gid = ib_gid_is_notzero(p_dgid);\r
-\r
-       if (is_nonzero_gid)\r
                p_pr->dgid = *p_dgid;\r
        else {\r
                p_dest_physp = p_dest_port->p_physp;\r
@@ -791,7 +800,7 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
        p_pr->hop_flow_raw &= cl_hton32(1 << 31);\r
 \r
        /* Only set HopLimit if going through a router */\r
-       if (is_nonzero_gid)\r
+       if (p_dgid)\r
                p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX);\r
 \r
        p_pr->pkey = p_parms->pkey;\r
@@ -816,8 +825,6 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -868,15 +875,13 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
           rather then requiring non-reversible paths ...\r
           see Vol1 Ver1.2 p900 l16\r
         */\r
-       if (comp_mask & IB_PR_COMPMASK_REVERSIBLE) {\r
-               if ((!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
-\r
-                       free(p_pr_item);\r
-                       p_pr_item = NULL;\r
-                       goto Exit;\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
@@ -885,22 +890,19 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (p_pr_item);\r
+       return p_pr_item;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,\r
-                                      IN const osm_madw_t * p_madw,\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 const ib_net64_t comp_mask,\r
                                       IN cl_qlist_t * p_list)\r
 {\r
-       const ib_path_rec_t *p_pr;\r
-       const ib_sa_mad_t *p_sa_mad;\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
@@ -928,9 +930,6 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
                /* One of the pairs doesn't share a pkey so the path is disqualified. */\r
                goto Exit;\r
 \r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\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
@@ -979,17 +978,15 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
        /*\r
           Refine our search if the client specified end-point LIDs\r
         */\r
-       if (comp_mask & IB_PR_COMPMASK_DLID) {\r
-               dest_lid_min_ho = cl_ntoh16(p_pr->dlid);\r
-               dest_lid_max_ho = cl_ntoh16(p_pr->dlid);\r
-       } else\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_min_ho = cl_ntoh16(p_pr->slid);\r
-               src_lid_max_ho = cl_ntoh16(p_pr->slid);\r
-       } else\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
@@ -1020,13 +1017,12 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
        path_num = 0;\r
 \r
        /* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */\r
-       if (p_sa_mad->method != IB_MAD_METHOD_GET)\r
-               if (comp_mask & IB_PR_COMPMASK_NUMBPATH)\r
-                       iterations = ib_path_rec_num_path(p_pr);\r
-               else\r
-                       iterations = (unsigned) (-1);\r
-       else\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
@@ -1111,8 +1107,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -1147,16 +1141,14 @@ static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix)
 }\r
 \r
 static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,\r
-                                       IN const osm_madw_t * p_madw,\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 ib_gid_t * p_dgid)\r
+                                       OUT const ib_gid_t ** pp_dgid)\r
 {\r
-       const ib_path_rec_t *p_pr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_net64_t comp_mask;\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_api_status_t status;\r
        ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;\r
 \r
        OSM_LOG_ENTER(sa->p_log);\r
@@ -1166,11 +1158,6 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
           to the source and destination port objects, if possible.\r
         */\r
 \r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\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
@@ -1189,7 +1176,6 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
                                        "Non local SGID subnet prefix 0x%016"\r
                                        PRIx64 "\n",\r
                                        cl_ntoh64(p_pr->sgid.unicast.prefix));\r
-\r
                                sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
                                goto Exit;\r
                        }\r
@@ -1207,35 +1193,24 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
                        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
-\r
                        sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
                        goto Exit;\r
                }\r
-       } else {\r
-               *pp_src_port = 0;\r
-               if (comp_mask & IB_PR_COMPMASK_SLID) {\r
-                       status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,\r
-                                                 cl_ntoh16(p_pr->slid),\r
-                                                 (void **)pp_src_port);\r
-\r
-                       if ((status != CL_SUCCESS) || (*pp_src_port == NULL)) {\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_pr->slid));\r
-\r
-                               sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\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
-       }\r
-\r
-       if (p_dgid)\r
-               memset(p_dgid, 0, sizeof(*p_dgid));\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
@@ -1253,6 +1228,8 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
                                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
@@ -1266,47 +1243,33 @@ static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
                        OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
                                "No dest port with GUID 0x%016" PRIx64 "\n",\r
                                cl_ntoh64(dest_guid));\r
-\r
                        sa_status = IB_SA_MAD_STATUS_INVALID_GID;\r
                        goto Exit;\r
                }\r
-\r
-               if (p_dgid)\r
-                       *p_dgid = p_pr->dgid;\r
-       } else {\r
-               *pp_dest_port = 0;\r
-               if (comp_mask & IB_PR_COMPMASK_DLID) {\r
-                       status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,\r
-                                                 cl_ntoh16(p_pr->dlid),\r
-                                                 (void **)pp_dest_port);\r
-\r
-                       if ((status != CL_SUCCESS) || (*pp_dest_port == NULL)) {\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,\r
-                                       "No dest port with LID %u\n",\r
-                                       cl_ntoh16(p_pr->dlid));\r
-\r
-                               sa_status = IB_SA_MAD_STATUS_NO_RECORDS;\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
-       }\r
+       } else\r
+               *pp_dest_port = NULL;\r
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (sa_status);\r
+       return sa_status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,\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 const ib_net64_t comp_mask,\r
                                 IN cl_qlist_t * p_list)\r
 {\r
        const cl_qmap_t *p_tbl;\r
@@ -1329,9 +1292,12 @@ static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
        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, p_madw, requester_port,\r
+                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
                                                   p_src_port, p_dest_port,\r
-                                                  p_dgid, comp_mask, p_list);\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
@@ -1341,17 +1307,15 @@ static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
                    (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
-/**********************************************************************\r
- **********************************************************************/\r
-static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,\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 const ib_net64_t comp_mask,\r
                                IN cl_qlist_t * p_list)\r
 {\r
        const cl_qmap_t *p_tbl;\r
@@ -1372,9 +1336,12 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
                 */\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, p_madw, requester_port,\r
+                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
                                                   p_src_port, p_port, p_dgid,\r
-                                                  comp_mask, p_list);\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
@@ -1383,9 +1350,12 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
                 */\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, p_madw, requester_port,\r
+                       pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port,\r
                                                   p_port, p_dest_port, p_dgid,\r
-                                                  comp_mask, p_list);\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
@@ -1393,77 +1363,35 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,\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 const ib_net64_t comp_mask,\r
                                IN cl_qlist_t * p_list)\r
 {\r
        OSM_LOG_ENTER(sa->p_log);\r
 \r
-       pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, p_src_port,\r
-                                  p_dest_port, p_dgid, comp_mask, p_list);\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
-/**********************************************************************\r
- **********************************************************************/\r
-static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)\r
-{\r
-       ib_path_rec_t *p_pr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       osm_mgrp_t *mgrp;\r
-\r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       if (!(p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID)) {\r
-               OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,\r
-                       "discard multicast target SA PR with wildcarded MGID");\r
-               return NULL;\r
-       }\r
-\r
-       mgrp = osm_get_mgrp_by_mgid(sa, &p_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, p_pr->dgid.raw, gid_str,\r
-                                 sizeof gid_str));\r
-               return NULL;\r
-       }\r
-\r
-       return mgrp;\r
-}\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa,\r
-                                               IN const osm_madw_t * p_madw,\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;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_net64_t comp_mask;\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;\r
-       uint8_t hop_limit;\r
+       uint8_t sl, hop_limit;\r
 \r
        OSM_LOG_ENTER(sa->p_log);\r
 \r
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
-       comp_mask = p_sa_mad->comp_mask;\r
-\r
-       /* check that MLID of the MC group matchs the PathRecord DLID */\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
@@ -1482,109 +1410,127 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa,
        }\r
 \r
        /* Also, MTU, rate, packet lifetime, and raw traffic requested are not currently checked */\r
-       if (comp_mask & IB_PR_COMPMASK_PKEY) {\r
-               if (p_pr->pkey != p_mgrp->mcmember_rec.pkey)\r
-                       goto Exit;\r
-       }\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) {\r
-               if (ib_path_rec_sl(p_pr) != sl)\r
-                       goto Exit;\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
-           (p_sa_mad->method != IB_MAD_METHOD_GET)) {\r
-               if (ib_path_rec_num_path(p_pr) == 0)\r
-                       goto Exit;\r
-       }\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
-               if (ib_path_rec_flow_lbl(p_pr) != flow_label)\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
-               if (ib_path_rec_hop_limit(p_pr) != hop_limit)\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
-               if (p_pr->tclass != p_mgrp->mcmember_rec.tclass)\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
+       return status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static int pr_rcv_check_mcast_dest(osm_sa_t * sa, IN const osm_madw_t * p_madw)\r
+static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,\r
+                                cl_qlist_t *list)\r
 {\r
-       const ib_path_rec_t *p_pr;\r
-       const ib_sa_mad_t *p_sa_mad;\r
-       ib_net64_t comp_mask;\r
-       int is_multicast = 0;\r
-\r
-       OSM_LOG_ENTER(sa->p_log);\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
-       p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-       p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
+       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");\r
 \r
-       comp_mask = p_sa_mad->comp_mask;\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
-       if (comp_mask & IB_PR_COMPMASK_DGID) {\r
-               is_multicast = ib_gid_is_multicast(&p_pr->dgid);\r
-               if (!is_multicast)\r
-                       goto Exit;\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
-       if (comp_mask & IB_PR_COMPMASK_DLID) {\r
-               if (cl_ntoh16(p_pr->dlid) >= IB_LID_MCAST_START_HO &&\r
-                   cl_ntoh16(p_pr->dlid) <= IB_LID_MCAST_END_HO)\r
-                       is_multicast = 1;\r
-               else if (is_multicast) {\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F12: "\r
-                               "PathRecord request indicates MGID but not MLID\n");\r
-                       is_multicast = -1;\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
-Exit:\r
-       OSM_LOG_EXIT(sa->p_log);\r
-       return (is_multicast);\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
-/**********************************************************************\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_path_rec_t *p_pr;\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
+       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
-       ib_gid_t dgid;\r
-       ib_net16_t sa_status;\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
-       int ret;\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_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-\r
        CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);\r
 \r
        /* we only support SubnAdmGet and SubnAdmGetTable methods */\r
@@ -1619,120 +1565,39 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
        cl_plock_acquire(sa->p_lock);\r
 \r
        /* Handle multicast destinations separately */\r
-       if ((ret = pr_rcv_check_mcast_dest(sa, p_madw)) < 0) {\r
-               /* Multicast DGID with unicast DLID */\r
-               cl_plock_release(sa->p_lock);\r
-               osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_INVALID_FIELD);\r
-               goto Exit;\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
-       if (ret > 0)\r
-               goto McastDest;\r
-\r
        OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n");\r
 \r
-       sa_status = pr_rcv_get_end_points(sa, p_madw, &p_src_port, &p_dest_port,\r
-                                         &dgid);\r
-\r
-       if (sa_status == IB_SA_MAD_STATUS_SUCCESS) {\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_madw, requester_port,\r
-                                                   p_src_port, p_dest_port,\r
-                                                   &dgid, p_sa_mad->comp_mask,\r
-                                                   &pr_list);\r
-                       else\r
-                               pr_rcv_process_half(sa, p_madw, requester_port,\r
-                                                   p_src_port, NULL, &dgid,\r
-                                                   p_sa_mad->comp_mask,\r
-                                                   &pr_list);\r
-               } else {\r
-                       if (p_dest_port)\r
-                               pr_rcv_process_half(sa, p_madw, requester_port,\r
-                                                   NULL, p_dest_port, &dgid,\r
-                                                   p_sa_mad->comp_mask,\r
-                                                   &pr_list);\r
-                       else\r
-                               /*\r
-                                  Katie, bar the door!\r
-                                */\r
-                               pr_rcv_process_world(sa, p_madw, requester_port,\r
-                                                    &dgid, p_sa_mad->comp_mask,\r
-                                                    &pr_list);\r
-               }\r
-       }\r
-       goto Unlock;\r
-\r
-McastDest:\r
-       OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");\r
-       {\r
-               osm_mgrp_t *p_mgrp = NULL;\r
-               ib_api_status_t status;\r
-               osm_pr_item_t *p_pr_item;\r
-               uint32_t flow_label;\r
-               uint8_t sl;\r
-               uint8_t hop_limit;\r
-\r
-               /* First, get the MC info */\r
-               p_mgrp = pr_get_mgrp(sa, p_madw);\r
-               if (!p_mgrp)\r
-                       goto Unlock;\r
-\r
-               /* Make sure the rest of the PathRecord matches the MC group attributes */\r
-               status = pr_match_mgrp_attributes(sa, p_madw, p_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
-                       goto Unlock;\r
-               }\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 1F18: "\r
-                               "Unable to allocate path record for MC group\n");\r
-                       goto Unlock;\r
-               }\r
-               memset(p_pr_item, 0, sizeof(*p_pr_item));\r
-\r
-               /* Copy PathRecord request into response */\r
-               p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);\r
-               p_pr = (ib_path_rec_t *)\r
-                   ib_sa_mad_get_payload_ptr(p_sa_mad);\r
-               p_pr_item->path_rec = *p_pr;\r
-\r
-               /* Now, use the MC info to cruft up the PathRecord response */\r
-               p_pr_item->path_rec.dgid = p_mgrp->mcmember_rec.mgid;\r
-               p_pr_item->path_rec.dlid = p_mgrp->mcmember_rec.mlid;\r
-               p_pr_item->path_rec.tclass = p_mgrp->mcmember_rec.tclass;\r
-               p_pr_item->path_rec.num_path = 1;\r
-               p_pr_item->path_rec.pkey = p_mgrp->mcmember_rec.pkey;\r
-\r
-               /* MTU, rate, and packet lifetime should be exactly */\r
-               p_pr_item->path_rec.mtu = (2 << 6) | p_mgrp->mcmember_rec.mtu;\r
-               p_pr_item->path_rec.rate = (2 << 6) | p_mgrp->mcmember_rec.rate;\r
-               p_pr_item->path_rec.pkt_life =\r
-                   (2 << 6) | p_mgrp->mcmember_rec.pkt_life;\r
-\r
-               /* SL, Hop Limit, and Flow Label */\r
-               ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,\r
-                                         &sl, &flow_label, &hop_limit);\r
-               ib_path_rec_set_sl(&p_pr_item->path_rec, sl);\r
-               ib_path_rec_set_qos_class(&p_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(&p_mgrp->mcmember_rec.mgid) !=\r
-                   IB_MC_SCOPE_LINK_LOCAL)\r
-                       hop_limit = IB_HOPLIMIT_MAX;\r
-\r
-               p_pr_item->path_rec.hop_flow_raw =\r
-                   cl_hton32(hop_limit) | (flow_label << 8);\r
-\r
-               cl_qlist_insert_tail(&pr_list, &p_pr_item->list_item);\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
index 3314a84a00fe66a7d2d825fd5170ec8ec3b8e22b..0bbc7f532039d15f481c86abdaecc03bd2587a31 100644 (file)
@@ -64,8 +64,6 @@ typedef struct osm_pkey_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_pkey_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -109,8 +107,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -133,8 +129,6 @@ static void sa_pkey_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -201,8 +195,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -211,8 +203,6 @@ static void sa_pkey_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
        sa_pkey_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
@@ -223,7 +213,6 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
        const ib_pkey_table_t *p_pkey;\r
        cl_qlist_t rec_list;\r
        osm_pkey_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
@@ -301,23 +290,15 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
         */\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
-                       status = IB_NOT_FOUND;\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
-               }\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_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
+                       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
index 95898baec929144f453096b4771b5e35b1ab0f8d..8702d6bd4011c653e17e83b2fa7157dbf4e63ba6 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -72,8 +72,6 @@ typedef struct osm_pir_search_ctxt {
        boolean_t is_enhanced_comp_mask;\r
 } osm_pir_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -108,11 +106,9 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -157,8 +153,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -385,8 +379,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -436,8 +428,6 @@ static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -446,20 +436,16 @@ static void sa_pir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
        sa_pir_by_comp_mask(p_ctxt->sa, p_node, p_ctxt);\r
 }\r
 \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 cl_ptr_vector_t *p_tbl;\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_api_status_t status = IB_SUCCESS;\r
        ib_net64_t comp_mask;\r
        osm_physp_t *p_req_physp;\r
 \r
@@ -499,7 +485,6 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
        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_tbl = &sa->p_subn->port_lid_tbl;\r
        p_pi = &p_rcvd_rec->port_info;\r
 \r
        cl_qlist_init(&rec_list);\r
@@ -514,41 +499,21 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 \r
        cl_plock_acquire(sa->p_lock);\r
 \r
-       CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);\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) {\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
-                       status = IB_NOT_FOUND;\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
-               }\r
-       } else if (comp_mask & IB_PIR_COMPMASK_BASELID) {\r
-               if ((uint16_t) cl_ptr_vector_get_size(p_tbl) >\r
-                   cl_ntoh16(p_pi->base_lid))\r
-                       p_port = cl_ptr_vector_get(p_tbl,\r
-                                                  cl_ntoh16(p_pi->base_lid));\r
-               else {\r
-                       status = IB_NOT_FOUND;\r
-                       OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2103: "\r
-                               "Given LID (%u) is out of range:%u\n",\r
-                               cl_ntoh16(p_pi->base_lid),\r
-                               cl_ptr_vector_get_size(p_tbl));\r
-               }\r
-       }\r
-\r
-       if (status == IB_SUCCESS) {\r
                if (p_port)\r
                        sa_pir_by_comp_mask(sa, p_port->p_node, &context);\r
                else\r
-                       cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,\r
-                                          sa_pir_by_comp_mask_cb, &context);\r
-       }\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
index 686429f671f7ddb3b63eaeebc68652fe6a5cc3b2..e007e020ebc9b6077c9fcccd334d2607a428e5d9 100644 (file)
@@ -76,8 +76,6 @@ typedef struct osm_sr_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_sr_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -137,8 +135,6 @@ Exit:
        return valid;\r
 }\r
 \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
@@ -158,8 +154,6 @@ match_name_to_key_association(IN osm_sa_t * sa,
        return TRUE;\r
 }\r
 \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
@@ -196,8 +190,6 @@ Exit:
        return valid;\r
 }\r
 \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
@@ -219,8 +211,6 @@ static void sr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,
        osm_sa_respond(sa, p_madw, sizeof(ib_service_record_t), p_list);\r
 }\r
 \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
@@ -447,8 +437,6 @@ Exit:
        return;\r
 }\r
 \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
@@ -509,8 +497,6 @@ Exit:
        return;\r
 }\r
 \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
@@ -613,8 +599,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -681,8 +665,6 @@ Exit:
        return;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sr_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sa_t *sa = context;\r
@@ -737,8 +719,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sr_rcv_lease_cb(IN void *context)\r
 {\r
        osm_sa_t *sa = context;\r
index 44122c9853ac65e0c04ef1fd75e4d9bccda08f06..5dbbb6a92b0ea72414d04652d6c0f5f6c43feba8 100644 (file)
@@ -71,8 +71,6 @@ typedef struct osm_slvl_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_slvl_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -116,8 +114,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -191,8 +187,6 @@ static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -201,8 +195,6 @@ static void sa_slvl_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
        sa_slvl_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 810ff5fbc5bee0e8897cee6f39a54e2d87e59fc5..3b77263011c57dbc61c68888b825289138e10dab 100644 (file)
@@ -114,8 +114,6 @@ Exit:
        return status;\r
 }\r
 \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
@@ -153,8 +151,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -163,8 +159,6 @@ static void sa_smir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt)
        sa_smir_by_comp_mask(p_ctxt->sa, p_rem_sm, p_ctxt);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_smir_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index 6b901b7688d0d3e8b3d42e75db0660b69533ec34..a58c6f59d2cbb539036a0e9cb2309c0b26538afc 100644 (file)
@@ -67,8 +67,6 @@ typedef struct osm_sir_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_sir_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -99,11 +97,9 @@ static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa,
 \r
 Exit:\r
        OSM_LOG_EXIT(sa->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -166,8 +162,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -195,8 +189,6 @@ Exit:
        OSM_LOG_EXIT(p_ctxt->sa->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sir_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index c590650a970b5995294e151b46471b3a54188885..92a34d4a5e9bf2b6b490732a4b0568a812b76f7d 100644 (file)
@@ -71,8 +71,6 @@ typedef struct osm_vl_arb_search_ctxt {
        const osm_physp_t *p_req_physp;\r
 } osm_vl_arb_search_ctxt_t;\r
 \r
-/**********************************************************************\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
@@ -115,8 +113,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -135,8 +131,6 @@ static void sa_vl_arb_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -203,8 +197,6 @@ Exit:
        OSM_LOG_EXIT(sa->p_log);\r
 }\r
 \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
@@ -213,8 +205,6 @@ static void sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * p_map_item, void *cxt)
        sa_vl_arb_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)\r
 {\r
        osm_sa_t *sa = ctx;\r
index f6b2c44cb65f10cbcc39b3fd4e6273fb9f49ffc3..bf7c7522102e645b7574349505126a5c0d19722c 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
 #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
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_svcr_delete(IN osm_svcr_t * p_svcr)\r
 {\r
        free(p_svcr);\r
 }\r
 \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
@@ -70,8 +67,6 @@ void osm_svcr_init(IN osm_svcr_t * p_svcr,
        p_svcr->service_record = *p_svc_rec;\r
 }\r
 \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
@@ -87,8 +82,6 @@ osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec)
        return p_svcr;\r
 }\r
 \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
@@ -104,8 +97,6 @@ static cl_status_t match_rid_of_svc_rec(IN const cl_list_item_t * p_list_item,
                return CL_SUCCESS;\r
 }\r
 \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
@@ -123,8 +114,6 @@ osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,
        return (osm_svcr_t *) p_list_item;\r
 }\r
 \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
@@ -134,6 +123,7 @@ void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
                "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
@@ -149,6 +139,7 @@ void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
                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
index bf611213dbc110bf701cd3e3eac2d37325d862a5..351bf5bdc4244dce6f8f8689daeb26602c2d81f0 100644 (file)
@@ -2,6 +2,7 @@
  * 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
@@ -55,8 +56,6 @@
 #include <opensm/osm_helper.h>\r
 #include <opensm/osm_sm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  * WE ONLY RECEIVE GET or SET responses\r
  */\r
@@ -72,7 +71,9 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
        osm_slvl_context_t *p_context;\r
        ib_net64_t port_guid;\r
        ib_net64_t node_guid;\r
-       uint8_t out_port_num, in_port_num;\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
@@ -93,7 +94,6 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
        p_port = osm_get_port_by_guid(sm->p_subn, port_guid);\r
 \r
        if (!p_port) {\r
-               cl_plock_release(sm->p_lock);\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
@@ -107,42 +107,53 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 \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
-               out_port_num =\r
-                   (uint8_t) cl_ntoh32(p_smp->attr_mod & 0xFF000000);\r
-               in_port_num =\r
-                   (uint8_t) cl_ntoh32((p_smp->attr_mod & 0x00FF0000) << 8);\r
-               p_physp = osm_node_get_physp_ptr(p_node, out_port_num);\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
-               p_physp = p_port->p_physp;\r
-               out_port_num = p_physp->port_num;\r
-               in_port_num = 0;\r
+               startoutport = endoutport = p_port->p_physp->port_num;\r
+               startinport = endinport = 0;\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 SLtoVL get response in_port_num %u out_port_num %u with "\r
-               "GUID 0x%" PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"\r
-               PRIx64 "\n", in_port_num, out_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", out_port_num);\r
-               goto Exit;\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
-       osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num,\r
-                               out_port_num, p_slvl_tbl, OSM_LOG_DEBUG);\r
-\r
-       osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num);\r
-\r
 Exit:\r
        cl_plock_release(sm->p_lock);\r
 \r
index a34600624e1b2496eeaf97b9c824b71e33d6fa06..9687f0e65404c2e28b97a253794203021e0ac9c5 100644 (file)
@@ -77,8 +77,6 @@ extern void osm_vla_rcv_process(IN void *context, IN void *data);
 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
-/**********************************************************************\r
- **********************************************************************/\r
 static void sm_process(osm_sm_t * sm, osm_signal_t signal)\r
 {\r
 #ifdef ENABLE_OSM_PERF_MGR\r
@@ -151,8 +149,6 @@ static void sweep_fail_process(IN void *context, IN void *p_data)
        sm->p_subn->force_heavy_sweep = TRUE;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_construct(IN osm_sm_t * p_sm)\r
 {\r
        memset(p_sm, 0, sizeof(*p_sm));\r
@@ -170,8 +166,6 @@ void osm_sm_construct(IN osm_sm_t * p_sm)
        osm_ucast_mgr_construct(&p_sm->ucast_mgr);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_shutdown(IN osm_sm_t * p_sm)\r
 {\r
        boolean_t signal_event = FALSE;\r
@@ -219,8 +213,6 @@ void osm_sm_shutdown(IN osm_sm_t * p_sm)
        OSM_LOG_EXIT(p_sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_destroy(IN osm_sm_t * p_sm)\r
 {\r
        OSM_LOG_ENTER(p_sm->p_log);\r
@@ -239,8 +231,6 @@ void osm_sm_destroy(IN osm_sm_t * p_sm)
        OSM_LOG_EXIT(p_sm->p_log);\r
 }\r
 \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
@@ -396,11 +386,9 @@ ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn,
 \r
 Exit:\r
        OSM_LOG_EXIT(p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
@@ -409,8 +397,6 @@ void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal)
        cl_spinlock_release(&p_sm->signal_lock);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_sweep(IN osm_sm_t * p_sm)\r
 {\r
        OSM_LOG_ENTER(p_sm->p_log);\r
@@ -418,8 +404,6 @@ void osm_sm_sweep(IN osm_sm_t * p_sm)
        OSM_LOG_EXIT(p_sm->p_log);\r
 }\r
 \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
@@ -437,11 +421,9 @@ ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid)
 \r
 Exit:\r
        OSM_LOG_EXIT(p_sm->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \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
index c059b5f0f64bae745b19b1fd3a1934f13909065d..a74f11ed43145dca8a141ee2d3e0dd12010fd0be 100644 (file)
@@ -3,6 +3,7 @@
  * 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
@@ -257,12 +258,10 @@ static void sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * p_ctrl,
                        "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
-       if (msg_id == CL_DISP_MSGID_NONE)\r
-               goto Exit;\r
-\r
        /*\r
           Post this MAD to the dispatcher for asynchronous\r
           processing by the appropriate controller.\r
@@ -319,14 +318,6 @@ static void sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * p_ctrl,
                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
-               break;\r
-       }\r
-\r
-       if (msg_id == CL_DISP_MSGID_NONE) {\r
-               /*\r
-                  There is an unknown MAD attribute type for which there is\r
-                  no recipient.  Simply retire the MAD here.\r
-                */\r
                osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
                goto Exit;\r
        }\r
@@ -397,14 +388,6 @@ static void sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * p_ctrl,
                        "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
-               break;\r
-       }\r
-\r
-       if (msg_id == CL_DISP_MSGID_NONE) {\r
-               /*\r
-                  There is an unknown MAD attribute type for which there is\r
-                  no recipient.  Simply retire the MAD here.\r
-                */\r
                osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
                goto Exit;\r
        }\r
@@ -484,14 +467,6 @@ static void sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * p_ctrl,
                        "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
-               break;\r
-       }\r
-\r
-       if (msg_id == CL_DISP_MSGID_NONE) {\r
-               /*\r
-                  There is an unknown MAD attribute type for which there is\r
-                  no recipient.  Simply retire the MAD here.\r
-                */\r
                osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\r
                goto Exit;\r
        }\r
@@ -552,6 +527,7 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl,
         */\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
@@ -559,14 +535,42 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl,
                        "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_mad_pool_put(p_ctrl->p_mad_pool, p_madw);\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
@@ -635,11 +639,8 @@ static void sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw,
        else\r
                status = p_smp->status;\r
 \r
-       if (status != 0) {\r
-               OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3111: "\r
-                       "Error status = 0x%X\n", cl_ntoh16(status));\r
-               osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR);\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
@@ -708,9 +709,14 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
 \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)\n",\r
-               ib_get_err_str(p_madw->status));\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
@@ -718,15 +724,12 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
           such a problem. The subnet will not be up, and the next sweep should\r
           be a heavy sweep as well.\r
         */\r
-       p_smp = osm_madw_get_smp_ptr(p_madw);\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
-            p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE ||\r
-            p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION)) {\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
@@ -734,6 +737,8 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
                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
@@ -764,10 +769,6 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
           An error occurred.  No response was received to a request MAD.\r
           Retire the original request MAD.\r
         */\r
-\r
-       osm_dump_dr_smp(p_ctrl->p_log, osm_madw_get_smp_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
@@ -801,8 +802,6 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw)
  * SEE ALSO\r
  *********/\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl)\r
 {\r
        CL_ASSERT(p_ctrl);\r
@@ -810,8 +809,6 @@ void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl)
        p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl)\r
 {\r
        CL_ASSERT(p_ctrl);\r
@@ -821,8 +818,6 @@ void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl)
        cl_disp_unregister(p_ctrl->h_disp);\r
 }\r
 \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
@@ -863,8 +858,6 @@ Exit:
        return status;\r
 }\r
 \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
index db148d49e6734e162011507ac1124bcad202def6..a8acd3d22c298661e00019775ffb541f0e105745 100644 (file)
@@ -61,8 +61,6 @@
 #include <opensm/osm_helper.h>\r
 #include <opensm/osm_opensm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_report_sm_state(osm_sm_t * sm)\r
 {\r
        char buf[64];\r
@@ -73,8 +71,6 @@ void osm_report_sm_state(osm_sm_t * sm)
        OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf);\r
 }\r
 \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
@@ -124,8 +120,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -156,8 +150,6 @@ static void sm_state_mgr_start_polling(osm_sm_t * sm)
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sm_state_mgr_polling_callback(IN void *context)\r
 {\r
        osm_sm_t *sm = context;\r
@@ -221,8 +213,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -231,8 +221,6 @@ static void sm_state_mgr_signal_error(osm_sm_t * sm, IN osm_sm_signal_t signal)
                osm_get_sm_mgr_state_str(sm->p_subn->sm_state));\r
 }\r
 \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
@@ -240,8 +228,6 @@ void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm)
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -464,8 +450,6 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
        return status;\r
 }\r
 \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
index 97a90f5b5ccf9f8611f804c5c6cc8afcd3036564..48d801f3cb5d79902220c9bd037445fcf51c1d11 100755 (executable)
@@ -74,8 +74,6 @@ static boolean_t smi_rcv_remote_sm_is_higher(IN osm_sm_t * sm,
 \r
 }\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
@@ -158,8 +156,6 @@ static ib_api_status_t smi_rcv_check_set_req_legality(IN const ib_smp_t * p_smp)
        return IB_INVALID_PARAMETER;\r
 }\r
 \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
@@ -256,7 +252,8 @@ static void smi_rcv_process_set_request(IN osm_sm_t * sm,
        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. AttributeModifier:0x%X RemoteState:%s\n",\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
@@ -299,8 +296,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -416,8 +411,6 @@ static int smi_rcv_process_get_sm(IN osm_sm_t * sm,
        return 0;\r
 }\r
 \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
@@ -511,8 +504,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \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
@@ -548,8 +539,6 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_sminfo_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index d8c5509dbbd5791ba872aefdea63b9f679d4dc2d..8eace4760b1c2c619b22357f173c235e18fc388f 100644 (file)
@@ -1,4 +1,5 @@
 /*\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
@@ -71,8 +72,6 @@ extern int osm_mcast_mgr_process(IN osm_sm_t * sm);
 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
-/**********************************************************************\r
- **********************************************************************/\r
 static void state_mgr_up_msg(IN const osm_sm_t * sm)\r
 {\r
        /*\r
@@ -88,8 +87,6 @@ static void state_mgr_up_msg(IN const osm_sm_t * sm)
                        "SUBNET UP" : "SUBNET UP (sweep disabled)");\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item,\r
                                       IN void *context)\r
 {\r
@@ -98,8 +95,6 @@ static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item,
        p_node->discovery_count = 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item,\r
                                       IN void *context)\r
 {\r
@@ -108,8 +103,6 @@ static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item,
        p_port->discovery_count = 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item,\r
                                         IN void *context)\r
 {\r
@@ -118,8 +111,6 @@ static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item,
        p_sw->need_update = 1;\r
 }\r
 \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
@@ -143,10 +134,10 @@ static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context)
 \r
        status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0,\r
                             OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context);\r
-\r
        if (status != IB_SUCCESS)\r
                OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3304: "\r
-                       "Request for SwitchInfo failed\n");\r
+                       "Request for SwitchInfo failed (%s)\n",\r
+                       ib_get_err_str(status));\r
 \r
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
@@ -184,15 +175,14 @@ static void state_mgr_get_remote_port_info(IN osm_sm_t * sm,
        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 that\r
-        * there is no point in going to heavy sweep */\r
-       status = osm_req_get(sm, &rem_node_dr_path,\r
-                            IB_MAD_ATTR_PORT_INFO, 0, CL_DISP_MSGID_NONE,\r
-                            &mad_context);\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\n");\r
+                       "Request for PortInfo failed (%s)\n",\r
+                       ib_get_err_str(status));\r
 \r
 Exit:\r
        OSM_LOG_EXIT(sm->p_log);\r
@@ -248,10 +238,10 @@ static ib_api_status_t state_mgr_sweep_hop_0(IN osm_sm_t * sm)
                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, "ERR 3305: "\r
-                               "Request for NodeInfo failed\n");\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
@@ -451,19 +441,20 @@ static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)
                                     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\n");\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 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
+               /* 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 = 0; port_num < num_ports; port_num++) {\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
@@ -480,11 +471,11 @@ static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)
                                                     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 3312: "\r
-                                               "Request for NodeInfo failed\n");\r
+                                               "Request for NodeInfo failed (%s)\n",\r
+                                               ib_get_err_str(status));\r
                        }\r
                }\r
                break;\r
@@ -506,11 +497,14 @@ static void query_sm_info(cl_map_item_t * item, void *cxt)
 #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 = cl_item_obj(item, r_sm, map_item,(osm_remote_sm_t *));\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
@@ -523,11 +517,7 @@ static void query_sm_info(cl_map_item_t * item, void *cxt)
                        ib_get_err_str(ret));\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
+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
@@ -540,14 +530,8 @@ static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context)
 \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
+       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
@@ -576,6 +560,43 @@ exit:
        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
@@ -631,7 +652,7 @@ static ib_api_status_t state_mgr_light_sweep_start(IN osm_sm_t * sm)
                                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
+                                       " (%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
@@ -848,7 +869,7 @@ static void state_mgr_report_new_ports(IN osm_sm_t * sm)
                /* 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 to be reachable */\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
@@ -875,7 +896,7 @@ static void state_mgr_report_new_ports(IN osm_sm_t * sm)
                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
+                       " 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
@@ -1017,16 +1038,15 @@ static void cleanup_switch(cl_map_item_t * item, void *log)
 \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 " is not up to date\n",\r
-                       cl_ntoh64(sw->p_node->node_info.node_guid));\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
-/**********************************************************************\r
- **********************************************************************/\r
 int wait_for_pending_transactions(osm_stats_t * stats)\r
 {\r
 #ifdef HAVE_LIBPTHREAD\r
@@ -1094,6 +1114,8 @@ static void do_sweep(osm_sm_t * sm)
                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
@@ -1141,7 +1163,7 @@ static void do_sweep(osm_sm_t * sm)
        }\r
 \r
        /* go to heavy sweep */\r
-_repeat_discovery:\r
+repeat_discovery:\r
 \r
        /* First of all - unset all flags */\r
        sm->p_subn->force_heavy_sweep = FALSE;\r
@@ -1178,7 +1200,7 @@ _repeat_discovery:
            wait_for_pending_transactions(&sm->p_subn->p_osm->stats))\r
                return;\r
 \r
-       /* discovery completed - check other sm presense */\r
+       /* discovery completed - check other sm presence */\r
        if (sm->master_sm_found) {\r
                /*\r
                 * Call the sm_state_mgr with signal\r
@@ -1195,7 +1217,7 @@ _repeat_discovery:
 \r
        /* if new sweep requested - don't bother with the rest */\r
        if (sm->p_subn->force_heavy_sweep)\r
-               goto _repeat_discovery;\r
+               goto repeat_discovery;\r
 \r
        OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "HEAVY SWEEP COMPLETE");\r
 \r
@@ -1358,7 +1380,8 @@ _repeat_discovery:
                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
+               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
@@ -1401,11 +1424,9 @@ void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal)
        case OSM_SIGNAL_SWEEP:\r
                do_sweep(sm);\r
                break;\r
-\r
        case OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST:\r
                do_process_mgrp_queue(sm);\r
                break;\r
-\r
        default:\r
                CL_ASSERT(FALSE);\r
                OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3320: "\r
index 5b45699b559eaa2edd95ca78a35eca2ad13a87c5..6461a1b4efb499acfb12d19f99bcaeb9071e81c8 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. 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
@@ -299,8 +299,8 @@ static const opt_rec_t opt_tbl[] = {
        { "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, 1 },\r
-       { "transaction_retries", OPT_OFFSET(transaction_retries), opts_parse_uint32, NULL, 1 },\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
@@ -324,11 +324,12 @@ static const opt_rec_t opt_tbl[] = {
        { "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, 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
@@ -348,12 +349,14 @@ static const opt_rec_t opt_tbl[] = {
        { "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
@@ -362,6 +365,7 @@ static const opt_rec_t opt_tbl[] = {
        { "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
@@ -394,11 +398,10 @@ static const opt_rec_t opt_tbl[] = {
        { "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
-/**********************************************************************\r
- **********************************************************************/\r
 static int compar_mgids(const void *m1, const void *m2)\r
 {\r
        return memcmp(m1, m2, sizeof(ib_gid_t));\r
@@ -420,8 +423,6 @@ void osm_subn_construct(IN osm_subn_t * p_subn)
        cl_fmap_init(&p_subn->mgrp_mgid_tbl, compar_mgids);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_subn_destroy(IN osm_subn_t * p_subn)\r
 {\r
        int i;\r
@@ -430,7 +431,6 @@ void osm_subn_destroy(IN osm_subn_t * p_subn)
        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_mgrp_t *p_mgrp;\r
        osm_infr_t *p_infr, *p_next_infr;\r
 \r
        /* it might be a good idea to de-allocate all known objects */\r
@@ -476,12 +476,9 @@ void osm_subn_destroy(IN osm_subn_t * p_subn)
        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
-               p_mgrp = p_subn->mgroups[i];\r
-               p_subn->mgroups[i] = NULL;\r
-               if (p_mgrp)\r
-                       osm_mgrp_delete(p_mgrp);\r
-       }\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
@@ -501,8 +498,6 @@ void osm_subn_destroy(IN osm_subn_t * p_subn)
        }\r
 }\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
@@ -514,12 +509,12 @@ ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,
                                    OSM_SUBNET_VECTOR_MIN_SIZE,\r
                                    OSM_SUBNET_VECTOR_GROW_SIZE);\r
        if (status != CL_SUCCESS)\r
-               return (status);\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
+               return status;\r
 \r
        /*\r
           LID zero is not valid.  NULL out this entry for the\r
@@ -540,33 +535,17 @@ ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,
        return IB_SUCCESS;\r
 }\r
 \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
-       const cl_ptr_vector_t *p_port_lid_tbl;\r
-       osm_port_t *p_port = NULL;\r
-\r
-       /* Find the port gid of the request in the subnet */\r
-       p_port_lid_tbl = &p_subn->port_lid_tbl;\r
-\r
-       CL_ASSERT(cl_ptr_vector_get_size(p_port_lid_tbl) < 0x10000);\r
-\r
-       if ((uint16_t) cl_ptr_vector_get_size(p_port_lid_tbl) >\r
-           cl_ntoh16(p_mad_addr->dest_lid)) {\r
-               p_port =\r
-                   cl_ptr_vector_get(p_port_lid_tbl,\r
-                                     cl_ntoh16(p_mad_addr->dest_lid));\r
-       } else {\r
-               /* The dest_lid is not in the subnet table - this is an error */\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
 \r
-       return p_port;\r
+       return port;\r
 }\r
 \r
 ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log,\r
@@ -579,7 +558,7 @@ ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log,
        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
+               return IB_INVALID_PARAMETER;\r
        }\r
 \r
        p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr);\r
@@ -605,8 +584,6 @@ osm_physp_t *osm_get_physp_by_mad_addr(IN osm_log_t * p_log,
        return p_port->p_physp;\r
 }\r
 \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
@@ -618,8 +595,6 @@ osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn,
        return p_switch;\r
 }\r
 \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
@@ -630,8 +605,6 @@ osm_node_t *osm_get_node_by_guid(IN osm_subn_t const *p_subn, IN uint64_t guid)
        return p_node;\r
 }\r
 \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
@@ -642,18 +615,23 @@ osm_port_t *osm_get_port_by_guid(IN osm_subn_t const *p_subn, IN ib_net64_t guid
        return p_port;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-osm_port_t *osm_get_port_by_lid(IN osm_subn_t const * subn, IN ib_net16_t lid)\r
+osm_port_t *osm_get_port_by_lid_ho(IN osm_subn_t const * subn, IN uint16_t lid)\r
 {\r
-       lid = cl_ntoh16(lid);\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
-/**********************************************************************\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
@@ -680,8 +658,6 @@ static void subn_init_qos_options(osm_qos_options_t *opt, osm_qos_options_t *f)
                memcpy(f, opt, sizeof(*f));\r
 }\r
 \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
@@ -727,6 +703,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
        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
@@ -737,21 +714,23 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 #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 = osm_strdup(p_opt->dump_files_dir);\r
-       p_opt->log_file = osm_strdup(OSM_DEFAULT_LOG_FILE);\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 = osm_strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE);\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 = osm_strdup(OSM_DEFAULT_QOS_POLICY_FILE);\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
@@ -766,14 +745,16 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
        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 = osm_strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE);\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
@@ -781,8 +762,6 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
        subn_init_qos_options(&p_opt->qos_rtr_options, NULL);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static char *clean_val(char *val)\r
 {\r
        char *p = val;\r
@@ -805,8 +784,6 @@ static char *clean_val(char *val)
        return val;\r
 }\r
 \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
@@ -823,8 +800,6 @@ static int subn_dump_qos_options(FILE * file, const char *set_name,
                       prefix, opt->vlarb_low, prefix, opt->sl2vl);\r
 }\r
 \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
@@ -928,8 +903,6 @@ static ib_api_status_t parse_prefix_routes_file(IN osm_subn_t * p_subn)
        return (errors == 0) ? IB_SUCCESS : IB_ERROR;\r
 }\r
 \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
@@ -1156,8 +1129,6 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts)\r
 {\r
        char line[1024];\r
@@ -1271,8 +1242,6 @@ int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)\r
 {\r
        fprintf(out,\r
@@ -1404,6 +1373,11 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
                "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
@@ -1477,6 +1451,12 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
                "# 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
@@ -1503,7 +1483,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
                "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
+               "# 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
@@ -1525,10 +1505,13 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
                "# SM Inactive\n"\r
                "sm_inactive %s\n\n"\r
                "# Babbling Port Policy\n"\r
-               "babbling_port_policy %s\n\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->babbling_port_policy ? "TRUE" : "FALSE",\r
+               p_opts->use_optimized_slvl ? "TRUE" : "FALSE");\r
 \r
 #ifdef ENABLE_OSM_PERF_MGR\r
        fprintf(out,\r
@@ -1555,8 +1538,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 \r
        fprintf(out,\r
                "#\n# Event Plugin Options\n#\n"\r
-               "event_plugin_name %s\n\n", p_opts->event_plugin_name ?\r
-               p_opts->event_plugin_name : null_str);\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
@@ -1647,6 +1636,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
                "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
index 58f61ef63f29158251d42fb598a4ac828942c64b..f79aca73f76adfc631eb2a79d5dd4893f89f5bb9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -319,8 +319,6 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
        return is_change_detected;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_si_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index 984bd1c59cab61e4f4f2223345c8f44810258a8a..9581c4c92f629d5d275f9a64ae305fb246bb0aba 100644 (file)
@@ -51,8 +51,6 @@
 #include <iba/ib_types.h>\r
 #include <opensm/osm_switch.h>\r
 \r
-/**********************************************************************\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
@@ -72,8 +70,6 @@ cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho,
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_switch_delete(IN OUT osm_switch_t ** pp_sw)\r
 {\r
        osm_switch_t *p_sw = *pp_sw;\r
@@ -82,6 +78,8 @@ void osm_switch_delete(IN OUT osm_switch_t ** pp_sw)
        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
@@ -96,8 +94,6 @@ void osm_switch_delete(IN OUT osm_switch_t ** pp_sw)
        *pp_sw = NULL;\r
 }\r
 \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
@@ -149,8 +145,6 @@ err:
        return NULL;\r
 }\r
 \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
@@ -167,8 +161,6 @@ boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,
        return TRUE;\r
 }\r
 \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
@@ -220,8 +212,6 @@ switch_find_node_guid_count(IN const osm_switch_t * p_sw,
        return switch_find_guid_common(p_sw, r, port_num, 0, 1);\r
 }\r
 \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
@@ -353,7 +343,7 @@ uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,
 \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 = i%num_ports;\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
@@ -478,8 +468,6 @@ uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw,
        return best_port;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_switch_clear_hops(IN osm_switch_t * p_sw)\r
 {\r
        unsigned i;\r
@@ -489,8 +477,6 @@ void osm_switch_clear_hops(IN osm_switch_t * p_sw)
                        memset(p_sw->hops[i], OSM_NO_PATH, p_sw->num_ports);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids)\r
 {\r
        uint16_t lft_size;\r
@@ -510,8 +496,6 @@ static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids)
        return 0;\r
 }\r
 \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
@@ -551,8 +535,6 @@ int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids
        return 0;\r
 }\r
 \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
@@ -577,8 +559,6 @@ uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,
        }\r
 }\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
index 0e04921b14932430564b0103771154cede833073..3a78e37afc6050dd394d672f7418852bcc498be9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -81,23 +81,10 @@ extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp);
  *\r
  **********************************************************************/\r
 \r
-typedef struct osm_trap_agingracker_context {\r
-       osm_log_t *p_log;\r
-       osm_physp_t *p_physp;\r
-} osm_trap_aging_tracker_context_t;\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
 static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,\r
-                                            IN uint16_t lid, IN uint8_t num)\r
+                                            IN ib_net16_t lid, IN uint8_t num)\r
 {\r
-       cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl);\r
-       osm_port_t *p_port;\r
-\r
-       if (lid > cl_ptr_vector_get_size(p_vec))\r
-               return NULL;\r
-\r
-       p_port = (osm_port_t *) cl_ptr_vector_get(p_vec, lid);\r
+       osm_port_t *p_port = osm_get_port_by_lid(sm->p_subn, lid);\r
        if (!p_port)\r
                return NULL;\r
 \r
@@ -107,14 +94,11 @@ static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,
        return osm_node_get_physp_ptr(p_port->p_node, num);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-uint64_t\r
-osm_trap_rcv_aging_tracker_callback(IN uint64_t key,\r
-                                   IN uint32_t num_regs, IN void *context)\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
-       uint16_t lid;\r
+       ib_net16_t lid;\r
        uint8_t port_num;\r
        osm_physp_t *p_physp;\r
 \r
@@ -124,20 +108,20 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
                /* We got an exit flag - do nothing */\r
                return 0;\r
 \r
-       lid = cl_ntoh16((uint16_t) ((key & 0x0000FFFF00000000ULL) >> 32));\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, lid);\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, lid);\r
+                       port_num, cl_ntoh16(lid));\r
 \r
                /* Clear its health bit */\r
                osm_physp_set_health(p_physp, TRUE);\r
@@ -192,28 +176,18 @@ static uint32_t trap_calc_crc32(void *buffer, uint32_t count)
        return crc;\r
 }\r
 \r
-/********************************************************************\r
- ********************************************************************/\r
-\r
 /* The key is created in the following manner:\r
    port_num  lid   crc\r
    \______/ \___/ \___/\r
      16b     16b   32b\r
 */\r
-static void\r
-trap_get_key(IN uint16_t lid, IN uint8_t port_num,\r
-            IN ib_mad_notice_attr_t * p_ntci, OUT uint64_t * trap_key)\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 = 0;\r
-\r
-       CL_ASSERT(trap_key);\r
-\r
-       crc = trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t));\r
-       *trap_key = ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc;\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
-/**********************************************************************\r
- **********************************************************************/\r
 static int print_num_received(IN uint32_t num_received)\r
 {\r
        uint32_t i;\r
@@ -237,7 +211,6 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
        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
-       int ret;\r
 \r
        /* select the nearest port to master opensm */\r
        if (p->p_remote_physp &&\r
@@ -247,10 +220,6 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
        /* 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
-       OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3810: "\r
-               "Disabling physical port 0x%016" PRIx64 " num:%u\n",\r
-               cl_ntoh64(osm_physp_get_port_guid(p)), p->port_num);\r
-\r
        memcpy(payload, &p->port_info, sizeof(ib_port_info_t));\r
 \r
        /* Set port to disabled/down */\r
@@ -264,15 +233,10 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
        context.pi_context.light_sweep = FALSE;\r
        context.pi_context.active_transition = FALSE;\r
 \r
-       ret = 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
-       if (ret)\r
-               OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: "\r
-                       "Request to set PortInfo failed\n");\r
-\r
-       return ret;\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
@@ -312,10 +276,46 @@ static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci,
                        cl_ntoh16(source_lid), cl_ntoh64(trans_id));\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-static void\r
-trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)\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
@@ -325,7 +325,6 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
        uint64_t trap_key;\r
        uint32_t num_received;\r
        osm_physp_t *p_physp;\r
-       cl_ptr_vector_t *p_tbl;\r
        osm_port_t *p_port;\r
        ib_net16_t source_lid = 0;\r
        boolean_t is_gsi = TRUE;\r
@@ -438,25 +437,18 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
                        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
-               }\r
-\r
-               /* If physp_change_trap is TRUE - the key will include the port number.\r
-                  If not - the port_number in the key will be zero. */\r
-               if (physp_change_trap == TRUE) {\r
                        port_num = p_ntci->data_details.ntc_129_131.port_num;\r
-                       trap_get_key(source_lid, port_num, p_ntci, &trap_key);\r
-               } else\r
-                       trap_get_key(source_lid, 0, p_ntci, &trap_key);\r
+               }\r
 \r
                /* try to find it in the aging tracker */\r
-               num_received =\r
-                   cl_event_wheel_num_regs(&sm->trap_aging_tracker,\r
-                                           trap_key);\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_ERROR, "ERR 3804: "\r
+                               OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
                                        "Received trap %u times consecutively\n",\r
                                        num_received);\r
                        /*\r
@@ -464,56 +456,16 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
                         * we mark it as unhealthy.\r
                         */\r
                        if (physp_change_trap == TRUE) {\r
-                               /* get the port */\r
-                               p_physp = get_physp_by_lid_and_num(sm,\r
-                                                                  cl_ntoh16\r
-                                                                  (p_ntci->\r
-                                                                   data_details.\r
-                                                                   ntc_129_131.\r
-                                                                   lid),\r
-                                                                  port_num);\r
-\r
-                               if (!p_physp)\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
-                                               "ERR 3805: "\r
-                                               "Failed to find physical port by lid:%u num:%u\n",\r
-                                               cl_ntoh16(p_ntci->data_details.\r
-                                                         ntc_129_131.lid),\r
-                                               p_ntci->data_details.\r
-                                               ntc_129_131.port_num);\r
-                               else {\r
-                                       /* When babbling port policy option is enabled and\r
-                                          Threshold for disabling a "babbling" port is exceeded */\r
-                                       if (sm->p_subn->opt.\r
-                                           babbling_port_policy\r
-                                           && num_received >= 250\r
-                                           && disable_port(sm, p_physp) == 0)\r
-                                               goto Exit;\r
-\r
-                                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                                               "Marking unhealthy physical port by lid:%u num:%u\n",\r
-                                               cl_ntoh16(p_ntci->data_details.\r
-                                                         ntc_129_131.lid),\r
-                                               p_ntci->data_details.\r
-                                               ntc_129_131.port_num);\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 it is not - no need to mark it again - just restart the timer. */\r
-                                       if (osm_physp_is_healthy(p_physp)) {\r
-                                               osm_physp_set_health(p_physp,\r
-                                                                    FALSE);\r
-                                               /* Make sure we sweep again - force a heavy sweep. */\r
-                                               /* The sweep should be done only after the re-registration, or\r
-                                                  else we'll be losing track of the timer. */\r
-                                               run_heavy_sweep = TRUE;\r
-                                       }\r
-                                       /* If we are marking the port as unhealthy - we want to\r
-                                          keep this for a longer period of time than the\r
-                                          OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT. Use the\r
-                                          OSM_DEFAULT_UNHEALTHY_TIMEOUT */\r
-                                       event_wheel_timeout =\r
-                                           OSM_DEFAULT_UNHEALTHY_TIMEOUT;\r
-                               }\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
@@ -521,25 +473,27 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
                /* 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, cl_get_time_stamp() + event_wheel_timeout, osm_trap_rcv_aging_tracker_callback,   /* no callback */\r
-                                          sm   /* no context */ );\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, cl_get_time_stamp() + event_wheel_timeout, NULL,  /* no callback */\r
-                                          NULL /* no context */ );\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
-                                       "Continuously received this trap %u times. Ignoring\n",\r
-                                       num_received);\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
-           cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 &&\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
@@ -552,20 +506,24 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
                        OSM_LOG(sm->p_log, OSM_LOG_ERROR,\r
                                "ERR 3812: No physical port found for "\r
                                "trap 144: \"node description update\"\n");\r
-       }\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/145 - these traps signal a change of\r
-                  certain port capabilities/system image guid.\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
-                    cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145 ||\r
                     run_heavy_sweep)) {\r
                        OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
                                "Forcing heavy sweep. Received trap:%u\n",\r
@@ -597,22 +555,8 @@ trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw)
                       sizeof(ib_gid_t));\r
        } else {\r
                /* Need to use the IssuerLID */\r
-               p_tbl = &sm->p_subn->port_lid_tbl;\r
-\r
-               CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);\r
-\r
-               if ((uint16_t) cl_ptr_vector_get_size(p_tbl) <=\r
-                   cl_ntoh16(source_lid)) {\r
-                       /*  the source lid is out of range */\r
-                       OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,\r
-                               "source lid is out of range:%u\n",\r
-                               cl_ntoh16(source_lid));\r
-\r
-                       goto Exit;\r
-               }\r
-               p_port = cl_ptr_vector_get(p_tbl, cl_ntoh16(source_lid));\r
-               if (p_port == 0) {\r
-                       /* We have the lid - but no corresponding port */\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
@@ -640,11 +584,8 @@ Exit:
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
-**********************************************************************/\r
-static void\r
-trap_rcv_process_response(IN osm_sm_t * sm,\r
-                         IN const osm_madw_t * const p_madw)\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
@@ -655,8 +596,6 @@ trap_rcv_process_response(IN osm_sm_t * sm,
        OSM_LOG_EXIT(sm->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_trap_rcv_process(IN void *context, IN void *data)\r
 {\r
        osm_sm_t *sm = context;\r
index 004824cbeaee3a815f6af3d3e14fcde1c62d0b7b..c84e0660c2289429679598695c31c4b2b64d0656 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008,2009 Mellanox Technologies LTD. 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
@@ -76,33 +76,21 @@ typedef struct cache_switch {
        cache_port_t ports[0];\r
 } cache_switch_t;\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
-/**********************************************************************\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
-/**********************************************************************\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
-/**********************************************************************\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
@@ -122,9 +110,6 @@ static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports)
        return p_cache_sw;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static void cache_sw_destroy(cache_switch_t * p_sw)\r
 {\r
        if (!p_sw)\r
@@ -137,9 +122,6 @@ static void cache_sw_destroy(cache_switch_t * p_sw)
        free(p_sw);\r
 }\r
 \r
-/**********************************************************************\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
@@ -151,8 +133,6 @@ static cache_switch_t *cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho)
        return p_cache_sw;\r
 }\r
 \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
@@ -200,9 +180,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)\r
 {\r
        cache_switch_t *p_sw;\r
@@ -232,9 +209,6 @@ static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr)
        }\r
 }\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
@@ -264,9 +238,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\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
@@ -327,9 +298,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }                              /* cache_remove_port() */\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -357,9 +325,6 @@ cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr,
        p_cache_sw->hops = NULL;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static void ucast_cache_dump(osm_ucast_mgr_t * p_mgr)\r
 {\r
        cache_switch_t *p_sw;\r
@@ -395,9 +360,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr)\r
 {\r
        cache_switch_t *p_sw;\r
@@ -424,9 +386,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)\r
 {\r
        cache_switch_t *p_cache_sw;\r
@@ -776,9 +735,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }                              /* osm_ucast_cache_validate() */\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -850,9 +806,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }                              /* osm_ucast_cache_check_new_link() */\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -927,9 +880,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }                              /* osm_ucast_cache_add_link() */\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -1040,9 +990,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }                              /* osm_ucast_cache_add_node() */\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -1079,6 +1026,3 @@ int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr)
 \r
        return 0;\r
 }\r
-\r
-/**********************************************************************\r
- **********************************************************************/\r
index 907bd33ee41b1b4a726aa0ef4db36de1a70a2841..f1cd597371610d3f208d083713cb28d5e1d59e65 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2008,2009 Mellanox Technologies LTD. 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
index 9b1b14c1dac4fb32042dbb34f233bbb06fe4d3b1..a66be414ddc0800a4c8b1fb4de0b3813d4b9efe8 100644 (file)
@@ -1975,7 +1975,7 @@ static inline int port_group_compare_load_down(const ftree_port_group_t * p1,
  * as it is much faster.\r
  *\r
  * Important note:\r
- * This function and __osm_ftree_bubble_sort_down must NOT be factorized.\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
@@ -2047,13 +2047,13 @@ bubble_sort_siblings(ftree_port_group_t ** p_group_array, uint32_t nmemb)
 \r
 /*\r
  * Function: Sorts an array of port group. Order is decide through\r
- * __osm_ftree_port_group_compare_load_down ( up counters, least load remote switch, biggest GUID)\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 __osm_ftree_bubble_sort_up must NOT be factorized.\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
@@ -2949,6 +2949,89 @@ static void fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
 /***************************************************\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
@@ -3586,7 +3669,7 @@ static int fabric_rank(IN ftree_fabric_t * p_ftree)
        if (res)\r
                goto Exit;\r
 \r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\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
@@ -3644,7 +3727,7 @@ static void fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree)
                p_ftree->leaf_switch_rank = p_sw->rank;\r
        }\r
 \r
-       OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO,\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
@@ -3772,7 +3855,7 @@ static int construct_fabric(IN void *context)
        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_SYS,\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
@@ -3780,7 +3863,7 @@ static int construct_fabric(IN void *context)
        }\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_SYS,\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
@@ -3790,7 +3873,7 @@ static int construct_fabric(IN void *context)
 \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_SYS,\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
@@ -3807,7 +3890,7 @@ static int construct_fabric(IN void *context)
        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_SYS,\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
@@ -3817,7 +3900,7 @@ static int construct_fabric(IN void *context)
        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_SYS,\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
@@ -3825,8 +3908,8 @@ static int construct_fabric(IN void *context)
        }\r
 \r
        if (cl_qmap_count(&p_ftree->hca_tbl) < 2) {\r
-               osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,\r
-                       "Fabric has %u CAa - topology is not fat-tree.\n"\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
@@ -3839,7 +3922,7 @@ static int construct_fabric(IN void *context)
           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_SYS,\r
+               osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO,\r
                        "Failed ranking the tree\n");\r
                status = -1;\r
                goto Exit;\r
@@ -3853,12 +3936,12 @@ static int construct_fabric(IN void *context)
        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_SYS,\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_SYS,\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
@@ -3870,7 +3953,7 @@ static int construct_fabric(IN void *context)
 \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_SYS,\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
@@ -3883,7 +3966,7 @@ static int construct_fabric(IN void *context)
           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_SYS,\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
@@ -3901,7 +3984,7 @@ static int construct_fabric(IN void *context)
           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_SYS,\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
@@ -3921,7 +4004,7 @@ static int construct_fabric(IN void *context)
           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_SYS,\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
@@ -3978,6 +4061,13 @@ static int do_routing(IN void *context)
                "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
index 528eac6f21b8d5d1793ccca45fc880ffb2777587..f635cfc7a03619ba70cd16a9d5e6a5d90419a3e2 100644 (file)
@@ -1008,7 +1008,7 @@ static void populate_fwd_tbls(lash_t * p_lash)
                memset(p_sw->new_lft, OSM_NO_PATH, p_sw->lft_size);\r
 \r
                for (lid = 1; lid <= max_lid_ho; lid++) {\r
-                       port = cl_ptr_vector_get(&p_subn->port_lid_tbl, lid);\r
+                       port = osm_get_port_by_lid_ho(p_subn, lid);\r
                        if (!port)\r
                                continue;\r
 \r
@@ -1259,7 +1259,7 @@ static lash_t *lash_create(osm_opensm_t * p_osm)
 \r
        p_lash->p_osm = p_osm;\r
 \r
-       return (p_lash);\r
+       return p_lash;\r
 }\r
 \r
 static void lash_delete(void *context)\r
index 229ad5a325e698c2b66431de1e59a18b04c19f31..9ccd58326c16b4301ad0be52fa55d63948672f29 100644 (file)
@@ -46,6 +46,7 @@
 #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 <opensm/osm_msgdef.h>\r
 #include <opensm/osm_opensm.h>\r
 \r
-/**********************************************************************\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
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr)\r
 {\r
        CL_ASSERT(p_mgr);\r
@@ -80,8 +77,6 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr)
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \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
@@ -99,7 +94,7 @@ ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr, IN osm_sm_t * sm)
                cl_qmap_init(&p_mgr->cache_sw_tbl);\r
 \r
        OSM_LOG_EXIT(p_mgr->p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
 /**********************************************************************\r
@@ -130,8 +125,6 @@ static void ucast_mgr_process_hop_0_1(IN cl_map_item_t * p_map_item,
        }\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
@@ -180,8 +173,6 @@ static void ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * p_mgr,
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \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
@@ -312,8 +303,6 @@ Exit:
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \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
@@ -390,11 +379,8 @@ static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item,
 #ifndef __WIN__\r
                        osm_port_t *port=cl_item_obj(item, port, list_item);\r
 #else\r
-                       osm_port_t *port=NULL;\r
-                       //osm_port_t *port2=NULL;\r
-                       port = cl_item_obj(item, port, list_item,(osm_port_t *));\r
-                       //port2 = cl_item_objX(item, port, list_item);\r
-                       //CL_ASSERT(port == port2);\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
@@ -406,8 +392,6 @@ static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item,
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item,\r
                                        IN void *context)\r
 {\r
@@ -458,8 +442,6 @@ static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item,
        OSM_LOG_EXIT(p_mgr->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static int set_hop_wf(void *ctx, uint64_t guid, char *p)\r
 {\r
        osm_ucast_mgr_t *m = ctx;\r
@@ -512,8 +494,102 @@ static void set_default_hop_wf(cl_map_item_t * p_map_item, void *ctx)
        }\r
 }\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
@@ -595,8 +671,6 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)\r
 {\r
        osm_switch_t *p_sw;\r
@@ -607,7 +681,7 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
 \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
+            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
@@ -615,12 +689,27 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn)
                                          (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
-/**********************************************************************\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
@@ -757,6 +846,7 @@ static void sort_ports_by_switch_load(osm_ucast_mgr_t * m)
 \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
@@ -798,8 +888,6 @@ static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,\r
                                  IN void *cxt)\r
 {\r
@@ -946,8 +1034,6 @@ void osm_ucast_mgr_set_fwd_tables(osm_ucast_mgr_t * p_mgr)
        ucast_mgr_pipeline_fwd_tbl(p_mgr);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t * osm)\r
 {\r
        int ret;\r
index a28e9dd17f0a74765a81ddf00058bce9ae9f75dd..e66748896df6e1af5c2bb777b72ac60a7b55a8ea 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. 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
@@ -77,8 +77,6 @@ struct updn_node {
        unsigned visited;\r
 };\r
 \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
@@ -204,8 +202,6 @@ static int updn_bfs_by_node(IN osm_log_t * p_log, IN osm_subn_t * p_subn,
        return 0;\r
 }\r
 \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
@@ -283,28 +279,22 @@ static int updn_subn_rank(IN updn_t * p_updn)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /* hack: preserve min hops entries to any other root switches */\r
-static void updn_clear_non_root_hops(updn_t * p_updn, osm_switch_t * p_sw)\r
+static void updn_clear_non_root_hops(updn_t * updn, osm_switch_t * sw)\r
 {\r
-       osm_port_t *p_port;\r
+       osm_port_t *port;\r
        unsigned i;\r
 \r
-       for (i = 0; i < p_sw->num_hops; i++)\r
-               if (p_sw->hops[i]) {\r
-                       p_port =\r
-                           cl_ptr_vector_get(&p_updn->p_osm->subn.port_lid_tbl,\r
-                                             i);\r
-                       if (!p_port || !p_port->p_node->sw\r
-                           || ((struct updn_node *)p_port->p_node->sw->priv)->\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(p_sw->hops[i], 0xff, p_sw->num_ports);\r
+                               memset(sw->hops[i], 0xff, sw->num_ports);\r
                }\r
 }\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
@@ -351,8 +341,6 @@ static int updn_set_min_hop_table(IN updn_t * p_updn)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static int updn_build_lid_matrices(IN updn_t * p_updn)\r
 {\r
        int status;\r
@@ -389,8 +377,6 @@ _exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static struct updn_node *create_updn_node(osm_switch_t * sw)\r
 {\r
        struct updn_node *u;\r
@@ -411,8 +397,6 @@ static void delete_updn_node(struct updn_node *u)
        free(u);\r
 }\r
 \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
@@ -517,8 +501,6 @@ _exit:
        return;\r
 }\r
 \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
@@ -662,8 +644,6 @@ static int updn_lid_matrices(void *ctx)
        return ret;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void updn_delete(void *context)\r
 {\r
        free(context);\r
index 1100076a781788c86eee95bb674c33743f2f9992..863120f00c9c2e25d8e6617870902c0a5f017646 100644 (file)
@@ -1,6 +1,7 @@
 /*\r
+ * Copyright (c) 2009 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) 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
@@ -53,9 +54,6 @@
 #include <opensm/osm_log.h>\r
 #include <opensm/osm_helper.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -180,8 +178,6 @@ static void vl15_poller(IN void *p_ptr)
        OSM_LOG_EXIT(p_vl->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_vl15_construct(IN osm_vl15_t * p_vl)\r
 {\r
        memset(p_vl, 0, sizeof(*p_vl));\r
@@ -194,8 +190,6 @@ void osm_vl15_construct(IN osm_vl15_t * p_vl)
        cl_thread_construct(&p_vl->poller);\r
 }\r
 \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
@@ -240,8 +234,6 @@ void osm_vl15_destroy(IN osm_vl15_t * p_vl, IN struct osm_mad_pool *p_pool)
        OSM_LOG_EXIT(p_vl->p_log);\r
 }\r
 \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
@@ -273,11 +265,9 @@ ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl, IN osm_vendor_t * p_vend,
                                "opensm poller");\r
 Exit:\r
        OSM_LOG_EXIT(p_log);\r
-       return (status);\r
+       return status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osm_vl15_poll(IN osm_vl15_t * p_vl)\r
 {\r
        OSM_LOG_ENTER(p_vl->p_log);\r
@@ -303,8 +293,6 @@ void osm_vl15_poll(IN osm_vl15_t * p_vl)
        OSM_LOG_EXIT(p_vl->p_log);\r
 }\r
 \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
index 07fbbba66c76abfda8f83bd932a1287d23961ca6..37e30bd152a6071dda804177fcf082e8a6be667b 100644 (file)
@@ -2,6 +2,8 @@
  * 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
@@ -55,8 +57,6 @@
 #include <opensm/osm_helper.h>\r
 #include <opensm/osm_sm.h>\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 /*\r
  * WE ONLY RECEIVE GET or SET responses\r
  */\r
@@ -93,12 +93,10 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
        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 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",\r
-                       cl_ntoh64(port_guid),\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
@@ -136,15 +134,14 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
                goto Exit;\r
        }\r
 \r
-       osm_dump_vl_arb_table(sm->p_log,\r
-                             port_guid, block_num,\r
-                             port_num, p_vla_tbl, OSM_LOG_DEBUG);\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
index 4712aff9389840d5c31f01871d5ef18ca68194cf..676b1c231d5224f98ddfcde4998450913aff073a 100644 (file)
@@ -172,9 +172,9 @@ static int new_size(int size)
 static int collision = 0;\r
 static int init_st = 0;\r
 \r
-static void stat_col()\r
+static void stat_col(void)\r
 {\r
-       FILE *f = fopen("/var/log/osm_st_col", "w");\r
+       FILE *f = fopen(OSM_DEFAULT_TMP_DIR "osm_st_col", "w");\r
        fprintf(f, "collision: %d\n", collision);\r
        fclose(f);\r
 }\r
index 2804ffc8f595847af21257d8a33b3620d2456185..1027e8d7f7bf2f138995be70c723e964f803be9b 100644 (file)
@@ -12,11 +12,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)
 TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)\r
 !endif\r
 \r
-# include only one vendor definition\r
-\r
-!include ..\opensm\vendor-ibal.inc\r
-#!include ..\opensm\vendor-umad.inc\r
-\r
+!include ..\mad-vendor.inc\r
 \r
 TARGETTYPE=PROGRAM\r
 UMTYPE=console\r
@@ -24,14 +20,14 @@ USE_MSVCRT=1
 OVR_DIR=..\addon\r
 \r
 \r
-SOURCES=\\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
+       main.c\r
 \r
 OSM_HOME=..\r
 \r
index b2e1cb82f8b8c1c7ce38bc38855a08d6449d3b9e..a8f41fe375a1fab876c38042720fde822a33c0f2 100644 (file)
@@ -61,8 +61,6 @@
 #define OSMT_DEFAULT_TRAP_WAIT_TIMEOUT_SEC 10\r
 #define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 boolean_t osmt_is_debug(void)\r
 {\r
 #if defined( _DEBUG_ )\r
@@ -72,8 +70,6 @@ boolean_t osmt_is_debug(void)
 #endif                         /* defined( _DEBUG_ ) */\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void show_usage()\r
 {\r
        printf\r
@@ -207,8 +203,6 @@ void show_usage()
               "          the transaction timeout with the -t option\n\n");\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void print_all_guids(IN osmtest_t * p_osmt)\r
 {\r
        ib_api_status_t status;\r
@@ -235,8 +229,6 @@ static void print_all_guids(IN osmtest_t * p_osmt)
                       cl_hton64(attr_array[i].port_guid));\r
 }\r
 \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
@@ -273,8 +265,6 @@ ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)
        return 0;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 int main(int argc, char *argv[])\r
 {\r
        static osmtest_t osm_test;\r
@@ -286,7 +276,11 @@ int main(int argc, char *argv[])
        int32_t vendor_debug = 0;\r
        char flow_name[64];\r
        uint32_t next_option;\r
-       const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh";\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
@@ -316,13 +310,6 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}      /* Required at end of array */\r
        };\r
 \r
-#ifdef __WIN__\r
-       if ( !strcmp(argv[1],"/?") ) {\r
-               show_usage();\r
-               return 0;\r
-       }\r
-#endif\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
@@ -559,6 +546,9 @@ int main(int argc, char *argv[])
                        }\r
                        break;\r
 \r
+#ifdef __WIN__\r
+               case '?':\r
+#endif\r
                case 'h':\r
                        show_usage();\r
                        return 0;\r
index 6e2cd3851d6a4df97e7b63605fd17388f4571edd..f603ade25bd7e51696c952a6d3c8a7e4dff131ec 100644 (file)
@@ -1,4 +1,5 @@
 /*\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
index 363a059f437cf04b855ede7dbe85c209b63e760c..ed8577c26102aae7a30657f27a95951a4a59e45f 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -51,9 +51,6 @@
 #include <complib/cl_list.h>\r
 #include "osmtest.h"\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)\r
 {\r
        uint32_t i;\r
@@ -126,9 +123,6 @@ static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt)
 \r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 static cl_status_t\r
 __match_mgids(IN const void *const p_object, IN void *context)\r
 {\r
@@ -143,9 +137,6 @@ __match_mgids(IN const void *const p_object, IN void *context)
                return CL_NOT_FOUND;\r
 }\r
 \r
-/**********************************************************************\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
@@ -273,9 +264,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\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
@@ -381,9 +369,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\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
index e9b5bed5c83408bde6a627929596bd4f4d859474..9921c26fd830dca380fd214eb0ee289067c81cb1 100644 (file)
@@ -55,8 +55,6 @@
 #include <complib/cl_debug.h>\r
 #include "osmtest.h"\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 \r
 ib_api_status_t\r
 osmt_register_service(IN osmtest_t * const p_osmt,\r
@@ -160,9 +158,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -284,9 +279,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -440,9 +432,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -569,9 +558,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -694,9 +680,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -828,9 +811,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -945,9 +925,6 @@ Exit:
        return status;\r
 }\r
 \r
-/**********************************************************************\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
@@ -1068,9 +1045,6 @@ Exit:
 }\r
 #endif\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 ib_api_status_t\r
 osmt_delete_service_by_name(IN osmtest_t * const p_osmt,\r
                            IN uint8_t IsServiceExist,\r
@@ -1174,9 +1148,6 @@ ExitNoDel:
        return status;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
-\r
 /*\r
  * Run a complete service records flow:\r
  * - register a service\r
index 14615e3926a410283cba1eb1484b8e1e15b8bdef..e82e7d8deb1963b7f1bea154c4ca9e194f1b06bf 100644 (file)
@@ -51,8 +51,6 @@
 #include <complib/cl_debug.h>\r
 #include "osmtest.h"\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_write_vl_arb_table(IN osmtest_t * const p_osmt,\r
                           IN FILE * fh,\r
index 5c7dcd7397168bf05462c7bd73947fb27c12e02e..4c03370c55ec9b2691eda0cf8caf8064b0168577 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. 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
@@ -247,8 +247,6 @@ static const char ib_mad_status_str_insuf_comps[] =
     "IB_SA_MAD_STATUS_INSUF_COMPS";\r
 static const char generic_or_str[] = " | ";\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad)\r
 {\r
        static char line[512];\r
@@ -378,8 +376,6 @@ const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad)
        return (line);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void subnet_construct(IN subnet_t * const p_subn)\r
 {\r
        cl_qmap_init(&p_subn->link_tbl);\r
@@ -396,8 +392,6 @@ void subnet_construct(IN subnet_t * const p_subn)
        cl_qmap_init(&p_subn->path_tbl);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 cl_status_t subnet_init(IN subnet_t * const p_subn)\r
 {\r
        cl_status_t status = IB_SUCCESS;\r
@@ -407,8 +401,6 @@ cl_status_t subnet_init(IN subnet_t * const p_subn)
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osmtest_construct(IN osmtest_t * const p_osmt)\r
 {\r
        memset(p_osmt, 0, sizeof(*p_osmt));\r
@@ -416,8 +408,6 @@ void osmtest_construct(IN osmtest_t * const p_osmt)
        subnet_construct(&p_osmt->exp_subn);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void osmtest_destroy(IN osmtest_t * const p_osmt)\r
 {\r
        cl_map_item_t *p_item, *p_next_item;\r
@@ -475,8 +465,6 @@ void osmtest_destroy(IN osmtest_t * const p_osmt)
        osm_log_destroy(&p_osmt->log);\r
 }\r
 \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
@@ -530,8 +518,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -550,8 +536,6 @@ void osmtest_query_res_cb(IN osmv_query_res_t * p_rec)
        OSM_LOG_EXIT(&p_osmt->log);\r
 }\r
 \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
@@ -579,7 +563,7 @@ osmtest_get_all_recs(IN osmtest_t * const p_osmt,
 \r
        p_context->p_osmt = p_osmt;\r
        user.attr_id = attr_id;\r
-       user.attr_offset = cl_ntoh16((uint16_t) (attr_size >> 3));\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
@@ -618,8 +602,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -705,8 +687,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -739,7 +719,7 @@ osmtest_get_node_rec(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -813,7 +793,7 @@ osmtest_get_node_rec_by_lid(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -856,8 +836,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -921,8 +899,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -989,8 +965,6 @@ Exit:
 }\r
 \r
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)\r
-/**********************************************************************\r
- **********************************************************************/\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
@@ -1051,8 +1025,6 @@ Exit:
 }\r
 #endif\r
 \r
-/**********************************************************************\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
@@ -1085,7 +1057,7 @@ osmtest_get_port_rec(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -1125,8 +1097,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1202,8 +1172,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1265,8 +1233,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1329,8 +1295,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1392,8 +1356,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1504,8 +1466,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1569,8 +1529,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1702,8 +1660,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_write_port_info(IN osmtest_t * const p_osmt,\r
                        IN FILE * fh,\r
@@ -1798,8 +1754,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1848,8 +1802,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1908,8 +1860,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1942,8 +1892,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -1977,7 +1925,7 @@ osmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
        num_recs = context.result.result_cnt;\r
 \r
        OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Received %zu records\n", num_recs);\r
+               "Received %u records\n", num_recs);\r
 \r
        result = fprintf(fh, "#\n" "# Link Records\n" "#\n");\r
        if (result < 0) {\r
@@ -2010,8 +1958,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -2043,7 +1989,7 @@ osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt,
        req.sm_key = 0;\r
 \r
        OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE,\r
-               "Query for path from 0x%X to 0x%X\n", slid, dlid);\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
@@ -2064,7 +2010,6 @@ osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt,
                                                      ((*p_context).result.\r
                                                       p_result_madw)));\r
                }\r
-               goto Exit;\r
        }\r
 \r
 Exit:\r
@@ -2108,7 +2053,7 @@ osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
         */\r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs);\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
@@ -2173,7 +2118,7 @@ osmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
         */\r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs);\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
@@ -2239,7 +2184,7 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
         */\r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs);\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
@@ -2269,7 +2214,7 @@ Exit:
        return (status);\r
 }\r
 \r
-#else\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
@@ -2582,8 +2527,6 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 \r
 #endif\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_create_inventory_file(IN osmtest_t * const p_osmt)\r
 {\r
@@ -2627,8 +2570,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -2706,8 +2647,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -2790,8 +2729,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -2867,8 +2804,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -2885,7 +2820,11 @@ osmtest_stress_path_recs_by_lid(IN osmtest_t * const p_osmt,
        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
@@ -2929,8 +2868,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3007,8 +2944,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3027,8 +2962,6 @@ osmtest_prepare_db_generic(IN osmtest_t * const p_osmt,
        OSM_LOG_EXIT(&p_osmt->log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static void osmtest_prepare_db(IN osmtest_t * const p_osmt)\r
 {\r
        OSM_LOG_ENTER(&p_osmt->log);\r
@@ -3039,8 +2972,6 @@ static void osmtest_prepare_db(IN osmtest_t * const p_osmt)
        OSM_LOG_EXIT(&p_osmt->log);\r
 }\r
 \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
@@ -3071,8 +3002,6 @@ static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt)
        return (status);\r
 }\r
 \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
@@ -3104,8 +3033,6 @@ static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt)
        return (status);\r
 }\r
 \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
@@ -3139,15 +3066,11 @@ Exit:
        return (status);\r
 }\r
 \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
-/**********************************************************************\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
@@ -3161,8 +3084,6 @@ osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt,
        return (TRUE);\r
 }\r
 \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
@@ -3272,8 +3193,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3451,8 +3370,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3484,8 +3401,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3963,8 +3878,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -3998,8 +3911,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -4033,8 +3944,6 @@ Exit:
 #ifdef VENDOR_RMPP_SUPPORT\r
 ib_net64_t portguid = 0;\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -4063,7 +3972,7 @@ osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt)
 \r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n",\r
+       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
                num_recs);\r
 \r
        /*\r
@@ -4108,8 +4017,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -4137,7 +4044,7 @@ osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt)
 \r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n",\r
+       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
                num_recs);\r
 \r
        /* No validation as yet */\r
@@ -4156,8 +4063,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -4186,7 +4091,7 @@ osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt)
 \r
        num_recs = context.result.result_cnt;\r
 \r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n",\r
+       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n",\r
                num_recs);\r
 \r
        /*\r
@@ -4269,7 +4174,7 @@ osmtest_get_link_rec_by_lid(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4347,7 +4252,7 @@ osmtest_get_guidinfo_rec_by_lid(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4426,7 +4331,7 @@ osmtest_get_pkeytbl_rec_by_lid(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4505,7 +4410,7 @@ osmtest_get_sw_info_rec_by_lid(IN osmtest_t * const p_osmt,
        if (lid)\r
                user.comp_mask = IB_SWIR_COMPMASK_LID;\r
        user.attr_id = IB_MAD_ATTR_SWITCH_INFO_RECORD;\r
-       user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4584,7 +4489,7 @@ osmtest_get_lft_rec_by_lid(IN osmtest_t * const p_osmt,
        if (lid)\r
                user.comp_mask = IB_LFTR_COMPMASK_LID;\r
        user.attr_id = IB_MAD_ATTR_LFT_RECORD;\r
-       user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4663,7 +4568,7 @@ osmtest_get_mft_rec_by_lid(IN osmtest_t * const p_osmt,
        if (lid)\r
                user.comp_mask = IB_MFTR_COMPMASK_LID;\r
        user.attr_id = IB_MAD_ATTR_MFT_RECORD;\r
-       user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4707,8 +4612,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -4737,7 +4640,7 @@ osmtest_sminfo_record_request(IN osmtest_t * const p_osmt,
 \r
        p_context->p_osmt = p_osmt;\r
        user.attr_id = IB_MAD_ATTR_SMINFO_RECORD;\r
-       user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4804,8 +4707,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -4839,7 +4740,7 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -4853,7 +4754,7 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt,
                user.comp_mask |= IB_IIR_COMPMASK_ENUM;\r
                user.p_attr = &record;\r
        } else {\r
-               user.attr_offset = cl_ntoh16((uint16_t) (sizeof(rec) >> 3));\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
@@ -4918,8 +4819,6 @@ Exit:
 }\r
 #endif\r
 \r
-/**********************************************************************\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
@@ -4945,7 +4844,7 @@ osmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt,
        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 %zu\n",\r
+                       "Too many records. Expected 1, received %u\n",\r
                        num_recs);\r
 \r
                status = IB_ERROR;\r
@@ -4975,8 +4874,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -5006,7 +4903,7 @@ osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt,
        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 = cl_ntoh16((uint16_t) (sizeof(record) >> 3));\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
@@ -5073,8 +4970,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -5122,8 +5017,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -5183,7 +5076,7 @@ osmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt,
        }\r
 \r
        num_recs = context.result.result_cnt;\r
-       OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "%zu records\n", num_recs);\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
@@ -5242,8 +5135,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_single_path_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -5326,8 +5217,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_single_node_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -5380,8 +5269,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 osmtest_validate_single_port_recs(IN osmtest_t * const p_osmt)\r
 {\r
@@ -5432,8 +5319,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -6146,8 +6031,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -6194,8 +6077,6 @@ static void str_skip_token(IN char line[], IN OUT uint32_t * const p_offset)
        }\r
 }\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
@@ -6421,8 +6302,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -6828,8 +6707,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -6989,8 +6866,6 @@ Exit:
        return (status);\r
 }\r
 \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
@@ -7070,8 +6945,6 @@ Exit:
        return (status);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t osmtest_create_db(IN osmtest_t * const p_osmt)\r
 {\r
        FILE *fh;\r
@@ -7214,8 +7087,6 @@ osmtest_get_user_port(IN osmtest_t * const p_osmt,
        return (choice - 1);\r
 }\r
 \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
@@ -7295,8 +7166,6 @@ Exit:
        return (status);\r
 }\r
 \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
index 399206323622c4719ef09778ba948794a2f1b96e..1b71a2d557af9e0af7ce1293e98221fbccb5fd0b 100644 (file)
 \r
 #include <oib_ver.h>\r
 \r
-#define VER_FILETYPE                           VFT_APP\r
-#define VER_FILESUBTYPE                                VFT2_UNKNOWN\r
+#define VER_FILETYPE                   VFT_APP\r
+#define VER_FILESUBTYPE                        VFT2_UNKNOWN\r
 #ifdef _DEBUG_\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application (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"\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
diff --git a/branches/opensm_3/user/osmtest/vendor-ibal.inc b/branches/opensm_3/user/osmtest/vendor-ibal.inc
new file mode 100644 (file)
index 0000000..303cdd4
--- /dev/null
@@ -0,0 +1,2 @@
+\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
new file mode 100644 (file)
index 0000000..d106d80
--- /dev/null
@@ -0,0 +1,2 @@
+\r
+!INCLUDE ..\opensm\vendor-umad.inc\r
diff --git a/branches/opensm_3/user/scripts/opensm.init.in b/branches/opensm_3/user/scripts/opensm.init.in
deleted file mode 100644 (file)
index 997dce5..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/bash\r
-#\r
-# opensm:              Manage OpenSM\r
-#\r
-# chkconfig: - 09 91\r
-# description:  Manage OpenSM\r
-#\r
-### BEGIN INIT INFO\r
-# Provides: opensm\r
-# Required-Start: $syslog\r
-# Default-Start: none\r
-# Default-Stop: 0 1 6\r
-# Description:  Manage OpenSM\r
-### END INIT INFO\r
-#\r
-# Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
-# Copyright 2006 PathScale, Inc.  All Rights Reserved.\r
-#\r
-# This Software is licensed under one of the following licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/cpl.php.\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
-#    copy of which is available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/gpl-license.php.\r
-#\r
-# Licensee has the right to choose one of the above licenses.\r
-#\r
-# Redistributions of source code must retain the above copyright\r
-# notice and one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-\r
-prefix=@prefix@\r
-exec_prefix=@exec_prefix@\r
-\r
-# Source function library.\r
-if [[ -s /etc/init.d/functions ]]; then\r
-    . /etc/init.d/functions\r
-    rc_status() { :; }\r
-    rc_exit() { exit $RETVAL; }\r
-fi\r
-if [[ -s /etc/rc.status ]]; then\r
-    . /etc/rc.status\r
-    failure() { rc_status -v; }\r
-    success() { rc_status -v; }\r
-fi\r
-\r
-CONFIG=@sysconfdir@/sysconfig/opensm\r
-if [[ -s $CONFIG ]]; then\r
-    . $CONFIG\r
-fi\r
-\r
-start () {\r
-    echo -n "Starting opensm: "\r
-    @sbindir@/opensm --daemon $OPTIONS > /dev/null\r
-    if [[ $RETVAL -eq 0 ]]; then\r
-        touch /var/lock/subsys/opensm\r
-        success\r
-    else\r
-        failure\r
-    fi\r
-    echo\r
-}\r
-\r
-stop () {\r
-    echo -n "Shutting down opensm: "\r
-    killproc opensm\r
-    if [[ $RETVAL -eq 0 ]]; then\r
-        rm -f /var/lock/subsys/opensm\r
-        success\r
-    else\r
-        failure\r
-    fi\r
-    echo\r
-}\r
-\r
-Xstatus () {\r
-       pid="`pidof opensm`"\r
-       ret=$?\r
-       if [ $ret -eq 0 ] ; then\r
-               echo "OpenSM is running... pid=$pid"\r
-       else\r
-               echo "OpenSM is not running."\r
-       fi\r
-}\r
-\r
-restart() {\r
-    stop\r
-    start\r
-}\r
-\r
-# See how we were called.\r
-case "$1" in\r
-    start)\r
-       start\r
-       ;;\r
-    stop)\r
-       stop\r
-       ;;\r
-    status)\r
-        Xstatus\r
-       ;;\r
-    restart | force-reload | reload)\r
-       restart\r
-       ;;\r
-    try-restart | condrestart)\r
-       [ -e /var/lock/subsys/opensm ] && restart\r
-       ;;\r
-    resweep)\r
-       killall -HUP opensm\r
-        RETVAL=$?\r
-       ;;\r
-    rotatelog)\r
-       killall -USR1 opensm\r
-        RETVAL=$?\r
-       ;;\r
-    *)\r
-       echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|resweep|rotatelog}"\r
-       RETVAL=1\r
-       ;;\r
-esac\r
-\r
-_rc_status_all=$RETVAL\r
-rc_exit\r
diff --git a/branches/opensm_3/user/scripts/opensm.logrotate b/branches/opensm_3/user/scripts/opensm.logrotate
deleted file mode 100644 (file)
index ee5a455..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/var/log/opensm.log {\r
-    missingok\r
-    notifempty\r
-    copytruncate\r
-    weekly\r
-    compress\r
-}\r
diff --git a/branches/opensm_3/user/scripts/opensm.sysconfig b/branches/opensm_3/user/scripts/opensm.sysconfig
deleted file mode 100644 (file)
index 2d72350..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# It will be used for sldd.sh\r
-OSM_HOSTS=""\r
diff --git a/branches/opensm_3/user/scripts/osm-regress.bat b/branches/opensm_3/user/scripts/osm-regress.bat
new file mode 100644 (file)
index 0000000..9229f91
--- /dev/null
@@ -0,0 +1,45 @@
+@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
diff --git a/branches/opensm_3/user/scripts/redhat-opensm.init.in b/branches/opensm_3/user/scripts/redhat-opensm.init.in
deleted file mode 100644 (file)
index 71d95d5..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/bin/bash\r
-#\r
-# Bring up/down opensm\r
-#\r
-# chkconfig: - 15 85\r
-# description: Activates/Deactivates InfiniBand Subnet Manager\r
-#\r
-### BEGIN INIT INFO\r
-# Provides:       opensm\r
-### END INIT INFO\r
-#\r
-# Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
-# Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
-#\r
-# This Software is licensed under one of the following licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/cpl.php.\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
-#    copy of which is available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/gpl-license.php.\r
-#\r
-# Licensee has the right to choose one of the above licenses.\r
-#\r
-# Redistributions of source code must retain the above copyright\r
-# notice and one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-#\r
-#  $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $\r
-#\r
-# processname: @sbindir@/opensm\r
-# config: @sysconfdir@/sysconfig/opensm\r
-# pidfile: /var/run/opensm.pid\r
-\r
-prefix=@prefix@\r
-exec_prefix=@exec_prefix@\r
-\r
-. /etc/rc.d/init.d/functions\r
-\r
-CONFIG=@sysconfdir@/sysconfig/opensm\r
-if [ -f $CONFIG ]; then\r
-    . $CONFIG\r
-fi\r
-\r
-prog=@sbindir@/opensm\r
-bin=${prog##*/}\r
-\r
-# Handover daemon for updating guid2lid cache file\r
-sldd_prog=@sbindir@/sldd.sh\r
-sldd_bin=${sldd_prog##*/}\r
-sldd_pid_file=/var/run/sldd.pid\r
-\r
-ACTION=$1\r
-\r
-# Setting OpenSM start parameters\r
-PID_FILE=/var/run/${bin}.pid\r
-touch $PID_FILE\r
-\r
-if [[ -n "${OSM_HOSTS}" && $(echo -n ${OSM_HOSTS} | wc -w | tr -d '[:space:]') -gt 1  ]]; then\r
-    HONORE_GUID2LID="--honor_guid2lid"\r
-fi\r
-\r
-#########################################################################\r
-\r
-start_sldd()\r
-{\r
-    if [ -f $sldd_pid_file ]; then\r
-            local line p\r
-            read line < $sldd_pid_file\r
-            for p in $line ; do\r
-                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p"\r
-            done\r
-    fi\r
-\r
-    if [ -z "$sldd_pid" ]; then\r
-        sldd_pid=`pidof -x $sldd_bin`\r
-    fi\r
-\r
-    if [ -n "${sldd_pid:-}" ] ; then\r
-       kill -9 ${sldd_pid} > /dev/null 2>&1\r
-    fi\r
-\r
-    $sldd_prog > /dev/null 2>&1 &\r
-    sldd_pid=$!\r
-\r
-    echo ${sldd_pid} > $sldd_pid_file\r
-    # Sleep is needed in order to update local gid2lid cache file before running opensm\r
-    sleep 3\r
-}\r
-\r
-stop_sldd()\r
-{\r
-    if [ -f $sldd_pid_file ]; then\r
-            local line p\r
-            read line < $sldd_pid_file\r
-            for p in $line ; do\r
-                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p"\r
-            done\r
-    fi\r
-\r
-    if [ -z "$sldd_pid" ]; then\r
-        sldd_pid=`pidof -x $sldd_bin`\r
-    fi\r
-\r
-    if [ -n "${sldd_pid:-}" ] ; then\r
-        kill -15 ${sldd_pid} > /dev/null 2>&1\r
-    fi\r
-\r
-}\r
-\r
-start()\r
-{\r
-    local OSM_PID=\r
-\r
-    pid=""\r
-\r
-    if [ -f $PID_FILE ]; then\r
-            local line p\r
-            read line < $PID_FILE\r
-            for p in $line ; do\r
-                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"\r
-            done\r
-    fi\r
-\r
-    if [ -z "$pid" ]; then\r
-        pid=`pidof -o $$ -o $PPID -o %PPID -x $bin`\r
-    fi\r
-\r
-    if [ -n "${pid:-}" ] ; then\r
-        echo $"${bin} (pid $pid) is already running..."\r
-    else\r
-\r
-       if [ -n "${HONORE_GUID2LID}" ]; then\r
-               # Run sldd daemod\r
-               start_sldd\r
-       fi\r
-\r
-        # Start opensm\r
-       echo -n "Starting IB Subnet Manager"\r
-        $prog --daemon ${HONORE_GUID2LID} ${OPTIONS} > /dev/null\r
-        cnt=0; alive=0\r
-        while [ $cnt -lt 6 -a $alive -ne 1 ]; do\r
-               echo -n ".";\r
-               sleep 1\r
-               alive=0\r
-                OSM_PID=`pidof $prog`\r
-                if [ "$OSM_PID" != "" ]; then\r
-                        alive=1\r
-                fi\r
-               let cnt++;\r
-       done\r
-\r
-        echo $OSM_PID > $PID_FILE\r
-        checkpid $OSM_PID\r
-        RC=$?\r
-        [ $RC -eq 0 ] && echo_success || echo_failure\r
-        [ $RC -eq 0 ] && touch /var/lock/subsys/opensm\r
-       echo\r
-\r
-    fi\r
-return $RC\r
-}\r
-\r
-stop()\r
-{\r
-    local pid=\r
-    local pid1=\r
-    local pid2=\r
-\r
-    # Stop sldd daemon\r
-    stop_sldd\r
-\r
-    if [ -f $PID_FILE ]; then\r
-            local line p\r
-            read line < $PID_FILE\r
-            for p in $line ; do\r
-                    [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid1="$pid1 $p"\r
-            done\r
-    fi\r
-\r
-    pid2=`pidof -o $$ -o $PPID -o %PPID -x $bin`\r
-\r
-    pid=`echo "$pid1 $pid2" | sed -e 's/\ /\n/g' | sort -n | uniq | sed -e 's/\n/\ /g'`\r
-\r
-    if [ -n "${pid:-}" ] ; then\r
-        # Kill opensm\r
-       echo -n "Stopping IB Subnet Manager."\r
-        kill -15 $pid > /dev/null 2>&1\r
-               cnt=0; alive=1\r
-        while [ $cnt -lt 6 -a $alive -ne 0 ]; do\r
-               echo -n ".";\r
-               alive=0\r
-               for p in $pid; do\r
-                       if checkpid $p ; then alive=1; echo -n "-"; fi\r
-               done\r
-               let cnt++;\r
-               sleep $alive\r
-       done\r
-\r
-        for p in $pid\r
-        do\r
-            while checkpid $p ; do\r
-                kill -KILL $p > /dev/null 2>&1\r
-                echo -n "+"\r
-                sleep 1\r
-            done\r
-        done\r
-        checkpid $pid\r
-        RC=$?\r
-        [ $RC -eq 0 ] && echo_failure || echo_success\r
-       echo\r
-        RC=$((! $RC))\r
-    else\r
-       echo -n "Stopping IB Subnet Manager."\r
-        echo_failure\r
-       echo\r
-        RC=1\r
-    fi\r
-\r
-    # Remove pid file if any.\r
-    rm -f $PID_FILE\r
-    rm -f /var/lock/subsys/opensm\r
-    return $RC\r
-}\r
-\r
-status()\r
-{\r
-    local pid\r
-\r
-    # First try "pidof"\r
-    pid=`pidof -o $$ -o $PPID -o %PPID -x ${bin}`\r
-    if [ -n "$pid" ]; then\r
-            echo $"${bin} (pid $pid) is running..."\r
-            return 0\r
-    fi\r
-\r
-     # Next try "/var/run/opensm.pid" files\r
-     if [ -f $PID_FILE ] ; then\r
-             read pid < $PID_FILE\r
-             if [ -n "$pid" ]; then\r
-                     echo $"${bin} dead but pid file $PID_FILE exists"\r
-                     return 1\r
-             fi\r
-     fi\r
-     echo $"${bin} is stopped"\r
-     return 3\r
-}\r
-\r
-\r
-\r
-case $ACTION in\r
-       start)\r
-                start\r
-               ;;\r
-       stop)\r
-               stop\r
-               ;;\r
-       restart)\r
-               stop\r
-                start\r
-               ;;\r
-       status)\r
-               status\r
-               ;;\r
-       condrestart)\r
-               pid=`pidof -o $$ -o $PPID -o %PPID -x $bin`\r
-               if [ -n "$pid" ]; then\r
-                       stop\r
-                       sleep 1\r
-                       start\r
-               fi\r
-               ;;\r
-       *)\r
-               echo\r
-               echo "Usage: `basename $0` {start|stop|restart|status}"\r
-               echo\r
-               exit 1\r
-               ;;\r
-esac\r
-\r
-RC=$?\r
-exit $RC\r
diff --git a/branches/opensm_3/user/scripts/sldd.sh.in b/branches/opensm_3/user/scripts/sldd.sh.in
deleted file mode 100644 (file)
index b661f0f..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/bin/bash\r
-#\r
-# Copyright (c) 2008 Voltaire, Inc. All rights reserved.\r
-# Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
-#\r
-# This Software is licensed under one of the following licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/cpl.php.\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is\r
-#    available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
-#    copy of which is available from the Open Source Initiative, see\r
-#    http://www.opensource.org/licenses/gpl-license.php.\r
-#\r
-# Licensee has the right to choose one of the above licenses.\r
-#\r
-# Redistributions of source code must retain the above copyright\r
-# notice and one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-#\r
-\r
-# OpenSM found to have the following problem\r
-# when handover is performed:\r
-# If some of the cluster nodes are rebooted during the handover they loose their LID assignment.\r
-# The reason for it is that the standby SM does not obey its own Guid to LID table\r
-# and simply uses the discovered LIDs. If some nodes are not available for it\r
-# their previous LID assignment is lost forever.\r
-\r
-# The idea is to use an external daemon that will distribute\r
-# the semi-static LID assignment table from the master SM to all standby SMs.\r
-# A standby SM, becoming a master . needs to obey the copied semi static LID assignment table.\r
-\r
-prefix=@prefix@\r
-exec_prefix=@exec_prefix@\r
-\r
-CONFIG=@sysconfdir@/sysconfig/opensm\r
-if [ -f $CONFIG ]; then\r
-       . $CONFIG\r
-fi\r
-\r
-SLDD_DEBUG=${SLDD_DEBUG:-0}\r
-\r
-CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid}\r
-CACHE_DIR=$(dirname ${CACHE_FILE})\r
-tmp_cache=${CACHE_FILE}.tmp\r
-\r
-PING='ping -w 1 -c 1'\r
-\r
-RCP=${RCP:-/usr/bin/scp}\r
-RSH=${RSH:-/usr/bin/ssh}\r
-IFCONFIG=${IFCONFIG:-'/sbin/ifconfig -a'}\r
-\r
-declare -i SLDD_DEBUG\r
-RESCAN_TIME=${RESCAN_TIME:-60}\r
-\r
-if [ -z "${OSM_HOSTS}" ]; then\r
-       [ $SLDD_DEBUG -eq 1 ] &&\r
-       echo "No OpenSM servers (OSM_HOSTS) configured for the IB subnet."\r
-       exit 0\r
-fi\r
-\r
-\r
-declare -a arr_OSM_HOSTS\r
-arr_OSM_HOSTS=(${OSM_HOSTS})\r
-\r
-num_of_osm_hosts=${#arr_OSM_HOSTS[@]}\r
-\r
-if [ ${num_of_osm_hosts} -eq 1 ]; then\r
-       [ $SLDD_DEBUG -eq 1 ] &&\r
-       echo "One OpenSM server configured in the IB subnet." &&\r
-       echo "Nothing to be done for SLDD"\r
-\r
-       exit 0\r
-fi\r
-\r
-trap 'trap_handler' 15\r
-\r
-trap_handler()\r
-{\r
-       logger -i "SLDD: Exiting."\r
-       exit 0\r
-}\r
-\r
-is_alive()\r
-{\r
-       $PING $1 > /dev/null 2>&1\r
-       return $?\r
-}\r
-\r
-is_local()\r
-{\r
-       $IFCONFIG | grep -w "$1" > /dev/null 2>&1\r
-       return $?\r
-}\r
-\r
-update_remote_cache()\r
-{\r
-       /bin/rm -f ${CACHE_FILE}.upd\r
-       /bin/cp -a ${CACHE_FILE} ${CACHE_FILE}.upd\r
-\r
-       [ $SLDD_DEBUG -eq 1 ] &&\r
-       echo "Updating remote cache file"\r
-\r
-       for host in ${OSM_HOSTS}\r
-       do\r
-               # Skip local host update\r
-               if [ "${host}" == "${local_host}" ]; then\r
-                       continue\r
-               fi\r
-\r
-               if is_alive $host; then\r
-                       stat=$($RSH $host "/bin/mkdir -p ${CACHE_DIR} > /dev/null 2>&1; /bin/rm -f ${CACHE_FILE}.${local_host} > /dev/null 2>&1; echo \$?" | tr -d '[:space:]')\r
-                       if [ "X${stat}" == "X0" ]; then\r
-                               [ $SLDD_DEBUG -eq 1 ] &&\r
-                               echo "Updating $host"\r
-                               logger -i "SLDD: updating $host with ${CACHE_FILE}"\r
-                               $RCP ${CACHE_FILE}.upd ${host}:${CACHE_FILE}.${local_host}\r
-                               /bin/cp ${CACHE_FILE}.upd ${CACHE_FILE}.${host}\r
-                       else\r
-                               [ $SLDD_DEBUG -eq 1 ] &&\r
-                               echo "$RSH to $host failed."\r
-                               logger -i "SLDD: Failed to update $host with ${CACHE_FILE}. $RSH without password should be enabled"\r
-                               exit 5\r
-                       fi\r
-               else\r
-                       [ $SLDD_DEBUG -eq 1 ] &&\r
-                       echo "$host is down."\r
-                       continue\r
-               fi\r
-       done\r
-}\r
-\r
-get_latest_remote_cache()\r
-{\r
-       # Find most updated remote cache file (the suffix should be like ip address: *.*.*.*)\r
-       echo -n "$(/bin/ls -1t ${CACHE_FILE}.*.* 2> /dev/null | head -1)"\r
-}\r
-\r
-get_largest_remote_cache()\r
-{\r
-       # Find largest (size) remote cache file (the suffix should be like ip address: *.*.*.*)\r
-       echo -n "$(/bin/ls -1S ${CACHE_FILE}.*.* 2> /dev/null | head -1)"\r
-}\r
-\r
-swap_cache_files()\r
-{\r
-       /bin/rm -f ${CACHE_FILE}.old\r
-       /bin/mv ${CACHE_FILE} ${CACHE_FILE}.old\r
-       /bin/cp ${largest_remote_cache} ${CACHE_FILE}\r
-       touch ${CACHE_FILE}.tmp\r
-}\r
-\r
-# Find local host in the osm hosts list\r
-local_host=""\r
-for host in ${OSM_HOSTS}\r
-do\r
-       if is_local $host; then\r
-               local_host=${host}\r
-       fi\r
-done\r
-\r
-# Get cache file info\r
-declare -i new_size=0\r
-declare -i last_size=0\r
-declare -i largest_remote_cache_size=0\r
-\r
-if [ -e ${CACHE_FILE} ]; then\r
-       last_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')\r
-else\r
-       touch ${CACHE_FILE} ${CACHE_FILE}.tmp\r
-fi\r
-\r
-# if [ ${last_size} -gt 0 ]; then\r
-#      # First time update\r
-#      update_remote_cache\r
-# fi\r
-\r
-while true\r
-do\r
-       if [ -s "${CACHE_FILE}" ]; then\r
-               new_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]')\r
-               # Check if local cache file grew from its last version or the time stamp changed\r
-               if [ ${new_size} -gt ${last_size} ]\r
-                  [ "$(/bin/ls -1t ${CACHE_FILE} ${CACHE_FILE}.tmp 2> /dev/null | head -1)"  != "${CACHE_FILE}.tmp" ]; then\r
-                       largest_remote_cache=$(get_largest_remote_cache)\r
-                       if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then\r
-                               largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')\r
-                       else\r
-                               largest_remote_cache_size=0\r
-                       fi\r
-\r
-                       # Check if local cache file larger than remote chache file\r
-                       if [ ${new_size} -gt ${largest_remote_cache_size} ]; then\r
-                               [ $SLDD_DEBUG -eq 1 ] &&\r
-                               echo "Local cache file larger then remote. Update remote cache files"\r
-                               last_size=${new_size}\r
-                               update_remote_cache\r
-                               continue\r
-                       fi\r
-               fi\r
-\r
-               largest_remote_cache=$(get_largest_remote_cache)\r
-               if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then\r
-                       largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]')\r
-               else\r
-                       largest_remote_cache_size=0\r
-               fi\r
-\r
-               # Update local cache file from remote\r
-               if [ ${largest_remote_cache_size} -gt ${new_size} ]; then\r
-                       [ $SLDD_DEBUG -eq 1 ] &&\r
-                       echo "Local cache file shorter then remote. Use ${largest_remote_cache}"\r
-                       logger -i "SLDD: updating local cache file with ${largest_remote_cache}"\r
-                       swap_cache_files\r
-                       last_size=${largest_remote_cache_size}\r
-               fi\r
-\r
-       else # The local cache file is empty\r
-               [ $SLDD_DEBUG -eq 1 ] &&\r
-               echo "${CACHE_FILE} is empty"\r
-\r
-               largest_remote_cache=$(get_largest_remote_cache)\r
-               if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then\r
-                       # Copy it to the current cache\r
-                       [ $SLDD_DEBUG -eq 1 ] &&\r
-                       echo "Local cache file is empty. Use ${largest_remote_cache}"\r
-                       logger -i "SLDD: updating local cache file with ${largest_remote_cache}"\r
-                       swap_cache_files\r
-               fi\r
-\r
-       fi\r
-\r
-       [ $SLDD_DEBUG -eq 1 ] &&\r
-       echo "Sleeping ${RESCAN_TIME} seconds."\r
-       sleep ${RESCAN_TIME}\r
-\r
-done\r