]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[OPENSM] OpenSM 3.3.6 - see changlog files for details.
authorStan Smith <stan.smith@intel.com>
Wed, 23 Jun 2010 20:55:36 +0000 (20:55 +0000)
committerStan Smith <stan.smith@intel.com>
Wed, 23 Jun 2010 20:55:36 +0000 (20:55 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@2829 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

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

index 17f863117802f8062ca815255eff49b804ce5e18..c922169351cf8434775d7e4529934f6144f7d87e 100644 (file)
@@ -1,61 +1,79 @@
-OpenSM for Windows: last updated [12-07-09]\r
+OpenSM for Windows: last updated [6-21-10]\r
 --------------------------------------------------\r
 \r
 OpenSM provides a user-mode implementation for an InfiniBand Subnet Manager and\r
 Administrator. Such a software entity is required to run in order to\r
-initialize the InfiniBand hardware (at least one per each InfiniBand subnet).\r
+initialize the InfiniBand hardware (at least one SM per each InfiniBand subnet).\r
 \r
 The full list of OpenSM features is described in the user manual\r
-provided in the doc sub directory.\r
+provided in the doc/ directory.\r
 \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 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
+Multiple OpenSM instances within a fabric are supported; the last OpenSM\r
+invocation will be the MASTER opensm, while others will be in STANDBY mode\r
+awaiting the demise of the MASTER opensm instance.\r
 \r
 \r
-Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600+\r
-----------------------------------------------------------------------\r
+Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600.16385.1 \r
+-----------------------------------------------------------------------------\r
   cd trunk\ulp\opensm\r
   build /wg\r
 \r
+Note the file trunk\ulp\opensm\mad-vendor.inc controls which vendor\r
+(IBAL or UMAD) is built with. Currently both vendors have been tested and\r
+pass all osm tests (osmtest, saquery PR) along with configuring a 52 node\r
+Windows HPC Edition cluster. \r
+The preferred vendor is UMAD as this is the vendor which is utilized by the\r
+OFED for Linux opensm build; therefore the UMAD vendor has seen the largest\r
+number of nodes and operational hours.\r
 \r
-OpenSM 3.3.3 status\r
+\r
+OpenSM 3.3.6 status\r
 -------------\r
 \r
-openSM 3.3.3 configured a 53 node HPC fabric runing Intel MPI regression tests.\r
-The openSM as a service is functioning well; log file resides 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
-strdup_expand() in places where the static paths were dup()'ed. strdup_expand()\r
-will expand environment vars encountered during the string dup operation; a\r
-solution although likely not the final solution, as when the static paths\r
-printf() the '%' char of the environment vars are incorrectly treated as a\r
-printf() control char...sigh.\r
-\r
-The osm vendor is 'IBAL' until UMAD QP1/SA read() interface is working.\r
-The include files vendor.* define which osm vendor is being built.\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 for 3.3.3 release.\r
+OpenSM src is based on the OFED management\opensm sources for the 3.3.6 release.\r
+\r
+Based-on implies the following build processes:\r
+\r
+  If you use the [ANNOUNCE]'d management (OpenSM and infiniband diagnostics) \r
+  tarballs, the lex/yacc and config files are already constructed:\r
+   see http://www.openfabrics.org/downloads/management/\r
+    (listed in http://www.openfabrics.org/downloads/management/latest.txt)\r
 \r
-Based-on implies the following process:\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
@@ -71,7 +89,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
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
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 e1244741b29b04e9193af42fa93e23ec2ce4ffaa..452e4b6e4b67d3251b7478ecc8a1d336a4080da6 100644 (file)
@@ -435,7 +435,6 @@ ibtrapgen_run( IN ibtrapgen_t * const p_ibtrapgen )
   }
 
  Exit:
-  //  sleep(3);
   OSM_LOG_EXIT( p_log );
   return(status);
 }
index de70f0a429655bf730a37dbee13b777cd011e69f..89df2cf2f10211adbfc4e6b1f8f94d69ac1dfa27 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 "%ProgramFiles%\\OFED\\OpenSM\\"\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 "%ProgramFiles%\\OFED\\OpenSM\\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 "%ProgramFiles%\\OFED\\OpenSM\\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 "%ProgramFiles%\\OFED\\OpenSM\\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 "%ProgramFiles%\\OFED\\OpenSM\\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
@@ -318,7 +309,11 @@ BEGIN_C_DECLS
 *\r
 * SYNOPSIS\r
 */\r
+#ifdef __WIN__\r
+#define OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC 3000\r
+#else\r
 #define OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC 200\r
+#endif\r
 /***********/\r
 /****d* OpenSM: Base/OSM_DEFAULT_SUBNET_TIMEOUT\r
 * NAME\r
@@ -668,7 +663,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 9d9a023859c22870b0ada8dc3743006840764819..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 "%ProgramFiles%\\OFED\\OpenSM\\ib-node-name-map.conf"\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..d1a3443e5851d827761bae37796564452dd72ce9 100644 (file)
 #endif                         /* __cplusplus */\r
 \r
 BEGIN_C_DECLS\r
+#ifdef __WIN__\r
+#define LOG_ENTRY_SIZE_MAX             2048\r
+#else\r
 #define LOG_ENTRY_SIZE_MAX             4096\r
+#endif\r
 #define BUF_SIZE                       LOG_ENTRY_SIZE_MAX\r
 #define __func__ __FUNCTION__\r
 #define OSM_LOG_ENTER( OSM_LOG_PTR ) \\r
@@ -120,6 +124,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 5e7f64773257a9d1d66f85249975ba50e1390919..5f354110f6689e4a56a999b096c5faf22800652e 100644 (file)
@@ -46,9 +46,9 @@
 * SYNOPSIS\r
 */\r
 #ifdef OSM_VENDOR_INTF_AL\r
-#define OSM_VERSION "OpenSM 3.3.3" " IBAL"\r
+#define OSM_VERSION "OpenSM 3.3.6" " IBAL"\r
 #else\r
-#define OSM_VERSION "OpenSM 3.3.3" " UMAD"\r
+#define OSM_VERSION "OpenSM 3.3.6" " UMAD"\r
 #endif\r
 /********/\r
 \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 0a9426698968029989d4f4f4fb21ce3d92ae1cc9..e40664a109a6fd0b42e6ac08d8f465c7577f1321 100644 (file)
@@ -320,7 +320,7 @@ typedef struct _osm_vend_wrap_t
        osm_bind_handle_t                       h_bind;\r
        ib_mad_element_t                        *p_elem;\r
        ib_av_handle_t                          h_av;\r
-       void*                                           p_resp_madw;\r
+       void                                            *p_resp_madw;\r
 \r
 } osm_vend_wrap_t;\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 4c7ff0ed25939010444257e73309c2288a033ec0..91fdc137d32c04677e7478d6023bf52f2f56f429 100644 (file)
@@ -65,6 +65,13 @@ typedef int  ssize_t;
 \r
 #define usleep(usec) SleepEx(usec/1000,TRUE)\r
 \r
+#ifdef HAVE_LIBPTHREAD\r
+#error HAVE_LIBPTHREAD defined?\r
+#endif\r
+\r
+/* for those cases where uses of pthreads constructs do not have\r
+ * #ifdef HAVE_LIBPTHREAD protection.\r
+ */\r
 #define pthread_t cl_thread_t\r
 #define pthread_mutex_t cl_mutex_t\r
 \r
@@ -96,6 +103,8 @@ getopt_long_only(int argc, char *const*argv,
 #endif\r
 \r
 extern char *strdup_expand(const char *);\r
+extern FILE *Fopen(const char *,const char *);\r
+#define fopen Fopen\r
 \r
 /* The following defines replace syslog.h */\r
 \r
diff --git a/trunk/ulp/opensm/user/libvendor/ChangeLog b/trunk/ulp/opensm/user/libvendor/ChangeLog
new file mode 100644 (file)
index 0000000..4ff3e09
--- /dev/null
@@ -0,0 +1,64 @@
+2007-07-11  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.2.1\r
+\r
+2007-07-10  Sean Hefty <sean.hefty@intel.com>\r
+\r
+       * osm_vendor_ibumad.c:  Use pkey index, rather than pkey\r
+         on umad_set_pkey call. Using index 0 for now.\r
+\r
+2007-05-07  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.(h c): Remove support for issmdisabled\r
+\r
+2007-03-29  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.2.0\r
+\r
+2007-03-27  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.(h c): Add support for issmdisabled\r
+\r
+2007-03-13  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.c: In osm_vendor_set_sm, set issmfd to\r
+         -1 on open error\r
+\r
+2007-03-12  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.c: In umad_receiver, display DR path of\r
+         sent MAD when it times out. In osm_vendor_send, simplify redundant\r
+         code. Cosmetic change to osm_log message in osm_vendor_bind.\r
+\r
+2007-02-20  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.1.1\r
+\r
+2007-02-20  Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.(h c): Fix termination crash associated\r
+         with umad_receiver thread termination.\r
+\r
+       * osm_vendor_mlx_sa.c, osm_vendor_mlx_sim.c: Changes for\r
+         compilation failures detected during ibutils/ibmgtsim building\r
+\r
+2007=01-10  Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.c: Close umad port in\r
+         osm_vendor_delete so same process can reinitialize\r
+         and resuse vendor layer.\r
+\r
+2006-10-12  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.c (umad_receiver): Fix endian of LID\r
+         displayed in send timeout error message.\r
+\r
+2006-10-10  Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_vendor_ibumad.c: Print errors to stderr rather than\r
+         stdout.\r
+\r
+2006-09-28  Eitan Zahavi <eitan@mellanox.co.il>\r
+\r
+       * osm_vendor_mlx_sa.c: Missing status on timeout SA query.\r
+\r
index e6c9cd56567ef305313b382586c2e94017152875..6fb3182bf698531e3aa07d11397b797fb29d5a75 100644 (file)
@@ -54,11 +54,13 @@ C_DEFINES=$(C_DEFINES) -D__WIN__ -DHAVE_CONFIG_H -D$(VENDOR_IF)
 !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
+!else\r
+# favor fast over default small; default is /Oxs.\r
+MSC_OPTIMIZATION= /Oxt\r
 !endif\r
 \r
 LINKER_FLAGS= $(LINKER_FLAGS) /DEF:$(VENDOR_LIB).exports\r
 \r
 MSC_WARNING_LEVEL= /W2 /wd4242\r
 \r
-#MSC_OPTIMIZATION= /O0\r
 \r
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 aa353f05bdf83db895dd7efe434800cb5cecf6bc..3980482ae7ca8d8e0d6bc8c713272e81119145af 100644 (file)
  */\r
 typedef struct _osm_al_bind_info\r
 {\r
-  osm_vendor_t                *p_vend;\r
-  void                        *client_context;\r
-  ib_qp_handle_t                 h_qp;\r
-  ib_mad_svc_handle_t               h_svc;\r
-  uint8_t                        port_num;\r
-  ib_pool_key_t                  pool_key;\r
-  osm_vend_mad_recv_callback_t      rcv_callback;\r
-  osm_vend_mad_send_err_callback_t  send_err_callback;\r
-  osm_mad_pool_t                 *p_osm_pool;\r
-  ib_av_handle_t                 h_dr_av;\r
+  osm_vendor_t                     *p_vend;\r
+  void                             *client_context;\r
+  ib_qp_handle_t                   h_qp;\r
+  ib_mad_svc_handle_t              h_svc;\r
+  uint8_t                          port_num;\r
+  ib_pool_key_t                    pool_key;\r
+  osm_vend_mad_recv_callback_t     rcv_callback;\r
+  osm_vend_mad_send_err_callback_t send_err_callback;\r
+  osm_mad_pool_t                   *p_osm_pool;\r
+  ib_av_handle_t                   h_dr_av;\r
 \r
 } osm_al_bind_info_t;\r
 /*\r
@@ -115,8 +115,7 @@ typedef struct _osm_al_bind_info
  * SEE ALSO\r
  *********/\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 inline static ib_api_status_t\r
 __osm_al_convert_wcs(\r
   IN ib_wc_status_t        const wc_status )\r
@@ -134,8 +133,7 @@ __osm_al_convert_wcs(
   }\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 void AL_API\r
 __osm_set_vend_wrap( IN  osm_al_bind_info_t* const p_bind,\r
                      IN  ib_mad_element_t* const   p_elem,\r
@@ -164,8 +162,7 @@ __osm_al_ca_err_callback( IN ib_async_event_rec_t *p_async_rec )
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 static void AL_API\r
 __osm_al_ca_destroy_callback( IN void *context )\r
 {\r
@@ -180,8 +177,6 @@ __osm_al_ca_destroy_callback( IN void *context )
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 \r
 static void AL_API\r
 __osm_al_err_callback( IN ib_async_event_rec_t *p_async_rec )\r
@@ -198,52 +193,57 @@ __osm_al_err_callback( IN ib_async_event_rec_t *p_async_rec )
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 /* \r
-    Send_cb will handle  the following cases :\r
-    Element Status  |  Send Response (no reponse expected)      | Send Request (response expeceted)  \r
-    ================|===========================================|==========================================\r
-        ERROR       |   Free : AV , madw(send_err_cb)           | Free : AV , madw , resp_madw \r
-        SUCCESS     |   Free : AV , madw                        | Free : AV , madw\r
-\r
-    Element Status  |  Receive Response (no reponse expected)    \r
-    ================|===========================================\r
-        ERROR       |   Free : AV , madw(send_err_cb) \r
-        SUCCESS     |   Free : AV , madw, resp_madw (both through rcv_callback)                        \r
-   \r
+Send_cb will handle  the following cases:\r
+Element Status  |  Send Response (no reponse expected) | Send Request (response expeceted)  \r
+================|======================================|========================\r
+    ERROR       |   Free : AV , madw(send_err_cb)      | Free:AV,madw,resp_madw \r
+    SUCCESS     |   Free : AV , madw                   | Free:AV,madw\r
+\r
+Element Status  |  Receive Response (no reponse expected)    \r
+================|===========================================\r
+    ERROR       |   Free : AV , madw(send_err_cb) \r
+    SUCCESS     |   Free : AV , madw, resp_madw (both through rcv_callback)\r
 */    \r
+\r
 static void AL_API\r
 __osm_al_send_callback(\r
-  IN const ib_mad_svc_handle_t h_mad_svc,\r
-  IN void *mad_svc_context,\r
-  IN ib_mad_element_t *p_elem )\r
+       IN const ib_mad_svc_handle_t h_mad_svc,\r
+       IN void                      *mad_svc_context,\r
+       IN ib_mad_element_t          *p_elem )\r
 {\r
   osm_al_bind_info_t* const p_bind = (osm_al_bind_info_t*)mad_svc_context;\r
   osm_vendor_t* const p_vend = p_bind->p_vend;\r
   osm_madw_t* const p_madw = (osm_madw_t*)p_elem->context1;\r
   osm_vend_wrap_t* p_vw = osm_madw_get_vend_ptr( p_madw );\r
   ib_mad_t *p_mad = ib_get_mad_buf( p_elem );\r
-  ib_av_attr_t         av_attr;\r
-  ib_pd_handle_t               h_pd;\r
+  ib_av_attr_t av_attr;\r
+  ib_pd_handle_t h_pd;\r
   ib_api_status_t status_elem,status;\r
   osm_madw_t *p_new_madw;\r
 \r
   OSM_LOG_ENTER( p_vend->p_log );\r
   UNUSED_PARAM(h_mad_svc);\r
+\r
   CL_ASSERT( p_vw );\r
   CL_ASSERT( p_vw->h_av );\r
-  /* since we use context1 , safely , and its the only place that remove the clean \r
-    p_elem,p_madw , h_av no checks are required */\r
+\r
+  /* since we use context1 safely, and its the only place that removes the\r
+     clean p_elem, p_madw, h_av no checks are required */\r
+\r
   status_elem = __osm_al_convert_wcs(p_elem->status);\r
+\r
   osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_send_callback: "\r
-           "Destroying av handle %p.\n", p_elem->h_av );\r
+           "%s[line %d]: Destroying av handle %p.\n",\r
+           __FUNCTION__, __LINE__, p_elem->h_av );\r
+\r
   /* Check first if its a direct route handle , in this case skip */\r
   if (p_elem->h_av != p_bind->h_dr_av) \r
   {\r
       ib_destroy_av( p_elem->h_av );\r
   }\r
+\r
   /* Since the free order is first resp_madw then madw (PARENT) we should check\r
    this case first */\r
   if (p_elem->resp_expected)\r
@@ -256,66 +256,64 @@ __osm_al_send_callback(
               pre-emptively allocated to handle a receive.\r
           */\r
           osm_log(p_vend->p_log, OSM_LOG_ERROR,\r
-                  "__osm_al_send_callback: ERR 3333 "\r
-                  " Mad Completed with WQE Error : %s.\n",ib_get_wc_status_str(p_elem->status));\r
+                  "%s[line %d]: ERR 3333 "\r
+                  "Mad Completed with WQE Error: %s.\n",\r
+                  __FUNCTION__,__LINE__,ib_get_wc_status_str(p_elem->status));\r
           if( p_vw->p_resp_madw )\r
           {\r
               osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
               p_vw->p_resp_madw = NULL;\r
           }\r
-\r
           p_bind->send_err_callback( p_bind->client_context, p_madw );\r
       }\r
       else\r
       {\r
-          /* We are in response flow of receive , need to apply the rcv_callback \r
-                The rcv_callback will free the resp_madw , req_madw , p_elem of receive\r
-                and request */\r
+          /* We are in response flow of receive, need to apply the rcv_callback.\r
+             The rcv_callback will free the resp_madw, req_madw, p_elem of\r
+             receive and request */\r
           osm_log(p_vend->p_log, OSM_LOG_DEBUG,\r
-                  "__osm_al_send_callback: "\r
-                  "The Mad is a response , thus handeled in __osm_al_send_callback\n");\r
+                  "%s[line %d]: "\r
+                  "Mad is a response, processed in p_bind->rcv_callback\n",\r
+                  __FUNCTION__, __LINE__ );\r
           p_new_madw = p_vw->p_resp_madw;\r
-          p_bind->rcv_callback( p_new_madw, p_bind->client_context,\r
-                                p_madw );\r
-\r
+          p_bind->rcv_callback( p_new_madw, p_bind->client_context, p_madw );\r
       }\r
   }\r
   else\r
   {\r
+      uint64_t saved_trans_id = cl_ntoh64( p_mad->trans_id );\r
+\r
       osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_send_callback: "\r
-           "Returning MAD to pool, TID = 0x%" PRIx64 ".\n",\r
-           cl_ntoh64( p_mad->trans_id ) );\r
+           "%s[line %d]: Returning MAD to pool, TID 0x%" PRIx64 ".\n",\r
+           __FUNCTION__, __LINE__, saved_trans_id );\r
+\r
       osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
-      if ( status_elem != IB_SUCCESS )\r
+\r
+      if ( status_elem != IB_SUCCESS ) {\r
           osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
-           "__osm_al_send_callback: ERR 3b0b "\r
-           "request mad had failed.\n");\r
-      goto Exit;\r
+           "%s[line %d]: ERR 3B0B request Mad (TID 0x%" PRIx64 ") failed '%s' "\r
+           "pool mads_out %u\n",\r
+           __FUNCTION__, __LINE__, saved_trans_id, ib_get_err_str(status_elem),\r
+           p_bind->p_osm_pool->mads_out);\r
+      }\r
   }\r
-\r
-\r
-\r
-\r
-\r
- Exit:\r
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 /*\r
     Receive_cb will be applied in the following cases :\r
-    Element Status  |  Receive Response (no reponse expected)      | Receive Request (response expeceted)  \r
-    ================|==============================================|=======================================\r
-        ERROR       |  NOT APPLIED                                 | NOT_APPLIED\r
-        SUCCESS     |  Free :  Resp_madw , copy_req_madw           | Allocate new_madw (for response then in send_cb free)\r
+    Element Status  |  Receive Response (no reponse expected) | Receive Request (response expected)  \r
+    ================|=========================================\r
+        ERROR       |  NOT APPLIED                            | NOT_APPLIED\r
+        SUCCESS     |  Free :  Resp_madw , copy_req_madw      | Allocate new_madw (for response then in send_cb free)\r
  */\r
- static void AL_API\r
+\r
+static void AL_API\r
 __osm_al_rcv_callback(\r
-  IN const ib_mad_svc_handle_t h_mad_svc,\r
-  IN void *mad_svc_context,\r
-  IN ib_mad_element_t *p_elem )\r
+       IN const ib_mad_svc_handle_t h_mad_svc,\r
+       IN void                      *mad_svc_context,\r
+       IN ib_mad_element_t          *p_elem )\r
 {\r
   osm_al_bind_info_t* const p_bind = (osm_al_bind_info_t*)mad_svc_context;\r
   osm_vendor_t* const p_vend = p_bind->p_vend;\r
@@ -330,17 +328,18 @@ __osm_al_rcv_callback(
   UNUSED_PARAM(h_mad_svc);\r
   CL_ASSERT( p_elem->context1 == NULL );\r
   CL_ASSERT( p_elem->context2 == NULL );\r
-    /*\r
+\r
+#if 0\r
   osm_log( p_vend->p_log, OSM_LOG_VERBOSE,\r
-             "__osm_al_rcv_callback:  "\r
-             "Handling Transaction : 0x%" PRIx64 " .\n",\r
-           cl_ntoh64(p_elem->p_mad_buf->trans_id));\r
-           */\r
+           "%s[line %d]: Handling Transaction: 0x%" PRIx64 " .\n",\r
+           __FUNCTION__, __LINE__, cl_ntoh64(p_elem->p_mad_buf->trans_id));\r
+#endif\r
+\r
   p_new_mad = ib_get_mad_buf( p_elem );\r
-  osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-           "__osm_al_rcv_callback: "\r
-           "Acquired implicitly MAD %p.\n", p_new_mad );\r
 \r
+  osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
+           "%s[line %d]: Acquired implicitly MAD %p.\n",\r
+           __FUNCTION__, __LINE__, p_new_mad);\r
   /*\r
     In preperation for initializing the new mad wrapper,\r
     Initialize the mad_addr structure for the received wire MAD.\r
@@ -362,7 +361,10 @@ __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
+\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
@@ -381,8 +383,9 @@ __osm_al_rcv_callback(
       allocated.\r
     */\r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-               "__osm_al_rcv_callback: "\r
-               "The Mad is a response , thus handled in __osm_al_send_callback\n");\r
+             "%s[line %d]: "\r
+               "The Mad is a response, processed in __osm_al_send_callback\n",\r
+               __FUNCTION__,__LINE__);\r
     CL_ASSERT( p_elem->send_context1 != NULL );\r
     CL_ASSERT( p_elem->send_context2 == NULL );\r
 \r
@@ -396,39 +399,36 @@ __osm_al_rcv_callback(
     osm_madw_set_mad( p_new_madw, p_new_mad );\r
     p_new_vw = osm_madw_get_vend_ptr( p_new_madw );\r
     __osm_set_vend_wrap(p_bind,p_elem,p_new_vw);\r
-    goto Exit;\r
   }\r
   else\r
   {\r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-                 "__osm_al_rcv_callback: "\r
-                 "The Mad is a request , thus handled in __osm_al_rcv_callback\n");\r
+             "%s[line %d]: "\r
+             "The Mad is a request, processed in p_bind->rcv_callback\n",\r
+               __FUNCTION__,__LINE__);\r
     CL_ASSERT( p_elem->send_context1 == NULL );\r
     CL_ASSERT( p_elem->send_context2 == NULL );\r
 \r
-    p_new_madw = osm_mad_pool_get_wrapper( p_bind->p_osm_pool,\r
-                                           p_bind, p_elem->size, p_new_mad, &mad_addr );\r
+    p_new_madw = osm_mad_pool_get_wrapper( p_bind->p_osm_pool, p_bind,\r
+                                           p_elem->size, p_new_mad, &mad_addr );\r
     CL_ASSERT(p_new_madw);\r
     p_new_vw = osm_madw_get_vend_ptr( p_new_madw );\r
 \r
     __osm_set_vend_wrap(p_bind,p_elem,p_new_vw);\r
+\r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
              "__osm_al_rcv_callback: "\r
              "Calling receive callback function %p.\n",\r
              p_bind->rcv_callback );\r
 \r
-\r
     p_bind->rcv_callback( p_new_madw, p_bind->client_context,\r
                           ((osm_madw_t*)p_elem->send_context1) );\r
   }\r
 \r
-\r
-  Exit:\r
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_api_status_t\r
 osm_vendor_init(\r
   IN osm_vendor_t* const p_vend,\r
@@ -450,19 +450,15 @@ osm_vendor_init(
              "osm_vendor_init: ERR 3B03: "\r
              "Error opening AL (%s).\n",\r
              ib_get_err_str( status ) );\r
-\r
-    goto Exit;\r
   }\r
+  else\r
+    p_vend->timeout = timeout;\r
 \r
-  p_vend->timeout = timeout;\r
-\r
- Exit:\r
   OSM_LOG_EXIT( p_log );\r
   return( status );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 osm_vendor_t*\r
 osm_vendor_new(\r
   IN osm_log_t* const p_log,\r
@@ -494,8 +490,7 @@ osm_vendor_new(
   return( p_vend );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 void\r
 osm_vendor_delete(\r
   IN osm_vendor_t** const pp_vend )\r
@@ -506,13 +501,12 @@ osm_vendor_delete(
   *pp_vend = NULL;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 static ib_api_status_t\r
 __osm_ca_info_init(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN osm_ca_info_t*  const   p_ca_info,\r
-  IN const ib_net64_t      ca_guid )\r
+  IN osm_vendor_t* const  p_vend,\r
+  IN osm_ca_info_t* const p_ca_info,\r
+  IN const ib_net64_t     ca_guid )\r
 {\r
   ib_api_status_t status;\r
 \r
@@ -527,9 +521,11 @@ __osm_ca_info_init(
              "Querying CA 0x%" PRIx64 ".\n",\r
              cl_ntoh64( ca_guid ) );\r
   }\r
-/* attr size by verbs definition is required to be (uint32_t *) under opensm is only being set as 1 */\r
+  /* attr size by verbs definition is required to be (uint32_t *) under opensm\r
+     it is only being set as 1 */\r
   status = ib_query_ca_by_guid( p_vend->h_al, ca_guid, NULL,\r
                                 (uint32_t*)&p_ca_info->attr_size );\r
+\r
   if( (status != IB_INSUFFICIENT_MEMORY ) && (status != IB_SUCCESS ) )\r
   {\r
     osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
@@ -559,7 +555,6 @@ __osm_ca_info_init(
              "__osm_ca_info_init: ERR 3B07: "\r
              "Unexpected status getting CA attributes (%s).\n",\r
              ib_get_err_str( status ) );\r
-    goto Exit;\r
   }\r
 \r
  Exit:\r
@@ -568,8 +563,6 @@ __osm_ca_info_init(
 }\r
 \r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 void\r
 osm_ca_info_destroy(\r
   IN osm_vendor_t*        const p_vend,\r
@@ -585,12 +578,11 @@ osm_ca_info_destroy(
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 osm_ca_info_t*\r
 osm_ca_info_new(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN const ib_net64_t      ca_guid )\r
+  IN osm_vendor_t* const p_vend,\r
+  IN const ib_net64_t    ca_guid )\r
 {\r
   ib_api_status_t status;\r
   osm_ca_info_t *p_ca_info;\r
@@ -608,7 +600,6 @@ osm_ca_info_new(
   {\r
     osm_ca_info_destroy( p_vend, p_ca_info );\r
     p_ca_info = NULL;\r
-    goto Exit;\r
   }\r
 \r
  Exit:\r
@@ -616,8 +607,7 @@ osm_ca_info_new(
   return( p_ca_info );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 static ib_api_status_t\r
 __osm_vendor_get_ca_guids(\r
   IN osm_vendor_t*        const p_vend,\r
@@ -711,13 +701,12 @@ __osm_ca_info_get_port_attr_ptr(
  * SEE ALSO\r
  *********/\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_api_status_t\r
 osm_vendor_get_all_port_attr(\r
-  IN osm_vendor_t*        const p_vend,\r
-  IN ib_port_attr_t*    const p_attr_array,\r
-  IN uint32_t*       const p_num_ports )\r
+  IN osm_vendor_t* const   p_vend,\r
+  IN ib_port_attr_t* const p_attr_array,\r
+  IN uint32_t* const       p_num_ports )\r
 {\r
   ib_api_status_t status;\r
 \r
@@ -736,7 +725,7 @@ osm_vendor_get_all_port_attr(
   /*\r
     1) Determine the number of CA's\r
     2) If not allready allocated - allocate an array big enough to hold the\r
-         ca info object , the ca info will be overwrite to contain the new ca info\r
+       ca info object, the ca info will be overwrite to contain the new ca info\r
     3) Call again to retrieve the guids.\r
   */\r
   status = __osm_vendor_get_ca_guids( p_vend, &p_ca_guid, &ca_count );\r
@@ -763,10 +752,7 @@ osm_vendor_get_all_port_attr(
   {\r
     p_ca_info = &p_vend->p_ca_info[ca];\r
 \r
-    status = __osm_ca_info_init(\r
-      p_vend,\r
-      p_ca_info,\r
-      p_ca_guid[ca] );\r
+    status = __osm_ca_info_init( p_vend, p_ca_info, p_ca_guid[ca] );\r
 \r
     if( status != IB_SUCCESS )\r
     {\r
@@ -775,7 +761,6 @@ osm_vendor_get_all_port_attr(
                "Unable to initialize CA Info object (%s).\n",\r
                ib_get_err_str( status ) );\r
     }\r
-\r
     total_ports += osm_ca_info_get_num_ports( p_ca_info );\r
   }\r
 \r
@@ -808,10 +793,8 @@ osm_vendor_get_all_port_attr(
     status = IB_INSUFFICIENT_MEMORY;\r
   }\r
 \r
-\r
   *p_num_ports = total_ports;\r
 \r
-\r
  Exit:\r
   if( p_ca_guid )\r
     cl_free( p_ca_guid );\r
@@ -820,8 +803,7 @@ osm_vendor_get_all_port_attr(
   return( status );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_net64_t\r
 osm_vendor_get_ca_guid(\r
   IN osm_vendor_t* const p_vend,\r
@@ -880,8 +862,7 @@ osm_vendor_get_ca_guid(
   return( 0 );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 uint8_t\r
 osm_vendor_get_port_num(\r
   IN osm_vendor_t* const p_vend,\r
@@ -941,8 +922,6 @@ osm_vendor_get_port_num(
 }\r
 \r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
 static ib_api_status_t\r
 __osm_vendor_open_ca(\r
   IN osm_vendor_t* const p_vend,\r
@@ -985,11 +964,7 @@ __osm_vendor_open_ca(
 \r
   CL_ASSERT( p_vend->h_ca );\r
 \r
-  status = ib_alloc_pd(\r
-    p_vend->h_ca,\r
-    IB_PDT_ALIAS,\r
-    p_vend,\r
-    &p_vend->h_pd );\r
+  status = ib_alloc_pd( p_vend->h_ca, IB_PDT_ALIAS, p_vend, &p_vend->h_pd );\r
 \r
   if( status != IB_SUCCESS )\r
   {\r
@@ -1008,8 +983,7 @@ __osm_vendor_open_ca(
   return( status );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 static void\r
 __osm_vendor_init_av(\r
   IN const osm_al_bind_info_t* p_bind,\r
@@ -1020,8 +994,7 @@ __osm_vendor_init_av(
   p_av->dlid = IB_LID_PERMISSIVE;\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 osm_bind_handle_t\r
 osm_vendor_bind(\r
   IN osm_vendor_t* const p_vend,\r
@@ -1047,15 +1020,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
@@ -1108,14 +1081,14 @@ 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
+\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
@@ -1140,6 +1113,22 @@ osm_vendor_bind(
   mad_svc.mgmt_version = p_user_bind->class_version;\r
   mad_svc.support_unsol = p_user_bind->is_responder;\r
 \r
+#define _NEW 1\r
+\r
+#if _NEW\r
+ if (p_user_bind->is_responder) {\r
+    mad_svc.method_array[IB_MAD_METHOD_GET] = TRUE;\r
+    mad_svc.method_array[IB_MAD_METHOD_SET] = TRUE;\r
+    if (p_user_bind->mad_class == IB_MCLASS_SUBN_ADM) {\r
+       mad_svc.method_array[IB_MAD_METHOD_GETTABLE] = TRUE;\r
+       mad_svc.method_array[IB_MAD_METHOD_DELETE] = TRUE;\r
+#ifdef DUAL_SIDED_RMPP\r
+       mad_svc.method_array[IB_MAD_METHOD_GETMULTI] = TRUE;\r
+#endif\r
+       /* Add in IB_MAD_METHOD_GETTRACETABLE when supported by OpenSM */\r
+    }\r
+ }\r
+#else\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
@@ -1147,13 +1136,21 @@ osm_vendor_bind(
   mad_svc.method_array[IB_MAD_METHOD_GETTABLE] = TRUE;\r
 \r
 #ifdef DUAL_SIDED_RMPP\r
-    mad_svc.method_array[IB_MAD_METHOD_GETMULTI] = TRUE;\r
+  mad_svc.method_array[IB_MAD_METHOD_GETMULTI] = TRUE;\r
+#endif\r
 #endif\r
 \r
-  status = ib_reg_mad_svc(\r
-    p_bind->h_qp,\r
-    &mad_svc,\r
-    &p_bind->h_svc );\r
+  /* Add in IB_MAD_METHOD_GETTRACETABLE when supported by OpenSM */\r
+#if _NEW\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
@@ -1171,19 +1168,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
@@ -1193,8 +1190,7 @@ osm_vendor_bind(
   return( (osm_bind_handle_t)p_bind );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 /* osm_vendor_unbind is added due to OSM-1.8.0 gen2 merging\r
     The functionality will be added when the Gen2 osm_vendor_unbind\r
     will be implemented.\r
@@ -1203,17 +1199,15 @@ void
 osm_vendor_unbind(\r
   IN osm_bind_handle_t h_bind)\r
 {\r
-       osm_al_bind_info_t *p_bind = ( osm_al_bind_info_t * ) h_bind;\r
-       osm_vendor_t *p_vend = p_bind->p_vend;\r
-\r
+  osm_al_bind_info_t *p_bind = ( osm_al_bind_info_t * ) h_bind;\r
+  osm_vendor_t *p_vend = p_bind->p_vend;\r
 \r
-       OSM_LOG_ENTER( p_vend->p_log );\r
+  OSM_LOG_ENTER( p_vend->p_log );\r
 \r
-       OSM_LOG_EXIT( p_vend->p_log);\r
+  OSM_LOG_EXIT( p_vend->p_log);\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_mad_t*\r
 osm_vendor_get(\r
   IN osm_bind_handle_t  h_bind,\r
@@ -1263,8 +1257,7 @@ osm_vendor_get(
   return( p_mad );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 void\r
 osm_vendor_put(\r
   IN osm_bind_handle_t h_bind,\r
@@ -1285,8 +1278,7 @@ osm_vendor_put(
        \r
     osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
              "osm_vendor_put: "\r
-             "Retiring MAD %p.\n", ib_get_mad_buf( p_vw->p_elem ) );\r
-  //            "Retiring MAD %p.\n", p_mad);\r
+                "Retiring MAD %p.\n", p_vw->p_elem);\r
   }\r
 \r
   status = ib_put_mad( p_vw->p_elem );\r
@@ -1297,17 +1289,15 @@ osm_vendor_put(
              "Unable to retire MAD (%s).\n",\r
              ib_get_err_str( status ) );\r
   }\r
-\r
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_api_status_t\r
 osm_vendor_send(\r
-  IN osm_bind_handle_t h_bind,\r
-  IN osm_madw_t* const p_madw,\r
-  IN boolean_t const resp_expected )\r
+       IN osm_bind_handle_t h_bind,\r
+       IN osm_madw_t* const p_madw,\r
+       IN boolean_t const   resp_expected )\r
 {\r
   osm_al_bind_info_t* const p_bind = h_bind;\r
   osm_vendor_t* const p_vend = p_bind->p_vend;\r
@@ -1337,9 +1327,8 @@ osm_vendor_send(
   */\r
   if( resp_expected )\r
   {\r
-    p_vw->p_resp_madw = osm_mad_pool_get_wrapper_raw(\r
-      p_bind->p_osm_pool );\r
-    if( p_vw->p_resp_madw == NULL  )\r
+    p_vw->p_resp_madw = osm_mad_pool_get_wrapper_raw( p_bind->p_osm_pool );\r
+    if( p_vw->p_resp_madw == NULL )\r
     {\r
       osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
                "osm_vendor_send: ERR 3B27: "\r
@@ -1347,7 +1336,6 @@ osm_vendor_send(
       status = IB_INSUFFICIENT_RESOURCES;\r
       goto Exit;\r
     }\r
-    \r
   }\r
   else\r
     p_vw->p_resp_madw = NULL;\r
@@ -1400,7 +1388,8 @@ osm_vendor_send(
 \r
       if( p_vw->p_resp_madw )\r
         osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
-      /* Since we in immediate error the vendor layer is expected to handle the rollback , i.e free of madw */\r
+      /* Since we in immediate error the vendor layer is expected to handle the\r
+         rollback , i.e free of madw */\r
       if (p_madw) \r
         osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
       goto Exit;\r
@@ -1434,7 +1423,6 @@ osm_vendor_send(
   /* Completion information. */\r
   p_elem->status = 0; /* Not trusting AL */\r
 \r
-\r
   if( (p_mad->mgmt_class == IB_MCLASS_SUBN_LID) ||\r
       (p_mad->mgmt_class == IB_MCLASS_SUBN_DIR) )\r
   {\r
@@ -1453,28 +1441,32 @@ osm_vendor_send(
   }\r
 \r
   status = ib_send_mad( p_bind->h_svc, p_elem, NULL );\r
+\r
   if( status != IB_SUCCESS )\r
   {\r
     osm_log( p_vend->p_log, OSM_LOG_ERROR,\r
              "osm_vendor_send: ERR 3B29: "\r
-             "Send failed , cleaning up (%s).\n",\r
+             "Send failed, cleaning up (%s)\n",\r
              ib_get_err_str( status ) );\r
-    /* When we destroy the av - we should take the pointer from local allocation since\r
-        we do not "trust" IBAL to keep track in p_elem */\r
+\r
+    /* When we destroy the av - we should take the pointer from local allocation\r
+       since we do not "trust" IBAL to keep track in p_elem */\r
 \r
     if (p_vw->h_av && (p_vw->h_av != p_bind->h_dr_av) )\r
     {\r
         osm_log( p_vend->p_log, OSM_LOG_DEBUG,\r
-                   "__osm_al_send: "\r
-                   "Destroying av handle %p.\n", p_vw->h_av );\r
+                 "%s[line %d] Destroying av handle %p.\n",\r
+                 __FUNCTION__,__LINE__,p_vw->h_av );\r
         ib_destroy_av( p_vw->h_av );\r
     }\r
+\r
     if( p_vw->p_resp_madw )\r
       osm_mad_pool_put( p_bind->p_osm_pool, p_vw->p_resp_madw );\r
-    /* Since we in immediate error the vendor layer is expected to handle the rollback , i.e free of madw */\r
+\r
+    /* Immediate error: the vendor layer is expected to handle the\r
+       rollback, i.e free of madw */\r
     if (p_madw) \r
       osm_mad_pool_put( p_bind->p_osm_pool, p_madw );\r
-    goto Exit;\r
   }\r
 \r
  Exit:\r
@@ -1482,8 +1474,7 @@ osm_vendor_send(
   return( status );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 ib_api_status_t\r
 osm_vendor_local_lid_change(\r
   IN osm_bind_handle_t h_bind )\r
@@ -1497,8 +1488,7 @@ osm_vendor_local_lid_change(
   return( IB_SUCCESS );\r
 }\r
 \r
-/**********************************************************************\r
- **********************************************************************/\r
+\r
 void\r
 osm_vendor_set_sm(\r
   IN osm_bind_handle_t h_bind,\r
@@ -1529,8 +1519,7 @@ osm_vendor_set_sm(
   OSM_LOG_EXIT( p_vend->p_log );\r
 }\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 a0bc0d6becc10c7a84a00633629b9cc6bc41ce0a..6dd67f9844d8735e28303ff8097eac0156657296 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
@@ -248,6 +249,7 @@ static void * OSM_API umad_receiver(void *p_ptr)
        ib_mad_t *mad;\r
        void *umad = 0;\r
        int mad_agent, length;\r
+       uint32_t status;\r
 \r
        OSM_LOG_ENTER(p_ur->p_log);\r
 \r
@@ -265,6 +267,7 @@ static void * OSM_API umad_receiver(void *p_ptr)
                        if (length <= MAD_BLOCK_SIZE) {\r
                                OSM_LOG(p_ur->p_log, OSM_LOG_ERROR, "ERR 5404: "\r
                                        "recv error on MAD sized umad (%m)\n");\r
+                               _set_errno(0);\r
                                continue;\r
                        } else {\r
                                umad_free(umad);\r
@@ -275,6 +278,7 @@ static void * OSM_API umad_receiver(void *p_ptr)
                                                "ERR 5405: "\r
                                                "can't alloc umad length %d\n",\r
                                                length);\r
+                                       _set_errno(0);\r
                                        continue;\r
                                }\r
 \r
@@ -309,7 +313,8 @@ static void * OSM_API umad_receiver(void *p_ptr)
                                                MAX(length, MAD_BLOCK_SIZE),\r
                                                &osm_addr))) {\r
                        OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5408: "\r
-                               "request for a new madw failed -- dropping packet\n");\r
+                               "request for a new madw (%d bytes) failed -- dropping packet\n",\r
+                               MAX(length, MAD_BLOCK_SIZE));\r
                        continue;\r
                }\r
 \r
@@ -324,27 +329,29 @@ static void * OSM_API umad_receiver(void *p_ptr)
                umad = swap_mad_bufs(p_madw, umad);\r
 \r
                /* if status != 0 then we are handling recv timeout on send */\r
-               if (umad_status(p_madw->vend_wrap.umad)) {\r
-                       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
+               if ((status=umad_status(p_madw->vend_wrap.umad))) {\r
+\r
                        if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) {\r
                                /* LID routed */\r
-                               OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,\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(%u) -- dropping\n"\r
+                                       "\t\t\tClass 0x%x, Method 0x%X, Attr 0x%X, "\r
+                                       "TID 0x%" PRIx64 ", LID %u\n",\r
+                                       status, 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(%u) -- dropping\n"\r
+                                       "\t\t\tMethod 0x%X, Attr 0x%X, TID 0x%" PRIx64\r
+                                       ", Hop Ptr: 0x%X\n",\r
+                                       status, 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 +360,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 +444,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 +480,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 +542,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 +574,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 +589,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 +654,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 +680,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 +797,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 +947,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 +957,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 +967,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 +982,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 +1007,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 +1034,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 +1116,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 +1139,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 +1150,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
index 4cd7de7da0e2def4f7cd00bffe919e2cf4a17dc0..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,7 +131,7 @@ __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 = %u / %u (%u)\n",\r
                                        query_res.result_cnt,\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 1f468e64cb30b2628a05d72abb27515f5ebb1e93..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
@@ -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
@@ -640,7 +625,6 @@ 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
@@ -688,7 +672,6 @@ osmv_query_sa(IN osm_bind_handle_t h_bind,
        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
@@ -889,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 ab6ba45bf133488f3738228965b87b1e26726e48..5fd6ea8afda35d92f53be5a3e95f0652cf7d23dd 100644 (file)
@@ -8,6 +8,25 @@
 
 #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;
@@ -17,10 +36,10 @@ static char *syslog_id;
 void openlog(char *ident, int option, int facility)
 {
        if (!syslog_fname)
-               syslog_fname = strdup_expand(OSM_DEFAULT_TMP_DIR "osm.syslog"); 
+               syslog_fname = strdup(OSM_DEFAULT_TMP_DIR "osm.syslog");        
 
        if (!syslog_file) {
-               syslog_file = fopen(syslog_fname,"w");
+               syslog_file = Fopen(syslog_fname,"w");
                if (syslog_file)
                        syslog_id = strdup(ident);
        }
@@ -48,13 +67,14 @@ void closelog(void)
  
 void syslog(int prio, char *fmt, ... )
 {
-       char Buffer[1024];
+       char Buffer[1400];
        SYSTEMTIME st;
        uint32_t pid = GetCurrentThreadId();
+       int rc;
        va_list args;
 
        va_start(args,fmt);
-       _vsnprintf(Buffer, 1024, (LPSTR)fmt, args); 
+       rc = _vsnprintf(Buffer, sizeof(Buffer), (LPSTR)fmt, args); 
        va_end(args);
 
        if (!syslog_file) {
@@ -62,8 +82,13 @@ void syslog(int prio, char *fmt, ... )
                return;
        }
 
+       if ( rc < 0 )
+               fprintf(syslog_file,"syslog() overflow @ %d\n", sizeof(Buffer));
+
        GetLocalTime(&st);
-       fprintf(syslog_file, "[%s][%02d:%02d:%02d:%03d][%04X] %s", syslog_id,
+
+       fprintf(syslog_file, "[%s][%02d-%02d-%4d %02d:%02d:%02d:%03d][%04X] %s",
+               syslog_id, st.wMonth, st.wDay, st.wYear,
                st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pid,
                Buffer);
        fflush(syslog_file);
index b5fc920838521495edcc158d02efe0ddef7946a1..bb66968da2371f811058615d4428e645140e9acc 100644 (file)
@@ -1,6 +1,6 @@
 \r
 # include only 'one' mad vendor.\r
 \r
-!INCLUDE vendor-ibal.inc\r
+#!INCLUDE vendor-ibal.inc\r
 \r
-#!INCLUDE vendor-umad.inc\r
+!INCLUDE vendor-umad.inc\r
index a6b1050eb9d9dc884c20b3c8b9157357cd1e0a70..a45d6786ea4a5bb580c8302290d95a0e9ec63e11 100644 (file)
@@ -93,7 +93,7 @@ Prints OpenSM version and exits.
 .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
+\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
@@ -295,21 +295,21 @@ is accumulative.
 .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
+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\%@OPENSM_CONFIG_DIR@/prefix\-routes.conf\fP.\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\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP. See\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
@@ -425,7 +425,7 @@ logrotate purposes.
 .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
+\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
@@ -1065,23 +1065,23 @@ Both or one of options -U and -M can be specified together with \'-R file\'.
 \r
 .SH FILES\r
 .TP\r
-.B @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\r
+.B /usr/local/etc/opensm/opensm.conf\r
 default OpenSM config file.\r
 \r
 .TP\r
-.B @OPENSM_CONFIG_DIR@/@NODENAMEMAPFILE@\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 @OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\r
+.B /usr/local/etc/opensm/partitions.conf\r
 default partition config file\r
 \r
 .TP\r
-.B @OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\r
+.B /usr/local/etc/opensm/qos-policy.conf\r
 default QOS policy config file\r
 \r
 .TP\r
-.B @OPENSM_CONFIG_DIR@/@PREFIX_ROUTES_FILE@\r
+.B /usr/local/etc/opensm/prefix-routes.conf\r
 default prefix routes file.\r
 \r
 .SH AUTHORS\r
diff --git a/trunk/ulp/opensm/user/opensm/ChangeLog b/trunk/ulp/opensm/user/opensm/ChangeLog
new file mode 100644 (file)
index 0000000..e15071e
--- /dev/null
@@ -0,0 +1,115 @@
+2007-07-11 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump to version 2.2.1\r
+\r
+2007-06-20 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Add 3LeafNetworks and Xsigo to osm_get_manufacturer_str\r
+\r
+2007-06-15 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_helper.c: Fix PortInfo:CapMask printing when CapMask is 0\r
+\r
+2007-06-11 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_helper.c: Remove OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED\r
+         from __osm_sm_mgr_signal_str\r
+\r
+2007-06-06 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_helper.c: More optimally deal with manufacturer strings\r
+\r
+2007-06-06 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Add Sun to osm_get_manufacturer_str\r
+\r
+2007-06-04 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Add 8x to __osm_lwa_str_fixed_width\r
+\r
+2007-05-07 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_helper.c: Remove repeated strlen() calls\r
+\r
+2007-04-27 Ira K. Weiny <weiny2@llnl.gov>\r
+\r
+       * osm_helper.c: In osm_dump_notice, use ib_get_producer_type_str\r
+         for printing producer type\r
+\r
+2007-04-26 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Clarify the proper usage of\r
+         osm_get_node_type_str_fixed_width to take uint8_t rather\r
+         than uint32_t for node_type argument\r
+\r
+2007-04-25 Yevgeny Kliteynik <kliteyn@dev.mellanox.co.il>\r
+\r
+       * osm_helper.c: Fix problematic usage of sprintf() when\r
+         source and destination strings overlap.\r
+\r
+2007-04-24 Albert L. Chu <chu11@llnl.gov>\r
+\r
+       * osm_helper.c: In osm_get_node_type_str_fixed_width, fix\r
+         both range limit and endian of node type check\r
+\r
+2007-03-29 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.2.0\r
+\r
+2007-03-21 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_log.c: Changed to support daemon mode\r
+\r
+2007-03-01 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.1.2\r
+\r
+       * osm_helper.c: Eliminate extraneous comma in __osm_disp_msg_ string\r
+         for OSM_MSG_MAD_PORT_INFO\r
+\r
+2007-02-26 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_log.c: Minor optimization to previous change to osm_log\r
+         for also flushing on OSM_LOG_SYS\r
+\r
+2007-02-26 Yevgeny Kliteynik <kliteyn@dev.mellanox.co.il>\r
+\r
+       * osm_log.c: In osm_log, flush log on OSM_LOG_SYS (as well\r
+         as OSM_LOG_ERROR)\r
+\r
+2007-02-20 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * configure.in: Bump version to 2.1.1\r
+\r
+       * osm_helper.c: In osm_dbg_get_capabilities_str, only display\r
+         Capability Mask if there are capabilities present\r
+\r
+2007-01-22 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Change DR path format from [%X] to %d,\r
+\r
+2007-01-08 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_log.c: Add osm_log_reopen_file API\r
+\r
+2006-12-22 Hal Rosenstock <halr@voltaire.com>\r
+\r
+       * osm_helper.c: Add osm_dump_switch_info_record API\r
+\r
+2006-11-03 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_log.c: Add osm_log_printf API\r
+\r
+2006-10-30 Sasha Khapyorsky <sashak@voltaire.com>\r
+\r
+       * osm_helper.c: Fix seg fault with strings which\r
+         might not be null terminated\r
+\r
+2006-10-18 Yevgeny Kliteynik <kliteyn@dev.mellanox.co.il>\r
+\r
+       * osm_log.c: Windows porting changes\r
+\r
+2006-09-19 Yevgeny Kliteynik <kliteyn@dev.mellanox.co.il>\r
+\r
+       * osm_log.c: Windows porting changes\r
+\r
index 1f0ad9404d63c878eafcff90d451574583a08cb5..32302d4481f8182626dc75415867a3195d7733a9 100644 (file)
@@ -62,11 +62,14 @@ C_DEFINES=$(C_DEFINES) -DWINVER=$(_NT_TARGET_VERSION)
 \r
 !if !$(FREEBUILD)\r
 C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG\r
+# If not specified, default is no optimization: /Od /Oi per WDK docs.\r
+!else\r
+# If not specified, default is /Oxs, favor fast code here.\r
+MSC_OPTIMIZATION= /Oxt\r
 !endif\r
 \r
 LINKER_FLAGS= $(LINKER_FLAGS)\r
 \r
 MSC_WARNING_LEVEL= /W2 /wd4090 /wd4242 /wd4334 /wd4007\r
 \r
-#MSC_OPTIMIZATION= /O0\r
 \r
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 e71d71727a2d1178fff0ee2ba5db23249ccba7b9..6512b3eb4e35ab5dba7b11944781353bee1608c1 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.\r
- * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.\r
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.\r
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.\r
+ * Copyright (c) 1996-2010 Intel Corporation. All rights reserved.\r
  * Copyright (c) 2009 HNR Consulting. All rights reserved.\r
  * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.\r
  *\r
@@ -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
@@ -617,10 +619,9 @@ opensm_main(void *OsmMainArgs)
        uint32_t val;\r
        const char *const short_option =\r
 #ifdef __WIN__\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
-#else\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
+          "?"\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
@@ -637,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
@@ -687,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
@@ -700,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
@@ -708,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
@@ -779,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
@@ -807,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
@@ -876,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
@@ -941,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
@@ -1051,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
@@ -1061,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
@@ -1071,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
@@ -1125,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
@@ -1135,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
@@ -1165,9 +1186,10 @@ opensm_main(void *OsmMainArgs)
        }\r
 \r
        if (osm.mad_pool.mads_out) {\r
-               fprintf(stdout,\r
-                       "There are still %u MADs out. Forcing the exit of the OpenSM application...\n",\r
-                       osm.mad_pool.mads_out);\r
+               fprintf(stdout, "Still outstanding MADs (mad_pool %u) QP0(%u), "\r
+                       "Forcing OpenSM exit...\n",\r
+                       osm_exit_flag, osm.mad_pool.mads_out,\r
+                       osm.stats.qp0_mads_outstanding);\r
 #ifdef HAVE_LIBPTHREAD\r
                pthread_cond_signal(&osm.stats.cond);\r
 #else\r
@@ -1346,11 +1368,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
@@ -1365,8 +1394,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
index 5ddd4560f4a12eff68820e08204889b474b94a05..ad2684e7bfab455ca9452af01f8c61acbc33f78d 100644 (file)
 #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 InfiniBand 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 InfiniBand Subnet Manager 3.3.6"\r
 #define VER_INTERNALNAME_STR        "opensm.exe"\r
 #define VER_ORIGINALFILENAME_STR    "opensm.exe"\r
 #endif\r
index 592f0263d96e19fac49055dc133aa67623e58631..a60cb33552c3b3782e7d6a38ad1a835dae94518a 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
@@ -416,7 +426,9 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
                        "   SA MADs rcvd                   : %d\n"\r
                        "   SA MADs sent                   : %d\n"\r
                        "   SA unknown MADs rcvd           : %d\n"\r
-                       "   SA MADs ignored                : %d\n",\r
+                       "   SA MADs ignored                : %d\n"\r
+                       "   SA MAD pool outstanding        : %d\n"\r
+                       "   SM MAD pool outstanding        : %d\n",\r
                        p_osm->stats.qp0_mads_outstanding,\r
                        p_osm->stats.qp0_mads_outstanding_on_wire,\r
                        p_osm->stats.qp0_mads_rcvd,\r
@@ -427,7 +439,10 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
                        p_osm->stats.sa_mads_rcvd,\r
                        p_osm->stats.sa_mads_sent,\r
                        p_osm->stats.sa_mads_rcvd_unknown,\r
-                       p_osm->stats.sa_mads_ignored);\r
+                       p_osm->stats.sa_mads_ignored,\r
+                       p_osm->sa.p_mad_pool->mads_out,\r
+                       p_osm->sm.p_mad_pool->mads_out\r
+);\r
                fprintf(out, "\n   Subnet flags\n"\r
                        "   ------------\n"\r
                        "   Ignore existing lfts           : %d\n"\r
@@ -451,9 +466,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 +533,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 +1162,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 +1250,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
@@ -1240,6 +1259,32 @@ static void help_exit(FILE * out, int detail)
        fprintf(out, "exit - graceful OpenSM shutdown.\n");\r
 }\r
 \r
+static void logit(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
+{\r
+       OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "%s",p_last[0]);\r
+       fflush(p_osm->log.out_port);\r
+}\r
+\r
+static void help_logit(FILE * out, int detail)\r
+{\r
+       fprintf(out, "logit - write cmd-line to osm.log file.\n");\r
+}\r
+\r
+static void reset_log(char **p_last, osm_opensm_t * p_osm, FILE * out)\r
+{\r
+       extern void truncate_log_file(osm_log_t * p_log);\r
+\r
+       OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "LogFile Reset - last entry.\n");\r
+       truncate_log_file(&p_osm->log);\r
+       OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "LogFile Reset\n");\r
+       fflush(p_osm->log.out_port);\r
+}\r
+\r
+static void help_reset_log(FILE * out, int detail)\r
+{\r
+       fprintf(out, "logreset - clear the osm.log file.\n");\r
+}\r
+\r
 #else  /* def __WIN__ */\r
 \r
 typedef struct _regexp_list {\r
@@ -1272,12 +1317,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 +1338,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
@@ -1351,6 +1396,8 @@ const struct command console_cmds[] = {
        {"help", &help_command, &help_parse},\r
 #ifdef __WIN__\r
        {"exit", &help_exit, &exit_parse},\r
+       {"logit", &help_logit, &logit},\r
+       {"logreset", &help_reset_log, &reset_log},\r
 #else\r
        {"quit", &help_quit, &quit_parse},\r
 #endif\r
@@ -1365,6 +1412,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 b6f2c756d6e4a7ab29ca94c69b4b3fb3eee80739..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
@@ -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 a1329b4b0f4dd397f2d68c9b33493d8f5da9e087..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
@@ -211,7 +235,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
        while (!cl_is_qlist_empty(&p_port->mcm_list)) {\r
                mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list),\r
                                       mcm_port, list_item);\r
-\r
                osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp,\r
                                     p_port->guid);\r
        }\r
@@ -221,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
@@ -261,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
@@ -287,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
@@ -345,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
@@ -417,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
index ed0f3f390e0a184a617e50fd2b13bd8a52b04990..0803f0f358853c282872ad16fce534abc5a595cf 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
@@ -1096,8 +1070,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
@@ -1157,8 +1129,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
@@ -1191,8 +1161,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
@@ -1284,8 +1252,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
@@ -1345,8 +1311,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
@@ -1428,8 +1392,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
@@ -1447,8 +1409,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
@@ -1478,8 +1438,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
@@ -1516,8 +1474,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
@@ -1540,8 +1496,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
@@ -1567,8 +1521,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
@@ -1593,8 +1545,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
@@ -1613,8 +1563,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
@@ -1640,8 +1588,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
@@ -1835,8 +1781,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
@@ -1942,8 +1886,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
@@ -1997,8 +1939,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
@@ -2006,8 +1946,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
@@ -2015,8 +1955,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
@@ -2024,13 +1962,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
@@ -2047,18 +1985,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
@@ -2095,13 +2028,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
@@ -2113,13 +2044,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
@@ -2129,17 +2058,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
@@ -2172,62 +2097,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
@@ -2240,14 +2165,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
@@ -2262,18 +2185,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
@@ -2285,14 +2204,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
@@ -2308,13 +2224,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 79c96ad1b3b160d7b2c130ecb6c496bb3b640d71..a745d47b2a1fd2364933bc932adbce211fd60211 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
@@ -55,7 +55,6 @@
 \r
 static int log_exit_count = 0;\r
 \r
-#ifndef __WIN__\r
 #include <sys/time.h>\r
 #include <unistd.h>\r
 #include <complib/cl_timer.h>\r
@@ -74,9 +73,6 @@ static char *month_str[] = {
        "Nov",\r
        "Dec"\r
 };\r
-#else\r
-void OsmReportState(IN const char *p_str);\r
-#endif                         /* ndef __WIN__ */\r
 \r
 #ifndef __WIN__\r
 \r
@@ -94,7 +90,7 @@ static void truncate_log_file(osm_log_t * p_log)
 \r
 #else                          /* Windows */\r
 \r
-static void truncate_log_file(osm_log_t * p_log)\r
+void truncate_log_file(osm_log_t * p_log)\r
 {\r
        int fd = _fileno(p_log->out_port);\r
        HANDLE hFile = (HANDLE) _get_osfhandle(fd);\r
@@ -105,6 +101,9 @@ static void truncate_log_file(osm_log_t * p_log)
        SetEndOfFile(hFile);\r
        p_log->count = 0;\r
 }\r
+\r
+extern void OsmReportState(IN const char *p_str);\r
+\r
 #endif                         /* ndef __WIN__ */\r
 \r
 void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,\r
@@ -116,6 +115,7 @@ void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
 #ifdef __WIN__\r
        SYSTEMTIME st;\r
        uint32_t pid = GetCurrentThreadId();\r
+       int rc;\r
 #else\r
        pid_t pid = 0;\r
        time_t tim;\r
@@ -125,17 +125,32 @@ 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
 #ifndef __WIN__\r
-       vsprintf(buffer, p_str, args);\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
-       _vsnprintf(buffer, 1024, (LPSTR)p_str, args);\r
+       if (p_log->log_prefix == NULL)\r
+               rc = _vsnprintf(buffer, sizeof(buffer), (LPSTR)p_str, args);\r
+       else {\r
+               int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix);\r
+               rc = _vsnprintf(buffer + n, (sizeof(buffer) - n), (LPSTR)p_str, args);\r
+       }\r
 #endif\r
        va_end(args);\r
 \r
+       if ( rc < 0 ) {\r
+               syslog(LOG_INFO,"%s() osm.log buffer-overflow @ bufsize %d\n",\r
+                                               __FUNCTION__,sizeof(buffer));\r
+       }\r
+\r
        /* this is a call to the syslog */\r
        if (verbosity & OSM_LOG_SYS) {\r
                syslog(LOG_INFO, "%s\n", buffer);\r
@@ -165,8 +180,9 @@ void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
 _retry:\r
        ret =\r
            fprintf(p_log->out_port,\r
-                   "[%02d:%02d:%02d:%03d][%04X] 0x%02x -> %s",\r
-                   st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,\r
+                   "[%s-%02d-%04d %02d:%02d:%02d:%03d][%04X] 0x%02x -> %s",\r
+                   month_str[st.wMonth-1], st.wDay, st.wYear,\r
+                       st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,\r
                    pid, verbosity, buffer);\r
 #else\r
        time_usecs = cl_get_time_stamp();\r
@@ -311,7 +327,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 4ae0f70fba87f3ee0c8d259eab9a0249d18adfe3..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
@@ -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..12451098b522c7775da2eab0461e21dabc26ea44 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 (%u)\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 85848690f2f69b5cfa2bead9997783c24cb5893f..a2dda590a8af69cc45593db61d0ffbb505a5ff18 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,8 +800,8 @@ 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
-               p_pr->hop_flow_raw |= IB_HOPLIMIT_MAX;\r
+       if (p_dgid)\r
+               p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX);\r
 \r
        p_pr->pkey = p_parms->pkey;\r
        ib_path_rec_set_sl(p_pr, p_parms->sl);\r
@@ -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
@@ -1599,8 +1545,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 \r
        /* update the requester physical port. */\r
        requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,\r
-                                                 osm_madw_get_mad_addr_ptr\r
-                                                 (p_madw));\r
+                                                 osm_madw_get_mad_addr_ptr(p_madw));\r
        if (requester_port == NULL) {\r
                OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F16: "\r
                        "Cannot find requester physical port\n");\r
@@ -1619,120 +1564,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 2e0b464401b47bcab8693c0afaa282128f30a5d7..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
@@ -261,9 +262,6 @@ static void sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * p_ctrl,
                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
@@ -320,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
@@ -398,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
@@ -485,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
@@ -553,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
@@ -560,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
@@ -636,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
@@ -709,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
@@ -719,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
@@ -735,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
@@ -765,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
@@ -802,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
@@ -811,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
@@ -822,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
@@ -864,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 37fe3279371fe3793b05025190ca910b121c3461..afa2c6a6768d52f5ee17992b16d40b0405d058bc 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
@@ -526,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
@@ -543,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
@@ -579,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
@@ -634,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
@@ -851,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
@@ -878,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
@@ -1020,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
@@ -1097,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
@@ -1144,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
@@ -1181,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
@@ -1198,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
@@ -1361,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
@@ -1404,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 4cd9279d060a5c299120af38d2cf87788c656575..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 = strdup_expand(p_opt->dump_files_dir);\r
-       p_opt->log_file = strdup_expand(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 = strdup_expand(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 = strdup_expand(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 = strdup_expand(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 d9e3fce8c2806e8e4300b4150c448447b2596839..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
@@ -403,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
@@ -455,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
@@ -509,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
@@ -592,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
@@ -604,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
@@ -612,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
@@ -754,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
@@ -795,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
@@ -943,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 48285ed2a53821139fb2ab46097138f2a78b36b0..f6460da8dd8d69245ec5d7d84dcc3c3abe72179b 100644 (file)
@@ -5,15 +5,11 @@ VENDOR_INC= $(WINIBHOME)\ulp\libibmad\include; \
 \r
 VENDOR_LIBS=$(TARGETPATH)\*\osmv_openib.lib \\r
        $(LIBPATH)\*\libibmad.lib \\r
-       $(LIBPATH)\*\libibumad.lib \\r
-       $(LIBPATH)\*\libibverbs.lib \\r
-       $(LIBPATH)\*\winverbs.lib \r
+       $(LIBPATH)\*\libibumad.lib\r
 \r
 VENDOR_LIBSD=$(TARGETPATH)\*\osmv_openib.lib \\r
        $(LIBPATH)\*\libibmadd.lib \\r
-       $(LIBPATH)\*\libibumadd.lib \\r
-       $(LIBPATH)\*\libibverbsd.lib \\r
-       $(LIBPATH)\*\winverbsd.lib\r
+       $(LIBPATH)\*\libibumadd.lib\r
 \r
 VENDOR_IF=OSM_VENDOR_INTF_OPENIB\r
 \r
index 8b8b52b78bf35d273098dafecb1782243babfdd4..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,11 +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 = \r
 #ifdef __WIN__\r
-       const char *const short_option = "?f:l:m:M:d:g:s:t:i:pcvVh";\r
-#else\r
-       const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh";\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
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 2e627d3bc8573cba980bdeac8fe82e44285bf317..20564688a04b4050686a46f9d4c44e6fbff7738e 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 = ib_get_attr_offset(attr_size);\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) attr_size);\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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -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
@@ -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
@@ -2581,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
@@ -2626,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
@@ -2705,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
@@ -2789,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
@@ -2866,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
@@ -2932,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
@@ -3010,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
@@ -3030,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
@@ -3042,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
@@ -3074,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
@@ -3107,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
@@ -3142,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
@@ -3164,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
@@ -3275,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
@@ -3454,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
@@ -3487,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
@@ -3966,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
@@ -4001,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
@@ -4036,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
@@ -4111,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
@@ -4159,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
@@ -4272,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4350,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4429,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4508,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4587,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4666,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        user.p_attr = &record;\r
 \r
        req.query_type = OSMV_QUERY_USER_DEFINED;\r
@@ -4710,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
@@ -4740,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+       user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
        p_sm_info_opt = p_options;\r
        if (p_sm_info_opt->sm_guid != 0) {\r
                record.sm_info.guid = p_sm_info_opt->sm_guid;\r
@@ -4807,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
@@ -4842,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+               user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\r
                p_inform_info_rec_opt = p_options;\r
                if (p_inform_info_rec_opt->subscriber_gid.unicast.prefix != 0 &&\r
                    p_inform_info_rec_opt->subscriber_gid.unicast.\r
@@ -4856,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 = ib_get_attr_offset((uint16_t) (sizeof(record)));\r
+               user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record));\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
@@ -4921,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
@@ -4978,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
@@ -5076,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
@@ -5125,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
@@ -5245,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
@@ -5329,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
@@ -5383,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
@@ -5435,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
@@ -6149,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
@@ -6197,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
@@ -6424,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
@@ -6831,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
@@ -6992,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
@@ -7073,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
@@ -7217,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
@@ -7298,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 012da398fb9db78bd7c52e384e6399ddf145212b..77ccc2390d5e29794b1cc19b37debcd7b19fc83d 100644 (file)
 #define VER_FILETYPE                           VFT_APP\r
 #define VER_FILESUBTYPE                                VFT2_UNKNOWN\r
 #ifdef _DEBUG_\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application 3.3.3 (Debug)"\r
+#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application 3.3.6 (Debug)"\r
 #define VER_INTERNALNAME_STR        "osmtest.exe"\r
 #define VER_ORIGINALFILENAME_STR    "osmtest.exe"\r
 #else\r
-#define VER_FILEDESCRIPTION_STR     "OpenSM Test Application 3.3.3"\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