From 0ca8e20805c4044ad9a604ee7a7822c693e11c6e Mon Sep 17 00:00:00 2001 From: Stan Smith Date: Wed, 2 Jun 2010 23:51:29 +0000 Subject: [PATCH] [OPENSM] commit 3.3.6 opensm for review/testing git-svn-id: svn://openib.tc.cornell.edu/gen1@2819 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/opensm_3/user/README.windows | 57 +- branches/opensm_3/user/complib/README.txt | 6 + .../opensm_3/user/complib/cl_dispatcher.c | 14 - branches/opensm_3/user/complib/libosmcomp.ver | 9 - .../user/doc/opensm_release_notes-3.3.txt | 92 +- branches/opensm_3/user/ibtrapgen/SOURCES | 10 +- branches/opensm_3/user/ibtrapgen/osm_files.c | 2 + .../opensm_3/user/ibtrapgen/vendor-ibal.inc | 2 + .../opensm_3/user/ibtrapgen/vendor-umad.inc | 2 + branches/opensm_3/user/include/iba/ib_types.h | 10703 ---------------- .../opensm_3/user/include/opensm/osm_base.h | 31 +- .../opensm_3/user/include/opensm/osm_config.h | 16 +- .../user/include/opensm/osm_event_plugin.h | 4 +- .../opensm_3/user/include/opensm/osm_log.h | 1 + .../user/include/opensm/osm_mcast_tbl.h | 4 +- .../user/include/opensm/osm_multicast.h | 65 +- .../user/include/opensm/osm_partition.h | 13 +- .../opensm_3/user/include/opensm/osm_pkey.h | 5 +- .../opensm_3/user/include/opensm/osm_port.h | 2 +- .../user/include/opensm/osm_port_profile.h | 2 +- .../user/include/opensm/osm_qos_policy.h | 2 +- .../opensm_3/user/include/opensm/osm_router.h | 2 +- .../opensm_3/user/include/opensm/osm_sa.h | 11 +- .../opensm_3/user/include/opensm/osm_sm.h | 2 +- .../opensm_3/user/include/opensm/osm_subnet.h | 119 +- .../opensm_3/user/include/opensm/osm_switch.h | 73 +- .../user/include/opensm/osm_ucast_cache.h | 2 +- .../user/include/opensm/osm_version.h | 6 +- .../user/include/opensm/osm_vl15intf.h | 2 +- .../user/include/vendor/osm_vendor_api.h | 4 +- .../user/include/vendor/osm_vendor_mlx.h | 5 +- .../user/include/vendor/osm_vendor_mlx_defs.h | 4 +- .../user/include/vendor/winosm_common.h | 30 +- branches/opensm_3/user/libvendor/SOURCES | 4 +- .../opensm_3/user/libvendor/libosmvendor.map | 20 - .../opensm_3/user/libvendor/libosmvendor.ver | 2 +- .../user/libvendor/osm_pkt_randomizer.c | 6 - .../opensm_3/user/libvendor/osm_vendor_al.c | 75 +- .../user/libvendor/osm_vendor_ibumad.c | 72 +- .../user/libvendor/osm_vendor_ibumad_sa.c | 30 +- .../opensm_3/user/libvendor/osm_vendor_mlx.c | 2 - .../user/libvendor/osm_vendor_mlx_hca.c | 2 - .../user/libvendor/osm_vendor_mlx_hca_sim.c | 2 - .../user/libvendor/osm_vendor_mlx_sa.c | 162 +- .../user/libvendor/osm_vendor_mlx_txn.c | 39 +- .../opensm_3/user/libvendor/winosm_common.c | 274 +- .../user/man/{opensm.8.in => opensm.8} | 28 +- branches/opensm_3/user/opensm/SOURCES | 87 +- branches/opensm_3/user/opensm/libopensm.ver | 2 +- branches/opensm_3/user/opensm/main.c | 144 +- branches/opensm_3/user/opensm/opensm.rc | 8 +- branches/opensm_3/user/opensm/osm_console.c | 51 +- branches/opensm_3/user/opensm/osm_db_files.c | 76 +- branches/opensm_3/user/opensm/osm_db_pack.c | 4 +- branches/opensm_3/user/opensm/osm_drop_mgr.c | 109 +- branches/opensm_3/user/opensm/osm_dump.c | 10 +- .../opensm_3/user/opensm/osm_event_plugin.c | 10 +- branches/opensm_3/user/opensm/osm_files.c | 86 + branches/opensm_3/user/opensm/osm_helper.c | 190 +- branches/opensm_3/user/opensm/osm_inform.c | 29 +- branches/opensm_3/user/opensm/osm_lid_mgr.c | 141 +- .../opensm_3/user/opensm/osm_lin_fwd_rcv.c | 10 +- branches/opensm_3/user/opensm/osm_link_mgr.c | 31 +- branches/opensm_3/user/opensm/osm_log.c | 22 +- branches/opensm_3/user/opensm/osm_mad_pool.c | 18 +- .../opensm_3/user/opensm/osm_mcast_fwd_rcv.c | 11 +- branches/opensm_3/user/opensm/osm_mcast_mgr.c | 409 +- branches/opensm_3/user/opensm/osm_mcast_tbl.c | 26 +- branches/opensm_3/user/opensm/osm_mcm_port.c | 6 +- branches/opensm_3/user/opensm/osm_mtree.c | 4 +- branches/opensm_3/user/opensm/osm_multicast.c | 77 +- branches/opensm_3/user/opensm/osm_node.c | 37 +- .../opensm_3/user/opensm/osm_node_desc_rcv.c | 6 +- .../opensm_3/user/opensm/osm_node_info_rcv.c | 26 +- branches/opensm_3/user/opensm/osm_opensm.c | 25 +- branches/opensm_3/user/opensm/osm_perfmgr.c | 8 +- .../opensm_3/user/opensm/osm_perfmgr_db.c | 48 +- branches/opensm_3/user/opensm/osm_pkey.c | 34 +- branches/opensm_3/user/opensm/osm_pkey_mgr.c | 80 +- branches/opensm_3/user/opensm/osm_pkey_rcv.c | 5 +- branches/opensm_3/user/opensm/osm_port.c | 24 - .../opensm_3/user/opensm/osm_port_info_rcv.c | 23 +- branches/opensm_3/user/opensm/osm_prtn.c | 9 +- branches/opensm_3/user/opensm/osm_qos.c | 158 +- .../opensm_3/user/opensm/osm_qos_parser_l.c | 2 +- .../opensm_3/user/opensm/osm_qos_parser_l.l | 2 +- .../opensm_3/user/opensm/osm_qos_parser_y.c | 3 +- .../opensm_3/user/opensm/osm_qos_parser_y.y | 3 +- .../opensm_3/user/opensm/osm_qos_policy.c | 25 +- branches/opensm_3/user/opensm/osm_remote_sm.c | 6 - branches/opensm_3/user/opensm/osm_req.c | 7 +- branches/opensm_3/user/opensm/osm_resp.c | 4 - branches/opensm_3/user/opensm/osm_router.c | 4 - branches/opensm_3/user/opensm/osm_sa.c | 74 +- .../user/opensm/osm_sa_class_port_info.c | 4 +- .../user/opensm/osm_sa_guidinfo_record.c | 12 +- .../opensm_3/user/opensm/osm_sa_informinfo.c | 69 +- .../opensm_3/user/opensm/osm_sa_lft_record.c | 10 +- .../opensm_3/user/opensm/osm_sa_link_record.c | 12 +- .../opensm_3/user/opensm/osm_sa_mad_ctrl.c | 18 +- .../user/opensm/osm_sa_mcmember_record.c | 269 +- .../opensm_3/user/opensm/osm_sa_mft_record.c | 8 +- .../user/opensm/osm_sa_multipath_record.c | 40 +- .../opensm_3/user/opensm/osm_sa_node_record.c | 10 +- .../opensm_3/user/opensm/osm_sa_path_record.c | 583 +- .../opensm_3/user/opensm/osm_sa_pkey_record.c | 29 +- .../user/opensm/osm_sa_portinfo_record.c | 53 +- .../user/opensm/osm_sa_service_record.c | 20 - .../opensm_3/user/opensm/osm_sa_slvl_record.c | 8 - .../user/opensm/osm_sa_sminfo_record.c | 6 - .../user/opensm/osm_sa_sw_info_record.c | 10 +- .../user/opensm/osm_sa_vlarb_record.c | 10 - branches/opensm_3/user/opensm/osm_service.c | 17 +- .../opensm_3/user/opensm/osm_slvl_map_rcv.c | 81 +- branches/opensm_3/user/opensm/osm_sm.c | 22 +- .../opensm_3/user/opensm/osm_sm_mad_ctrl.c | 97 +- .../opensm_3/user/opensm/osm_sm_state_mgr.c | 16 - .../opensm_3/user/opensm/osm_sminfo_rcv.c | 15 +- branches/opensm_3/user/opensm/osm_state_mgr.c | 137 +- branches/opensm_3/user/opensm/osm_subnet.c | 141 +- .../opensm_3/user/opensm/osm_sw_info_rcv.c | 4 +- branches/opensm_3/user/opensm/osm_switch.c | 26 +- branches/opensm_3/user/opensm/osm_trap_rcv.c | 249 +- .../opensm_3/user/opensm/osm_ucast_cache.c | 58 +- .../opensm_3/user/opensm/osm_ucast_file.c | 2 +- .../opensm_3/user/opensm/osm_ucast_ftree.c | 128 +- .../opensm_3/user/opensm/osm_ucast_lash.c | 4 +- branches/opensm_3/user/opensm/osm_ucast_mgr.c | 152 +- .../opensm_3/user/opensm/osm_ucast_updn.c | 38 +- branches/opensm_3/user/opensm/osm_vl15intf.c | 18 +- .../opensm_3/user/opensm/osm_vl_arb_rcv.c | 15 +- branches/opensm_3/user/opensm/st.c | 4 +- branches/opensm_3/user/osmtest/SOURCES | 10 +- branches/opensm_3/user/osmtest/main.c | 26 +- .../user/osmtest/osmt_mtl_regular_qp.c | 1 + .../opensm_3/user/osmtest/osmt_multicast.c | 17 +- branches/opensm_3/user/osmtest/osmt_service.c | 29 - .../opensm_3/user/osmtest/osmt_slvl_vl_arb.c | 2 - branches/opensm_3/user/osmtest/osmtest.c | 191 +- branches/opensm_3/user/osmtest/osmtest.rc | 8 +- .../opensm_3/user/osmtest/vendor-ibal.inc | 2 + .../opensm_3/user/osmtest/vendor-umad.inc | 2 + branches/opensm_3/user/scripts/opensm.init.in | 133 - .../opensm_3/user/scripts/opensm.logrotate | 7 - .../opensm_3/user/scripts/opensm.sysconfig | 2 - .../opensm_3/user/scripts/osm-regress.bat | 45 + .../user/scripts/redhat-opensm.init.in | 292 - branches/opensm_3/user/scripts/sldd.sh.in | 246 - 148 files changed, 2716 insertions(+), 14886 deletions(-) create mode 100644 branches/opensm_3/user/complib/README.txt delete mode 100644 branches/opensm_3/user/complib/libosmcomp.ver create mode 100644 branches/opensm_3/user/ibtrapgen/vendor-ibal.inc create mode 100644 branches/opensm_3/user/ibtrapgen/vendor-umad.inc delete mode 100644 branches/opensm_3/user/include/iba/ib_types.h delete mode 100644 branches/opensm_3/user/libvendor/libosmvendor.map rename branches/opensm_3/user/man/{opensm.8.in => opensm.8} (95%) create mode 100644 branches/opensm_3/user/opensm/osm_files.c create mode 100644 branches/opensm_3/user/osmtest/vendor-ibal.inc create mode 100644 branches/opensm_3/user/osmtest/vendor-umad.inc delete mode 100644 branches/opensm_3/user/scripts/opensm.init.in delete mode 100644 branches/opensm_3/user/scripts/opensm.logrotate delete mode 100644 branches/opensm_3/user/scripts/opensm.sysconfig create mode 100644 branches/opensm_3/user/scripts/osm-regress.bat delete mode 100644 branches/opensm_3/user/scripts/redhat-opensm.init.in delete mode 100644 branches/opensm_3/user/scripts/sldd.sh.in diff --git a/branches/opensm_3/user/README.windows b/branches/opensm_3/user/README.windows index 4b64a485..99c8fc3e 100644 --- a/branches/opensm_3/user/README.windows +++ b/branches/opensm_3/user/README.windows @@ -1,4 +1,4 @@ -OpenSM README for Windows: last updated [10-23-09] +OpenSM for Windows: last updated [5-27-10] -------------------------------------------------- OpenSM provides a user-mode implementation for an InfiniBand Subnet Manager and @@ -10,13 +10,16 @@ provided in the doc sub directory. The installation of OpenSM includes: -%ProgramFiles%\Winof\ +%ProgramFiles%\OFED\ opensm.exe - the SM/SA executable osmtest.exe - a test program for the SM/SA -The standard WinOF installation creates an OpenSM Windows Service which is +The standard OFED installation creates an OpenSM Windows Service which is inactive by default. If one chooses the install feature 'Startup OpenSM' then -the Windows Service is reset to start automatically at System boot. +the OpenSM Windows Service is reset to start automatically at System boot. +Multiple OpenSM instances within a fabric are supported; the 1st OpenSM instance +will be the MASTER opensm, while others will be in STANDBY mode awaiting +the demise of the MASTER opensm instance. Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600+ @@ -25,36 +28,44 @@ Building opensm.exe, osmtest.exe from the SVN tree with MSFT WDK 7600+ build /wg -OpenSM status +OpenSM 3.3.6 status ------------- -Consider this an Alpha code drop. -Opensm 3.3.2 has work to be completed and much testing to be done before prime -time deployment. That said, openSM 3.3.2 configured a 20 node HPC fabric runing -Intel MPI regression tests. -The openSM as a service seems to be functioning well; log file in +openSM 3.3.6 [vendor-IBAL] configured a 53 node HPC fabric runing Intel MPI regression tests. +All osmtests pass successfully; see 'opensm\user\scripts\osm-regress.bat'. + +The openSM as a service is functioning correctly; the OpenSM log file resides in %TEMP\osm.log which translates to %windir%\temp\osm.log when run as a service. +Additionally %TEMP\osm.syslog or '%windir%\temp\osm.syslog', when run as a service, exists +as a high level record of OpenSM events; where osm.log contains more detailed information +which controlled by opensm.exe -V and/or -D command line switches. The log path is now static in definition as the usage output changed which no -longer allowed calls to GetTempPath(). In order to work around this I used -osm_strdup() in places where the static paths were dup()'ed. osm_strdup() will -expand environment vars during the string dup operation; a solution although -likely not the final solution, as when the static paths printf() the '%' char -of the environment vars are incorrectly treated as printf() control...sigh. - -The osm vendor is IBAL until UMAD is less buggy and has is_osm functionality. -There are include files vendor.* which drive which osm vendor is being used. +longer allowed calls to GetTempPath(). In order to work around this fopen() +is actually a macro which redirects to Fopen(). The difference being Fopen() +will strdup_expand() the filename argument and then call the Windows version +of fopen(). This approach allows filenames like '%TEMP%\osm.log' to be properly +expanded and opened without excessive code changes to filenames. + +The osm vendor is 'IBAL' until UMAD QP1/SA interfaces are debugged. +The include file user\mad-vendor.inc define which osm vendor is being built/used. Make sure all SOURCES files are using the same vendor! -nmake/build pre-processing leaves much to be desired... :-( OpenSM Code Base ---------------- -OpenSM src is based on the OFED management\opensm sources. +OpenSM src is based on the OFED management\opensm sources for the 3.3.6 release. + +Based-on implies the following build processes: -Based-on implies the following process: + If you use the [ANNOUNCE]'d management (OpenSM and infiniband diagnostics) + tarballs, the lex/yacc and config files are already constructed: + see http://www.openfabrics.org/downloads/management/ + (listed in http://www.openfabrics.org/downloads/management/latest.txt) + + otherwise From the OFED management maintainers git repository on a Linux system 1) git clone git://git.openfabrics.org/~sashak/management @@ -70,7 +81,7 @@ Based-on implies the following process: 10) Carefully apply/reject changes. There are a few (<30) differing files which the OFED community - declined to accept due to Windows orientation; an onogin story...sigh. + declined to accept due to Windows orientation; an ongoing story...sigh. The bigger change blocks are found in the following files: opensm\main.c OpenSM as a Windows service support. opensm\console.c Windows console support without poll(). @@ -89,4 +100,4 @@ Based-on implies the following process: b) management/opensm/opensm/osm_qos_parser_l.l c) management/opensm/opensm/configure.h d) management/opensm/include/opensm/osm_version.h - + diff --git a/branches/opensm_3/user/complib/README.txt b/branches/opensm_3/user/complib/README.txt new file mode 100644 index 00000000..abc98b42 --- /dev/null +++ b/branches/opensm_3/user/complib/README.txt @@ -0,0 +1,6 @@ + + +******* DO NOT Confuse this complib\ with trunk\core\complib; trunk\core\complib\ and + trunk\inc\complib are the prefered versions and searched 1st. + +This complib\ exists only for OFED openSM code compatibility. \ No newline at end of file diff --git a/branches/opensm_3/user/complib/cl_dispatcher.c b/branches/opensm_3/user/complib/cl_dispatcher.c index d0faea20..d09c9b3c 100644 --- a/branches/opensm_3/user/complib/cl_dispatcher.c +++ b/branches/opensm_3/user/complib/cl_dispatcher.c @@ -118,8 +118,6 @@ void __cl_disp_worker(IN void *context) cl_spinlock_release(&p_disp->lock); } -/******************************************************************** - ********************************************************************/ void cl_disp_construct(IN cl_dispatcher_t * const p_disp) { CL_ASSERT(p_disp); @@ -131,8 +129,6 @@ void cl_disp_construct(IN cl_dispatcher_t * const p_disp) cl_qpool_construct(&p_disp->msg_pool); } -/******************************************************************** - ********************************************************************/ void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp) { CL_ASSERT(p_disp); @@ -148,8 +144,6 @@ void cl_disp_shutdown(IN cl_dispatcher_t * const p_disp) free(cl_qlist_remove_head(&p_disp->reg_list)); } -/******************************************************************** - ********************************************************************/ void cl_disp_destroy(IN cl_dispatcher_t * const p_disp) { CL_ASSERT(p_disp); @@ -161,8 +155,6 @@ void cl_disp_destroy(IN cl_dispatcher_t * const p_disp) cl_ptr_vector_destroy(&p_disp->reg_vec); } -/******************************************************************** - ********************************************************************/ cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp, IN const uint32_t thread_count, IN const char *const name) @@ -203,8 +195,6 @@ cl_status_t cl_disp_init(IN cl_dispatcher_t * const p_disp, return (status); } -/******************************************************************** - ********************************************************************/ cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp, IN const cl_disp_msgid_t msg_id, IN cl_pfn_msgrcv_cb_t pfn_callback @@ -259,8 +249,6 @@ cl_disp_reg_handle_t cl_disp_register(IN cl_dispatcher_t * const p_disp, return (p_reg); } -/******************************************************************** - ********************************************************************/ void cl_disp_unregister(IN const cl_disp_reg_handle_t handle) { cl_disp_reg_info_t *p_reg; @@ -297,8 +285,6 @@ void cl_disp_unregister(IN const cl_disp_reg_handle_t handle) cl_spinlock_release(&p_disp->lock); } -/******************************************************************** - ********************************************************************/ cl_status_t cl_disp_post(IN const cl_disp_reg_handle_t handle, IN const cl_disp_msgid_t msg_id, IN const void *const p_data, diff --git a/branches/opensm_3/user/complib/libosmcomp.ver b/branches/opensm_3/user/complib/libosmcomp.ver deleted file mode 100644 index 23a0f4d6..00000000 --- a/branches/opensm_3/user/complib/libosmcomp.ver +++ /dev/null @@ -1,9 +0,0 @@ -# In this file we track the current API version -# of the complib library interface -# The version is built of the following -# tree numbers: -# API_REV:RUNNING_REV:AGE -# API_REV - advance on any added API -# RUNNING_REV - advance any change to the vendor files -# AGE - number of backward versions the API still supports -LIBVERSION=2:5:0 diff --git a/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt b/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt index 29013555..fb27b274 100644 --- a/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt +++ b/branches/opensm_3/user/doc/opensm_release_notes-3.3.txt @@ -3,14 +3,14 @@ Version: OpenSM 3.3.x Repo: git://git.openfabrics.org/~sashak/management.git -Date: Nov 2009 +Date: Dec 2009 1 Overview ---------- This document describes the contents of the OpenSM 3.3 release. OpenSM is an InfiniBand compliant Subnet Manager and Administration, and runs on top of OpenIB. The OpenSM version for this release -is opensm-3.3.3. +is opensm-3.3.6. This document includes the following sections: 1 This Overview section (describing new features and software @@ -53,9 +53,14 @@ This document includes the following sections: around to improve connectivity. I/O nodes list is provided using file and --io_guid_file command line option. +* MGID to MLID compression - infrastructure for many MGIDs to single MLID + compression. This becomes helpful when number of multicast groups + exceeds subnet's MLID routing capability (normally 1024 groups). In such + cases many multicast groups (MGID) can be routed using same MLID value. + * Many code improvements, optimizations and cleanups. -* Windows support (very early stage yet). +* Windows support (early stage). 1.2 Minor New Features: @@ -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 e07a2f1 Add LMC support to DOR routing 1acfe8a opensm: Add SuperMicro to list of recognized vendors +f02f40e opensm: implement 'connect_roots' option in fat-tree routing +748d41e opensm SA DB dump/restore: added option to dump SA DB on every sweep +b03a95e complib/cl_fleximap: add cl_fmap_match() function +b7a8a87 opensm/include/iba/ib_types.h: adding Congestion Control definitions +fa356f8 opensm: Add support for optimized SLtoVLMappingTable programming +8aaae91 Dimension port order file support +7662eec opensm: Add option to specify prefix to syslog messages +2382cf3 opensm: Add update_desc command to opensm console 1.3 Library API Changes @@ -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 b44c398 opensm: invalidate routing cache when entering master state 595f2e3 opensm: update LFTs when entering master +8406c65 opensm: fix port chooser +fa90512 opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM +7ec9f7c opensm: discard multicast SA PR with wildcard DGID +5cdb53f opensm/osm_sa_node_record.c use comp mask to match by LID or GUID +55f9772 opensm: Return single PathRecord for SubnAdmGet with DGID/SGID wild + carded +5ec0b5f opensm: compress IPV6 SNM groups to use a single MLID +26e7e83 opensm/osm_lid_mgr: fix couple of duplicate LIDs bugs +fedc419 opensm: Multicast root switch calculation 4.2 Other Bug Fixes @@ -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 6b9a1e9 opensm/PerfMgr: Primarily fix enhanced switch port 0 perf manager operation -8406c65 opensm: fix port chooser 4f79a17 opensm/osm_perfmgr.c: In osm_perfmgr_init, eliminate memory leak on error 22da81f opensm/osm_ucast_ftree.c: fix full topology dump @@ -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 3e6bcdb opensm/lash: fix memory leaks 3ff97b9 opensm/vendor: save some stack memory -fa90512 opensm/osm_vendor_*_sa: fix incompatibility with QLogic SM ccc7621 opensm/osm_ucast_ftree.c: fixing errors in comments 1a802b3 Corrected incoherency in __osm_ftree_fabric_route_to_non_cns comments 85a7e54 opensm/osm_sm.c: fix MC group creation in race condition - aad1af2 opensm/osm_trap_rcv.c: Improvements in log_trap_info() f619d67 opensm/osm_trap_rcv.c: Minor reorganization of trap_rcv_process_request 084335b opensm/link_mgr: verify port's lid -d525931 opensm/osm_vendor_ibumad: Use OSM_UMAD_MAX_AGENTS rather than UMAD_CA_MAX_AGENTS +d525931 opensm/osm_vendor_ibumad: Use OSM_UMAD_MAX_AGENTS rather than + UMAD_CA_MAX_AGENTS f342c62 opensm/osm_sa.c: don't ignore failure in osm_mgrp_add_port() 587fda4 osmtest/osmt_multicast.c: fix strict aliasing breakage warning 6931f3e opensm: make subnet's max mlid update implementation independent @@ -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 84d9830 opensm/osm_ucast_updn.c: Reduce temporary allocation of cas_per_sw 347ad64 opensm/ib_types.h: Mask off client rereg bit in set_client_rereg - c2ab189 opensm/osm_state_mgr.c: in cleanup_switch() check only relevant LFT part 40c93d3 use transportable constant attributes @@ -348,7 +367,6 @@ fe20080 osm_sa.c - void * arithmetic causes problems 180b335 update functions to match .h prototypes 9240ef4 opensm/osm_ucast_lash: fix use after free bug 6f1a21a opensm: osm_get_port_by_lid() helper -7ec9f7c opensm: discard multicast SA PR with wildcard DGID c9e2818 opensm/osm_sa_path_record.c: validate multicast membership 225dcf5 opensm/osm_mesh.c: Remove edges in lash matrix 4dd928b opensm/osm_sa_mcmember_record.c: clean uninitialized variable use @@ -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 failure in __osmv_send_sa_req cf97ebf opensm/osm_ucast_lash.(h c): Replace memory allocation by array -5cdb53f opensm/osm_sa_node_record.c use comp mask to match by LID or GUID 957461c opensm/osm_sa.c add attribute and component mask to error message 5d339a1 osm_dump.c dump port if lft is set up 518083d osm_port.c: check if op_vls = 0 before max_op_vls comparison @@ -442,6 +459,60 @@ cd226c7 OpenSM: include/vendor/osm_vendor.h - Replaced #elif with no condition by #else 9f8bd4a management: Fixed custom_release in SPEC files c0b8207 opensm/PerfMgr: Change redir_tbl_size to num_ports for better clarity +596bb08 opensm/osm_sa.c: check for SA DB file only if requested +2f2bd4e opensm SA DB dump/restore: load SA DB only once +4abcbf2 opensm: Added print_desc to various log messages +5e3d235 opensm/osm_vendor_ibumad.c: Move error info into single message +8e5ca10 opensm/libvendor//osm_vendor_ibumad_sa.c: uninitialized fields +d13c2b6 opensm/osm_sm_mad_ctrl.c Changes to some error messages +f79d315 opensm/osm_sm_mad_ctrl.c: Add missing call to return mad to mad pool +150a9b1 opensm/osm_sa_mcmember_record.c: print mcast join/create failures in + VERBOSE instead of DEBUG level +9b7882a opensm/osm_vendor_ibumad.c: Change LID format to decimal in log message +5256c43 opensm/osm_vendor_mlx: fix compilation error +93db10d opensm/osm_vendor_mlx_txn.c: eliminate bunch of compilation warnings +156fdc1 opensm/osm_helper.c Log format changes +7a55434 opensm/osm_ucast_ftree.c Changed log level +a1694de opensm/osm_state_mgr.c Added more info to some error messages +fdec20a opensm/osm_trap_rcv.c: Eliminate heavy sweep on receipt of trap 145 +13a32a7 opensm - standardize on a single Windows #define - take #2 +b236a10 opensm/osm_db_files.c: kill useless malloc() castings +4ba0c26 opensm/osm_db_files.c: add '/' path delimited +e3b98a5 opensm/osm_sm_mad_ctrl.c: Fix qp0_mads_accounting +dbbe5b3 opensm/osm_subnet.c: fixing bug in dumping options file +f22856a opensm/osm_ucast_mgr.c: fix memory leak +0d5f0b6 opensm: osm_get_mgrp_by_mgid() helper +e3c044a osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator +3dda2dc opensm/osm_sa_member_record.c: mlid independent MGID generator +1f95a3c opensm/osm_sa_mcmember_record.c: move mgid allocation code +b78add1 complib: replace intn_t types by C99 intptr_t +a864fd3 osmtest/osmt_mtl_regular_qp.c: cleaning uintn_t use +9e01318 opensm/osm_console.c: make const functions +f8c4c3e opensm/osm_mgrp_new(): add subnet db insertion +80da047 complib/fleximap: make compar callback to return int +bf7fe2d opensm: cleanup intn_t uses +0862bba opensm/main.c: opensm cannot be killed while asking for port guid +2b70193 opensm/complib: bug in cl_list_insert_array_head/tail functions +4764199 opensm - use C99 transportable data type for pointer storage +a9c326c opensm/osm_state_mgr.c: do not probe remote side of port 0 +4945706 opensm/osm_mcast_mgr.c: fix return value on alloc_mfts() failures +8312a24 OpenSM: Fix unused variable compiler warning. +ab8f0a3 opensm/partition: keep multicast group pointer +a817430 opensm: Only clear SMP beyond end of PortInfo attribute +52fb6f2 opensm/osm_switch.h: Remove dead osm_switch_get_physp_ptr routine +aa6d932 opensm/osm_mcast_tbl.c: In osm_mcast_tbl_clear_mlid, use memset to + clear port mask entry +2ad846b opensm/osm_trap_rcv.c: use source_lid and port_num for logging +b9d7756 opensm/osm_mcast_tbl: Fix size of port mask table array +11c0a9b opensm/main.c: Use strtoul rather than strtol for parsing transaction + timeout +0608af9 opensm/osm_sm_mad_ctrl.c: In sm_mad_ctrl_send_err_cb, revert setting + of init failure on QoS initialization failures +c6b4d4a opensm/osm_vendor_ibumad.c: Add transaction ID to osm_vendor_send + log message +520af84 opensm/osm_sa_path_record.c: don't set dgid pointer for local subnet +4a878fb opensm/osm_mcast_mgr.c: fix osm_mcast_mgr_compute_max_hops for + managed switch * Other less critical or visible bugs were also fixed. @@ -621,6 +692,7 @@ Table 2 - Qualified IB Stacks Stack | Version -----------------------------------------|-------------------------- The main stream Linux kernel | 2.6.x +OFED | 1.5,1.5.x OFED | 1.4 OFED | 1.3 OFED | 1.2 diff --git a/branches/opensm_3/user/ibtrapgen/SOURCES b/branches/opensm_3/user/ibtrapgen/SOURCES index 850a113a..b479a708 100644 --- a/branches/opensm_3/user/ibtrapgen/SOURCES +++ b/branches/opensm_3/user/ibtrapgen/SOURCES @@ -16,10 +16,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR) TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR) !endif -# include only one vendor definition - -!include ..\opensm\vendor-ibal.inc -#!include ..\opensm\vendor-umad.inc +!INCLUDE ..\mad-vendor.inc TARGETTYPE=PROGRAM UMTYPE=console @@ -52,8 +49,9 @@ INCLUDES= \ $(WINIBHOME)\inc; \ $(WINIBHOME)\inc\user; \ $(WINIBHOME)\inc\user\linux; \ + $(VENDOR_INC); \ $(OSM_HOME); \ - $(OSM_HOME)\include; \ + $(OSM_HOME)\include; # Could be any special flag needed for this project USER_C_FLAGS=$(USER_C_FLAGS) /MD @@ -68,5 +66,5 @@ C_DEFINES=$(C_DEFINES) LINKER_FLAGS= $(LINKER_FLAGS) -MSC_WARNING_LEVEL= /W3 +MSC_WARNING_LEVEL= /W3 /wd4090 diff --git a/branches/opensm_3/user/ibtrapgen/osm_files.c b/branches/opensm_3/user/ibtrapgen/osm_files.c index c4fbcdf1..95065542 100644 --- a/branches/opensm_3/user/ibtrapgen/osm_files.c +++ b/branches/opensm_3/user/ibtrapgen/osm_files.c @@ -5,3 +5,5 @@ #include <..\opensm\osm_mad_pool.c> #include <..\opensm\osm_log.c> +#include <..\opensm\osm_helper.c> + diff --git a/branches/opensm_3/user/ibtrapgen/vendor-ibal.inc b/branches/opensm_3/user/ibtrapgen/vendor-ibal.inc new file mode 100644 index 00000000..303cdd49 --- /dev/null +++ b/branches/opensm_3/user/ibtrapgen/vendor-ibal.inc @@ -0,0 +1,2 @@ + +!INCLUDE ..\opensm\vendor-ibal.inc diff --git a/branches/opensm_3/user/ibtrapgen/vendor-umad.inc b/branches/opensm_3/user/ibtrapgen/vendor-umad.inc new file mode 100644 index 00000000..d106d80f --- /dev/null +++ b/branches/opensm_3/user/ibtrapgen/vendor-umad.inc @@ -0,0 +1,2 @@ + +!INCLUDE ..\opensm\vendor-umad.inc diff --git a/branches/opensm_3/user/include/iba/ib_types.h b/branches/opensm_3/user/include/iba/ib_types.h deleted file mode 100644 index 1b0f1f4c..00000000 --- a/branches/opensm_3/user/include/iba/ib_types.h +++ /dev/null @@ -1,10703 +0,0 @@ -/* - * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. - * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. - * Copyright (c) 2009 HNR Consulting. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -#if !defined(__IB_TYPES_H__) -#define __IB_TYPES_H__ - -#include -#include -#include - -#ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } -#else /* !__cplusplus */ -# define BEGIN_C_DECLS -# define END_C_DECLS -#endif /* __cplusplus */ - -BEGIN_C_DECLS -#if defined( __WIN__ ) -#if defined( EXPORT_AL_SYMBOLS ) -#define OSM_EXPORT __declspec(dllexport) -#else -#define OSM_EXPORT __declspec(dllimport) -#endif -#define OSM_API __stdcall -#define OSM_CDECL __cdecl -#else -#define OSM_EXPORT extern -#define OSM_API -#define OSM_CDECL -#define __ptr64 -#endif -/****h* IBA Base/Constants -* NAME -* Constants -* -* DESCRIPTION -* The following constants are used throughout the IBA code base. -* -* Definitions are from the InfiniBand Architecture Specification v1.2 -* -*********/ -/****d* IBA Base: Constants/MAD_BLOCK_SIZE -* NAME -* MAD_BLOCK_SIZE -* -* DESCRIPTION -* Size of a non-RMPP MAD datagram. -* -* SOURCE -*/ -#define MAD_BLOCK_SIZE 256 -/**********/ -/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE -* NAME -* MAD_RMPP_HDR_SIZE -* -* DESCRIPTION -* Size of an RMPP header, including the common MAD header. -* -* SOURCE -*/ -#define MAD_RMPP_HDR_SIZE 36 -/**********/ -/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE -* NAME -* MAD_RMPP_DATA_SIZE -* -* DESCRIPTION -* Size of an RMPP transaction data section. -* -* SOURCE -*/ -#define MAD_RMPP_DATA_SIZE (MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE) -/**********/ -/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE -* NAME -* MAD_BLOCK_GRH_SIZE -* -* DESCRIPTION -* Size of a MAD datagram, including the GRH. -* -* SOURCE -*/ -#define MAD_BLOCK_GRH_SIZE 296 -/**********/ -/****d* IBA Base: Constants/IB_LID_PERMISSIVE -* NAME -* IB_LID_PERMISSIVE -* -* DESCRIPTION -* Permissive LID -* -* SOURCE -*/ -#define IB_LID_PERMISSIVE 0xFFFF -/**********/ -/****d* IBA Base: Constants/IB_DEFAULT_PKEY -* NAME -* IB_DEFAULT_PKEY -* -* DESCRIPTION -* P_Key value for the default partition. -* -* SOURCE -*/ -#define IB_DEFAULT_PKEY 0xFFFF -/**********/ -/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY -* NAME -* IB_QP1_WELL_KNOWN_Q_KEY -* -* DESCRIPTION -* Well-known Q_Key for QP1 privileged mode access (15.4.2). -* -* SOURCE -*/ -#define IB_QP1_WELL_KNOWN_Q_KEY CL_HTON32(0x80010000) -/*********/ -#define IB_QP0 0 -#define IB_QP1 CL_HTON32(1) -#define IB_QP_PRIVILEGED_Q_KEY CL_HTON32(0x80000000) -/****d* IBA Base: Constants/IB_LID_UCAST_START -* NAME -* IB_LID_UCAST_START -* -* DESCRIPTION -* Lowest valid unicast LID value. -* -* SOURCE -*/ -#define IB_LID_UCAST_START_HO 0x0001 -#define IB_LID_UCAST_START (CL_HTON16(IB_LID_UCAST_START_HO)) -/**********/ -/****d* IBA Base: Constants/IB_LID_UCAST_END -* NAME -* IB_LID_UCAST_END -* -* DESCRIPTION -* Highest valid unicast LID value. -* -* SOURCE -*/ -#define IB_LID_UCAST_END_HO 0xBFFF -#define IB_LID_UCAST_END (CL_HTON16(IB_LID_UCAST_END_HO)) -/**********/ -/****d* IBA Base: Constants/IB_LID_MCAST_START -* NAME -* IB_LID_MCAST_START -* -* DESCRIPTION -* Lowest valid multicast LID value. -* -* SOURCE -*/ -#define IB_LID_MCAST_START_HO 0xC000 -#define IB_LID_MCAST_START (CL_HTON16(IB_LID_MCAST_START_HO)) -/**********/ -/****d* IBA Base: Constants/IB_LID_MCAST_END -* NAME -* IB_LID_MCAST_END -* -* DESCRIPTION -* Highest valid multicast LID value. -* -* SOURCE -*/ -#define IB_LID_MCAST_END_HO 0xFFFE -#define IB_LID_MCAST_END (CL_HTON16(IB_LID_MCAST_END_HO)) -/**********/ -/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX -* NAME -* IB_DEFAULT_SUBNET_PREFIX -* -* DESCRIPTION -* Default subnet GID prefix. -* -* SOURCE -*/ -#define IB_DEFAULT_SUBNET_PREFIX (CL_HTON64(0xFE80000000000000ULL)) -/**********/ -/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX -* NAME -* IB_NODE_NUM_PORTS_MAX -* -* DESCRIPTION -* Maximum number of ports in a single node (14.2.5.7). -* SOURCE -*/ -#define IB_NODE_NUM_PORTS_MAX 0xFE -/**********/ -/****d* IBA Base: Constants/IB_INVALID_PORT_NUM -* NAME -* IB_INVALID_PORT_NUM -* -* DESCRIPTION -* Value used to indicate an invalid port number (14.2.5.10). -* -* SOURCE -*/ -#define IB_INVALID_PORT_NUM 0xFF -/*********/ -/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX -* NAME -* IB_SUBNET_PATH_HOPS_MAX -* -* DESCRIPTION -* Maximum number of directed route switch hops in a subnet (14.2.1.2). -* -* SOURCE -*/ -#define IB_SUBNET_PATH_HOPS_MAX 64 -/*********/ -/****d* IBA Base: Constants/IB_HOPLIMIT_MAX -* NAME -* IB_HOPLIMIT_MAX -* -* DESCRIPTION -* Maximum number of router hops allowed. -* -* SOURCE -*/ -#define IB_HOPLIMIT_MAX 255 -/*********/ -/****d* IBA Base: Constants/IB_MC_SCOPE_* -* NAME -* IB_MC_SCOPE_* -* -* DESCRIPTION -* Scope component definitions from IBA 1.2.1 (Table 3 p. 148) -*/ -#define IB_MC_SCOPE_LINK_LOCAL 0x2 -#define IB_MC_SCOPE_SITE_LOCAL 0x5 -#define IB_MC_SCOPE_ORG_LOCAL 0x8 -#define IB_MC_SCOPE_GLOBAL 0xE -/*********/ -/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS -* NAME -* IB_PKEY_MAX_BLOCKS -* -* DESCRIPTION -* Maximum number of PKEY blocks (14.2.5.7). -* -* SOURCE -*/ -#define IB_PKEY_MAX_BLOCKS 2048 -/*********/ -/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID -* NAME -* IB_MCAST_MAX_BLOCK_ID -* -* DESCRIPTION -* Maximum number of Multicast port mask blocks -* -* SOURCE -*/ -#define IB_MCAST_MAX_BLOCK_ID 511 -/*********/ -/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO -* NAME -* IB_MCAST_BLOCK_ID_MASK_HO -* -* DESCRIPTION -* Mask (host order) to recover the Multicast block ID. -* -* SOURCE -*/ -#define IB_MCAST_BLOCK_ID_MASK_HO 0x000001FF -/*********/ -/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE -* NAME -* IB_MCAST_BLOCK_SIZE -* -* DESCRIPTION -* Number of port mask entries in a multicast forwarding table block. -* -* SOURCE -*/ -#define IB_MCAST_BLOCK_SIZE 32 -/*********/ -/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE -* NAME -* IB_MCAST_MASK_SIZE -* -* DESCRIPTION -* Number of port mask bits in each entry in the multicast forwarding table. -* -* SOURCE -*/ -#define IB_MCAST_MASK_SIZE 16 -/*********/ -/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO -* NAME -* IB_MCAST_POSITION_MASK_HO -* -* DESCRIPTION -* Mask (host order) to recover the multicast block position. -* -* SOURCE -*/ -#define IB_MCAST_POSITION_MASK_HO 0xF0000000 -/*********/ -/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX -* NAME -* IB_MCAST_POSITION_MAX -* -* DESCRIPTION -* Maximum value for the multicast block position. -* -* SOURCE -*/ -#define IB_MCAST_POSITION_MAX 0xF -/*********/ -/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT -* NAME -* IB_MCAST_POSITION_SHIFT -* -* DESCRIPTION -* Shift value to normalize the multicast block position value. -* -* SOURCE -*/ -#define IB_MCAST_POSITION_SHIFT 28 -/*********/ -/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX -* NAME -* IB_PKEY_ENTRIES_MAX -* -* DESCRIPTION -* Maximum number of PKEY entries per port (14.2.5.7). -* -* SOURCE -*/ -#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK) -/*********/ -/****d* IBA Base: Constants/IB_PKEY_BASE_MASK -* NAME -* IB_PKEY_BASE_MASK -* -* DESCRIPTION -* Masks for the base P_Key value given a P_Key Entry. -* -* SOURCE -*/ -#define IB_PKEY_BASE_MASK (CL_HTON16(0x7FFF)) -/*********/ -/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK -* NAME -* IB_PKEY_TYPE_MASK -* -* DESCRIPTION -* Masks for the P_Key membership type given a P_Key Entry. -* -* SOURCE -*/ -#define IB_PKEY_TYPE_MASK (CL_HTON16(0x8000)) -/*********/ -/****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY -* NAME -* IB_DEFAULT_PARTIAL_PKEY -* -* DESCRIPTION -* 0x7FFF in network order -* -* SOURCE -*/ -#define IB_DEFAULT_PARTIAL_PKEY (CL_HTON16(0x7FFF)) -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID -* NAME -* IB_MCLASS_SUBN_LID -* -* DESCRIPTION -* Subnet Management Class, Subnet Manager LID routed (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_SUBN_LID 0x01 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR -* NAME -* IB_MCLASS_SUBN_DIR -* -* DESCRIPTION -* Subnet Management Class, Subnet Manager directed route (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_SUBN_DIR 0x81 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM -* NAME -* IB_MCLASS_SUBN_ADM -* -* DESCRIPTION -* Management Class, Subnet Administration (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_SUBN_ADM 0x03 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_PERF -* NAME -* IB_MCLASS_PERF -* -* DESCRIPTION -* Management Class, Performance Management (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_PERF 0x04 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_BM -* NAME -* IB_MCLASS_BM -* -* DESCRIPTION -* Management Class, Baseboard Management (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_BM 0x05 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT -* NAME -* IB_MCLASS_DEV_MGMT -* -* DESCRIPTION -* Management Class, Device Management (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_DEV_MGMT 0x06 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT -* NAME -* IB_MCLASS_COMM_MGMT -* -* DESCRIPTION -* Management Class, Communication Management (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_COMM_MGMT 0x07 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_SNMP -* NAME -* IB_MCLASS_SNMP -* -* DESCRIPTION -* Management Class, SNMP Tunneling (13.4.4) -* -* SOURCE -*/ -#define IB_MCLASS_SNMP 0x08 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN -* NAME -* IB_MCLASS_VENDOR_LOW_RANGE_MIN -* -* DESCRIPTION -* Management Class, Vendor Specific Low Range Start -* -* SOURCE -*/ -#define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX -* NAME -* IB_MCLASS_VENDOR_LOW_RANGE_MAX -* -* DESCRIPTION -* Management Class, Vendor Specific Low Range End -* -* SOURCE -*/ -#define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM -* NAME -* IB_MCLASS_DEV_ADM -* -* DESCRIPTION -* Management Class, Device Administration -* -* SOURCE -*/ -#define IB_MCLASS_DEV_ADM 0x10 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_BIS -* NAME -* IB_MCLASS_BIS -* -* DESCRIPTION -* Management Class, BIS -* -* SOURCE -*/ -#define IB_MCLASS_BIS 0x12 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN -* NAME -* IB_MCLASS_VENDOR_HIGH_RANGE_MIN -* -* DESCRIPTION -* Management Class, Vendor Specific High Range Start -* -* SOURCE -*/ -#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30 -/**********/ -/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX -* NAME -* IB_MCLASS_VENDOR_HIGH_RANGE_MAX -* -* DESCRIPTION -* Management Class, Vendor Specific High Range End -* -* SOURCE -*/ -#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f -/**********/ -/****f* IBA Base: Types/ib_class_is_vendor_specific_low -* NAME -* ib_class_is_vendor_specific_low -* -* DESCRIPTION -* Indicates if the Class Code if a vendor specific class from -* the low range -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_class_is_vendor_specific_low(IN const uint8_t class_code) -{ - return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) && - (class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX)); -} - -/* -* PARAMETERS -* class_code -* [in] The Management Datagram Class Code -* -* RETURN VALUE -* TRUE if the class is in the Low range of Vendor Specific MADs -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX -*********/ - -/****f* IBA Base: Types/ib_class_is_vendor_specific_high -* NAME -* ib_class_is_vendor_specific_high -* -* DESCRIPTION -* Indicates if the Class Code if a vendor specific class from -* the high range -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_class_is_vendor_specific_high(IN const uint8_t class_code) -{ - return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) && - (class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX)); -} - -/* -* PARAMETERS -* class_code -* [in] The Management Datagram Class Code -* -* RETURN VALUE -* TRUE if the class is in the High range of Vendor Specific MADs -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX -*********/ - -/****f* IBA Base: Types/ib_class_is_vendor_specific -* NAME -* ib_class_is_vendor_specific -* -* DESCRIPTION -* Indicates if the Class Code if a vendor specific class -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_class_is_vendor_specific(IN const uint8_t class_code) -{ - return (ib_class_is_vendor_specific_low(class_code) || - ib_class_is_vendor_specific_high(class_code)); -} - -/* -* PARAMETERS -* class_code -* [in] The Management Datagram Class Code -* -* RETURN VALUE -* TRUE if the class is a Vendor Specific MAD -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high -*********/ - -/****f* IBA Base: Types/ib_class_is_rmpp -* NAME -* ib_class_is_rmpp -* -* DESCRIPTION -* Indicates if the Class Code supports RMPP -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code) -{ - return ((class_code == IB_MCLASS_SUBN_ADM) || - (class_code == IB_MCLASS_DEV_MGMT) || - (class_code == IB_MCLASS_DEV_ADM) || - (class_code == IB_MCLASS_BIS) || - ib_class_is_vendor_specific_high(class_code)); -} - -/* -* PARAMETERS -* class_code -* [in] The Management Datagram Class Code -* -* RETURN VALUE -* TRUE if the class supports RMPP -* FALSE otherwise. -* -* NOTES -* -*********/ - -/* - * MAD methods - */ - -/****d* IBA Base: Constants/IB_MAX_METHOD -* NAME -* IB_MAX_METHOD -* -* DESCRIPTION -* Total number of methods available to a class, not including the R-bit. -* -* SOURCE -*/ -#define IB_MAX_METHODS 128 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK -* NAME -* IB_MAD_METHOD_RESP_MASK -* -* DESCRIPTION -* Response mask to extract 'R' bit from the method field. (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_RESP_MASK 0x80 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_GET -* NAME -* IB_MAD_METHOD_GET -* -* DESCRIPTION -* Get() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_GET 0x01 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_SET -* NAME -* IB_MAD_METHOD_SET -* -* DESCRIPTION -* Set() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_SET 0x02 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP -* NAME -* IB_MAD_METHOD_GET_RESP -* -* DESCRIPTION -* GetResp() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_GET_RESP 0x81 -/**********/ - -#define IB_MAD_METHOD_DELETE 0x15 - -/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE -* NAME -* IB_MAD_METHOD_GETTABLE -* -* DESCRIPTION -* SubnAdmGetTable() Method (15.2.2) -* -* SOURCE -*/ -#define IB_MAD_METHOD_GETTABLE 0x12 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP -* NAME -* IB_MAD_METHOD_GETTABLE_RESP -* -* DESCRIPTION -* SubnAdmGetTableResp() Method (15.2.2) -* -* SOURCE -*/ -#define IB_MAD_METHOD_GETTABLE_RESP 0x92 - -/**********/ - -#define IB_MAD_METHOD_GETTRACETABLE 0x13 -#define IB_MAD_METHOD_GETMULTI 0x14 -#define IB_MAD_METHOD_GETMULTI_RESP 0x94 - -/****d* IBA Base: Constants/IB_MAD_METHOD_SEND -* NAME -* IB_MAD_METHOD_SEND -* -* DESCRIPTION -* Send() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_SEND 0x03 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP -* NAME -* IB_MAD_METHOD_TRAP -* -* DESCRIPTION -* Trap() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_TRAP 0x05 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT -* NAME -* IB_MAD_METHOD_REPORT -* -* DESCRIPTION -* Report() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_REPORT 0x06 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP -* NAME -* IB_MAD_METHOD_REPORT_RESP -* -* DESCRIPTION -* ReportResp() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_REPORT_RESP 0x86 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS -* NAME -* IB_MAD_METHOD_TRAP_REPRESS -* -* DESCRIPTION -* TrapRepress() Method (13.4.5) -* -* SOURCE -*/ -#define IB_MAD_METHOD_TRAP_REPRESS 0x07 -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY -* NAME -* IB_MAD_STATUS_BUSY -* -* DESCRIPTION -* Temporarily busy, MAD discarded (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_BUSY (CL_HTON16(0x0001)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT -* NAME -* IB_MAD_STATUS_REDIRECT -* -* DESCRIPTION -* QP Redirection required (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_REDIRECT (CL_HTON16(0x0002)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER -* NAME -* IB_MAD_STATUS_UNSUP_CLASS_VER -* -* DESCRIPTION -* Unsupported class version (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_UNSUP_CLASS_VER (CL_HTON16(0x0004)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD -* NAME -* IB_MAD_STATUS_UNSUP_METHOD -* -* DESCRIPTION -* Unsupported method (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_UNSUP_METHOD (CL_HTON16(0x0008)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR -* NAME -* IB_MAD_STATUS_UNSUP_METHOD_ATTR -* -* DESCRIPTION -* Unsupported method/attribute combination (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_UNSUP_METHOD_ATTR (CL_HTON16(0x000C)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD -* NAME -* IB_MAD_STATUS_INVALID_FIELD -* -* DESCRIPTION -* Attribute contains one or more invalid fields (13.4.7) -* -* SOURCE -*/ -#define IB_MAD_STATUS_INVALID_FIELD (CL_HTON16(0x001C)) -/**********/ - -#define IB_MAD_STATUS_CLASS_MASK (CL_HTON16(0xFF00)) - -#define IB_SA_MAD_STATUS_SUCCESS (CL_HTON16(0x0000)) -#define IB_SA_MAD_STATUS_NO_RESOURCES (CL_HTON16(0x0100)) -#define IB_SA_MAD_STATUS_REQ_INVALID (CL_HTON16(0x0200)) -#define IB_SA_MAD_STATUS_NO_RECORDS (CL_HTON16(0x0300)) -#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS (CL_HTON16(0x0400)) -#define IB_SA_MAD_STATUS_INVALID_GID (CL_HTON16(0x0500)) -#define IB_SA_MAD_STATUS_INSUF_COMPS (CL_HTON16(0x0600)) -#define IB_SA_MAD_STATUS_DENIED (CL_HTON16(0x0700)) -#define IB_SA_MAD_STATUS_PRIO_SUGGESTED (CL_HTON16(0x0800)) - -#define IB_DM_MAD_STATUS_NO_IOC_RESP (CL_HTON16(0x0100)) -#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES (CL_HTON16(0x0200)) -#define IB_DM_MAD_STATUS_IOC_FAILURE (CL_HTON16(0x8000)) - -/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO -* NAME -* IB_MAD_ATTR_CLASS_PORT_INFO -* -* DESCRIPTION -* ClassPortInfo attribute (13.4.8) -* -* SOURCE -*/ -#define IB_MAD_ATTR_CLASS_PORT_INFO (CL_HTON16(0x0001)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE -* NAME -* IB_MAD_ATTR_NOTICE -* -* DESCRIPTION -* Notice attribute (13.4.8) -* -* SOURCE -*/ -#define IB_MAD_ATTR_NOTICE (CL_HTON16(0x0002)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO -* NAME -* IB_MAD_ATTR_INFORM_INFO -* -* DESCRIPTION -* InformInfo attribute (13.4.8) -* -* SOURCE -*/ -#define IB_MAD_ATTR_INFORM_INFO (CL_HTON16(0x0003)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC -* NAME -* IB_MAD_ATTR_NODE_DESC -* -* DESCRIPTION -* NodeDescription attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_NODE_DESC (CL_HTON16(0x0010)) - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL -* NAME -* IB_MAD_ATTR_PORT_SMPL_CTRL -* -* DESCRIPTION -* PortSamplesControl attribute (16.1.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_SMPL_CTRL (CL_HTON16(0x0010)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO -* NAME -* IB_MAD_ATTR_NODE_INFO -* -* DESCRIPTION -* NodeInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_NODE_INFO (CL_HTON16(0x0011)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT -* NAME -* IB_MAD_ATTR_PORT_SMPL_RSLT -* -* DESCRIPTION -* PortSamplesResult attribute (16.1.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_SMPL_RSLT (CL_HTON16(0x0011)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO -* NAME -* IB_MAD_ATTR_SWITCH_INFO -* -* DESCRIPTION -* SwitchInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SWITCH_INFO (CL_HTON16(0x0012)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS -* NAME -* IB_MAD_ATTR_PORT_CNTRS -* -* DESCRIPTION -* PortCounters attribute (16.1.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_CNTRS (CL_HTON16(0x0012)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS_EXT -* NAME -* IB_MAD_ATTR_PORT_CNTRS_EXT -* -* DESCRIPTION -* PortCountersExtended attribute (16.1.4) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_CNTRS_EXT (CL_HTON16(0x001D)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_XMIT_DATA_SL -* NAME -* IB_MAD_ATTR_PORT_XMIT_DATA_SL -* -* DESCRIPTION -* PortXmitDataSL attribute (A13.6.4) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_XMIT_DATA_SL (CL_HTON16(0x0036)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_RCV_DATA_SL -* NAME -* IB_MAD_ATTR_PORT_RCV_DATA_SL -* -* DESCRIPTION -* PortRcvDataSL attribute (A13.6.4) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_RCV_DATA_SL (CL_HTON16(0x0037)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO -* NAME -* IB_MAD_ATTR_GUID_INFO -* -* DESCRIPTION -* GUIDInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_GUID_INFO (CL_HTON16(0x0014)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO -* NAME -* IB_MAD_ATTR_PORT_INFO -* -* DESCRIPTION -* PortInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORT_INFO (CL_HTON16(0x0015)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE -* NAME -* IB_MAD_ATTR_P_KEY_TABLE -* -* DESCRIPTION -* PartitionTable attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_P_KEY_TABLE (CL_HTON16(0x0016)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE -* NAME -* IB_MAD_ATTR_SLVL_TABLE -* -* DESCRIPTION -* SL VL Mapping Table attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SLVL_TABLE (CL_HTON16(0x0017)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION -* NAME -* IB_MAD_ATTR_VL_ARBITRATION -* -* DESCRIPTION -* VL Arbitration Table attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_VL_ARBITRATION (CL_HTON16(0x0018)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL -* NAME -* IB_MAD_ATTR_LIN_FWD_TBL -* -* DESCRIPTION -* Switch linear forwarding table -* -* SOURCE -*/ -#define IB_MAD_ATTR_LIN_FWD_TBL (CL_HTON16(0x0019)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL -* NAME -* IB_MAD_ATTR_RND_FWD_TBL -* -* DESCRIPTION -* Switch random forwarding table -* -* SOURCE -*/ -#define IB_MAD_ATTR_RND_FWD_TBL (CL_HTON16(0x001A)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL -* NAME -* IB_MAD_ATTR_MCAST_FWD_TBL -* -* DESCRIPTION -* Switch multicast forwarding table -* -* SOURCE -*/ -#define IB_MAD_ATTR_MCAST_FWD_TBL (CL_HTON16(0x001B)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD -* NAME -* IB_MAD_ATTR_NODE_RECORD -* -* DESCRIPTION -* NodeRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_NODE_RECORD (CL_HTON16(0x0011)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD -* NAME -* IB_MAD_ATTR_PORTINFO_RECORD -* -* DESCRIPTION -* PortInfoRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PORTINFO_RECORD (CL_HTON16(0x0012)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD -* NAME -* IB_MAD_ATTR_SWITCH_INFO_RECORD -* -* DESCRIPTION -* SwitchInfoRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SWITCH_INFO_RECORD (CL_HTON16(0x0014)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD -* NAME -* IB_MAD_ATTR_LINK_RECORD -* -* DESCRIPTION -* LinkRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_LINK_RECORD (CL_HTON16(0x0020)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO -* NAME -* IB_MAD_ATTR_SM_INFO -* -* DESCRIPTION -* SMInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SM_INFO (CL_HTON16(0x0020)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD -* NAME -* IB_MAD_ATTR_SMINFO_RECORD -* -* DESCRIPTION -* SMInfoRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SMINFO_RECORD (CL_HTON16(0x0018)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD -* NAME -* IB_MAD_ATTR_GUIDINFO_RECORD -* -* DESCRIPTION -* GuidInfoRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_GUIDINFO_RECORD (CL_HTON16(0x0030)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG -* NAME -* IB_MAD_ATTR_VENDOR_DIAG -* -* DESCRIPTION -* VendorDiag attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_VENDOR_DIAG (CL_HTON16(0x0030)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO -* NAME -* IB_MAD_ATTR_LED_INFO -* -* DESCRIPTION -* LedInfo attribute (14.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_LED_INFO (CL_HTON16(0x0031)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD -* NAME -* IB_MAD_ATTR_SERVICE_RECORD -* -* DESCRIPTION -* ServiceRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SERVICE_RECORD (CL_HTON16(0x0031)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD -* NAME -* IB_MAD_ATTR_LFT_RECORD -* -* DESCRIPTION -* LinearForwardingTableRecord attribute (15.2.5.6) -* -* SOURCE -*/ -#define IB_MAD_ATTR_LFT_RECORD (CL_HTON16(0x0015)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD -* NAME -* IB_MAD_ATTR_MFT_RECORD -* -* DESCRIPTION -* MulticastForwardingTableRecord attribute (15.2.5.8) -* -* SOURCE -*/ -#define IB_MAD_ATTR_MFT_RECORD (CL_HTON16(0x0017)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD -* NAME -* IB_MAD_ATTR_PKEYTBL_RECORD -* -* DESCRIPTION -* PKEY Table Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PKEY_TBL_RECORD (CL_HTON16(0x0033)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD -* NAME -* IB_MAD_ATTR_PATH_RECORD -* -* DESCRIPTION -* PathRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PATH_RECORD (CL_HTON16(0x0035)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD -* NAME -* IB_MAD_ATTR_VLARB_RECORD -* -* DESCRIPTION -* VL Arbitration Table Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_VLARB_RECORD (CL_HTON16(0x0036)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD -* NAME -* IB_MAD_ATTR_SLVL_RECORD -* -* DESCRIPTION -* SLtoVL Mapping Table Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SLVL_RECORD (CL_HTON16(0x0013)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD -* NAME -* IB_MAD_ATTR_MCMEMBER_RECORD -* -* DESCRIPTION -* MCMemberRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_MCMEMBER_RECORD (CL_HTON16(0x0038)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD -* NAME -* IB_MAD_ATTR_TRACE_RECORD -* -* DESCRIPTION -* TraceRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_TRACE_RECORD (CL_HTON16(0x0039)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD -* NAME -* IB_MAD_ATTR_MULTIPATH_RECORD -* -* DESCRIPTION -* MultiPathRecord attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_MULTIPATH_RECORD (CL_HTON16(0x003A)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD -* NAME -* IB_MAD_ATTR_SVC_ASSOCIATION_RECORD -* -* DESCRIPTION -* Service Association Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD (CL_HTON16(0x003B)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD -* NAME -* IB_MAD_ATTR_INFORM_INFO_RECORD -* -* DESCRIPTION -* InformInfo Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_INFORM_INFO_RECORD (CL_HTON16(0x00F3)) - -/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO -* NAME -* IB_MAD_ATTR_IO_UNIT_INFO -* -* DESCRIPTION -* IOUnitInfo attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_IO_UNIT_INFO (CL_HTON16(0x0010)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE -* NAME -* IB_MAD_ATTR_IO_CONTROLLER_PROFILE -* -* DESCRIPTION -* IOControllerProfile attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE (CL_HTON16(0x0011)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES -* NAME -* IB_MAD_ATTR_SERVICE_ENTRIES -* -* DESCRIPTION -* ServiceEntries attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SERVICE_ENTRIES (CL_HTON16(0x0012)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT -* NAME -* IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT -* -* DESCRIPTION -* DiagnosticTimeout attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT (CL_HTON16(0x0020)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST -* NAME -* IB_MAD_ATTR_PREPARE_TO_TEST -* -* DESCRIPTION -* PrepareToTest attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_PREPARE_TO_TEST (CL_HTON16(0x0021)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE -* NAME -* IB_MAD_ATTR_TEST_DEVICE_ONCE -* -* DESCRIPTION -* TestDeviceOnce attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_TEST_DEVICE_ONCE (CL_HTON16(0x0022)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP -* NAME -* IB_MAD_ATTR_TEST_DEVICE_LOOP -* -* DESCRIPTION -* TestDeviceLoop attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_TEST_DEVICE_LOOP (CL_HTON16(0x0023)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE -* NAME -* IB_MAD_ATTR_DIAG_CODE -* -* DESCRIPTION -* DiagCode attribute (16.3.3) -* -* SOURCE -*/ -#define IB_MAD_ATTR_DIAG_CODE (CL_HTON16(0x0024)) -/**********/ - -/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD -* NAME -* IB_MAD_ATTR_SVC_ASSOCIATION_RECORD -* -* DESCRIPTION -* Service Association Record attribute (15.2.5) -* -* SOURCE -*/ -#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD (CL_HTON16(0x003B)) -/**********/ - -/****d* IBA Base: Constants/IB_NODE_TYPE_CA -* NAME -* IB_NODE_TYPE_CA -* -* DESCRIPTION -* Encoded generic node type used in MAD attributes (13.4.8.2) -* -* SOURCE -*/ -#define IB_NODE_TYPE_CA 0x01 -/**********/ - -/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH -* NAME -* IB_NODE_TYPE_SWITCH -* -* DESCRIPTION -* Encoded generic node type used in MAD attributes (13.4.8.2) -* -* SOURCE -*/ -#define IB_NODE_TYPE_SWITCH 0x02 -/**********/ - -/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER -* NAME -* IB_NODE_TYPE_ROUTER -* -* DESCRIPTION -* Encoded generic node type used in MAD attributes (13.4.8.2) -* -* SOURCE -*/ -#define IB_NODE_TYPE_ROUTER 0x03 -/**********/ - -/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CA -* NAME -* IB_NOTICE_PRODUCER_TYPE_CA -* -* DESCRIPTION -* Encoded generic producer type used in Notice attribute (13.4.8.2) -* -* SOURCE -*/ -#define IB_NOTICE_PRODUCER_TYPE_CA (CL_HTON32(0x000001)) -/**********/ - -/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_SWITCH -* NAME -* IB_NOTICE_PRODUCER_TYPE_SWITCH -* -* DESCRIPTION -* Encoded generic producer type used in Notice attribute (13.4.8.2) -* -* SOURCE -*/ -#define IB_NOTICE_PRODUCER_TYPE_SWITCH (CL_HTON32(0x000002)) -/**********/ - -/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_ROUTER -* NAME -* IB_NOTICE_PRODUCER_TYPE_ROUTER -* -* DESCRIPTION -* Encoded generic producer type used in Notice attribute (13.4.8.2) -* -* SOURCE -*/ -#define IB_NOTICE_PRODUCER_TYPE_ROUTER (CL_HTON32(0x000003)) -/**********/ - -/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CLASS_MGR -* NAME -* IB_NOTICE_PRODUCER_TYPE_CLASS_MGR -* -* DESCRIPTION -* Encoded generic producer type used in Notice attribute (13.4.8.2) -* -* SOURCE -*/ -#define IB_NOTICE_PRODUCER_TYPE_CLASS_MGR (CL_HTON32(0x000004)) -/**********/ - -/****d* IBA Base: Constants/IB_MTU_LEN_TYPE -* NAME -* IB_MTU_LEN_TYPE -* -* DESCRIPTION -* Encoded path MTU. -* 1: 256 -* 2: 512 -* 3: 1024 -* 4: 2048 -* 5: 4096 -* others: reserved -* -* SOURCE -*/ -#define IB_MTU_LEN_256 1 -#define IB_MTU_LEN_512 2 -#define IB_MTU_LEN_1024 3 -#define IB_MTU_LEN_2048 4 -#define IB_MTU_LEN_4096 5 - -#define IB_MIN_MTU IB_MTU_LEN_256 -#define IB_MAX_MTU IB_MTU_LEN_4096 - -/**********/ - -/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE -* NAME -* IB_PATH_SELECTOR_TYPE -* -* DESCRIPTION -* Path selector. -* 0: greater than specified -* 1: less than specified -* 2: exactly the specified -* 3: largest available -* -* SOURCE -*/ -#define IB_PATH_SELECTOR_GREATER_THAN 0 -#define IB_PATH_SELECTOR_LESS_THAN 1 -#define IB_PATH_SELECTOR_EXACTLY 2 -#define IB_PATH_SELECTOR_LARGEST 3 -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE -* NAME -* IB_SMINFO_STATE_NOTACTIVE -* -* DESCRIPTION -* Encoded state value used in the SMInfo attribute. -* -* SOURCE -*/ -#define IB_SMINFO_STATE_NOTACTIVE 0 -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING -* NAME -* IB_SMINFO_STATE_DISCOVERING -* -* DESCRIPTION -* Encoded state value used in the SMInfo attribute. -* -* SOURCE -*/ -#define IB_SMINFO_STATE_DISCOVERING 1 -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY -* NAME -* IB_SMINFO_STATE_STANDBY -* -* DESCRIPTION -* Encoded state value used in the SMInfo attribute. -* -* SOURCE -*/ -#define IB_SMINFO_STATE_STANDBY 2 -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER -* NAME -* IB_SMINFO_STATE_MASTER -* -* DESCRIPTION -* Encoded state value used in the SMInfo attribute. -* -* SOURCE -*/ -#define IB_SMINFO_STATE_MASTER 3 -/**********/ - -/****d* IBA Base: Constants/IB_PATH_REC_SL_MASK -* NAME -* IB_PATH_REC_SL_MASK -* -* DESCRIPTION -* Mask for the sl field for path record -* -* SOURCE -*/ -#define IB_PATH_REC_SL_MASK 0x000F - -/****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK -* NAME -* IB_MILTIPATH_REC_SL_MASK -* -* DESCRIPTION -* Mask for the sl field for MultiPath record -* -* SOURCE -*/ -#define IB_MULTIPATH_REC_SL_MASK 0x000F - -/****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK -* NAME -* IB_PATH_REC_QOS_CLASS_MASK -* -* DESCRIPTION -* Mask for the QoS class field for path record -* -* SOURCE -*/ -#define IB_PATH_REC_QOS_CLASS_MASK 0xFFF0 - -/****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK -* NAME -* IB_MULTIPATH_REC_QOS_CLASS_MASK -* -* DESCRIPTION -* Mask for the QoS class field for MultiPath record -* -* SOURCE -*/ -#define IB_MULTIPATH_REC_QOS_CLASS_MASK 0xFFF0 - -/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK -* NAME -* IB_PATH_REC_SELECTOR_MASK -* -* DESCRIPTION -* Mask for the selector field for path record MTU, rate, -* and packet lifetime. -* -* SOURCE -*/ -#define IB_PATH_REC_SELECTOR_MASK 0xC0 - -/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK -* NAME -* IB_MULTIPATH_REC_SELECTOR_MASK -* -* DESCRIPTION -* Mask for the selector field for multipath record MTU, rate, -* and packet lifetime. -* -* SOURCE -*/ -#define IB_MULTIPATH_REC_SELECTOR_MASK 0xC0 -/**********/ - -/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK -* NAME -* IB_PATH_REC_BASE_MASK -* -* DESCRIPTION -* Mask for the base value field for path record MTU, rate, -* and packet lifetime. -* -* SOURCE -*/ -#define IB_PATH_REC_BASE_MASK 0x3F -/**********/ - -/****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK -* NAME -* IB_MULTIPATH_REC_BASE_MASK -* -* DESCRIPTION -* Mask for the base value field for multipath record MTU, rate, -* and packet lifetime. -* -* SOURCE -*/ -#define IB_MULTIPATH_REC_BASE_MASK 0x3F -/**********/ - -/****h* IBA Base/Type Definitions -* NAME -* Type Definitions -* -* DESCRIPTION -* Definitions are from the InfiniBand Architecture Specification v1.2 -* -*********/ - -/****d* IBA Base: Types/ib_net16_t -* NAME -* ib_net16_t -* -* DESCRIPTION -* Defines the network ordered type for 16-bit values. -* -* SOURCE -*/ -typedef uint16_t ib_net16_t; -/**********/ - -/****d* IBA Base: Types/ib_net32_t -* NAME -* ib_net32_t -* -* DESCRIPTION -* Defines the network ordered type for 32-bit values. -* -* SOURCE -*/ -typedef uint32_t ib_net32_t; -/**********/ - -/****d* IBA Base: Types/ib_net64_t -* NAME -* ib_net64_t -* -* DESCRIPTION -* Defines the network ordered type for 64-bit values. -* -* SOURCE -*/ -typedef uint64_t ib_net64_t; -/**********/ - -/****d* IBA Base: Types/ib_gid_prefix_t -* NAME -* ib_gid_prefix_t -* -* DESCRIPTION -* -* SOURCE -*/ -typedef ib_net64_t ib_gid_prefix_t; -/**********/ - -/****d* IBA Base: Constants/ib_link_states_t -* NAME -* ib_link_states_t -* -* DESCRIPTION -* Defines the link states of a port. -* -* SOURCE -*/ -#define IB_LINK_NO_CHANGE 0 -#define IB_LINK_DOWN 1 -#define IB_LINK_INIT 2 -#define IB_LINK_ARMED 3 -#define IB_LINK_ACTIVE 4 -#define IB_LINK_ACT_DEFER 5 -/**********/ - -static const char *const __ib_node_type_str[] = { - "UNKNOWN", - "Channel Adapter", - "Switch", - "Router" -}; - -/****f* IBA Base: Types/ib_get_node_type_str -* NAME -* ib_get_node_type_str -* -* DESCRIPTION -* Returns a string for the specified node type. -* 14.2.5.3 NodeInfo -* -* SYNOPSIS -*/ -static inline const char *OSM_API ib_get_node_type_str(IN uint8_t node_type) -{ - if (node_type > IB_NODE_TYPE_ROUTER) - node_type = 0; - return (__ib_node_type_str[node_type]); -} - -/* -* PARAMETERS -* node_type -* [in] Encoded node type as returned in the NodeInfo attribute. - -* RETURN VALUES -* Pointer to the node type string. -* -* NOTES -* -* SEE ALSO -* ib_node_info_t -*********/ - -static const char *const __ib_producer_type_str[] = { - "UNKNOWN", - "Channel Adapter", - "Switch", - "Router", - "Class Manager" -}; - -/****f* IBA Base: Types/ib_get_producer_type_str -* NAME -* ib_get_producer_type_str -* -* DESCRIPTION -* Returns a string for the specified producer type -* 13.4.8.2 Notice -* 13.4.8.3 InformInfo -* -* SYNOPSIS -*/ -static inline const char *OSM_API -ib_get_producer_type_str(IN ib_net32_t producer_type) -{ - if (cl_ntoh32(producer_type) > - CL_NTOH32(IB_NOTICE_PRODUCER_TYPE_CLASS_MGR)) - producer_type = 0; - return (__ib_producer_type_str[cl_ntoh32(producer_type)]); -} - -/* -* PARAMETERS -* producer_type -* [in] Encoded producer type from the Notice attribute - -* RETURN VALUES -* Pointer to the producer type string. -* -* NOTES -* -* SEE ALSO -* ib_notice_get_prod_type -*********/ - -static const char *const __ib_port_state_str[] = { - "No State Change (NOP)", - "DOWN", - "INIT", - "ARMED", - "ACTIVE", - "ACTDEFER", - "UNKNOWN" -}; - -/****f* IBA Base: Types/ib_get_port_state_str -* NAME -* ib_get_port_state_str -* -* DESCRIPTION -* Returns a string for the specified port state. -* -* SYNOPSIS -*/ -static inline const char *OSM_API ib_get_port_state_str(IN uint8_t port_state) -{ - if (port_state > IB_LINK_ACTIVE) - port_state = IB_LINK_ACTIVE + 1; - return (__ib_port_state_str[port_state]); -} - -/* -* PARAMETERS -* port_state -* [in] Encoded port state as returned in the PortInfo attribute. - -* RETURN VALUES -* Pointer to the port state string. -* -* NOTES -* -* SEE ALSO -* ib_port_info_t -*********/ - -/****f* IBA Base: Types/ib_get_port_state_from_str -* NAME -* ib_get_port_state_from_str -* -* DESCRIPTION -* Returns a string for the specified port state. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_get_port_state_from_str(IN char *p_port_state_str) -{ - if (!strncmp(p_port_state_str, "No State Change (NOP)", 12)) - return (0); - else if (!strncmp(p_port_state_str, "DOWN", 4)) - return (1); - else if (!strncmp(p_port_state_str, "INIT", 4)) - return (2); - else if (!strncmp(p_port_state_str, "ARMED", 5)) - return (3); - else if (!strncmp(p_port_state_str, "ACTIVE", 6)) - return (4); - else if (!strncmp(p_port_state_str, "ACTDEFER", 8)) - return (5); - return (6); -} - -/* -* PARAMETERS -* p_port_state_str -* [in] A string matching one returned by ib_get_port_state_str -* -* RETURN VALUES -* The appropriate code. -* -* NOTES -* -* SEE ALSO -* ib_port_info_t -*********/ - -/****d* IBA Base: Constants/Join States -* NAME -* Join States -* -* DESCRIPTION -* Defines the join state flags for multicast group management. -* -* SOURCE -*/ -#define IB_JOIN_STATE_FULL 1 -#define IB_JOIN_STATE_NON 2 -#define IB_JOIN_STATE_SEND_ONLY 4 -/**********/ - -/****f* IBA Base: Types/ib_pkey_get_base -* NAME -* ib_pkey_get_base -* -* DESCRIPTION -* Returns the base P_Key value with the membership bit stripped. -* -* SYNOPSIS -*/ -static inline ib_net16_t OSM_API ib_pkey_get_base(IN const ib_net16_t pkey) -{ - return ((ib_net16_t) (pkey & IB_PKEY_BASE_MASK)); -} - -/* -* PARAMETERS -* pkey -* [in] P_Key value -* -* RETURN VALUE -* Returns the base P_Key value with the membership bit stripped. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_pkey_is_full_member -* NAME -* ib_pkey_is_full_member -* -* DESCRIPTION -* Indicates if the port is a full member of the parition. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey) -{ - return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK); -} - -/* -* PARAMETERS -* pkey -* [in] P_Key value -* -* RETURN VALUE -* TRUE if the port is a full member of the partition. -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_pkey_get_base, ib_net16_t -*********/ - -/****f* IBA Base: Types/ib_pkey_is_invalid -* NAME -* ib_pkey_is_invalid -* -* DESCRIPTION -* Returns TRUE if the given P_Key is an invalid P_Key -* C10-116: the CI shall regard a P_Key as invalid if its low-order -* 15 bits are all zero... -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey) -{ - return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE; -} - -/* -* PARAMETERS -* pkey -* [in] P_Key value -* -* RETURN VALUE -* Returns the base P_Key value with the membership bit stripped. -* -* NOTES -* -* SEE ALSO -*********/ - -/****d* IBA Base: Types/ib_gid_t -* NAME -* ib_gid_t -* -* DESCRIPTION -* -* SYNOPSIS -*/ -#include -typedef union _ib_gid { - uint8_t raw[16]; - struct _ib_gid_unicast { - ib_gid_prefix_t prefix; - ib_net64_t interface_id; - } PACK_SUFFIX unicast; - struct _ib_gid_multicast { - uint8_t header[2]; - uint8_t raw_group_id[14]; - } PACK_SUFFIX multicast; -} PACK_SUFFIX ib_gid_t; -#include -/* -* FIELDS -* raw -* GID represented as an unformated byte array. -* -* unicast -* Typical unicast representation with subnet prefix and -* port GUID. -* -* multicast -* Representation for multicast use. -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_gid_is_multicast -* NAME -* ib_gid_is_multicast -* -* DESCRIPTION -* Returns a boolean indicating whether a GID is a multicast GID. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid) -{ - return (p_gid->raw[0] == 0xFF); -} - -/****f* IBA Base: Types/ib_gid_get_scope -* NAME -* ib_gid_get_scope -* -* DESCRIPTION -* Returns scope of (assumed) multicast GID. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API ib_mgid_get_scope(IN const ib_gid_t * p_gid) -{ - return (p_gid->raw[1] & 0x0F); -} - -/****f* IBA Base: Types/ib_gid_set_scope -* NAME -* ib_gid_set_scope -* -* DESCRIPTION -* Sets scope of (assumed) multicast GID. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_mgid_set_scope(IN ib_gid_t * const p_gid, IN const uint8_t scope) -{ - p_gid->raw[1] &= 0xF0; - p_gid->raw[1] |= scope & 0x0F; -} - -/****f* IBA Base: Types/ib_gid_set_default -* NAME -* ib_gid_set_default -* -* DESCRIPTION -* Sets a GID to the default value. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_gid_set_default(IN ib_gid_t * const p_gid, IN const ib_net64_t interface_id) -{ - p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX; - p_gid->unicast.interface_id = interface_id; -} - -/* -* PARAMETERS -* p_gid -* [in] Pointer to the GID object. -* -* interface_id -* [in] Manufacturer assigned EUI64 value of a port. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****f* IBA Base: Types/ib_gid_get_subnet_prefix -* NAME -* ib_gid_get_subnet_prefix -* -* DESCRIPTION -* Gets the subnet prefix from a GID. -* -* SYNOPSIS -*/ -static inline ib_net64_t OSM_API -ib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid) -{ - return (p_gid->unicast.prefix); -} - -/* -* PARAMETERS -* p_gid -* [in] Pointer to the GID object. -* -* RETURN VALUES -* 64-bit subnet prefix value. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****f* IBA Base: Types/ib_gid_is_link_local -* NAME -* ib_gid_is_link_local -* -* DESCRIPTION -* Returns TRUE if the unicast GID scoping indicates link local, -* FALSE otherwise. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_gid_is_link_local(IN const ib_gid_t * const p_gid) -{ - return ((ib_gid_get_subnet_prefix(p_gid) & - CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX); -} - -/* -* PARAMETERS -* p_gid -* [in] Pointer to the GID object. -* -* RETURN VALUES -* Returns TRUE if the unicast GID scoping indicates link local, -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****f* IBA Base: Types/ib_gid_is_site_local -* NAME -* ib_gid_is_site_local -* -* DESCRIPTION -* Returns TRUE if the unicast GID scoping indicates site local, -* FALSE otherwise. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_gid_is_site_local(IN const ib_gid_t * const p_gid) -{ - return ((ib_gid_get_subnet_prefix(p_gid) & - CL_HTON64(0xFFFFFFFFFFFF0000ULL)) == - CL_HTON64(0xFEC0000000000000ULL)); -} - -/* -* PARAMETERS -* p_gid -* [in] Pointer to the GID object. -* -* RETURN VALUES -* Returns TRUE if the unicast GID scoping indicates site local, -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****f* IBA Base: Types/ib_gid_get_guid -* NAME -* ib_gid_get_guid -* -* DESCRIPTION -* Gets the guid from a GID. -* -* SYNOPSIS -*/ -static inline ib_net64_t OSM_API -ib_gid_get_guid(IN const ib_gid_t * const p_gid) -{ - return (p_gid->unicast.interface_id); -} - -/* -* PARAMETERS -* p_gid -* [in] Pointer to the GID object. -* -* RETURN VALUES -* 64-bit GUID value. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****s* IBA Base: Types/ib_path_rec_t -* NAME -* ib_path_rec_t -* -* DESCRIPTION -* Path records encapsulate the properties of a given -* route between two end-points on a subnet. -* -* SYNOPSIS -*/ -#include -typedef struct _ib_path_rec { - ib_net64_t service_id; - ib_gid_t dgid; - ib_gid_t sgid; - ib_net16_t dlid; - ib_net16_t slid; - ib_net32_t hop_flow_raw; - uint8_t tclass; - uint8_t num_path; - ib_net16_t pkey; - ib_net16_t qos_class_sl; - uint8_t mtu; - uint8_t rate; - uint8_t pkt_life; - uint8_t preference; - uint8_t resv2[6]; -} PACK_SUFFIX ib_path_rec_t; -#include -/* -* FIELDS -* service_id -* Service ID for QoS. -* -* dgid -* GID of destination port. -* -* sgid -* GID of source port. -* -* dlid -* LID of destination port. -* -* slid -* LID of source port. -* -* hop_flow_raw -* Global routing parameters: hop count, flow label and raw bit. -* -* tclass -* Another global routing parameter. -* -* num_path -* Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. -* In responses, undefined. -* -* pkey -* Partition key (P_Key) to use on this path. -* -* qos_class_sl -* QoS class and service level to use on this path. -* -* mtu -* MTU and MTU selector fields to use on this path -* -* rate -* Rate and rate selector fields to use on this path. -* -* pkt_life -* Packet lifetime -* -* preference -* Indicates the relative merit of this path versus other path -* records returned from the SA. Lower numbers are better. -* -* resv2 -* Reserved bytes. -* SEE ALSO -*********/ - -/* Path Record Component Masks */ -#define IB_PR_COMPMASK_SERVICEID_MSB (CL_HTON64(((uint64_t)1)<<0)) -#define IB_PR_COMPMASK_SERVICEID_LSB (CL_HTON64(((uint64_t)1)<<1)) -#define IB_PR_COMPMASK_DGID (CL_HTON64(((uint64_t)1)<<2)) -#define IB_PR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<3)) -#define IB_PR_COMPMASK_DLID (CL_HTON64(((uint64_t)1)<<4)) -#define IB_PR_COMPMASK_SLID (CL_HTON64(((uint64_t)1)<<5)) -#define IB_PR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<6)) -#define IB_PR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<7)) -#define IB_PR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<8)) -#define IB_PR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<9)) -#define IB_PR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<10)) -#define IB_PR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<11)) -#define IB_PR_COMPMASK_NUMBPATH (CL_HTON64(((uint64_t)1)<<12)) -#define IB_PR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<13)) -#define IB_PR_COMPMASK_QOS_CLASS (CL_HTON64(((uint64_t)1)<<14)) -#define IB_PR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<15)) -#define IB_PR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<16)) -#define IB_PR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<17)) -#define IB_PR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<18)) -#define IB_PR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<19)) -#define IB_PR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<20)) -#define IB_PR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<21)) - -/* Link Record Component Masks */ -#define IB_LR_COMPMASK_FROM_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_LR_COMPMASK_FROM_PORT (CL_HTON64(((uint64_t)1)<<1)) -#define IB_LR_COMPMASK_TO_PORT (CL_HTON64(((uint64_t)1)<<2)) -#define IB_LR_COMPMASK_TO_LID (CL_HTON64(((uint64_t)1)<<3)) - -/* VL Arbitration Record Masks */ -#define IB_VLA_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_VLA_COMPMASK_OUT_PORT (CL_HTON64(((uint64_t)1)<<1)) -#define IB_VLA_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<2)) - -/* SLtoVL Mapping Record Masks */ -#define IB_SLVL_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_SLVL_COMPMASK_IN_PORT (CL_HTON64(((uint64_t)1)<<1)) -#define IB_SLVL_COMPMASK_OUT_PORT (CL_HTON64(((uint64_t)1)<<2)) - -/* P_Key Table Record Masks */ -#define IB_PKEY_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_PKEY_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1)) -#define IB_PKEY_COMPMASK_PORT (CL_HTON64(((uint64_t)1)<<2)) - -/* Switch Info Record Masks */ -#define IB_SWIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_SWIR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1)) - -/* LFT Record Masks */ -#define IB_LFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_LFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1)) - -/* MFT Record Masks */ -#define IB_MFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_MFTR_COMPMASK_POSITION (CL_HTON64(((uint64_t)1)<<1)) -#define IB_MFTR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_MFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<3)) -#define IB_MFTR_COMPMASK_RESERVED2 (CL_HTON64(((uint64_t)1)<<4)) - -/* NodeInfo Record Masks */ -#define IB_NR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_NR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1)) -#define IB_NR_COMPMASK_BASEVERSION (CL_HTON64(((uint64_t)1)<<2)) -#define IB_NR_COMPMASK_CLASSVERSION (CL_HTON64(((uint64_t)1)<<3)) -#define IB_NR_COMPMASK_NODETYPE (CL_HTON64(((uint64_t)1)<<4)) -#define IB_NR_COMPMASK_NUMPORTS (CL_HTON64(((uint64_t)1)<<5)) -#define IB_NR_COMPMASK_SYSIMAGEGUID (CL_HTON64(((uint64_t)1)<<6)) -#define IB_NR_COMPMASK_NODEGUID (CL_HTON64(((uint64_t)1)<<7)) -#define IB_NR_COMPMASK_PORTGUID (CL_HTON64(((uint64_t)1)<<8)) -#define IB_NR_COMPMASK_PARTCAP (CL_HTON64(((uint64_t)1)<<9)) -#define IB_NR_COMPMASK_DEVID (CL_HTON64(((uint64_t)1)<<10)) -#define IB_NR_COMPMASK_REV (CL_HTON64(((uint64_t)1)<<11)) -#define IB_NR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<12)) -#define IB_NR_COMPMASK_VENDID (CL_HTON64(((uint64_t)1)<<13)) -#define IB_NR_COMPMASK_NODEDESC (CL_HTON64(((uint64_t)1)<<14)) - -/* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/ -#define IB_SR_COMPMASK_SID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_SR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<1)) -#define IB_SR_COMPMASK_SPKEY (CL_HTON64(((uint64_t)1)<<2)) -#define IB_SR_COMPMASK_RES1 (CL_HTON64(((uint64_t)1)<<3)) -#define IB_SR_COMPMASK_SLEASE (CL_HTON64(((uint64_t)1)<<4)) -#define IB_SR_COMPMASK_SKEY (CL_HTON64(((uint64_t)1)<<5)) -#define IB_SR_COMPMASK_SNAME (CL_HTON64(((uint64_t)1)<<6)) -#define IB_SR_COMPMASK_SDATA8_0 (CL_HTON64(((uint64_t)1)<<7)) -#define IB_SR_COMPMASK_SDATA8_1 (CL_HTON64(((uint64_t)1)<<8)) -#define IB_SR_COMPMASK_SDATA8_2 (CL_HTON64(((uint64_t)1)<<9)) -#define IB_SR_COMPMASK_SDATA8_3 (CL_HTON64(((uint64_t)1)<<10)) -#define IB_SR_COMPMASK_SDATA8_4 (CL_HTON64(((uint64_t)1)<<11)) -#define IB_SR_COMPMASK_SDATA8_5 (CL_HTON64(((uint64_t)1)<<12)) -#define IB_SR_COMPMASK_SDATA8_6 (CL_HTON64(((uint64_t)1)<<13)) -#define IB_SR_COMPMASK_SDATA8_7 (CL_HTON64(((uint64_t)1)<<14)) -#define IB_SR_COMPMASK_SDATA8_8 (CL_HTON64(((uint64_t)1)<<15)) -#define IB_SR_COMPMASK_SDATA8_9 (CL_HTON64(((uint64_t)1)<<16)) -#define IB_SR_COMPMASK_SDATA8_10 (CL_HTON64(((uint64_t)1)<<17)) -#define IB_SR_COMPMASK_SDATA8_11 (CL_HTON64(((uint64_t)1)<<18)) -#define IB_SR_COMPMASK_SDATA8_12 (CL_HTON64(((uint64_t)1)<<19)) -#define IB_SR_COMPMASK_SDATA8_13 (CL_HTON64(((uint64_t)1)<<20)) -#define IB_SR_COMPMASK_SDATA8_14 (CL_HTON64(((uint64_t)1)<<21)) -#define IB_SR_COMPMASK_SDATA8_15 (CL_HTON64(((uint64_t)1)<<22)) -#define IB_SR_COMPMASK_SDATA16_0 (CL_HTON64(((uint64_t)1)<<23)) -#define IB_SR_COMPMASK_SDATA16_1 (CL_HTON64(((uint64_t)1)<<24)) -#define IB_SR_COMPMASK_SDATA16_2 (CL_HTON64(((uint64_t)1)<<25)) -#define IB_SR_COMPMASK_SDATA16_3 (CL_HTON64(((uint64_t)1)<<26)) -#define IB_SR_COMPMASK_SDATA16_4 (CL_HTON64(((uint64_t)1)<<27)) -#define IB_SR_COMPMASK_SDATA16_5 (CL_HTON64(((uint64_t)1)<<28)) -#define IB_SR_COMPMASK_SDATA16_6 (CL_HTON64(((uint64_t)1)<<29)) -#define IB_SR_COMPMASK_SDATA16_7 (CL_HTON64(((uint64_t)1)<<30)) -#define IB_SR_COMPMASK_SDATA32_0 (CL_HTON64(((uint64_t)1)<<31)) -#define IB_SR_COMPMASK_SDATA32_1 (CL_HTON64(((uint64_t)1)<<32)) -#define IB_SR_COMPMASK_SDATA32_2 (CL_HTON64(((uint64_t)1)<<33)) -#define IB_SR_COMPMASK_SDATA32_3 (CL_HTON64(((uint64_t)1)<<34)) -#define IB_SR_COMPMASK_SDATA64_0 (CL_HTON64(((uint64_t)1)<<35)) -#define IB_SR_COMPMASK_SDATA64_1 (CL_HTON64(((uint64_t)1)<<36)) - -/* Port Info Record Component Masks */ -#define IB_PIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_PIR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<1)) -#define IB_PIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_PIR_COMPMASK_MKEY (CL_HTON64(((uint64_t)1)<<3)) -#define IB_PIR_COMPMASK_GIDPRE (CL_HTON64(((uint64_t)1)<<4)) -#define IB_PIR_COMPMASK_BASELID (CL_HTON64(((uint64_t)1)<<5)) -#define IB_PIR_COMPMASK_SMLID (CL_HTON64(((uint64_t)1)<<6)) -#define IB_PIR_COMPMASK_CAPMASK (CL_HTON64(((uint64_t)1)<<7)) -#define IB_PIR_COMPMASK_DIAGCODE (CL_HTON64(((uint64_t)1)<<8)) -#define IB_PIR_COMPMASK_MKEYLEASEPRD (CL_HTON64(((uint64_t)1)<<9)) -#define IB_PIR_COMPMASK_LOCALPORTNUM (CL_HTON64(((uint64_t)1)<<10)) -#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11)) -#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT (CL_HTON64(((uint64_t)1)<<12)) -#define IB_PIR_COMPMASK_LNKWIDTHACTIVE (CL_HTON64(((uint64_t)1)<<13)) -#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT (CL_HTON64(((uint64_t)1)<<14)) -#define IB_PIR_COMPMASK_PORTSTATE (CL_HTON64(((uint64_t)1)<<15)) -#define IB_PIR_COMPMASK_PORTPHYSTATE (CL_HTON64(((uint64_t)1)<<16)) -#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17)) -#define IB_PIR_COMPMASK_MKEYPROTBITS (CL_HTON64(((uint64_t)1)<<18)) -#define IB_PIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<19)) -#define IB_PIR_COMPMASK_LMC (CL_HTON64(((uint64_t)1)<<20)) -#define IB_PIR_COMPMASK_LINKSPEEDACTIVE (CL_HTON64(((uint64_t)1)<<21)) -#define IB_PIR_COMPMASK_LINKSPEEDENABLE (CL_HTON64(((uint64_t)1)<<22)) -#define IB_PIR_COMPMASK_NEIGHBORMTU (CL_HTON64(((uint64_t)1)<<23)) -#define IB_PIR_COMPMASK_MASTERSMSL (CL_HTON64(((uint64_t)1)<<24)) -#define IB_PIR_COMPMASK_VLCAP (CL_HTON64(((uint64_t)1)<<25)) -#define IB_PIR_COMPMASK_INITTYPE (CL_HTON64(((uint64_t)1)<<26)) -#define IB_PIR_COMPMASK_VLHIGHLIMIT (CL_HTON64(((uint64_t)1)<<27)) -#define IB_PIR_COMPMASK_VLARBHIGHCAP (CL_HTON64(((uint64_t)1)<<28)) -#define IB_PIR_COMPMASK_VLARBLOWCAP (CL_HTON64(((uint64_t)1)<<29)) -#define IB_PIR_COMPMASK_INITTYPEREPLY (CL_HTON64(((uint64_t)1)<<30)) -#define IB_PIR_COMPMASK_MTUCAP (CL_HTON64(((uint64_t)1)<<31)) -#define IB_PIR_COMPMASK_VLSTALLCNT (CL_HTON64(((uint64_t)1)<<32)) -#define IB_PIR_COMPMASK_HOQLIFE (CL_HTON64(((uint64_t)1)<<33)) -#define IB_PIR_COMPMASK_OPVLS (CL_HTON64(((uint64_t)1)<<34)) -#define IB_PIR_COMPMASK_PARENFIN (CL_HTON64(((uint64_t)1)<<35)) -#define IB_PIR_COMPMASK_PARENFOUT (CL_HTON64(((uint64_t)1)<<36)) -#define IB_PIR_COMPMASK_FILTERRAWIN (CL_HTON64(((uint64_t)1)<<37)) -#define IB_PIR_COMPMASK_FILTERRAWOUT (CL_HTON64(((uint64_t)1)<<38)) -#define IB_PIR_COMPMASK_MKEYVIO (CL_HTON64(((uint64_t)1)<<39)) -#define IB_PIR_COMPMASK_PKEYVIO (CL_HTON64(((uint64_t)1)<<40)) -#define IB_PIR_COMPMASK_QKEYVIO (CL_HTON64(((uint64_t)1)<<41)) -#define IB_PIR_COMPMASK_GUIDCAP (CL_HTON64(((uint64_t)1)<<42)) -#define IB_PIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<43)) -#define IB_PIR_COMPMASK_SUBNTO (CL_HTON64(((uint64_t)1)<<44)) -#define IB_PIR_COMPMASK_RESV4 (CL_HTON64(((uint64_t)1)<<45)) -#define IB_PIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<46)) -#define IB_PIR_COMPMASK_LOCALPHYERR (CL_HTON64(((uint64_t)1)<<47)) -#define IB_PIR_COMPMASK_OVERRUNERR (CL_HTON64(((uint64_t)1)<<48)) - -/* Multicast Member Record Component Masks */ -#define IB_MCR_COMPMASK_GID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_MCR_COMPMASK_MGID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_MCR_COMPMASK_PORT_GID (CL_HTON64(((uint64_t)1)<<1)) -#define IB_MCR_COMPMASK_QKEY (CL_HTON64(((uint64_t)1)<<2)) -#define IB_MCR_COMPMASK_MLID (CL_HTON64(((uint64_t)1)<<3)) -#define IB_MCR_COMPMASK_MTU_SEL (CL_HTON64(((uint64_t)1)<<4)) -#define IB_MCR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<5)) -#define IB_MCR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<6)) -#define IB_MCR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<7)) -#define IB_MCR_COMPMASK_RATE_SEL (CL_HTON64(((uint64_t)1)<<8)) -#define IB_MCR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<9)) -#define IB_MCR_COMPMASK_LIFE_SEL (CL_HTON64(((uint64_t)1)<<10)) -#define IB_MCR_COMPMASK_LIFE (CL_HTON64(((uint64_t)1)<<11)) -#define IB_MCR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<12)) -#define IB_MCR_COMPMASK_FLOW (CL_HTON64(((uint64_t)1)<<13)) -#define IB_MCR_COMPMASK_HOP (CL_HTON64(((uint64_t)1)<<14)) -#define IB_MCR_COMPMASK_SCOPE (CL_HTON64(((uint64_t)1)<<15)) -#define IB_MCR_COMPMASK_JOIN_STATE (CL_HTON64(((uint64_t)1)<<16)) -#define IB_MCR_COMPMASK_PROXY (CL_HTON64(((uint64_t)1)<<17)) - -/* GUID Info Record Component Masks */ -#define IB_GIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_GIR_COMPMASK_BLOCKNUM (CL_HTON64(((uint64_t)1)<<1)) -#define IB_GIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_GIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<3)) -#define IB_GIR_COMPMASK_GID0 (CL_HTON64(((uint64_t)1)<<4)) -#define IB_GIR_COMPMASK_GID1 (CL_HTON64(((uint64_t)1)<<5)) -#define IB_GIR_COMPMASK_GID2 (CL_HTON64(((uint64_t)1)<<6)) -#define IB_GIR_COMPMASK_GID3 (CL_HTON64(((uint64_t)1)<<7)) -#define IB_GIR_COMPMASK_GID4 (CL_HTON64(((uint64_t)1)<<8)) -#define IB_GIR_COMPMASK_GID5 (CL_HTON64(((uint64_t)1)<<9)) -#define IB_GIR_COMPMASK_GID6 (CL_HTON64(((uint64_t)1)<<10)) -#define IB_GIR_COMPMASK_GID7 (CL_HTON64(((uint64_t)1)<<11)) - -/* MultiPath Record Component Masks */ -#define IB_MPR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<0)) -#define IB_MPR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<1)) -#define IB_MPR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<2)) -#define IB_MPR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<3)) -#define IB_MPR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<4)) -#define IB_MPR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<5)) -#define IB_MPR_COMPMASK_NUMBPATH (CL_HTON64(((uint64_t)1)<<6)) -#define IB_MPR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<7)) -#define IB_MPR_COMPMASK_QOS_CLASS (CL_HTON64(((uint64_t)1)<<8)) -#define IB_MPR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<9)) -#define IB_MPR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<10)) -#define IB_MPR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<11)) -#define IB_MPR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<12)) -#define IB_MPR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<13)) -#define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14)) -#define IB_MPR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<15)) -#define IB_MPR_COMPMASK_SERVICEID_MSB (CL_HTON64(((uint64_t)1)<<16)) -#define IB_MPR_COMPMASK_INDEPSELEC (CL_HTON64(((uint64_t)1)<<17)) -#define IB_MPR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<18)) -#define IB_MPR_COMPMASK_SGIDCOUNT (CL_HTON64(((uint64_t)1)<<19)) -#define IB_MPR_COMPMASK_DGIDCOUNT (CL_HTON64(((uint64_t)1)<<20)) -#define IB_MPR_COMPMASK_SERVICEID_LSB (CL_HTON64(((uint64_t)1)<<21)) - -/* SMInfo Record Component Masks */ -#define IB_SMIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_SMIR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<1)) -#define IB_SMIR_COMPMASK_GUID (CL_HTON64(((uint64_t)1)<<2)) -#define IB_SMIR_COMPMASK_SMKEY (CL_HTON64(((uint64_t)1)<<3)) -#define IB_SMIR_COMPMASK_ACTCOUNT (CL_HTON64(((uint64_t)1)<<4)) -#define IB_SMIR_COMPMASK_PRIORITY (CL_HTON64(((uint64_t)1)<<5)) -#define IB_SMIR_COMPMASK_SMSTATE (CL_HTON64(((uint64_t)1)<<6)) - -/* InformInfo Record Component Masks */ -#define IB_IIR_COMPMASK_SUBSCRIBERGID (CL_HTON64(((uint64_t)1)<<0)) -#define IB_IIR_COMPMASK_ENUM (CL_HTON64(((uint64_t)1)<<1)) -#define IB_IIR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<2)) -#define IB_IIR_COMPMASK_GID (CL_HTON64(((uint64_t)1)<<3)) -#define IB_IIR_COMPMASK_LIDRANGEBEGIN (CL_HTON64(((uint64_t)1)<<4)) -#define IB_IIR_COMPMASK_LIDRANGEEND (CL_HTON64(((uint64_t)1)<<5)) -#define IB_IIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<6)) -#define IB_IIR_COMPMASK_ISGENERIC (CL_HTON64(((uint64_t)1)<<7)) -#define IB_IIR_COMPMASK_SUBSCRIBE (CL_HTON64(((uint64_t)1)<<8)) -#define IB_IIR_COMPMASK_TYPE (CL_HTON64(((uint64_t)1)<<9)) -#define IB_IIR_COMPMASK_TRAPNUMB (CL_HTON64(((uint64_t)1)<<10)) -#define IB_IIR_COMPMASK_DEVICEID (CL_HTON64(((uint64_t)1)<<10)) -#define IB_IIR_COMPMASK_QPN (CL_HTON64(((uint64_t)1)<<11)) -#define IB_IIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<12)) -#define IB_IIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<13)) -#define IB_IIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<14)) -#define IB_IIR_COMPMASK_PRODTYPE (CL_HTON64(((uint64_t)1)<<15)) -#define IB_IIR_COMPMASK_VENDID (CL_HTON64(((uint64_t)1)<<15)) - -/****f* IBA Base: Types/ib_path_rec_init_local -* NAME -* ib_path_rec_init_local -* -* DESCRIPTION -* Initializes a subnet local path record. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_path_rec_init_local(IN ib_path_rec_t * const p_rec, - IN ib_gid_t * const p_dgid, - IN ib_gid_t * const p_sgid, - IN ib_net16_t dlid, - IN ib_net16_t slid, - IN uint8_t num_path, - IN ib_net16_t pkey, - IN uint8_t sl, - IN uint16_t qos_class, - IN uint8_t mtu_selector, - IN uint8_t mtu, - IN uint8_t rate_selector, - IN uint8_t rate, - IN uint8_t pkt_life_selector, - IN uint8_t pkt_life, IN uint8_t preference) -{ - p_rec->dgid = *p_dgid; - p_rec->sgid = *p_sgid; - p_rec->dlid = dlid; - p_rec->slid = slid; - p_rec->num_path = num_path; - p_rec->pkey = pkey; - p_rec->qos_class_sl = cl_hton16((sl & IB_PATH_REC_SL_MASK) | - (qos_class << 4)); - p_rec->mtu = (uint8_t) ((mtu & IB_PATH_REC_BASE_MASK) | - (uint8_t) (mtu_selector << 6)); - p_rec->rate = (uint8_t) ((rate & IB_PATH_REC_BASE_MASK) | - (uint8_t) (rate_selector << 6)); - p_rec->pkt_life = (uint8_t) ((pkt_life & IB_PATH_REC_BASE_MASK) | - (uint8_t) (pkt_life_selector << 6)); - p_rec->preference = preference; - - /* Clear global routing fields for local path records */ - p_rec->hop_flow_raw = 0; - p_rec->tclass = 0; - p_rec->service_id = 0; - - memset(p_rec->resv2, 0, sizeof(p_rec->resv2)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* dgid -* [in] GID of destination port. -* -* sgid -* [in] GID of source port. -* -* dlid -* [in] LID of destination port. -* -* slid -* [in] LID of source port. -* -* num_path -* [in] Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. -* In responses, undefined. -* -* pkey -* [in] Partition key (P_Key) to use on this path. -* -* qos_class -* [in] QoS class to use on this path. Lower 12-bits are valid. -* -* sl -* [in] Service level to use on this path. Lower 4-bits are valid. -* -* mtu_selector -* [in] Encoded MTU selector value to use on this path -* -* mtu -* [in] Encoded MTU to use on this path -* -* rate_selector -* [in] Encoded rate selector value to use on this path. -* -* rate -* [in] Encoded rate to use on this path. -* -* pkt_life_selector -* [in] Encoded Packet selector value lifetime for this path. -* -* pkt_life -* [in] Encoded Packet lifetime for this path. -* -* preference -* [in] Indicates the relative merit of this path versus other path -* records returned from the SA. Lower numbers are better. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -* ib_gid_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_num_path -* NAME -* ib_path_rec_num_path -* -* DESCRIPTION -* Get max number of paths to return. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_num_path(IN const ib_path_rec_t * const p_rec) -{ - return (p_rec->num_path & 0x7F); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Maximum number of paths to return for each unique SGID_DGID combination. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_set_sl -* NAME -* ib_path_rec_set_sl -* -* DESCRIPTION -* Set path service level. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_path_rec_set_sl(IN ib_path_rec_t * const p_rec, IN const uint8_t sl) -{ - p_rec->qos_class_sl = - (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_QOS_CLASS_MASK)) | - cl_hton16(sl & IB_PATH_REC_SL_MASK); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* sl -* [in] Service level to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_sl -* NAME -* ib_path_rec_sl -* -* DESCRIPTION -* Get path service level. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_sl(IN const ib_path_rec_t * const p_rec) -{ - return (uint8_t)(cl_ntoh16(p_rec->qos_class_sl) & IB_PATH_REC_SL_MASK); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* SL. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_set_qos_class -* NAME -* ib_path_rec_set_qos_class -* -* DESCRIPTION -* Set path QoS class. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec, - IN const uint16_t qos_class) -{ - p_rec->qos_class_sl = - (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) | - cl_hton16(qos_class << 4); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* qos_class -* [in] QoS class to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_qos_class -* NAME -* ib_path_rec_qos_class -* -* DESCRIPTION -* Get QoS class. -* -* SYNOPSIS -*/ -static inline uint16_t OSM_API -ib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec) -{ - return (cl_ntoh16(p_rec->qos_class_sl) >> 4); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* QoS class of the path record. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_mtu -* NAME -* ib_path_rec_mtu -* -* DESCRIPTION -* Get encoded path MTU. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_mtu(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->mtu & IB_PATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path MTU. -* 1: 256 -* 2: 512 -* 3: 1024 -* 4: 2048 -* 5: 4096 -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_mtu_sel -* NAME -* ib_path_rec_mtu_sel -* -* DESCRIPTION -* Get encoded path MTU selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) ((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path MTU selector value (for queries). -* 0: greater than MTU specified -* 1: less than MTU specified -* 2: exactly the MTU specified -* 3: largest MTU available -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_rate -* NAME -* ib_path_rec_rate -* -* DESCRIPTION -* Get encoded path rate. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_rate(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->rate & IB_PATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path rate. -* 2: 2.5 Gb/sec. -* 3: 10 Gb/sec. -* 4: 30 Gb/sec. -* 5: 5 Gb/sec. -* 6: 20 Gb/sec. -* 7: 40 Gb/sec. -* 8: 60 Gb/sec. -* 9: 80 Gb/sec. -* 10: 120 Gb/sec. -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_rate_sel -* NAME -* ib_path_rec_rate_sel -* -* DESCRIPTION -* Get encoded path rate selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) ((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path rate selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: largest rate available -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_pkt_life -* NAME -* ib_path_rec_pkt_life -* -* DESCRIPTION -* Get encoded path pkt_life. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->pkt_life & IB_PATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path pkt_life = 4.096 usec * 2 ** PacketLifeTime. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_pkt_life_sel -* NAME -* ib_path_rec_pkt_life_sel -* -* DESCRIPTION -* Get encoded path pkt_lifetime selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) ((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Encoded path pkt_lifetime selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: smallest packet lifetime available -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_flow_lbl -* NAME -* ib_path_rec_flow_lbl -* -* DESCRIPTION -* Get flow label. -* -* SYNOPSIS -*/ -static inline uint32_t OSM_API -ib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec) -{ - return (((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Flow label of the path record. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****f* IBA Base: Types/ib_path_rec_hop_limit -* NAME -* ib_path_rec_hop_limit -* -* DESCRIPTION -* Get hop limit. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec) -{ - return ((uint8_t) (cl_ntoh32(p_rec->hop_flow_raw) & 0x000000FF)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the path record object. -* -* RETURN VALUES -* Hop limit of the path record. -* -* NOTES -* -* SEE ALSO -* ib_path_rec_t -*********/ - -/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP -* NAME -* IB_CLASS_CAP_TRAP -* -* DESCRIPTION -* ClassPortInfo CapabilityMask bits. This bit will be set -* if the class supports Trap() MADs (13.4.8.1). -* -* SEE ALSO -* ib_class_port_info_t, IB_CLASS_CAP_GETSET -* -* SOURCE -*/ -#define IB_CLASS_CAP_TRAP 0x0001 -/*********/ - -/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET -* NAME -* IB_CLASS_CAP_GETSET -* -* DESCRIPTION -* ClassPortInfo CapabilityMask bits. This bit will be set -* if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1). -* -* SEE ALSO -* ib_class_port_info_t, IB_CLASS_CAP_TRAP -* -* SOURCE -*/ -#define IB_CLASS_CAP_GETSET 0x0002 -/*********/ - -/****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK -* NAME -* IB_CLASS_RESP_TIME_MASK -* -* DESCRIPTION -* Mask bits to extract the reponse time value from the -* resp_time_val field of ib_class_port_info_t. -* -* SEE ALSO -* ib_class_port_info_t -* -* SOURCE -*/ -#define IB_CLASS_RESP_TIME_MASK 0x1F -/*********/ - -/****s* IBA Base: Types/ib_class_port_info_t -* NAME -* ib_class_port_info_t -* -* DESCRIPTION -* IBA defined ClassPortInfo attribute (13.4.8.1) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_class_port_info { - uint8_t base_ver; - uint8_t class_ver; - ib_net16_t cap_mask; - ib_net32_t cap_mask2_resp_time; - ib_gid_t redir_gid; - ib_net32_t redir_tc_sl_fl; - ib_net16_t redir_lid; - ib_net16_t redir_pkey; - ib_net32_t redir_qp; - ib_net32_t redir_qkey; - ib_gid_t trap_gid; - ib_net32_t trap_tc_sl_fl; - ib_net16_t trap_lid; - ib_net16_t trap_pkey; - ib_net32_t trap_hop_qp; - ib_net32_t trap_qkey; -} PACK_SUFFIX ib_class_port_info_t; -#include -/* -* FIELDS -* base_ver -* Maximum supported MAD Base Version. -* -* class_ver -* Maximum supported management class version. -* -* cap_mask -* Supported capabilities of this management class. -* -* cap_mask2_resp_time -* Maximum expected response time and additional -* supported capabilities of this management class. -* -* redir_gid -* GID to use for redirection, or zero -* -* redir_tc_sl_fl -* Traffic class, service level and flow label the requester -* should use if the service is redirected. -* -* redir_lid -* LID used for redirection, or zero -* -* redir_pkey -* P_Key used for redirection -* -* redir_qp -* QP number used for redirection -* -* redir_qkey -* Q_Key associated with the redirected QP. This shall be the -* well known Q_Key value. -* -* trap_gid -* GID value used for trap messages from this service. -* -* trap_tc_sl_fl -* Traffic class, service level and flow label used for -* trap messages originated by this service. -* -* trap_lid -* LID used for trap messages, or zero -* -* trap_pkey -* P_Key used for trap messages -* -* trap_hop_qp -* Hop limit (upper 8 bits) and QP number used for trap messages -* -* trap_qkey -* Q_Key associated with the trap messages QP. -* -* SEE ALSO -* IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP -* -*********/ - -#define IB_PM_ALL_PORT_SELECT (CL_HTON16(((uint16_t)1)<<8)) -#define IB_PM_EXT_WIDTH_SUPPORTED (CL_HTON16(((uint16_t)1)<<9)) -#define IB_PM_EXT_WIDTH_NOIETF_SUP (CL_HTON16(((uint16_t)1)<<10)) - -/****f* IBA Base: Types/ib_class_set_resp_time_val -* NAME -* ib_class_set_resp_time_val -* -* DESCRIPTION -* Set maximum expected response time. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi, - IN const uint8_t val) -{ - p_cpi->cap_mask2_resp_time = - (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) | - cl_hton32(val & IB_CLASS_RESP_TIME_MASK); -} - -/* -* PARAMETERS -* p_cpi -* [in] Pointer to the class port info object. -* -* val -* [in] Response time value to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_class_port_info_t -*********/ - -/****f* IBA Base: Types/ib_class_resp_time_val -* NAME -* ib_class_resp_time_val -* -* DESCRIPTION -* Get response time value. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi) -{ - return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) & - IB_CLASS_RESP_TIME_MASK); -} - -/* -* PARAMETERS -* p_cpi -* [in] Pointer to the class port info object. -* -* RETURN VALUES -* Response time value. -* -* NOTES -* -* SEE ALSO -* ib_class_port_info_t -*********/ - -/****f* IBA Base: Types/ib_class_set_cap_mask2 -* NAME -* ib_class_set_cap_mask2 -* -* DESCRIPTION -* Set ClassPortInfo:CapabilityMask2. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi, - IN const uint32_t cap_mask2) -{ - p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time & - CL_HTON32(IB_CLASS_RESP_TIME_MASK)) | - cl_hton32(cap_mask2 << 5); -} - -/* -* PARAMETERS -* p_cpi -* [in] Pointer to the class port info object. -* -* cap_mask2 -* [in] CapabilityMask2 value to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_class_port_info_t -*********/ - -/****f* IBA Base: Types/ib_class_cap_mask2 -* NAME -* ib_class_cap_mask2 -* -* DESCRIPTION -* Get ClassPortInfo:CapabilityMask2. -* -* SYNOPSIS -*/ -static inline uint32_t OSM_API -ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi) -{ - return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> 5); -} - -/* -* PARAMETERS -* p_cpi -* [in] Pointer to the class port info object. -* -* RETURN VALUES -* CapabilityMask2 of the ClassPortInfo. -* -* NOTES -* -* SEE ALSO -* ib_class_port_info_t -*********/ - -/****s* IBA Base: Types/ib_sm_info_t -* NAME -* ib_sm_info_t -* -* DESCRIPTION -* SMInfo structure (14.2.5.13). -* -* SYNOPSIS -*/ -#include -typedef struct _ib_sm_info { - ib_net64_t guid; - ib_net64_t sm_key; - ib_net32_t act_count; - uint8_t pri_state; -} PACK_SUFFIX ib_sm_info_t; -#include -/* -* FIELDS -* guid -* Port GUID for this SM. -* -* sm_key -* SM_Key of this SM. -* -* act_count -* Activity counter used as a heartbeat. -* -* pri_state -* Priority and State information -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_sminfo_get_priority -* NAME -* ib_sminfo_get_priority -* -* DESCRIPTION -* Returns the priority value. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi) -{ - return ((uint8_t) ((p_smi->pri_state & 0xF0) >> 4)); -} - -/* -* PARAMETERS -* p_smi -* [in] Pointer to the SMInfo Attribute. -* -* RETURN VALUES -* Returns the priority value. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_sminfo_get_state -* NAME -* ib_sminfo_get_state -* -* DESCRIPTION -* Returns the state value. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_sminfo_get_state(IN const ib_sm_info_t * const p_smi) -{ - return ((uint8_t) (p_smi->pri_state & 0x0F)); -} - -/* -* PARAMETERS -* p_smi -* [in] Pointer to the SMInfo Attribute. -* -* RETURN VALUES -* Returns the state value. -* -* NOTES -* -* SEE ALSO -*********/ - -/****s* IBA Base: Types/ib_mad_t -* NAME -* ib_mad_t -* -* DESCRIPTION -* IBA defined MAD header (13.4.3) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_mad { - uint8_t base_ver; - uint8_t mgmt_class; - uint8_t class_ver; - uint8_t method; - ib_net16_t status; - ib_net16_t class_spec; - ib_net64_t trans_id; - ib_net16_t attr_id; - ib_net16_t resv; - ib_net32_t attr_mod; -} PACK_SUFFIX ib_mad_t; -#include -/* -* FIELDS -* base_ver -* MAD base format. -* -* mgmt_class -* Class of operation. -* -* class_ver -* Version of MAD class-specific format. -* -* method -* Method to perform, including 'R' bit. -* -* status -* Status of operation. -* -* class_spec -* Reserved for subnet management. -* -* trans_id -* Transaction ID. -* -* attr_id -* Attribute ID. -* -* resv -* Reserved field. -* -* attr_mod -* Attribute modifier. -* -* SEE ALSO -*********/ - -/****s* IBA Base: Types/ib_rmpp_mad_t -* NAME -* ib_rmpp_mad_t -* -* DESCRIPTION -* IBA defined MAD RMPP header (13.6.2.1) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_rmpp_mad { - ib_mad_t common_hdr; - uint8_t rmpp_version; - uint8_t rmpp_type; - uint8_t rmpp_flags; - uint8_t rmpp_status; - ib_net32_t seg_num; - ib_net32_t paylen_newwin; -} PACK_SUFFIX ib_rmpp_mad_t; -#include -/* -* SEE ALSO -* ib_mad_t -*********/ - -/****f* IBA Base: Types/ib_mad_init_new -* NAME -* ib_mad_init_new -* -* DESCRIPTION -* Initializes a MAD common header. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_mad_init_new(IN ib_mad_t * const p_mad, - IN const uint8_t mgmt_class, - IN const uint8_t class_ver, - IN const uint8_t method, - IN const ib_net64_t trans_id, - IN const ib_net16_t attr_id, IN const ib_net32_t attr_mod) -{ - CL_ASSERT(p_mad); - p_mad->base_ver = 1; - p_mad->mgmt_class = mgmt_class; - p_mad->class_ver = class_ver; - p_mad->method = method; - p_mad->status = 0; - p_mad->class_spec = 0; - p_mad->trans_id = trans_id; - p_mad->attr_id = attr_id; - p_mad->resv = 0; - p_mad->attr_mod = attr_mod; -} - -/* -* PARAMETERS -* p_mad -* [in] Pointer to the MAD common header. -* -* mgmt_class -* [in] Class of operation. -* -* class_ver -* [in] Version of MAD class-specific format. -* -* method -* [in] Method to perform, including 'R' bit. -* -* trans_Id -* [in] Transaction ID. -* -* attr_id -* [in] Attribute ID. -* -* attr_mod -* [in] Attribute modifier. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -* ib_mad_t -*********/ - -/****f* IBA Base: Types/ib_mad_init_response -* NAME -* ib_mad_init_response -* -* DESCRIPTION -* Initializes a MAD common header as a response. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_mad_init_response(IN const ib_mad_t * const p_req_mad, - IN ib_mad_t * const p_mad, IN const ib_net16_t status) -{ - CL_ASSERT(p_req_mad); - CL_ASSERT(p_mad); - *p_mad = *p_req_mad; - p_mad->status = status; - if (p_mad->method == IB_MAD_METHOD_SET) - p_mad->method = IB_MAD_METHOD_GET; - p_mad->method |= IB_MAD_METHOD_RESP_MASK; -} - -/* -* PARAMETERS -* p_req_mad -* [in] Pointer to the MAD common header in the original request MAD. -* -* p_mad -* [in] Pointer to the MAD common header to initialize. -* -* status -* [in] MAD Status value to return; -* -* RETURN VALUES -* None. -* -* NOTES -* p_req_mad and p_mad may point to the same MAD. -* -* SEE ALSO -* ib_mad_t -*********/ - -/****f* IBA Base: Types/ib_mad_is_response -* NAME -* ib_mad_is_response -* -* DESCRIPTION -* Returns TRUE if the MAD is a response ('R' bit set) -* or if the MAD is a TRAP REPRESS, -* FALSE otherwise. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_mad_is_response(IN const ib_mad_t * const p_mad) -{ - CL_ASSERT(p_mad); - return (p_mad->method & IB_MAD_METHOD_RESP_MASK || - p_mad->method == IB_MAD_METHOD_TRAP_REPRESS); -} - -/* -* PARAMETERS -* p_mad -* [in] Pointer to the MAD. -* -* RETURN VALUES -* Returns TRUE if the MAD is a response ('R' bit set), -* FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_mad_t -*********/ - -#define IB_RMPP_TYPE_DATA 1 -#define IB_RMPP_TYPE_ACK 2 -#define IB_RMPP_TYPE_STOP 3 -#define IB_RMPP_TYPE_ABORT 4 - -#define IB_RMPP_NO_RESP_TIME 0x1F -#define IB_RMPP_FLAG_ACTIVE 0x01 -#define IB_RMPP_FLAG_FIRST 0x02 -#define IB_RMPP_FLAG_LAST 0x04 - -#define IB_RMPP_STATUS_SUCCESS 0 -#define IB_RMPP_STATUS_RESX 1 /* resources exhausted */ -#define IB_RMPP_STATUS_T2L 118 /* time too long */ -#define IB_RMPP_STATUS_BAD_LEN 119 /* incon. last and payload len */ -#define IB_RMPP_STATUS_BAD_SEG 120 /* incon. first and segment no */ -#define IB_RMPP_STATUS_BADT 121 /* bad rmpp type */ -#define IB_RMPP_STATUS_W2S 122 /* newwindowlast too small */ -#define IB_RMPP_STATUS_S2B 123 /* segment no too big */ -#define IB_RMPP_STATUS_BAD_STATUS 124 /* illegal status */ -#define IB_RMPP_STATUS_UNV 125 /* unsupported version */ -#define IB_RMPP_STATUS_TMR 126 /* too many retries */ -#define IB_RMPP_STATUS_UNSPEC 127 /* unspecified */ - -/****f* IBA Base: Types/ib_rmpp_is_flag_set -* NAME -* ib_rmpp_is_flag_set -* -* DESCRIPTION -* Returns TRUE if the MAD has the given RMPP flag set. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad, - IN const uint8_t flag) -{ - CL_ASSERT(p_rmpp_mad); - return ((p_rmpp_mad->rmpp_flags & flag) == flag); -} - -/* -* PARAMETERS -* ib_rmpp_mad_t -* [in] Pointer to a MAD with an RMPP header. -* -* flag -* [in] The RMPP flag being examined. -* -* RETURN VALUES -* Returns TRUE if the MAD has the given RMPP flag set. -* -* NOTES -* -* SEE ALSO -* ib_mad_t, ib_rmpp_mad_t -*********/ - -static inline void OSM_API -ib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad, - IN const uint8_t resp_time) -{ - CL_ASSERT(p_rmpp_mad); - p_rmpp_mad->rmpp_flags |= (resp_time << 3); -} - -static inline uint8_t OSM_API -ib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad) -{ - CL_ASSERT(p_rmpp_mad); - return ((uint8_t) (p_rmpp_mad->rmpp_flags >> 3)); -} - -/****d* IBA Base: Constants/IB_SMP_DIRECTION -* NAME -* IB_SMP_DIRECTION -* -* DESCRIPTION -* The Direction bit for directed route SMPs. -* -* SOURCE -*/ -#define IB_SMP_DIRECTION_HO 0x8000 -#define IB_SMP_DIRECTION (CL_HTON16(IB_SMP_DIRECTION_HO)) -/**********/ - -/****d* IBA Base: Constants/IB_SMP_STATUS_MASK -* NAME -* IB_SMP_STATUS_MASK -* -* DESCRIPTION -* Mask value for extracting status from a directed route SMP. -* -* SOURCE -*/ -#define IB_SMP_STATUS_MASK_HO 0x7FFF -#define IB_SMP_STATUS_MASK (CL_HTON16(IB_SMP_STATUS_MASK_HO)) -/**********/ - -/****s* IBA Base: Types/ib_smp_t -* NAME -* ib_smp_t -* -* DESCRIPTION -* IBA defined SMP. (14.2.1.2) -* -* SYNOPSIS -*/ -#define IB_SMP_DATA_SIZE 64 -#include -typedef struct _ib_smp { - uint8_t base_ver; - uint8_t mgmt_class; - uint8_t class_ver; - uint8_t method; - ib_net16_t status; - uint8_t hop_ptr; - uint8_t hop_count; - ib_net64_t trans_id; - ib_net16_t attr_id; - ib_net16_t resv; - ib_net32_t attr_mod; - ib_net64_t m_key; - ib_net16_t dr_slid; - ib_net16_t dr_dlid; - uint32_t resv1[7]; - uint8_t data[IB_SMP_DATA_SIZE]; - uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX]; - uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX]; -} PACK_SUFFIX ib_smp_t; -#include -/* -* FIELDS -* base_ver -* MAD base format. -* -* mgmt_class -* Class of operation. -* -* class_ver -* Version of MAD class-specific format. -* -* method -* Method to perform, including 'R' bit. -* -* status -* Status of operation. -* -* hop_ptr -* Hop pointer for directed route MADs. -* -* hop_count -* Hop count for directed route MADs. -* -* trans_Id -* Transaction ID. -* -* attr_id -* Attribute ID. -* -* resv -* Reserved field. -* -* attr_mod -* Attribute modifier. -* -* m_key -* Management key value. -* -* dr_slid -* Directed route source LID. -* -* dr_dlid -* Directed route destination LID. -* -* resv0 -* Reserved for 64 byte alignment. -* -* data -* MAD data payload. -* -* initial_path -* Outbound port list. -* -* return_path -* Inbound port list. -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_smp_get_status -* NAME -* ib_smp_get_status -* -* DESCRIPTION -* Returns the SMP status value in network order. -* -* SYNOPSIS -*/ -static inline ib_net16_t OSM_API -ib_smp_get_status(IN const ib_smp_t * const p_smp) -{ - return ((ib_net16_t) (p_smp->status & IB_SMP_STATUS_MASK)); -} - -/* -* PARAMETERS -* p_smp -* [in] Pointer to the SMP packet. -* -* RETURN VALUES -* Returns the SMP status value in network order. -* -* NOTES -* -* SEE ALSO -* ib_smp_t -*********/ - -/****f* IBA Base: Types/ib_smp_is_response -* NAME -* ib_smp_is_response -* -* DESCRIPTION -* Returns TRUE if the SMP is a response MAD, FALSE otherwise. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_smp_is_response(IN const ib_smp_t * const p_smp) -{ - return (ib_mad_is_response((const ib_mad_t *)p_smp)); -} - -/* -* PARAMETERS -* p_smp -* [in] Pointer to the SMP packet. -* -* RETURN VALUES -* Returns TRUE if the SMP is a response MAD, FALSE otherwise. -* -* NOTES -* -* SEE ALSO -* ib_smp_t -*********/ - -/****f* IBA Base: Types/ib_smp_is_d -* NAME -* ib_smp_is_d -* -* DESCRIPTION -* Returns TRUE if the SMP 'D' (direction) bit is set. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp) -{ - return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION); -} - -/* -* PARAMETERS -* p_smp -* [in] Pointer to the SMP packet. -* -* RETURN VALUES -* Returns TRUE if the SMP 'D' (direction) bit is set. -* -* NOTES -* -* SEE ALSO -* ib_smp_t -*********/ - -/****f* IBA Base: Types/ib_smp_init_new -* NAME -* ib_smp_init_new -* -* DESCRIPTION -* Initializes a MAD common header. -* -* TODO -* This is too big for inlining, but leave it here for now -* since there is not yet another convenient spot. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_smp_init_new(IN ib_smp_t * const p_smp, - IN const uint8_t method, - IN const ib_net64_t trans_id, - IN const ib_net16_t attr_id, - IN const ib_net32_t attr_mod, - IN const uint8_t hop_count, - IN const ib_net64_t m_key, - IN const uint8_t * path_out, - IN const ib_net16_t dr_slid, IN const ib_net16_t dr_dlid) -{ - CL_ASSERT(p_smp); - CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX); - p_smp->base_ver = 1; - p_smp->mgmt_class = IB_MCLASS_SUBN_DIR; - p_smp->class_ver = 1; - p_smp->method = method; - p_smp->status = 0; - p_smp->hop_ptr = 0; - p_smp->hop_count = hop_count; - p_smp->trans_id = trans_id; - p_smp->attr_id = attr_id; - p_smp->resv = 0; - p_smp->attr_mod = attr_mod; - p_smp->m_key = m_key; - p_smp->dr_slid = dr_slid; - p_smp->dr_dlid = dr_dlid; - - memset(p_smp->resv1, 0, - sizeof(p_smp->resv1) + - sizeof(p_smp->data) + - sizeof(p_smp->initial_path) + sizeof(p_smp->return_path)); - - /* copy the path */ - memcpy(&p_smp->initial_path, path_out, sizeof(p_smp->initial_path)); -} - -/* -* PARAMETERS -* p_smp -* [in] Pointer to the SMP packet. -* -* method -* [in] Method to perform, including 'R' bit. -* -* trans_Id -* [in] Transaction ID. -* -* attr_id -* [in] Attribute ID. -* -* attr_mod -* [in] Attribute modifier. -* -* hop_count -* [in] Number of hops in the path. -* -* m_key -* [in] Management key for this SMP. -* -* path_out -* [in] Port array for outbound path. -* -* -* RETURN VALUES -* None. -* -* NOTES -* Payload area is initialized to zero. -* -* -* SEE ALSO -* ib_mad_t -*********/ - -/****f* IBA Base: Types/ib_smp_get_payload_ptr -* NAME -* ib_smp_get_payload_ptr -* -* DESCRIPTION -* Gets a pointer to the SMP payload area. -* -* SYNOPSIS -*/ -static inline void *OSM_API -ib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp) -{ - return ((void *)p_smp->data); -} - -/* -* PARAMETERS -* p_smp -* [in] Pointer to the SMP packet. -* -* RETURN VALUES -* Pointer to SMP payload area. -* -* NOTES -* -* SEE ALSO -* ib_mad_t -*********/ - -/****s* IBA Base: Types/ib_node_info_t -* NAME -* ib_node_info_t -* -* DESCRIPTION -* IBA defined NodeInfo. (14.2.5.3) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_node_info { - uint8_t base_version; - uint8_t class_version; - uint8_t node_type; - uint8_t num_ports; - ib_net64_t sys_guid; - ib_net64_t node_guid; - ib_net64_t port_guid; - ib_net16_t partition_cap; - ib_net16_t device_id; - ib_net32_t revision; - ib_net32_t port_num_vendor_id; -} PACK_SUFFIX ib_node_info_t; -#include -/************/ - -/****s* IBA Base: Types/ib_sa_mad_t -* NAME -* ib_sa_mad_t -* -* DESCRIPTION -* IBA defined SA MAD format. (15.2.1) -* -* SYNOPSIS -*/ -#define IB_SA_DATA_SIZE 200 - -#include -typedef struct _ib_sa_mad { - uint8_t base_ver; - uint8_t mgmt_class; - uint8_t class_ver; - uint8_t method; - ib_net16_t status; - ib_net16_t resv; - ib_net64_t trans_id; - ib_net16_t attr_id; - ib_net16_t resv1; - ib_net32_t attr_mod; - uint8_t rmpp_version; - uint8_t rmpp_type; - uint8_t rmpp_flags; - uint8_t rmpp_status; - ib_net32_t seg_num; - ib_net32_t paylen_newwin; - ib_net64_t sm_key; - ib_net16_t attr_offset; - ib_net16_t resv3; - ib_net64_t comp_mask; - uint8_t data[IB_SA_DATA_SIZE]; -} PACK_SUFFIX ib_sa_mad_t; -#include -/**********/ -#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE) - -static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset) -{ - return (((uint32_t) cl_ntoh16(attr_offset)) << 3); -} - -static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size) -{ - return (cl_hton16((uint16_t) (attr_size >> 3))); -} - -/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr -* NAME -* ib_sa_mad_get_payload_ptr -* -* DESCRIPTION -* Gets a pointer to the SA MAD's payload area. -* -* SYNOPSIS -*/ -static inline void *OSM_API -ib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad) -{ - return ((void *)p_sa_mad->data); -} - -/* -* PARAMETERS -* p_sa_mad -* [in] Pointer to the SA MAD packet. -* -* RETURN VALUES -* Pointer to SA MAD payload area. -* -* NOTES -* -* SEE ALSO -* ib_mad_t -*********/ - -#define IB_NODE_INFO_PORT_NUM_MASK (CL_HTON32(0xFF000000)) -#define IB_NODE_INFO_VEND_ID_MASK (CL_HTON32(0x00FFFFFF)) -#if CPU_LE -#define IB_NODE_INFO_PORT_NUM_SHIFT 0 -#else -#define IB_NODE_INFO_PORT_NUM_SHIFT 24 -#endif - -/****f* IBA Base: Types/ib_node_info_get_local_port_num -* NAME -* ib_node_info_get_local_port_num -* -* DESCRIPTION -* Gets a the local port number from the NodeInfo attribute. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni) -{ - return ((uint8_t) ((p_ni->port_num_vendor_id & - IB_NODE_INFO_PORT_NUM_MASK) - >> IB_NODE_INFO_PORT_NUM_SHIFT)); -} - -/* -* PARAMETERS -* p_ni -* [in] Pointer to a NodeInfo attribute. -* -* RETURN VALUES -* Local port number that returned the attribute. -* -* NOTES -* -* SEE ALSO -* ib_node_info_t -*********/ - -/****f* IBA Base: Types/ib_node_info_get_vendor_id -* NAME -* ib_node_info_get_vendor_id -* -* DESCRIPTION -* Gets the VendorID from the NodeInfo attribute. -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni) -{ - return ((ib_net32_t) (p_ni->port_num_vendor_id & - IB_NODE_INFO_VEND_ID_MASK)); -} - -/* -* PARAMETERS -* p_ni -* [in] Pointer to a NodeInfo attribute. -* -* RETURN VALUES -* VendorID that returned the attribute. -* -* NOTES -* -* SEE ALSO -* ib_node_info_t -*********/ - -#define IB_NODE_DESCRIPTION_SIZE 64 - -#include -typedef struct _ib_node_desc { - // Node String is an array of UTF-8 characters - // that describe the node in text format - // Note that this string is NOT NULL TERMINATED! - uint8_t description[IB_NODE_DESCRIPTION_SIZE]; -} PACK_SUFFIX ib_node_desc_t; -#include - -#include -typedef struct _ib_node_record_t { - ib_net16_t lid; - ib_net16_t resv; - ib_node_info_t node_info; - ib_node_desc_t node_desc; - uint8_t pad[4]; -} PACK_SUFFIX ib_node_record_t; -#include - -/****s* IBA Base: Types/ib_port_info_t -* NAME -* ib_port_info_t -* -* DESCRIPTION -* IBA defined PortInfo. (14.2.5.6) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_info { - ib_net64_t m_key; - ib_net64_t subnet_prefix; - ib_net16_t base_lid; - ib_net16_t master_sm_base_lid; - ib_net32_t capability_mask; - ib_net16_t diag_code; - ib_net16_t m_key_lease_period; - uint8_t local_port_num; - uint8_t link_width_enabled; - uint8_t link_width_supported; - uint8_t link_width_active; - uint8_t state_info1; /* LinkSpeedSupported and PortState */ - uint8_t state_info2; /* PortPhysState and LinkDownDefaultState */ - uint8_t mkey_lmc; - uint8_t link_speed; /* LinkSpeedEnabled and LinkSpeedActive */ - uint8_t mtu_smsl; - uint8_t vl_cap; /* VLCap and InitType */ - uint8_t vl_high_limit; - uint8_t vl_arb_high_cap; - uint8_t vl_arb_low_cap; - uint8_t mtu_cap; - uint8_t vl_stall_life; - uint8_t vl_enforce; - ib_net16_t m_key_violations; - ib_net16_t p_key_violations; - ib_net16_t q_key_violations; - uint8_t guid_cap; - uint8_t subnet_timeout; /* cli_rereg(1b), mcast_pkey_trap_suppr(1b), resrv(1b), timeout(5b) */ - uint8_t resp_time_value; - uint8_t error_threshold; /* local phy errors(4b), overrun errors(4b) */ - ib_net16_t max_credit_hint; - ib_net32_t link_rt_latency; /* reserv(8b), link round trip lat(24b) */ -} PACK_SUFFIX ib_port_info_t; -#include -/************/ - -#define IB_PORT_STATE_MASK 0x0F -#define IB_PORT_LMC_MASK 0x07 -#define IB_PORT_LMC_MAX 0x07 -#define IB_PORT_MPB_MASK 0xC0 -#define IB_PORT_MPB_SHIFT 6 -#define IB_PORT_LINK_SPEED_SHIFT 4 -#define IB_PORT_LINK_SPEED_SUPPORTED_MASK 0xF0 -#define IB_PORT_LINK_SPEED_ACTIVE_MASK 0xF0 -#define IB_PORT_LINK_SPEED_ENABLED_MASK 0x0F -#define IB_PORT_PHYS_STATE_MASK 0xF0 -#define IB_PORT_PHYS_STATE_SHIFT 4 -#define IB_PORT_PHYS_STATE_NO_CHANGE 0 -#define IB_PORT_PHYS_STATE_SLEEP 1 -#define IB_PORT_PHYS_STATE_POLLING 2 -#define IB_PORT_PHYS_STATE_DISABLED 3 -#define IB_PORT_PHYS_STATE_PORTCONFTRAIN 4 -#define IB_PORT_PHYS_STATE_LINKUP 5 -#define IB_PORT_PHYS_STATE_LINKERRRECOVER 6 -#define IB_PORT_PHYS_STATE_PHYTEST 7 -#define IB_PORT_LNKDWNDFTSTATE_MASK 0x0F - -#define IB_PORT_CAP_RESV0 (CL_HTON32(0x00000001)) -#define IB_PORT_CAP_IS_SM (CL_HTON32(0x00000002)) -#define IB_PORT_CAP_HAS_NOTICE (CL_HTON32(0x00000004)) -#define IB_PORT_CAP_HAS_TRAP (CL_HTON32(0x00000008)) -#define IB_PORT_CAP_HAS_IPD (CL_HTON32(0x00000010)) -#define IB_PORT_CAP_HAS_AUTO_MIG (CL_HTON32(0x00000020)) -#define IB_PORT_CAP_HAS_SL_MAP (CL_HTON32(0x00000040)) -#define IB_PORT_CAP_HAS_NV_MKEY (CL_HTON32(0x00000080)) -#define IB_PORT_CAP_HAS_NV_PKEY (CL_HTON32(0x00000100)) -#define IB_PORT_CAP_HAS_LED_INFO (CL_HTON32(0x00000200)) -#define IB_PORT_CAP_SM_DISAB (CL_HTON32(0x00000400)) -#define IB_PORT_CAP_HAS_SYS_IMG_GUID (CL_HTON32(0x00000800)) -#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000)) -#define IB_PORT_CAP_RESV13 (CL_HTON32(0x00002000)) -#define IB_PORT_CAP_RESV14 (CL_HTON32(0x00004000)) -#define IB_PORT_CAP_RESV15 (CL_HTON32(0x00008000)) -#define IB_PORT_CAP_HAS_COM_MGT (CL_HTON32(0x00010000)) -#define IB_PORT_CAP_HAS_SNMP (CL_HTON32(0x00020000)) -#define IB_PORT_CAP_REINIT (CL_HTON32(0x00040000)) -#define IB_PORT_CAP_HAS_DEV_MGT (CL_HTON32(0x00080000)) -#define IB_PORT_CAP_HAS_VEND_CLS (CL_HTON32(0x00100000)) -#define IB_PORT_CAP_HAS_DR_NTC (CL_HTON32(0x00200000)) -#define IB_PORT_CAP_HAS_CAP_NTC (CL_HTON32(0x00400000)) -#define IB_PORT_CAP_HAS_BM (CL_HTON32(0x00800000)) -#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_HTON32(0x01000000)) -#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000)) -#define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000)) -#define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000)) -#define IB_PORT_CAP_HAS_VEND_MADS (CL_HTON32(0x10000000)) -#define IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS (CL_HTON32(0x20000000)) -#define IB_PORT_CAP_HAS_MCAST_FDB_TOP (CL_HTON32(0x40000000)) -#define IB_PORT_CAP_HAS_HIER_INFO (CL_HTON32(0x80000000)) - -/****f* IBA Base: Types/ib_port_info_get_port_state -* NAME -* ib_port_info_get_port_state -* -* DESCRIPTION -* Returns the port state. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_port_state(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->state_info1 & IB_PORT_STATE_MASK)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Port state. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_port_state -* NAME -* ib_port_info_set_port_state -* -* DESCRIPTION -* Sets the port state. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_port_state(IN ib_port_info_t * const p_pi, - IN const uint8_t port_state) -{ - p_pi->state_info1 = (uint8_t) ((p_pi->state_info1 & 0xF0) | port_state); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* port_state -* [in] Port state value to set. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_vl_cap -* NAME -* ib_port_info_get_vl_cap -* -* DESCRIPTION -* Gets the VL Capability of a port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi) -{ - return ((p_pi->vl_cap >> 4) & 0x0F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* VL_CAP field -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_init_type -* NAME -* ib_port_info_get_init_type -* -* DESCRIPTION -* Gets the init type of a port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_init_type(IN const ib_port_info_t * const p_pi) -{ - return (uint8_t) (p_pi->vl_cap & 0x0F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* InitType field -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_op_vls -* NAME -* ib_port_info_get_op_vls -* -* DESCRIPTION -* Gets the operational VLs on a port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi) -{ - return ((p_pi->vl_enforce >> 4) & 0x0F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* OP_VLS field -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_op_vls -* NAME -* ib_port_info_set_op_vls -* -* DESCRIPTION -* Sets the operational VLs on a port. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_op_vls(IN ib_port_info_t * const p_pi, IN const uint8_t op_vls) -{ - p_pi->vl_enforce = - (uint8_t) ((p_pi->vl_enforce & 0x0F) | (op_vls << 4)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* op_vls -* [in] Encoded operation VLs value. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_state_no_change -* NAME -* ib_port_info_set_state_no_change -* -* DESCRIPTION -* Sets the port state fields to the value for "no change". -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi) -{ - ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE); - p_pi->state_info2 = 0; -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_link_speed_sup -* NAME -* ib_port_info_get_link_speed_sup -* -* DESCRIPTION -* Returns the encoded value for the link speed supported. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) ((p_pi->state_info1 & - IB_PORT_LINK_SPEED_SUPPORTED_MASK) >> - IB_PORT_LINK_SPEED_SHIFT)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the link speed supported. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_link_speed_sup -* NAME -* ib_port_info_set_link_speed_sup -* -* DESCRIPTION -* Given an integer of the supported link speed supported. -* Set the appropriate bits in state_info1 -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_link_speed_sup(IN uint8_t const speed, - IN ib_port_info_t * p_pi) -{ - p_pi->state_info1 = - (~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1) | - (IB_PORT_LINK_SPEED_SUPPORTED_MASK & - (speed << IB_PORT_LINK_SPEED_SHIFT)); -} - -/* -* PARAMETERS -* speed -* [in] Supported Speeds Code. -* -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* This function does not return a value. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_port_phys_state -* NAME -* ib_port_info_get_port_phys_state -* -* DESCRIPTION -* Returns the encoded value for the port physical state. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) ((p_pi->state_info2 & - IB_PORT_PHYS_STATE_MASK) >> - IB_PORT_PHYS_STATE_SHIFT)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the port physical state. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_port_phys_state -* NAME -* ib_port_info_set_port_phys_state -* -* DESCRIPTION -* Given an integer of the port physical state, -* Set the appropriate bits in state_info2 -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_port_phys_state(IN uint8_t const phys_state, - IN ib_port_info_t * p_pi) -{ - p_pi->state_info2 = - (~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2) | - (IB_PORT_PHYS_STATE_MASK & - (phys_state << IB_PORT_PHYS_STATE_SHIFT)); -} - -/* -* PARAMETERS -* phys_state -* [in] port physical state. -* -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* This function does not return a value. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_link_down_def_state -* NAME -* ib_port_info_get_link_down_def_state -* -* DESCRIPTION -* Returns the link down default state. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* link down default state of the port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_link_down_def_state -* NAME -* ib_port_info_set_link_down_def_state -* -* DESCRIPTION -* Sets the link down default state of the port. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi, - IN const uint8_t link_dwn_state) -{ - p_pi->state_info2 = - (uint8_t) ((p_pi->state_info2 & 0xF0) | link_dwn_state); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* link_dwn_state -* [in] Link down default state of the port. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_link_speed_active -* NAME -* ib_port_info_get_link_speed_active -* -* DESCRIPTION -* Returns the Link Speed Active value assigned to this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) ((p_pi->link_speed & - IB_PORT_LINK_SPEED_ACTIVE_MASK) >> - IB_PORT_LINK_SPEED_SHIFT)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the link speed active value assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -#define IB_LINK_WIDTH_ACTIVE_1X 1 -#define IB_LINK_WIDTH_ACTIVE_4X 2 -#define IB_LINK_WIDTH_ACTIVE_8X 4 -#define IB_LINK_WIDTH_ACTIVE_12X 8 -#define IB_LINK_SPEED_ACTIVE_2_5 1 -#define IB_LINK_SPEED_ACTIVE_5 2 -#define IB_LINK_SPEED_ACTIVE_10 4 - -/* following v1 ver1.2 p901 */ -#define IB_PATH_RECORD_RATE_2_5_GBS 2 -#define IB_PATH_RECORD_RATE_10_GBS 3 -#define IB_PATH_RECORD_RATE_30_GBS 4 -#define IB_PATH_RECORD_RATE_5_GBS 5 -#define IB_PATH_RECORD_RATE_20_GBS 6 -#define IB_PATH_RECORD_RATE_40_GBS 7 -#define IB_PATH_RECORD_RATE_60_GBS 8 -#define IB_PATH_RECORD_RATE_80_GBS 9 -#define IB_PATH_RECORD_RATE_120_GBS 10 - -#define IB_MIN_RATE IB_PATH_RECORD_RATE_2_5_GBS -#define IB_MAX_RATE IB_PATH_RECORD_RATE_120_GBS - -/****f* IBA Base: Types/ib_port_info_compute_rate -* NAME -* ib_port_info_compute_rate -* -* DESCRIPTION -* Returns the encoded value for the path rate. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi) -{ - uint8_t rate = 0; - - switch (ib_port_info_get_link_speed_active(p_pi)) { - case IB_LINK_SPEED_ACTIVE_2_5: - switch (p_pi->link_width_active) { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_8X: - rate = IB_PATH_RECORD_RATE_20_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate = IB_PATH_RECORD_RATE_30_GBS; - break; - - default: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - } - break; - case IB_LINK_SPEED_ACTIVE_5: - switch (p_pi->link_width_active) { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_5_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_20_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_8X: - rate = IB_PATH_RECORD_RATE_40_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate = IB_PATH_RECORD_RATE_60_GBS; - break; - - default: - rate = IB_PATH_RECORD_RATE_5_GBS; - break; - } - break; - case IB_LINK_SPEED_ACTIVE_10: - switch (p_pi->link_width_active) { - case IB_LINK_WIDTH_ACTIVE_1X: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_4X: - rate = IB_PATH_RECORD_RATE_40_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_8X: - rate = IB_PATH_RECORD_RATE_80_GBS; - break; - - case IB_LINK_WIDTH_ACTIVE_12X: - rate = IB_PATH_RECORD_RATE_120_GBS; - break; - - default: - rate = IB_PATH_RECORD_RATE_10_GBS; - break; - } - break; - default: - rate = IB_PATH_RECORD_RATE_2_5_GBS; - break; - } - - return rate; -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the link speed supported. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_path_get_ipd -* NAME -* ib_path_get_ipd -* -* DESCRIPTION -* Returns the encoded value for the inter packet delay. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_path_get_ipd(IN uint8_t local_link_width_supported, IN uint8_t path_rec_rate) -{ - uint8_t ipd = 0; - - switch (local_link_width_supported) { - /* link_width_supported = 1: 1x */ - case 1: - break; - - /* link_width_supported = 3: 1x or 4x */ - case 3: - switch (path_rec_rate & 0x3F) { - case IB_PATH_RECORD_RATE_2_5_GBS: - ipd = 3; - break; - default: - break; - } - break; - - /* link_width_supported = 11: 1x or 4x or 12x */ - case 11: - switch (path_rec_rate & 0x3F) { - case IB_PATH_RECORD_RATE_2_5_GBS: - ipd = 11; - break; - case IB_PATH_RECORD_RATE_10_GBS: - ipd = 2; - break; - default: - break; - } - break; - - default: - break; - } - - return ipd; -} - -/* -* PARAMETERS -* local_link_width_supported -* [in] link with supported for this port -* -* path_rec_rate -* [in] rate field of the path record -* -* RETURN VALUES -* Returns the ipd -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_mtu_cap -* NAME -* ib_port_info_get_mtu_cap -* -* DESCRIPTION -* Returns the encoded value for the maximum MTU supported by this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->mtu_cap & 0x0F)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encooded value for the maximum MTU supported by this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu -* NAME -* ib_port_info_get_neighbor_mtu -* -* DESCRIPTION -* Returns the encoded value for the neighbor MTU supported by this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) ((p_pi->mtu_smsl & 0xF0) >> 4)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the neighbor MTU at this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu -* NAME -* ib_port_info_set_neighbor_mtu -* -* DESCRIPTION -* Sets the Neighbor MTU value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi, - IN const uint8_t mtu) -{ - CL_ASSERT(mtu <= 5); - CL_ASSERT(mtu != 0); - p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0x0F) | (mtu << 4)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* mtu -* [in] Encoded MTU value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_master_smsl -* NAME -* ib_port_info_get_master_smsl -* -* DESCRIPTION -* Returns the encoded value for the Master SMSL at this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi) -{ - return (uint8_t) (p_pi->mtu_smsl & 0x0F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the encoded value for the Master SMSL at this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_master_smsl -* NAME -* ib_port_info_set_master_smsl -* -* DESCRIPTION -* Sets the Master SMSL value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi, - IN const uint8_t smsl) -{ - p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0xF0) | smsl); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* mtu -* [in] Encoded Master SMSL value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_timeout -* NAME -* ib_port_info_set_timeout -* -* DESCRIPTION -* Sets the encoded subnet timeout value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_timeout(IN ib_port_info_t * const p_pi, - IN const uint8_t timeout) -{ - CL_ASSERT(timeout <= 0x1F); - p_pi->subnet_timeout = - (uint8_t) ((p_pi->subnet_timeout & 0xE0) | (timeout & 0x1F)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* timeout -* [in] Encoded timeout value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_client_rereg -* NAME -* ib_port_info_set_client_rereg -* -* DESCRIPTION -* Sets the encoded client reregistration bit value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi, - IN const uint8_t client_rereg) -{ - CL_ASSERT(client_rereg <= 0x1); - p_pi->subnet_timeout = - (uint8_t) ((p_pi->subnet_timeout & 0x7F) | (client_rereg << 7)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* client_rereg -* [in] Client reregistration value to set (either 1 or 0). -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_mcast_pkey_trap_suppress -* NAME -* ib_port_info_set_mcast_pkey_trap_suppress -* -* DESCRIPTION -* Sets the encoded multicast pkey trap suppresion enabled bit value -* in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi, - IN const uint8_t trap_suppress) -{ - CL_ASSERT(trap_suppress <= 0x1); - p_pi->subnet_timeout = - (uint8_t) ((p_pi->subnet_timeout & 0xBF) | (trap_suppress << 6)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* trap_suppress -* [in] Multicast pkey trap suppresion enabled value to set -* (either 1 or 0). -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_timeout -* NAME -* ib_port_info_get_timeout -* -* DESCRIPTION -* Gets the encoded subnet timeout value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_timeout(IN ib_port_info_t const *p_pi) -{ - return (p_pi->subnet_timeout & 0x1F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* The encoded timeout value -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_client_rereg -* NAME -* ib_port_info_get_client_rereg -* -* DESCRIPTION -* Gets the encoded client reregistration bit value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi) -{ - return ((p_pi->subnet_timeout & 0x80) >> 7); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Client reregistration value (either 1 or 0). -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_mcast_pkey_trap_suppress -* NAME -* ib_port_info_get_mcast_pkey_trap_suppress -* -* DESCRIPTION -* Gets the encoded multicast pkey trap suppresion enabled bit value -* in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const *p_pi) -{ - return ((p_pi->subnet_timeout & 0x40) >> 6); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Multicast PKey trap suppression enabled value (either 1 or 0). -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime -* NAME -* ib_port_info_set_hoq_lifetime -* -* DESCRIPTION -* Sets the Head of Queue Lifetime for which a packet can live in the head -* of VL queue -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi, - IN const uint8_t hoq_life) -{ - p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) | - (p_pi->vl_stall_life & 0xe0)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* hoq_life -* [in] Encoded lifetime value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime -* NAME -* ib_port_info_get_hoq_lifetime -* -* DESCRIPTION -* Gets the Head of Queue Lifetime for which a packet can live in the head -* of VL queue -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->vl_stall_life & 0x1f)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Encoded lifetime value -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_vl_stall_count -* NAME -* ib_port_info_set_vl_stall_count -* -* DESCRIPTION -* Sets the VL Stall Count which define the number of contiguous -* HLL (hoq) drops that will put the VL into stalled mode. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi, - IN const uint8_t vl_stall_count) -{ - p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) | - ((vl_stall_count << 5) & 0xe0)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* vl_stall_count -* [in] value to set -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_vl_stall_count -* NAME -* ib_port_info_get_vl_stall_count -* -* DESCRIPTION -* Gets the VL Stall Count which define the number of contiguous -* HLL (hoq) drops that will put the VL into stalled mode -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* vl stall count -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_lmc -* NAME -* ib_port_info_get_lmc -* -* DESCRIPTION -* Returns the LMC value assigned to this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the LMC value assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_lmc -* NAME -* ib_port_info_set_lmc -* -* DESCRIPTION -* Sets the LMC value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc) -{ - CL_ASSERT(lmc <= IB_PORT_LMC_MAX); - p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* lmc -* [in] LMC value to set, must be less than 7. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled -* NAME -* ib_port_info_get_link_speed_enabled -* -* DESCRIPTION -* Returns the link speed enabled value assigned to this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Port state. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled -* NAME -* ib_port_info_set_link_speed_enabled -* -* DESCRIPTION -* Sets the link speed enabled value in the PortInfo attribute. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi, - IN const uint8_t link_speed_enabled) -{ - p_pi->link_speed = - (uint8_t) ((p_pi->link_speed & 0xF0) | link_speed_enabled); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* link_speed_enabled -* [in] link speed enabled value to set. -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_mpb -* NAME -* ib_port_info_get_mpb -* -* DESCRIPTION -* Returns the M_Key protect bits assigned to this port. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_mpb(IN const ib_port_info_t * const p_pi) -{ - return ((uint8_t) ((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >> - IB_PORT_MPB_SHIFT)); -} - -/* -* PARAMETERS -* p_ni -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the M_Key protect bits assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_mpb -* NAME -* ib_port_info_set_mpb -* -* DESCRIPTION -* Set the M_Key protect bits of this port. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_mpb(IN ib_port_info_t * p_pi, IN uint8_t mpb) -{ - p_pi->mkey_lmc = - (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) | - (IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT)); -} - -/* -* PARAMETERS -* mpb -* [in] M_Key protect bits -* p_ni -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd -* NAME -* ib_port_info_get_local_phy_err_thd -* -* DESCRIPTION -* Returns the Phy Link Threshold -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi) -{ - return (uint8_t) ((p_pi->error_threshold & 0xF0) >> 4); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the Phy Link error threshold assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd -* NAME -* ib_port_info_get_local_overrun_err_thd -* -* DESCRIPTION -* Returns the Credits Overrun Errors Threshold -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi) -{ - return (uint8_t) (p_pi->error_threshold & 0x0F); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* RETURN VALUES -* Returns the Credits Overrun errors threshold assigned to this port. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd -* NAME -* ib_port_info_set_phy_and_overrun_err_thd -* -* DESCRIPTION -* Sets the Phy Link and Credits Overrun Errors Threshold -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi, - IN uint8_t phy_threshold, - IN uint8_t overrun_threshold) -{ - p_pi->error_threshold = - (uint8_t) (((phy_threshold & 0x0F) << 4) | - (overrun_threshold & 0x0F)); -} - -/* -* PARAMETERS -* p_pi -* [in] Pointer to a PortInfo attribute. -* -* phy_threshold -* [in] Physical Link Errors Threshold above which Trap 129 is generated -* -* overrun_threshold -* [in] Credits overrun Errors Threshold above which Trap 129 is generated -* -* RETURN VALUES -* None. -* -* NOTES -* -* SEE ALSO -*********/ - -typedef uint8_t ib_svc_name_t[64]; - -#include -typedef struct _ib_service_record { - ib_net64_t service_id; - ib_gid_t service_gid; - ib_net16_t service_pkey; - ib_net16_t resv; - ib_net32_t service_lease; - uint8_t service_key[16]; - ib_svc_name_t service_name; - uint8_t service_data8[16]; - ib_net16_t service_data16[8]; - ib_net32_t service_data32[4]; - ib_net64_t service_data64[2]; -} PACK_SUFFIX ib_service_record_t; -#include - -#include -typedef struct _ib_portinfo_record { - ib_net16_t lid; - uint8_t port_num; - uint8_t resv; - ib_port_info_t port_info; -} PACK_SUFFIX ib_portinfo_record_t; -#include - -#include -typedef struct _ib_link_record { - ib_net16_t from_lid; - uint8_t from_port_num; - uint8_t to_port_num; - ib_net16_t to_lid; - uint8_t pad[2]; -} PACK_SUFFIX ib_link_record_t; -#include - -#include -typedef struct _ib_sminfo_record { - ib_net16_t lid; - uint16_t resv0; - ib_sm_info_t sm_info; - uint8_t pad[7]; -} PACK_SUFFIX ib_sminfo_record_t; -#include - -/****s* IBA Base: Types/ib_lft_record_t -* NAME -* ib_lft_record_t -* -* DESCRIPTION -* IBA defined LinearForwardingTableRecord (15.2.5.6) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_lft_record { - ib_net16_t lid; - ib_net16_t block_num; - uint32_t resv0; - uint8_t lft[64]; -} PACK_SUFFIX ib_lft_record_t; -#include -/************/ - -/****s* IBA Base: Types/ib_mft_record_t -* NAME -* ib_mft_record_t -* -* DESCRIPTION -* IBA defined MulticastForwardingTableRecord (15.2.5.8) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_mft_record { - ib_net16_t lid; - ib_net16_t position_block_num; - uint32_t resv0; - ib_net16_t mft[IB_MCAST_BLOCK_SIZE]; -} PACK_SUFFIX ib_mft_record_t; -#include -/************/ - -/****s* IBA Base: Types/ib_switch_info_t -* NAME -* ib_switch_info_t -* -* DESCRIPTION -* IBA defined SwitchInfo. (14.2.5.4) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_switch_info { - ib_net16_t lin_cap; - ib_net16_t rand_cap; - ib_net16_t mcast_cap; - ib_net16_t lin_top; - uint8_t def_port; - uint8_t def_mcast_pri_port; - uint8_t def_mcast_not_port; - uint8_t life_state; - ib_net16_t lids_per_port; - ib_net16_t enforce_cap; - uint8_t flags; - uint8_t resvd; - ib_net16_t mcast_top; -} PACK_SUFFIX ib_switch_info_t; -#include -/************/ - -#include -typedef struct _ib_switch_info_record { - ib_net16_t lid; - uint16_t resv0; - ib_switch_info_t switch_info; -} PACK_SUFFIX ib_switch_info_record_t; -#include - -#define IB_SWITCH_PSC 0x04 - -/****f* IBA Base: Types/ib_switch_info_get_state_change -* NAME -* ib_switch_info_get_state_change -* -* DESCRIPTION -* Returns the value of the state change flag. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si) -{ - return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC); -} - -/* -* PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. -* -* RETURN VALUES -* Returns the value of the state change flag. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_switch_info_clear_state_change -* NAME -* ib_switch_info_clear_state_change -* -* DESCRIPTION -* Clears the switch's state change bit. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si) -{ - p_si->life_state = (uint8_t) (p_si->life_state & 0xFB); -} - -/* -* PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_switch_info_get_opt_sl2vlmapping -* NAME -* ib_switch_info_get_state_opt_sl2vlmapping -* -* DESCRIPTION -* Returns the value of the optimized SLtoVLMapping programming flag. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si) -{ - return ((p_si->life_state & 0x01) == 0x01); -} - -/* -* PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. -* -* RETURN VALUES -* Returns the value of the optimized SLtoVLMapping programming flag. -* -* NOTES -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0 -* NAME -* ib_switch_info_is_enhanced_port0 -* -* DESCRIPTION -* Returns TRUE if the enhancedPort0 bit is on (meaning the switch -* port zero supports enhanced functions). -* Returns FALSE otherwise. -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si) -{ - return ((p_si->flags & 0x08) == 0x08); -} - -/* -* PARAMETERS -* p_si -* [in] Pointer to a SwitchInfo attribute. -* -* RETURN VALUES -* Returns TRUE if the switch supports enhanced port 0. FALSE otherwise. -* -* NOTES -* -* SEE ALSO -*********/ - -/****s* IBA Base: Types/ib_guid_info_t -* NAME -* ib_guid_info_t -* -* DESCRIPTION -* IBA defined GuidInfo. (14.2.5.5) -* -* SYNOPSIS -*/ -#define GUID_TABLE_MAX_ENTRIES 8 - -#include -typedef struct _ib_guid_info { - ib_net64_t guid[GUID_TABLE_MAX_ENTRIES]; -} PACK_SUFFIX ib_guid_info_t; -#include -/************/ - -#include -typedef struct _ib_guidinfo_record { - ib_net16_t lid; - uint8_t block_num; - uint8_t resv; - uint32_t reserved; - ib_guid_info_t guid_info; -} PACK_SUFFIX ib_guidinfo_record_t; -#include - -#define IB_MULTIPATH_MAX_GIDS 11 /* Support max that can fit into first MAD (for now) */ - -#include -typedef struct _ib_multipath_rec_t { - ib_net32_t hop_flow_raw; - uint8_t tclass; - uint8_t num_path; - ib_net16_t pkey; - ib_net16_t qos_class_sl; - uint8_t mtu; - uint8_t rate; - uint8_t pkt_life; - uint8_t service_id_8msb; - uint8_t independence; /* formerly resv2 */ - uint8_t sgid_count; - uint8_t dgid_count; - uint8_t service_id_56lsb[7]; - ib_gid_t gids[IB_MULTIPATH_MAX_GIDS]; -} PACK_SUFFIX ib_multipath_rec_t; -#include -/* -* FIELDS -* hop_flow_raw -* Global routing parameters: hop count, flow label and raw bit. -* -* tclass -* Another global routing parameter. -* -* num_path -* Reversible path - 1 bit to say if path is reversible. -* num_path [6:0] In queries, maximum number of paths to return. -* In responses, undefined. -* -* pkey -* Partition key (P_Key) to use on this path. -* -* qos_class_sl -* QoS class and service level to use on this path. -* -* mtu -* MTU and MTU selector fields to use on this path -* rate -* Rate and rate selector fields to use on this path. -* -* pkt_life -* Packet lifetime -* -* service_id_8msb -* 8 most significant bits of Service ID -* -* service_id_56lsb -* 56 least significant bits of Service ID -* -* preference -* Indicates the relative merit of this path versus other path -* records returned from the SA. Lower numbers are better. -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_num_path -* NAME -* ib_multipath_rec_num_path -* -* DESCRIPTION -* Get max number of paths to return. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec) -{ - return (p_rec->num_path & 0x7F); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Maximum number of paths to return for each unique SGID_DGID combination. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_set_sl -* NAME -* ib_multipath_rec_set_sl -* -* DESCRIPTION -* Set path service level. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_multipath_rec_set_sl( - IN ib_multipath_rec_t* const p_rec, - IN const uint8_t sl ) -{ - p_rec->qos_class_sl = - (p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_QOS_CLASS_MASK)) | - cl_hton16(sl & IB_MULTIPATH_REC_SL_MASK); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the MultiPath record object. -* -* sl -* [in] Service level to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_sl -* NAME -* ib_multipath_rec_sl -* -* DESCRIPTION -* Get multipath service level. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) ((cl_ntoh16(p_rec->qos_class_sl)) & IB_MULTIPATH_REC_SL_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* SL. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_set_qos_class -* NAME -* ib_multipath_rec_set_qos_class -* -* DESCRIPTION -* Set path QoS class. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_multipath_rec_set_qos_class( - IN ib_multipath_rec_t* const p_rec, - IN const uint16_t qos_class ) -{ - p_rec->qos_class_sl = - (p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_SL_MASK)) | - cl_hton16(qos_class << 4); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the MultiPath record object. -* -* qos_class -* [in] QoS class to set. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_qos_class -* NAME -* ib_multipath_rec_qos_class -* -* DESCRIPTION -* Get QoS class. -* -* SYNOPSIS -*/ -static inline uint16_t OSM_API -ib_multipath_rec_qos_class( - IN const ib_multipath_rec_t* const p_rec ) -{ - return (cl_ntoh16( p_rec->qos_class_sl ) >> 4); -} -/* -* PARAMETERS -* p_rec -* [in] Pointer to the MultiPath record object. -* -* RETURN VALUES -* QoS class of the MultiPath record. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_mtu -* NAME -* ib_multipath_rec_mtu -* -* DESCRIPTION -* Get encoded path MTU. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path MTU. -* 1: 256 -* 2: 512 -* 3: 1024 -* 4: 2048 -* 5: 4096 -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_mtu_sel -* NAME -* ib_multipath_rec_mtu_sel -* -* DESCRIPTION -* Get encoded multipath MTU selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) ((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path MTU selector value (for queries). -* 0: greater than MTU specified -* 1: less than MTU specified -* 2: exactly the MTU specified -* 3: largest MTU available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_rate -* NAME -* ib_multipath_rec_rate -* -* DESCRIPTION -* Get encoded multipath rate. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->rate & IB_MULTIPATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded multipath rate. -* 2: 2.5 Gb/sec. -* 3: 10 Gb/sec. -* 4: 30 Gb/sec. -* others: reserved -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_rate_sel -* NAME -* ib_multipath_rec_rate_sel -* -* DESCRIPTION -* Get encoded multipath rate selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) - ((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path rate selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: largest rate available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_pkt_life -* NAME -* ib_multipath_rec_pkt_life -* -* DESCRIPTION -* Get encoded multipath pkt_life. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) (p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded multipath pkt_life = 4.096 usec * 2 ** PacketLifeTime. -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel -* NAME -* ib_multipath_rec_pkt_life_sel -* -* DESCRIPTION -* Get encoded multipath pkt_lifetime selector. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec) -{ - return ((uint8_t) - ((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6)); -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Encoded path pkt_lifetime selector value (for queries). -* 0: greater than rate specified -* 1: less than rate specified -* 2: exactly the rate specified -* 3: smallest packet lifetime available -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -/****f* IBA Base: Types/ib_multipath_rec_service_id -* NAME -* ib_multipath_rec_service_id -* -* DESCRIPTION -* Get multipath service id. -* -* SYNOPSIS -*/ -static inline ib_net64_t OSM_API -ib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec) -{ - union { - ib_net64_t sid; - uint8_t sid_arr[8]; - } sid_union; - sid_union.sid_arr[0] = p_rec->service_id_8msb; - memcpy(&sid_union.sid_arr[1], p_rec->service_id_56lsb, 7); - return sid_union.sid; -} - -/* -* PARAMETERS -* p_rec -* [in] Pointer to the multipath record object. -* -* RETURN VALUES -* Service ID -* -* NOTES -* -* SEE ALSO -* ib_multipath_rec_t -*********/ - -#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK 32 -/****s* IBA Base: Types/ib_pkey_table_t -* NAME -* ib_pkey_table_t -* -* DESCRIPTION -* IBA defined PKey table. (14.2.5.7) -* -* SYNOPSIS -*/ - -#include -typedef struct _ib_pkey_table { - ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK]; -} PACK_SUFFIX ib_pkey_table_t; -#include -/************/ - -/****s* IBA Base: Types/ib_pkey_table_record_t -* NAME -* ib_pkey_table_record_t -* -* DESCRIPTION -* IBA defined P_Key Table Record for SA Query. (15.2.5.11) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_pkey_table_record { - ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 - uint16_t block_num; - uint8_t port_num; // for switch: port number, for CA: reserved - uint8_t reserved1; - uint16_t reserved2; - ib_pkey_table_t pkey_tbl; -} PACK_SUFFIX ib_pkey_table_record_t; -#include -/************/ - -#define IB_DROP_VL 15 -#define IB_MAX_NUM_VLS 16 -/****s* IBA Base: Types/ib_slvl_table_t -* NAME -* ib_slvl_table_t -* -* DESCRIPTION -* IBA defined SL2VL Mapping Table Attribute. (14.2.5.8) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_slvl_table { - uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS / 2]; -} PACK_SUFFIX ib_slvl_table_t; -#include -/************/ - -/****s* IBA Base: Types/ib_slvl_table_record_t -* NAME -* ib_slvl_table_record_t -* -* DESCRIPTION -* IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_slvl_table_record { - ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 - uint8_t in_port_num; // reserved for CAs - uint8_t out_port_num; // reserved for CAs - uint32_t resv; - ib_slvl_table_t slvl_tbl; -} PACK_SUFFIX ib_slvl_table_record_t; -#include -/************/ - -/****f* IBA Base: Types/ib_slvl_table_set -* NAME -* ib_slvl_table_set -* -* DESCRIPTION -* Set slvl table entry. -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl, - IN uint8_t sl_index, IN uint8_t vl) -{ - uint8_t idx = sl_index / 2; - CL_ASSERT(vl <= 15); - CL_ASSERT(sl_index <= 15); - - if (sl_index % 2) - /* this is an odd sl. Need to update the ls bits */ - p_slvl_tbl->raw_vl_by_sl[idx] = - (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl; - else - /* this is an even sl. Need to update the ms bits */ - p_slvl_tbl->raw_vl_by_sl[idx] = - (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F); -} - -/* -* PARAMETERS -* p_slvl_tbl -* [in] pointer to ib_slvl_table_t object. -* -* sl_index -* [in] the sl index in the table to be updated. -* -* vl -* [in] the vl value to update for that sl. -* -* RETURN VALUES -* None -* -* NOTES -* -* SEE ALSO -* ib_slvl_table_t -*********/ - -/****f* IBA Base: Types/ib_slvl_table_get -* NAME -* ib_slvl_table_get -* -* DESCRIPTION -* Get slvl table entry. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index) -{ - uint8_t idx = sl_index / 2; - CL_ASSERT(sl_index <= 15); - - if (sl_index % 2) - /* this is an odd sl. Need to return the ls bits. */ - return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F); - else - /* this is an even sl. Need to return the ms bits. */ - return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4); -} - -/* -* PARAMETERS -* p_slvl_tbl -* [in] pointer to ib_slvl_table_t object. -* -* sl_index -* [in] the sl index in the table whose value should be returned. -* -* RETURN VALUES -* vl for the requested sl_index. -* -* NOTES -* -* SEE ALSO -* ib_slvl_table_t -*********/ - -/****s* IBA Base: Types/ib_vl_arb_element_t -* NAME -* ib_vl_arb_element_t -* -* DESCRIPTION -* IBA defined VL Arbitration Table Element. (14.2.5.9) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_vl_arb_element { - uint8_t vl; - uint8_t weight; -} PACK_SUFFIX ib_vl_arb_element_t; -#include -/************/ - -#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32 - -/****s* IBA Base: Types/ib_vl_arb_table_t -* NAME -* ib_vl_arb_table_t -* -* DESCRIPTION -* IBA defined VL Arbitration Table. (14.2.5.9) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_vl_arb_table { - ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK]; -} PACK_SUFFIX ib_vl_arb_table_t; -#include -/************/ - -/****s* IBA Base: Types/ib_vl_arb_table_record_t -* NAME -* ib_vl_arb_table_record_t -* -* DESCRIPTION -* IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_vl_arb_table_record { - ib_net16_t lid; // for CA: lid of port, for switch lid of port 0 - uint8_t port_num; - uint8_t block_num; - uint32_t reserved; - ib_vl_arb_table_t vl_arb_tbl; -} PACK_SUFFIX ib_vl_arb_table_record_t; -#include -/************/ - -/* - * Global route header information received with unreliable datagram messages - */ -#include -typedef struct _ib_grh { - ib_net32_t ver_class_flow; - ib_net16_t resv1; - uint8_t resv2; - uint8_t hop_limit; - ib_gid_t src_gid; - ib_gid_t dest_gid; -} PACK_SUFFIX ib_grh_t; -#include - -/****f* IBA Base: Types/ib_grh_get_ver_class_flow -* NAME -* ib_grh_get_ver_class_flow -* -* DESCRIPTION -* Get encoded version, traffic class and flow label in grh -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow, - OUT uint8_t * const p_ver, - OUT uint8_t * const p_tclass, - OUT uint32_t * const p_flow_lbl) -{ - ib_net32_t tmp_ver_class_flow; - - if (p_ver) - *p_ver = (uint8_t) (ver_class_flow & 0x0f); - - tmp_ver_class_flow = ver_class_flow >> 4; - - if (p_tclass) - *p_tclass = (uint8_t) (tmp_ver_class_flow & 0xff); - - tmp_ver_class_flow = tmp_ver_class_flow >> 8; - - if (p_flow_lbl) - *p_flow_lbl = tmp_ver_class_flow & 0xfffff; -} - -/* -* PARAMETERS -* ver_class_flow -* [in] the version, traffic class and flow label info. -* -* RETURN VALUES -* p_ver -* [out] pointer to the version info. -* -* p_tclass -* [out] pointer to the traffic class info. -* -* p_flow_lbl -* [out] pointer to the flow label info -* -* NOTES -* -* SEE ALSO -* ib_grh_t -*********/ - -/****f* IBA Base: Types/ib_grh_set_ver_class_flow -* NAME -* ib_grh_set_ver_class_flow -* -* DESCRIPTION -* Set encoded version, traffic class and flow label in grh -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_grh_set_ver_class_flow(IN const uint8_t ver, - IN const uint8_t tclass, IN const uint32_t flow_lbl) -{ - ib_net32_t ver_class_flow; - - ver_class_flow = flow_lbl; - ver_class_flow = ver_class_flow << 8; - ver_class_flow = ver_class_flow | tclass; - ver_class_flow = ver_class_flow << 4; - ver_class_flow = ver_class_flow | ver; - return (ver_class_flow); -} - -/* -* PARAMETERS -* ver -* [in] the version info. -* -* tclass -* [in] the traffic class info. -* -* flow_lbl -* [in] the flow label info -* -* RETURN VALUES -* ver_class_flow -* [out] the version, traffic class and flow label info. -* -* NOTES -* -* SEE ALSO -* ib_grh_t -*********/ - -/****s* IBA Base: Types/ib_member_rec_t -* NAME -* ib_member_rec_t -* -* DESCRIPTION -* Multicast member record, used to create, join, and leave multicast -* groups. -* -* SYNOPSIS -*/ -#include -typedef struct _ib_member_rec { - ib_gid_t mgid; - ib_gid_t port_gid; - ib_net32_t qkey; - ib_net16_t mlid; - uint8_t mtu; - uint8_t tclass; - ib_net16_t pkey; - uint8_t rate; - uint8_t pkt_life; - ib_net32_t sl_flow_hop; - uint8_t scope_state; - uint8_t proxy_join:1; - uint8_t reserved[2]; - uint8_t pad[4]; -} PACK_SUFFIX ib_member_rec_t; -#include -/* -* FIELDS -* mgid -* Multicast GID address for this multicast group. -* -* port_gid -* Valid GID of the endpoint joining this multicast group. -* -* qkey -* Q_Key to be sued by this multicast group. -* -* mlid -* Multicast LID for this multicast group. -* -* mtu -* MTU and MTU selector fields to use on this path -* -* tclass -* Another global routing parameter. -* -* pkey -* Partition key (P_Key) to use for this member. -* -* rate -* Rate and rate selector fields to use on this path. -* -* pkt_life -* Packet lifetime -* -* sl_flow_hop -* Global routing parameters: service level, hop count, and flow label. -* -* scope_state -* MGID scope and JoinState of multicast request. -* -* proxy_join -* Enables others in the Partition to proxy add/remove from the group -* -* SEE ALSO -*********/ - -/****f* IBA Base: Types/ib_member_get_sl_flow_hop -* NAME -* ib_member_get_sl_flow_hop -* -* DESCRIPTION -* Get encoded sl, flow label, and hop limit -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop, - OUT uint8_t * const p_sl, - OUT uint32_t * const p_flow_lbl, - OUT uint8_t * const p_hop) -{ - uint32_t tmp; - - tmp = cl_ntoh32(sl_flow_hop); - if (p_hop) - *p_hop = (uint8_t) tmp; - tmp >>= 8; - - if (p_flow_lbl) - *p_flow_lbl = (uint32_t) (tmp & 0xfffff); - tmp >>= 20; - - if (p_sl) - *p_sl = (uint8_t) tmp; -} - -/* -* PARAMETERS -* sl_flow_hop -* [in] the sl, flow label, and hop limit of MC Group -* -* RETURN VALUES -* p_sl -* [out] pointer to the service level -* -* p_flow_lbl -* [out] pointer to the flow label info -* -* p_hop -* [out] pointer to the hop count limit. -* -* NOTES -* -* SEE ALSO -* ib_member_rec_t -*********/ - -/****f* IBA Base: Types/ib_member_set_sl_flow_hop -* NAME -* ib_member_set_sl_flow_hop -* -* DESCRIPTION -* Set encoded sl, flow label, and hop limit -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_member_set_sl_flow_hop(IN const uint8_t sl, - IN const uint32_t flow_label, - IN const uint8_t hop_limit) -{ - uint32_t tmp; - - tmp = (sl << 28) | ((flow_label & 0xfffff) << 8) | hop_limit; - return cl_hton32(tmp); -} - -/* -* PARAMETERS -* sl -* [in] the service level. -* -* flow_lbl -* [in] the flow label info -* -* hop_limit -* [in] the hop limit. -* -* RETURN VALUES -* sl_flow_hop -* [out] the encoded sl, flow label, and hop limit -* -* NOTES -* -* SEE ALSO -* ib_member_rec_t -*********/ - -/****f* IBA Base: Types/ib_member_get_scope_state -* NAME -* ib_member_get_scope_state -* -* DESCRIPTION -* Get encoded MGID scope and JoinState -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_member_get_scope_state(IN const uint8_t scope_state, - OUT uint8_t * const p_scope, - OUT uint8_t * const p_state) -{ - uint8_t tmp_scope_state; - - if (p_state) - *p_state = (uint8_t) (scope_state & 0x0f); - - tmp_scope_state = scope_state >> 4; - - if (p_scope) - *p_scope = (uint8_t) (tmp_scope_state & 0x0f); - -} - -/* -* PARAMETERS -* scope_state -* [in] the scope and state -* -* RETURN VALUES -* p_scope -* [out] pointer to the MGID scope -* -* p_state -* [out] pointer to the join state -* -* NOTES -* -* SEE ALSO -* ib_member_rec_t -*********/ - -/****f* IBA Base: Types/ib_member_set_scope_state -* NAME -* ib_member_set_scope_state -* -* DESCRIPTION -* Set encoded version, MGID scope and JoinState -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_member_set_scope_state(IN const uint8_t scope, IN const uint8_t state) -{ - uint8_t scope_state; - - scope_state = scope; - scope_state = scope_state << 4; - scope_state = scope_state | state; - return (scope_state); -} - -/* -* PARAMETERS -* scope -* [in] the MGID scope -* -* state -* [in] the JoinState -* -* RETURN VALUES -* scope_state -* [out] the encoded one -* -* NOTES -* -* SEE ALSO -* ib_member_rec_t -*********/ - -/****f* IBA Base: Types/ib_member_set_join_state -* NAME -* ib_member_set_join_state -* -* DESCRIPTION -* Set JoinState -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec, - IN const uint8_t state) -{ - /* keep the scope as it is */ - p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state); -} - -/* -* PARAMETERS -* p_mc_rec -* [in] pointer to the member record -* -* state -* [in] the JoinState -* -* RETURN VALUES -* NONE -* -* NOTES -* -* SEE ALSO -* ib_member_rec_t -*********/ - -/* - * Join State Codes: - */ -#define IB_MC_REC_STATE_FULL_MEMBER 0x01 -#define IB_MC_REC_STATE_NON_MEMBER 0x02 -#define IB_MC_REC_STATE_SEND_ONLY_NON_MEMBER 0x04 - -/* - * Generic MAD notice types - */ -#define IB_NOTICE_TYPE_FATAL 0x00 -#define IB_NOTICE_TYPE_URGENT 0x01 -#define IB_NOTICE_TYPE_SECURITY 0x02 -#define IB_NOTICE_TYPE_SUBN_MGMT 0x03 -#define IB_NOTICE_TYPE_INFO 0x04 -#define IB_NOTICE_TYPE_EMPTY 0x7F - -#include -typedef struct _ib_mad_notice_attr // Total Size calc Accumulated -{ - uint8_t generic_type; // 1 1 - union _notice_g_or_v { - struct _notice_generic // 5 6 - { - uint8_t prod_type_msb; - ib_net16_t prod_type_lsb; - ib_net16_t trap_num; - } PACK_SUFFIX generic; - struct _notice_vend { - uint8_t vend_id_msb; - ib_net16_t vend_id_lsb; - ib_net16_t dev_id; - } PACK_SUFFIX vend; - } g_or_v; - ib_net16_t issuer_lid; // 2 8 - ib_net16_t toggle_count; // 2 10 - union _data_details // 54 64 - { - struct _raw_data { - uint8_t details[54]; - } PACK_SUFFIX raw_data; - struct _ntc_64_67 { - uint8_t res[6]; - ib_gid_t gid; // the Node or Multicast Group that came in/out - } PACK_SUFFIX ntc_64_67; - struct _ntc_128 { - ib_net16_t sw_lid; // the sw lid of which link state changed - } PACK_SUFFIX ntc_128; - struct _ntc_129_131 { - ib_net16_t pad; - ib_net16_t lid; // lid and port number of the violation - uint8_t port_num; - } PACK_SUFFIX ntc_129_131; - struct _ntc_144 { - ib_net16_t pad1; - ib_net16_t lid; // lid where change occured - uint8_t pad2; // reserved - uint8_t local_changes; // 7b reserved 1b local changes - ib_net32_t new_cap_mask; // new capability mask - ib_net16_t change_flgs; // 13b reserved 3b change flags - } PACK_SUFFIX ntc_144; - struct _ntc_145 { - ib_net16_t pad1; - ib_net16_t lid; // lid where sys guid changed - ib_net16_t pad2; - ib_net64_t new_sys_guid; // new system image guid - } PACK_SUFFIX ntc_145; - struct _ntc_256 { // total: 54 - ib_net16_t pad1; // 2 - ib_net16_t lid; // 2 - ib_net16_t dr_slid; // 2 - uint8_t method; // 1 - uint8_t pad2; // 1 - ib_net16_t attr_id; // 2 - ib_net32_t attr_mod; // 4 - ib_net64_t mkey; // 8 - uint8_t pad3; // 1 - uint8_t dr_trunc_hop; // 1 - uint8_t dr_rtn_path[30]; // 30 - } PACK_SUFFIX ntc_256; - struct _ntc_257_258 // violation of p/q_key // 49 - { - ib_net16_t pad1; // 2 - ib_net16_t lid1; // 2 - ib_net16_t lid2; // 2 - ib_net32_t key; // 4 - ib_net32_t qp1; // 4b sl, 4b pad, 24b qp1 - ib_net32_t qp2; // 8b pad, 24b qp2 - ib_gid_t gid1; // 16 - ib_gid_t gid2; // 16 - } PACK_SUFFIX ntc_257_258; - struct _ntc_259 // pkey violation from switch 51 - { - ib_net16_t data_valid; // 2 - ib_net16_t lid1; // 2 - ib_net16_t lid2; // 2 - ib_net16_t pkey; // 2 - ib_net32_t sl_qp1; // 4b sl, 4b pad, 24b qp1 - ib_net32_t qp2; // 8b pad, 24b qp2 - ib_gid_t gid1; // 16 - ib_gid_t gid2; // 16 - ib_net16_t sw_lid; // 2 - uint8_t port_no; // 1 - } PACK_SUFFIX ntc_259; - struct _ntc_bkey_259 // bkey violation - { - ib_net16_t lidaddr; - uint8_t method; - uint8_t reserved; - ib_net16_t attribute_id; - ib_net32_t attribute_modifier; - ib_net32_t qp; // qp is low 24 bits - ib_net64_t bkey; - ib_gid_t gid; - } PACK_SUFFIX ntc_bkey_259; - } data_details; - ib_gid_t issuer_gid; // 16 80 -} PACK_SUFFIX ib_mad_notice_attr_t; -#include - -/** - * Trap 259 masks - */ -#define TRAP_259_MASK_SL (CL_HTON32(0xF0000000)) -#define TRAP_259_MASK_QP (CL_HTON32(0x00FFFFFF)) - -/** - * Trap 144 masks - */ -#define TRAP_144_MASK_OTHER_LOCAL_CHANGES 0x01 -#define TRAP_144_MASK_SM_PRIORITY_CHANGE (CL_HTON16(0x0008)) -#define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004)) -#define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002)) -#define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE (CL_HTON16(0x0001)) - -/****f* IBA Base: Types/ib_notice_is_generic -* NAME -* ib_notice_is_generic -* -* DESCRIPTION -* Check if the notice is generic -* -* SYNOPSIS -*/ -static inline boolean_t OSM_API -ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc) -{ - return (p_ntc->generic_type & 0x80); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* RETURN VALUES -* TRUE if mad is generic -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_get_type -* NAME -* ib_notice_get_type -* -* DESCRIPTION -* Get the notice type -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc) -{ - return p_ntc->generic_type & 0x7f; -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* RETURN VALUES -* TRUE if mad is generic -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_get_prod_type -* NAME -* ib_notice_get_prod_type -* -* DESCRIPTION -* Get the notice Producer Type of Generic Notice -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc) -{ - uint32_t pt; - - pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) | - (p_ntc->g_or_v.generic.prod_type_msb << 16); - return cl_hton32(pt); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* RETURN VALUES -* The producer type -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_set_prod_type -* NAME -* ib_notice_set_prod_type -* -* DESCRIPTION -* Set the notice Producer Type of Generic Notice -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc, - IN ib_net32_t prod_type_val) -{ - uint32_t ptv = cl_ntoh32(prod_type_val); - p_ntc->g_or_v.generic.prod_type_lsb = - cl_hton16((uint16_t) (ptv & 0x0000ffff)); - p_ntc->g_or_v.generic.prod_type_msb = - (uint8_t) ((ptv & 0x00ff0000) >> 16); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* prod_type -* [in] The producer Type code -* -* RETURN VALUES -* None -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_set_prod_type_ho -* NAME -* ib_notice_set_prod_type_ho -* -* DESCRIPTION -* Set the notice Producer Type of Generic Notice given Host Order -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc, - IN uint32_t prod_type_val_ho) -{ - p_ntc->g_or_v.generic.prod_type_lsb = - cl_hton16((uint16_t) (prod_type_val_ho & 0x0000ffff)); - p_ntc->g_or_v.generic.prod_type_msb = - (uint8_t) ((prod_type_val_ho & 0x00ff0000) >> 16); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* prod_type -* [in] The producer Type code in host order -* -* RETURN VALUES -* None -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_get_vend_id -* NAME -* ib_notice_get_vend_id -* -* DESCRIPTION -* Get the Vendor Id of Vendor type Notice -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc) -{ - uint32_t vi; - - vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) | - (p_ntc->g_or_v.vend.vend_id_msb << 16); - return cl_hton32(vi); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* RETURN VALUES -* The Vendor Id of Vendor type Notice -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_set_vend_id -* NAME -* ib_notice_set_vend_id -* -* DESCRIPTION -* Set the notice Producer Type of Generic Notice -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc, IN ib_net32_t vend_id) -{ - uint32_t vi = cl_ntoh32(vend_id); - p_ntc->g_or_v.vend.vend_id_lsb = - cl_hton16((uint16_t) (vi & 0x0000ffff)); - p_ntc->g_or_v.vend.vend_id_msb = (uint8_t) ((vi & 0x00ff0000) >> 16); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* vend_id -* [in] The producer Type code -* -* RETURN VALUES -* None -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -/****f* IBA Base: Types/ib_notice_set_vend_id_ho -* NAME -* ib_notice_set_vend_id_ho -* -* DESCRIPTION -* Set the notice Producer Type of Generic Notice given a host order value -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc, - IN uint32_t vend_id_ho) -{ - p_ntc->g_or_v.vend.vend_id_lsb = - cl_hton16((uint16_t) (vend_id_ho & 0x0000ffff)); - p_ntc->g_or_v.vend.vend_id_msb = - (uint8_t) ((vend_id_ho & 0x00ff0000) >> 16); -} - -/* -* PARAMETERS -* p_ntc -* [in] Pointer to the notice MAD attribute -* -* vend_id_ho -* [in] The producer Type code in host order -* -* RETURN VALUES -* None -* -* SEE ALSO -* ib_mad_notice_attr_t -*********/ - -#include -typedef struct _ib_inform_info { - ib_gid_t gid; - ib_net16_t lid_range_begin; - ib_net16_t lid_range_end; - ib_net16_t reserved1; - uint8_t is_generic; - uint8_t subscribe; - ib_net16_t trap_type; - union _inform_g_or_v { - struct _inform_generic { - ib_net16_t trap_num; - ib_net32_t qpn_resp_time_val; - uint8_t reserved2; - uint8_t node_type_msb; - ib_net16_t node_type_lsb; - } PACK_SUFFIX generic; - struct _inform_vend { - ib_net16_t dev_id; - ib_net32_t qpn_resp_time_val; - uint8_t reserved2; - uint8_t vendor_id_msb; - ib_net16_t vendor_id_lsb; - } PACK_SUFFIX vend; - } PACK_SUFFIX g_or_v; -} PACK_SUFFIX ib_inform_info_t; -#include - -/****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time -* NAME -* ib_inform_info_get_qpn_resp_time -* -* DESCRIPTION -* Get QPN of the inform info -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val, - OUT ib_net32_t * const p_qpn, - OUT uint8_t * const p_resp_time_val) -{ - uint32_t tmp = cl_ntoh32(qpn_resp_time_val); - - if (p_qpn) - *p_qpn = cl_hton32((tmp & 0xffffff00) >> 8); - if (p_resp_time_val) - *p_resp_time_val = (uint8_t) (tmp & 0x0000001f); -} - -/* -* PARAMETERS -* qpn_resp_time_val -* [in] the qpn and resp time val from the mad -* -* RETURN VALUES -* p_qpn -* [out] pointer to the qpn -* -* p_state -* [out] pointer to the resp time val -* -* NOTES -* -* SEE ALSO -* ib_inform_info_t -*********/ - -/****f* IBA Base: Types/ib_inform_info_set_qpn -* NAME -* ib_inform_info_set_qpn -* -* DESCRIPTION -* Set the QPN of the inform info -* -* SYNOPSIS -*/ -static inline void OSM_API -ib_inform_info_set_qpn(IN ib_inform_info_t * p_ii, IN ib_net32_t const qpn) -{ - uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val); - - p_ii->g_or_v.generic.qpn_resp_time_val = - cl_hton32((tmp & 0x000000ff) | ((cl_ntoh32(qpn) << 8) & 0xffffff00) - ); -} - -/* -* PARAMETERS -* -* NOTES -* -* SEE ALSO -* ib_inform_info_t -*********/ - -/****f* IBA Base: Types/ib_inform_info_get_prod_type -* NAME -* ib_inform_info_get_prod_type -* -* DESCRIPTION -* Get Producer Type of the Inform Info -* 13.4.8.3 InformInfo -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf) -{ - uint32_t nt; - - nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) | - (p_inf->g_or_v.generic.node_type_msb << 16); - return cl_hton32(nt); -} - -/* -* PARAMETERS -* p_inf -* [in] pointer to an inform info -* -* RETURN VALUES -* The producer type -* -* NOTES -* -* SEE ALSO -* ib_inform_info_t -*********/ - -/****f* IBA Base: Types/ib_inform_info_get_vend_id -* NAME -* ib_inform_info_get_vend_id -* -* DESCRIPTION -* Get Node Type of the Inform Info -* -* SYNOPSIS -*/ -static inline ib_net32_t OSM_API -ib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf) -{ - uint32_t vi; - - vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) | - (p_inf->g_or_v.vend.vendor_id_msb << 16); - return cl_hton32(vi); -} - -/* -* PARAMETERS -* p_inf -* [in] pointer to an inform info -* -* RETURN VALUES -* The node type -* -* NOTES -* -* SEE ALSO -* ib_inform_info_t -*********/ - -/****s* IBA Base: Types/ib_inform_info_record_t -* NAME -* ib_inform_info_record_t -* -* DESCRIPTION -* IBA defined InformInfo Record. (15.2.5.12) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_inform_info_record { - ib_gid_t subscriber_gid; - ib_net16_t subscriber_enum; - uint8_t reserved[6]; - ib_inform_info_t inform_info; - uint8_t pad[4]; -} PACK_SUFFIX ib_inform_info_record_t; -#include - -/****s* IBA Base: Types/ib_perfmgt_mad_t -* NAME -* ib_perfmgt_mad_t -* -* DESCRIPTION -* IBA defined Perf Management MAD (16.3.1) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_perfmgt_mad { - ib_mad_t header; - uint8_t resv[40]; -#define IB_PM_DATA_SIZE 192 - uint8_t data[IB_PM_DATA_SIZE]; -} PACK_SUFFIX ib_perfmgt_mad_t; -#include -/* -* FIELDS -* header -* Common MAD header. -* -* resv -* Reserved. -* -* data -* Performance Management payload. The structure and content of this field -* depends upon the method, attr_id, and attr_mod fields in the header. -* -* SEE ALSO -* ib_mad_t -*********/ - -/****s* IBA Base: Types/ib_port_counters -* NAME -* ib_port_counters_t -* -* DESCRIPTION -* IBA defined PortCounters Attribute. (16.1.3.5) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_counters { - uint8_t reserved; - uint8_t port_select; - ib_net16_t counter_select; - ib_net16_t symbol_err_cnt; - uint8_t link_err_recover; - uint8_t link_downed; - ib_net16_t rcv_err; - ib_net16_t rcv_rem_phys_err; - ib_net16_t rcv_switch_relay_err; - ib_net16_t xmit_discards; - uint8_t xmit_constraint_err; - uint8_t rcv_constraint_err; - uint8_t counter_select2; - uint8_t link_int_buffer_overrun; - ib_net16_t resv; - ib_net16_t vl15_dropped; - ib_net32_t xmit_data; - ib_net32_t rcv_data; - ib_net32_t xmit_pkts; - ib_net32_t rcv_pkts; - ib_net32_t xmit_wait; -} PACK_SUFFIX ib_port_counters_t; -#include - -#define PC_LINK_INT(integ_buf_over) ((integ_buf_over & 0xF0) >> 4) -#define PC_BUF_OVERRUN(integ_buf_over) (integ_buf_over & 0x0F) - -/****s* IBA Base: Types/ib_port_counters_ext -* NAME -* ib_port_counters_ext_t -* -* DESCRIPTION -* IBA defined PortCounters Extended Attribute. (16.1.4.11) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_counters_ext { - uint8_t reserved; - uint8_t port_select; - ib_net16_t counter_select; - ib_net32_t reserved2; - ib_net64_t xmit_data; - ib_net64_t rcv_data; - ib_net64_t xmit_pkts; - ib_net64_t rcv_pkts; - ib_net64_t unicast_xmit_pkts; - ib_net64_t unicast_rcv_pkts; - ib_net64_t multicast_xmit_pkts; - ib_net64_t multicast_rcv_pkts; -} PACK_SUFFIX ib_port_counters_ext_t; -#include - -/****s* IBA Base: Types/ib_port_samples_control -* NAME -* ib_port_samples_control_t -* -* DESCRIPTION -* IBA defined PortSamplesControl Attribute. (16.1.3.2) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_samples_control { - uint8_t op_code; - uint8_t port_select; - uint8_t tick; - uint8_t counter_width; /* 5 bits res : 3bits counter_width */ - ib_net32_t counter_mask; /* 2 bits res : 3 bits counter_mask : 27 bits counter_masks_1to9 */ - ib_net16_t counter_mask_10to14; /* 1 bits res : 15 bits counter_masks_10to14 */ - uint8_t sample_mech; - uint8_t sample_status; /* 6 bits res : 2 bits sample_status */ - ib_net64_t option_mask; - ib_net64_t vendor_mask; - ib_net32_t sample_start; - ib_net32_t sample_interval; - ib_net16_t tag; - ib_net16_t counter_select0; - ib_net16_t counter_select1; - ib_net16_t counter_select2; - ib_net16_t counter_select3; - ib_net16_t counter_select4; - ib_net16_t counter_select5; - ib_net16_t counter_select6; - ib_net16_t counter_select7; - ib_net16_t counter_select8; - ib_net16_t counter_select9; - ib_net16_t counter_select10; - ib_net16_t counter_select11; - ib_net16_t counter_select12; - ib_net16_t counter_select13; - ib_net16_t counter_select14; -} PACK_SUFFIX ib_port_samples_control_t; -#include - -/****d* IBA Base: Types/CounterSelect values -* NAME -* Counter select values -* -* DESCRIPTION -* Mandatory counter select values (16.1.3.3) -* -* SYNOPSIS -*/ -#define IB_CS_PORT_XMIT_DATA (CL_HTON16(0x0001)) -#define IB_CS_PORT_RCV_DATA (CL_HTON16(0x0002)) -#define IB_CS_PORT_XMIT_PKTS (CL_HTON16(0x0003)) -#define IB_CS_PORT_RCV_PKTS (CL_HTON16(0x0004)) -#define IB_CS_PORT_XMIT_WAIT (CL_HTON16(0x0005)) - -/****s* IBA Base: Types/ib_port_samples_result -* NAME -* ib_port_samples_result_t -* -* DESCRIPTION -* IBA defined PortSamplesControl Attribute. (16.1.3.2) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_samples_result { - ib_net16_t tag; - ib_net16_t sample_status; /* 14 bits res : 2 bits sample_status */ - ib_net32_t counter0; - ib_net32_t counter1; - ib_net32_t counter2; - ib_net32_t counter3; - ib_net32_t counter4; - ib_net32_t counter5; - ib_net32_t counter6; - ib_net32_t counter7; - ib_net32_t counter8; - ib_net32_t counter9; - ib_net32_t counter10; - ib_net32_t counter11; - ib_net32_t counter12; - ib_net32_t counter13; - ib_net32_t counter14; -} PACK_SUFFIX ib_port_samples_result_t; -#include - -/****s* IBA Base: Types/ib_port_xmit_data_sl -* NAME -* ib_port_xmit_data_sl_t -* -* DESCRIPTION -* IBA defined PortXmitDataSL Attribute. (A13.6.4) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_xmit_data_sl { - uint8_t reserved; - uint8_t port_select; - ib_net16_t counter_select; - ib_net32_t port_xmit_data_sl[16]; - uint8_t resv[124]; -} PACK_SUFFIX ib_port_xmit_data_sl_t; -#include - -/****s* IBA Base: Types/ib_port_rcv_data_sl -* NAME -* ib_port_rcv_data_sl_t -* -* DESCRIPTION -* IBA defined PortRcvDataSL Attribute. (A13.6.4) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_port_rcv_data_sl { - uint8_t reserved; - uint8_t port_select; - ib_net16_t counter_select; - ib_net32_t port_rcv_data_sl[16]; - uint8_t resv[124]; -} PACK_SUFFIX ib_port_rcv_data_sl_t; -#include - -/****d* IBA Base: Types/DM_SVC_NAME -* NAME -* DM_SVC_NAME -* -* DESCRIPTION -* IBA defined Device Management service name (16.3) -* -* SYNOPSIS -*/ -#define DM_SVC_NAME "DeviceManager.IBTA" -/* -* SEE ALSO -*********/ - -/****s* IBA Base: Types/ib_dm_mad_t -* NAME -* ib_dm_mad_t -* -* DESCRIPTION -* IBA defined Device Management MAD (16.3.1) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_dm_mad { - ib_mad_t header; - uint8_t resv[40]; -#define IB_DM_DATA_SIZE 192 - uint8_t data[IB_DM_DATA_SIZE]; -} PACK_SUFFIX ib_dm_mad_t; -#include -/* -* FIELDS -* header -* Common MAD header. -* -* resv -* Reserved. -* -* data -* Device Management payload. The structure and content of this field -* depend upon the method, attr_id, and attr_mod fields in the header. -* -* SEE ALSO -* ib_mad_t -*********/ - -/****s* IBA Base: Types/ib_iou_info_t -* NAME -* ib_iou_info_t -* -* DESCRIPTION -* IBA defined IO Unit information structure (16.3.3.3) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_iou_info { - ib_net16_t change_id; - uint8_t max_controllers; - uint8_t diag_rom; -#define IB_DM_CTRL_LIST_SIZE 128 - uint8_t controller_list[IB_DM_CTRL_LIST_SIZE]; -#define IOC_NOT_INSTALLED 0x0 -#define IOC_INSTALLED 0x1 -// Reserved values 0x02-0xE -#define SLOT_DOES_NOT_EXIST 0xF -} PACK_SUFFIX ib_iou_info_t; -#include -/* -* FIELDS -* change_id -* Value incremented, with rollover, by any change to the controller_list. -* -* max_controllers -* Number of slots in controller_list. -* -* diag_rom -* A byte containing two fields: DiagDeviceID and OptionROM. -* These fields may be read using the ib_iou_info_diag_dev_id -* and ib_iou_info_option_rom functions. -* -* controller_list -* A series of 4-bit nibbles, with each nibble representing a slot -* in the IO Unit. Individual nibbles may be read using the -* ioc_at_slot function. -* -* SEE ALSO -* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot -*********/ - -/****f* IBA Base: Types/ib_iou_info_diag_dev_id -* NAME -* ib_iou_info_diag_dev_id -* -* DESCRIPTION -* Returns the DiagDeviceID. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info) -{ - return ((uint8_t) (p_iou_info->diag_rom >> 6 & 1)); -} - -/* -* PARAMETERS -* p_iou_info -* [in] Pointer to the IO Unit information structure. -* -* RETURN VALUES -* DiagDeviceID field of the IO Unit information. -* -* NOTES -* -* SEE ALSO -* ib_iou_info_t -*********/ - -/****f* IBA Base: Types/ib_iou_info_option_rom -* NAME -* ib_iou_info_option_rom -* -* DESCRIPTION -* Returns the OptionROM. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info) -{ - return ((uint8_t) (p_iou_info->diag_rom >> 7)); -} - -/* -* PARAMETERS -* p_iou_info -* [in] Pointer to the IO Unit information structure. -* -* RETURN VALUES -* OptionROM field of the IO Unit information. -* -* NOTES -* -* SEE ALSO -* ib_iou_info_t -*********/ - -/****f* IBA Base: Types/ioc_at_slot -* NAME -* ioc_at_slot -* -* DESCRIPTION -* Returns the IOC value at the specified slot. -* -* SYNOPSIS -*/ -static inline uint8_t OSM_API -ioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot) -{ - if (slot >= IB_DM_CTRL_LIST_SIZE) - return SLOT_DOES_NOT_EXIST; - else - return (int8_t) - ((slot % 2) ? - ((p_iou_info->controller_list[slot / 2] & 0xf0) >> 4) : - (p_iou_info->controller_list[slot / 2] & 0x0f)); -} - -/* -* PARAMETERS -* p_iou_info -* [in] Pointer to the IO Unit information structure. -* -* slot -* [in] Pointer to the IO Unit information structure. -* -* RETURN VALUES -* OptionROM field of the IO Unit information. -* -* NOTES -* -* SEE ALSO -* ib_iou_info_t -*********/ - -/****s* IBA Base: Types/ib_ioc_profile_t -* NAME -* ib_ioc_profile_t -* -* DESCRIPTION -* IBA defined IO Controller profile structure (16.3.3.4) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_ioc_profile { - ib_net64_t ioc_guid; - ib_net32_t vend_id; - ib_net32_t dev_id; - ib_net16_t dev_ver; - ib_net16_t resv2; - ib_net32_t subsys_vend_id; - ib_net32_t subsys_id; - ib_net16_t io_class; - ib_net16_t io_subclass; - ib_net16_t protocol; - ib_net16_t protocol_ver; - ib_net32_t resv3; - ib_net16_t send_msg_depth; - uint8_t resv4; - uint8_t rdma_read_depth; - ib_net32_t send_msg_size; - ib_net32_t rdma_size; - uint8_t ctrl_ops_cap; -#define CTRL_OPS_CAP_ST 0x01 -#define CTRL_OPS_CAP_SF 0x02 -#define CTRL_OPS_CAP_RT 0x04 -#define CTRL_OPS_CAP_RF 0x08 -#define CTRL_OPS_CAP_WT 0x10 -#define CTRL_OPS_CAP_WF 0x20 -#define CTRL_OPS_CAP_AT 0x40 -#define CTRL_OPS_CAP_AF 0x80 - uint8_t resv5; - uint8_t num_svc_entries; -#define MAX_NUM_SVC_ENTRIES 0xff - uint8_t resv6[9]; -#define CTRL_ID_STRING_LEN 64 - char id_string[CTRL_ID_STRING_LEN]; -} PACK_SUFFIX ib_ioc_profile_t; -#include -/* -* FIELDS -* ioc_guid -* An EUI-64 GUID used to uniquely identify the IO controller. -* -* vend_id -* IO controller vendor ID, IEEE format. -* -* dev_id -* A number assigned by the vendor to identify the type of controller. -* -* dev_ver -* A number assigned by the vendor to identify the divice version. -* -* subsys_vend_id -* ID of the vendor of the enclosure, if any, in which the IO controller -* resides in IEEE format; otherwise zero. -* -* subsys_id -* A number identifying the subsystem where the controller resides. -* -* io_class -* 0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand -* Architecture. 0xffff = Vendor specific. -* -* io_subclass -* 0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand -* Architecture. 0xffff = Vendor specific. This shall be set to 0xfff -* if the io_class component is 0xffff. -* -* protocol -* 0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand -* Architecture. 0xffff = Vendor specific. This shall be set to 0xfff -* if the io_class component is 0xffff. -* -* protocol_ver -* Protocol specific. -* -* send_msg_depth -* Maximum depth of the send message queue. -* -* rdma_read_depth -* Maximum depth of the per-channel RDMA read queue. -* -* send_msg_size -* Maximum size of send messages. -* -* ctrl_ops_cap -* Supported operation types of this IO controller. A bit set to one -* for affirmation of supported capability. -* -* num_svc_entries -* Number of entries in the service entries table. -* -* id_string -* UTF-8 encoded string for identifying the controller to an operator. -* -* SEE ALSO -* ib_dm_mad_t -*********/ - -static inline uint32_t OSM_API -ib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile) -{ - return (cl_ntoh32(p_ioc_profile->vend_id) >> 8); -} - -static inline void OSM_API -ib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile, - IN const uint32_t vend_id) -{ - p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8); -} - -/****s* IBA Base: Types/ib_svc_entry_t -* NAME -* ib_svc_entry_t -* -* DESCRIPTION -* IBA defined IO Controller service entry structure (16.3.3.5) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_svc_entry { -#define MAX_SVC_ENTRY_NAME_LEN 40 - char name[MAX_SVC_ENTRY_NAME_LEN]; - ib_net64_t id; -} PACK_SUFFIX ib_svc_entry_t; -#include -/* -* FIELDS -* name -* UTF-8 encoded, null-terminated name of the service. -* -* id -* An identifier of the associated Service. -* -* SEE ALSO -* ib_svc_entries_t -*********/ - -/****s* IBA Base: Types/ib_svc_entries_t -* NAME -* ib_svc_entries_t -* -* DESCRIPTION -* IBA defined IO Controller service entry array (16.3.3.5) -* -* SYNOPSIS -*/ -#include -typedef struct _ib_svc_entries { -#define SVC_ENTRY_COUNT 4 - ib_svc_entry_t service_entry[SVC_ENTRY_COUNT]; -} PACK_SUFFIX ib_svc_entries_t; -#include -/* -* FIELDS -* service_entry -* An array of IO controller service entries. -* -* SEE ALSO -* ib_dm_mad_t, ib_svc_entry_t -*********/ - -static inline void OSM_API -ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi, - OUT uint8_t * const p_slot, - OUT uint8_t * const p_lo, OUT uint8_t * const p_hi) -{ - ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi); - - if (p_slot) - *p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f); - if (p_hi) - *p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff); - if (p_lo) - *p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff); -} - -/* - * IBA defined information describing an I/O controller - */ -#include -typedef struct _ib_ioc_info { - ib_net64_t module_guid; - ib_net64_t iou_guid; - ib_ioc_profile_t ioc_profile; - ib_net64_t access_key; - uint16_t initiators_conf; - uint8_t resv[38]; -} PACK_SUFFIX ib_ioc_info_t; -#include - -/* - * The following definitions are shared between the Access Layer and VPD - */ -typedef struct _ib_ca *__ptr64 ib_ca_handle_t; -typedef struct _ib_pd *__ptr64 ib_pd_handle_t; -typedef struct _ib_rdd *__ptr64 ib_rdd_handle_t; -typedef struct _ib_mr *__ptr64 ib_mr_handle_t; -typedef struct _ib_mw *__ptr64 ib_mw_handle_t; -typedef struct _ib_qp *__ptr64 ib_qp_handle_t; -typedef struct _ib_eec *__ptr64 ib_eec_handle_t; -typedef struct _ib_cq *__ptr64 ib_cq_handle_t; -typedef struct _ib_av *__ptr64 ib_av_handle_t; -typedef struct _ib_mcast *__ptr64 ib_mcast_handle_t; - -/* Currently for windows branch, use the extended version of ib special verbs struct - in order to be compliant with Infinicon ib_types; later we'll change it to support - OpenSM ib_types.h */ - -#ifndef __WIN__ -/****d* Access Layer/ib_api_status_t -* NAME -* ib_api_status_t -* -* DESCRIPTION -* Function return codes indicating the success or failure of an API call. -* Note that success is indicated by the return value IB_SUCCESS, which -* is always zero. -* -* NOTES -* IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call -* in the pre-ioctl step itself. -* -* SYNOPSIS -*/ -typedef enum _ib_api_status_t { - IB_SUCCESS, - IB_INSUFFICIENT_RESOURCES, - IB_INSUFFICIENT_MEMORY, - IB_INVALID_PARAMETER, - IB_INVALID_SETTING, - IB_NOT_FOUND, - IB_TIMEOUT, - IB_CANCELED, - IB_INTERRUPTED, - IB_INVALID_PERMISSION, - IB_UNSUPPORTED, - IB_OVERFLOW, - IB_MAX_MCAST_QPS_REACHED, - IB_INVALID_QP_STATE, - IB_INVALID_EEC_STATE, - IB_INVALID_APM_STATE, - IB_INVALID_PORT_STATE, - IB_INVALID_STATE, - IB_RESOURCE_BUSY, - IB_INVALID_PKEY, - IB_INVALID_LKEY, - IB_INVALID_RKEY, - IB_INVALID_MAX_WRS, - IB_INVALID_MAX_SGE, - IB_INVALID_CQ_SIZE, - IB_INVALID_SERVICE_TYPE, - IB_INVALID_GID, - IB_INVALID_LID, - IB_INVALID_GUID, - IB_INVALID_CA_HANDLE, - IB_INVALID_AV_HANDLE, - IB_INVALID_CQ_HANDLE, - IB_INVALID_EEC_HANDLE, - IB_INVALID_QP_HANDLE, - IB_INVALID_PD_HANDLE, - IB_INVALID_MR_HANDLE, - IB_INVALID_MW_HANDLE, - IB_INVALID_RDD_HANDLE, - IB_INVALID_MCAST_HANDLE, - IB_INVALID_CALLBACK, - IB_INVALID_AL_HANDLE, /* InfiniBand Access Layer */ - IB_INVALID_HANDLE, /* InfiniBand Access Layer */ - IB_ERROR, /* InfiniBand Access Layer */ - IB_REMOTE_ERROR, /* Infiniband Access Layer */ - IB_VERBS_PROCESSING_DONE, /* See Notes above */ - IB_INVALID_WR_TYPE, - IB_QP_IN_TIMEWAIT, - IB_EE_IN_TIMEWAIT, - IB_INVALID_PORT, - IB_NOT_DONE, - IB_UNKNOWN_ERROR /* ALWAYS LAST ENUM VALUE! */ -} ib_api_status_t; -/*****/ - -OSM_EXPORT const char *ib_error_str[]; - -/****f* IBA Base: Types/ib_get_err_str -* NAME -* ib_get_err_str -* -* DESCRIPTION -* Returns a string for the specified status value. -* -* SYNOPSIS -*/ -static inline const char *OSM_API ib_get_err_str(IN ib_api_status_t status) -{ - if (status > IB_UNKNOWN_ERROR) - status = IB_UNKNOWN_ERROR; - return (ib_error_str[status]); -} - -/* -* PARAMETERS -* status -* [in] status value -* -* RETURN VALUES -* Pointer to the status description string. -* -* NOTES -* -* SEE ALSO -*********/ - -/****d* Verbs/ib_async_event_t -* NAME -* ib_async_event_t -- Async event types -* -* DESCRIPTION -* This type indicates the reason the async callback was called. -* The context in the ib_event_rec_t indicates the resource context -* that associated with the callback. For example, for IB_AE_CQ_ERROR -* the context provided during the ib_create_cq is returned in the event. -* -* SYNOPSIS -*/ -typedef enum _ib_async_event_t { - IB_AE_SQ_ERROR = 1, - IB_AE_SQ_DRAINED, - IB_AE_RQ_ERROR, - IB_AE_CQ_ERROR, - IB_AE_QP_FATAL, - IB_AE_QP_COMM, - IB_AE_QP_APM, - IB_AE_EEC_FATAL, - IB_AE_EEC_COMM, - IB_AE_EEC_APM, - IB_AE_LOCAL_FATAL, - IB_AE_PKEY_TRAP, - IB_AE_QKEY_TRAP, - IB_AE_MKEY_TRAP, - IB_AE_PORT_TRAP, - IB_AE_SYSIMG_GUID_TRAP, - IB_AE_BUF_OVERRUN, - IB_AE_LINK_INTEGRITY, - IB_AE_FLOW_CTRL_ERROR, - IB_AE_BKEY_TRAP, - IB_AE_QP_APM_ERROR, - IB_AE_EEC_APM_ERROR, - IB_AE_WQ_REQ_ERROR, - IB_AE_WQ_ACCESS_ERROR, - IB_AE_PORT_ACTIVE, - IB_AE_PORT_DOWN, - IB_AE_UNKNOWN /* ALWAYS LAST ENUM VALUE */ -} ib_async_event_t; -/* -* VALUES -* IB_AE_SQ_ERROR -* An error occurred when accessing the send queue of the QP or EEC. -* This event is optional. -* -* IB_AE_SQ_DRAINED -* The send queue of the specified QP has completed the outstanding -* messages in progress when the state change was requested and, if -* applicable, has received all acknowledgements for those messages. -* -* IB_AE_RQ_ERROR -* An error occurred when accessing the receive queue of the QP or EEC. -* This event is optional. -* -* IB_AE_CQ_ERROR -* An error occurred when writing an entry to the CQ. -* -* IB_AE_QP_FATAL -* A catastrophic error occurred while accessing or processing the -* work queue that prevents reporting of completions. -* -* IB_AE_QP_COMM -* The first packet has arrived for the receive work queue where the -* QP is still in the RTR state. -* -* IB_AE_QP_APM -* If alternate path migration is supported, this event indicates that -* the QP connection has migrated to the alternate path. -* -* IB_AE_EEC_FATAL -* If reliable datagram service is supported, this event indicates that -* a catastrophic error occurred while accessing or processing the EEC -* that prevents reporting of completions. -* -* IB_AE_EEC_COMM -* If reliable datagram service is supported, this event indicates that -* the first packet has arrived for the receive work queue where the -* EEC is still in the RTR state. -* -* IB_AE_EEC_APM -* If reliable datagram service and alternate path migration is supported, -* this event indicates that the EEC connection has migrated to the -* alternate path. -* -* IB_AE_LOCAL_FATAL -* A catastrophic HCA error occurred which cannot be attributed to -* any resource; behavior is indeterminate. -* -* IB_AE_PKEY_TRAP -* A PKEY violation was detected. This event is optional. -* -* IB_AE_QKEY_TRAP -* A QKEY violation was detected. This event is optional. -* -* IB_AE_MKEY_TRAP -* A MKEY violation was detected. This event is optional. -* -* IB_AE_PORT_TRAP -* A port capability change was detected. This event is optional. -* -* IB_AE_SYSIMG_GUID_TRAP -* If the system image GUID is supported, this event indicates that -* the system image GUID of this HCA has been changed. This event -* is optional. -* -* IB_AE_BUF_OVERRUN -* The number of consecutive flow control update periods with at least -* one overrun error in each period has exceeded the threshold specified -* in the port info attributes. This event is optional. -* -* IB_AE_LINK_INTEGRITY -* The detection of excessively frequent local physical errors has -* exceeded the threshold specified in the port info attributes. This -* event is optional. -* -* IB_AE_FLOW_CTRL_ERROR -* An HCA watchdog timer monitoring the arrival of flow control updates -* has expired without receiving an update. This event is optional. -* -* IB_AE_BKEY_TRAP -* An BKEY violation was detected. This event is optional. -* -* IB_AE_QP_APM_ERROR -* If alternate path migration is supported, this event indicates that -* an incoming path migration request to this QP was not accepted. -* -* IB_AE_EEC_APM_ERROR -* If reliable datagram service and alternate path migration is supported, -* this event indicates that an incoming path migration request to this -* EEC was not accepted. -* -* IB_AE_WQ_REQ_ERROR -* An OpCode violation was detected at the responder. -* -* IB_AE_WQ_ACCESS_ERROR -* An access violation was detected at the responder. -* -* IB_AE_PORT_ACTIVE -* If the port active event is supported, this event is generated -* when the link becomes active: IB_LINK_ACTIVE. -* -* IB_AE_PORT_DOWN -* The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED, -* IB_LINK_DOWN. -* -* IB_AE_UNKNOWN -* An unknown error occurred which cannot be attributed to any -* resource; behavior is indeterminate. -* -*****/ - -OSM_EXPORT const char *ib_async_event_str[]; - -/****f* IBA Base: Types/ib_get_async_event_str -* NAME -* ib_get_async_event_str -* -* DESCRIPTION -* Returns a string for the specified asynchronous event. -* -* SYNOPSIS -*/ -static inline const char *OSM_API -ib_get_async_event_str(IN ib_async_event_t event) -{ - if (event > IB_AE_UNKNOWN) - event = IB_AE_UNKNOWN; - return (ib_async_event_str[event]); -} - -/* -* PARAMETERS -* event -* [in] event value -* -* RETURN VALUES -* Pointer to the asynchronous event description string. -* -* NOTES -* -* SEE ALSO -*********/ - -/****s* Verbs/ib_event_rec_t -* NAME -* ib_event_rec_t -- Async event notification record -* -* DESCRIPTION -* When an async event callback is made, this structure is passed to indicate -* the type of event, the source of event that caused it, and the context -* associated with this event. -* -* context -- Context of the resource that caused the event. -* -- ca_context if this is a port/adapter event. -* -- qp_context if the source is a QP event -* -- cq_context if the source is a CQ event. -* -- ee_context if the source is an EE event. -* -* SYNOPSIS -*/ -typedef struct _ib_event_rec { - void *context; - ib_async_event_t type; - /* HCA vendor specific event information. */ - uint64_t vendor_specific; - /* The following structures are valid only for trap types. */ - union _trap { - struct { - uint16_t lid; - ib_net64_t port_guid; - uint8_t port_num; - /* - * The following structure is valid only for - * P_KEY, Q_KEY, and M_KEY violation traps. - */ - struct { - uint8_t sl; - uint16_t src_lid; - uint16_t dest_lid; - union _key { - uint16_t pkey; - uint32_t qkey; - uint64_t mkey; - } key; - uint32_t src_qp; - uint32_t dest_qp; - ib_gid_t src_gid; - ib_gid_t dest_gid; - } violation; - } info; - ib_net64_t sysimg_guid; - } trap; -} ib_event_rec_t; -/*******/ - -/****d* Access Layer/ib_atomic_t -* NAME -* ib_atomic_t -* -* DESCRIPTION -* Indicates atomicity levels supported by an adapter. -* -* SYNOPSIS -*/ -typedef enum _ib_atomic_t { - IB_ATOMIC_NONE, - IB_ATOMIC_LOCAL, - IB_ATOMIC_GLOBAL -} ib_atomic_t; -/* -* VALUES -* IB_ATOMIC_NONE -* Atomic operations not supported. -* -* IB_ATOMIC_LOCAL -* Atomic operations guaranteed between QPs of a single CA. -* -* IB_ATOMIC_GLOBAL -* Atomic operations are guaranteed between CA and any other entity -* in the system. -*****/ - -/****s* Access Layer/ib_port_cap_t -* NAME -* ib_port_cap_t -* -* DESCRIPTION -* Indicates which management agents are currently available on the specified -* port. -* -* SYNOPSIS -*/ -typedef struct _ib_port_cap { - boolean_t cm; - boolean_t snmp; - boolean_t dev_mgmt; - boolean_t vend; - boolean_t sm; - boolean_t sm_disable; - boolean_t qkey_ctr; - boolean_t pkey_ctr; - boolean_t notice; - boolean_t trap; - boolean_t apm; - boolean_t slmap; - boolean_t pkey_nvram; - boolean_t mkey_nvram; - boolean_t sysguid; - boolean_t dr_notice; - boolean_t boot_mgmt; - boolean_t capm_notice; - boolean_t reinit; - boolean_t ledinfo; - boolean_t port_active; -} ib_port_cap_t; -/*****/ - -/****d* Access Layer/ib_init_type_t -* NAME -* ib_init_type_t -* -* DESCRIPTION -* If supported by the HCA, the type of initialization requested by -* this port before SM moves it to the active or armed state. If the -* SM implements reinitialization, it shall set these bits to indicate -* the type of initialization performed prior to activating the port. -* Otherwise, these bits shall be set to 0. -* -* SYNOPSIS -*/ -typedef uint8_t ib_init_type_t; -#define IB_INIT_TYPE_NO_LOAD 0x01 -#define IB_INIT_TYPE_PRESERVE_CONTENT 0x02 -#define IB_INIT_TYPE_PRESERVE_PRESENCE 0x04 -#define IB_INIT_TYPE_DO_NOT_RESUSCITATE 0x08 -/*****/ - -/****s* Access Layer/ib_port_attr_mod_t -* NAME -* ib_port_attr_mod_t -* -* DESCRIPTION -* Port attributes that may be modified. -* -* SYNOPSIS -*/ -typedef struct _ib_port_attr_mod { - ib_port_cap_t cap; - uint16_t pkey_ctr; - uint16_t qkey_ctr; - ib_init_type_t init_type; - ib_net64_t system_image_guid; -} ib_port_attr_mod_t; -/* -* SEE ALSO -* ib_port_cap_t -*****/ - -/****s* Access Layer/ib_port_attr_t -* NAME -* ib_port_attr_t -* -* DESCRIPTION -* Information about a port on a given channel adapter. -* -* SYNOPSIS -*/ -typedef struct _ib_port_attr { - ib_net64_t port_guid; - uint8_t port_num; - uint8_t mtu; - uint64_t max_msg_size; - ib_net16_t lid; - uint8_t lmc; - /* - * LinkWidthSupported as defined in PortInfo. Required to calculate - * inter-packet delay (a.k.a. static rate). - */ - uint8_t link_width_supported; - uint16_t max_vls; - ib_net16_t sm_lid; - uint8_t sm_sl; - uint8_t link_state; - ib_init_type_t init_type_reply; /* Optional */ - /* - * subnet_timeout: - * The maximum expected subnet propagation delay to reach any port on - * the subnet. This value also determines the rate at which traps can - * be generated from this node. - * - * timeout = 4.096 microseconds * 2^subnet_timeout - */ - uint8_t subnet_timeout; - ib_port_cap_t cap; - uint16_t pkey_ctr; - uint16_t qkey_ctr; - uint16_t num_gids; - uint16_t num_pkeys; - /* - * Pointers at the end of the structure to allow doing a simple - * memory comparison of contents up to the first pointer. - */ - ib_gid_t *p_gid_table; - ib_net16_t *p_pkey_table; -} ib_port_attr_t; -/* -* SEE ALSO -* uint8_t, ib_port_cap_t, ib_link_states_t -*****/ - -/****s* Access Layer/ib_ca_attr_t -* NAME -* ib_ca_attr_t -* -* DESCRIPTION -* Information about a channel adapter. -* -* SYNOPSIS -*/ -typedef struct _ib_ca_attr { - ib_net64_t ca_guid; - uint32_t vend_id; - uint16_t dev_id; - uint16_t revision; - uint64_t fw_ver; - /* - * Total size of the ca attributes in bytes - */ - uint32_t size; - uint32_t max_qps; - uint32_t max_wrs; - uint32_t max_sges; - uint32_t max_rd_sges; - uint32_t max_cqs; - uint32_t max_cqes; - uint32_t max_pds; - uint32_t init_regions; - uint64_t init_region_size; - uint32_t init_windows; - uint32_t max_addr_handles; - uint32_t max_partitions; - ib_atomic_t atomicity; - uint8_t max_qp_resp_res; - uint8_t max_eec_resp_res; - uint8_t max_resp_res; - uint8_t max_qp_init_depth; - uint8_t max_eec_init_depth; - uint32_t max_eecs; - uint32_t max_rdds; - uint32_t max_ipv6_qps; - uint32_t max_ether_qps; - uint32_t max_mcast_grps; - uint32_t max_mcast_qps; - uint32_t max_qps_per_mcast_grp; - uint32_t max_fmr; - uint32_t max_map_per_fmr; - /* - * local_ack_delay: - * Specifies the maximum time interval between the local CA receiving - * a message and the transmission of the associated ACK or NAK. - * - * timeout = 4.096 microseconds * 2^local_ack_delay - */ - uint8_t local_ack_delay; - boolean_t bad_pkey_ctr_support; - boolean_t bad_qkey_ctr_support; - boolean_t raw_mcast_support; - boolean_t apm_support; - boolean_t av_port_check; - boolean_t change_primary_port; - boolean_t modify_wr_depth; - boolean_t current_qp_state_support; - boolean_t shutdown_port_capability; - boolean_t init_type_support; - boolean_t port_active_event_support; - boolean_t system_image_guid_support; - boolean_t hw_agents; - ib_net64_t system_image_guid; - uint32_t num_page_sizes; - uint8_t num_ports; - uint32_t *p_page_size; - ib_port_attr_t *p_port_attr; -} ib_ca_attr_t; -/* -* FIELDS -* ca_guid -* GUID for this adapter. -* -* vend_id -* IEEE vendor ID for this adapter -* -* dev_id -* Device ID of this adapter. (typically from PCI device ID) -* -* revision -* Revision ID of this adapter -* -* fw_ver -* Device Firmware version. -* -* size -* Total size in bytes for the HCA attributes. This size includes total -* size required for all the variable members of the structure. If a -* vendor requires to pass vendor specific fields beyond this structure, -* the HCA vendor can choose to report a larger size. If a vendor is -* reporting extended vendor specific features, they should also provide -* appropriate access functions to aid with the required interpretation. -* -* max_qps -* Maximum number of QP's supported by this HCA. -* -* max_wrs -* Maximum number of work requests supported by this HCA. -* -* max_sges -* Maximum number of scatter gather elements supported per work request. -* -* max_rd_sges -* Maximum number of scatter gather elements supported for READ work -* requests for a Reliable Datagram QP. This value must be zero if RD -* service is not supported. -* -* max_cqs -* Maximum number of Completion Queues supported. -* -* max_cqes -* Maximum number of CQ elements supported per CQ. -* -* max_pds -* Maximum number of protection domains supported. -* -* init_regions -* Initial number of memory regions supported. These are only informative -* values. HCA vendors can extended and grow these limits on demand. -* -* init_region_size -* Initial limit on the size of the registered memory region. -* -* init_windows -* Initial number of window entries supported. -* -* max_addr_handles -* Maximum number of address handles supported. -* -* max_partitions -* Maximum number of partitions supported. -* -* atomicity -* Indicates level of atomic operations supported by this HCA. -* -* max_qp_resp_res -* max_eec_resp_res -* Maximum limit on number of responder resources for incoming RDMA -* operations, on QPs and EEC's respectively. -* -* max_resp_res -* Maximum number of responder resources per HCA, with this HCA used as -* the target. -* -* max_qp_init_depth -* max_eec_init_depth -* Maximimum initiator depth per QP or EEC for initiating RDMA reads and -* atomic operations. -* -* max_eecs -* Maximimum number of EEC's supported by the HCA. -* -* max_rdds -* Maximum number of Reliable datagram domains supported. -* -* max_ipv6_qps -* max_ether_qps -* Maximum number of IPV6 and raw ether QP's supported by this HCA. -* -* max_mcast_grps -* Maximum number of multicast groups supported. -* -* max_mcast_qps -* Maximum number of QP's that can support multicast operations. -* -* max_qps_per_mcast_grp -* Maximum number of multicast QP's per multicast group. -* -* local_ack_delay -* Specifies the maximum time interval between the local CA receiving -* a message and the transmission of the associated ACK or NAK. -* timeout = 4.096 microseconds * 2^local_ack_delay -* -* bad_pkey_ctr_support -* bad_qkey_ctr_support -* Indicates support for the bad pkey and qkey counters. -* -* raw_mcast_support -* Indicates support for raw packet multicast. -* -* apm_support -* Indicates support for Automatic Path Migration. -* -* av_port_check -* Indicates ability to check port number in address handles. -* -* change_primary_port -* Indicates ability to change primary port for a QP or EEC during a -* SQD->RTS transition. -* -* modify_wr_depth -* Indicates ability to modify QP depth during a modify QP operation. -* Check the verb specification for permitted states. -* -* current_qp_state_support -* Indicates ability of the HCA to support the current QP state modifier -* during a modify QP operation. -* -* shutdown_port_capability -* Shutdown port capability support indicator. -* -* init_type_support -* Indicates init_type_reply and ability to set init_type is supported. -* -* port_active_event_support -* Port active event support indicator. -* -* system_image_guid_support -* System image GUID support indicator. -* -* hw_agents -* Indicates SMA is implemented in HW. -* -* system_image_guid -* Optional system image GUID. This field is valid only if the -* system_image_guid_support flag is set. -* -* num_page_sizes -* Indicates support for different page sizes supported by the HCA. -* The variable size array can be obtained from p_page_size. -* -* num_ports -* Number of physical ports supported on this HCA. -* -* p_page_size -* Array holding different page size supported. -* -* p_port_attr -* Array holding port attributes. -* -* NOTES -* This structure contains the attributes of a channel adapter. Users must -* call ib_copy_ca_attr to copy the contents of this structure to a new -* memory region. -* -* SEE ALSO -* ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr -*****/ - -/****f* Access layer/ib_copy_ca_attr -* NAME -* ib_copy_ca_attr -* -* DESCRIPTION -* Copies CA attributes. -* -* SYNOPSIS -*/ -ib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest, - IN const ib_ca_attr_t * const p_src); -/* -* PARAMETERS -* p_dest -* Pointer to the buffer that is the destination of the copy. -* -* p_src -* Pointer to the CA attributes to copy. -* -* RETURN VALUE -* Pointer to the copied CA attributes. -* -* NOTES -* The buffer pointed to by the p_dest parameter must be at least the size -* specified in the size field of the buffer pointed to by p_src. -* -* SEE ALSO -* ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr -*****/ - -/****s* Access Layer/ib_av_attr_t -* NAME -* ib_av_attr_t -* -* DESCRIPTION -* IBA address vector. -* -* SYNOPSIS -*/ -typedef struct _ib_av_attr { - uint8_t port_num; - uint8_t sl; - ib_net16_t dlid; - boolean_t grh_valid; - ib_grh_t grh; - uint8_t static_rate; - uint8_t path_bits; - struct _av_conn { - uint8_t path_mtu; - uint8_t local_ack_timeout; - uint8_t seq_err_retry_cnt; - uint8_t rnr_retry_cnt; - } conn; -} ib_av_attr_t; -/* -* SEE ALSO -* ib_gid_t -*****/ - -/****d* Access Layer/ib_qp_type_t -* NAME -* ib_qp_type_t -* -* DESCRIPTION -* Indicates the type of queue pair being created. -* -* SYNOPSIS -*/ -typedef enum _ib_qp_type { - IB_QPT_RELIABLE_CONN = 0, /* Matches CM REQ transport type */ - IB_QPT_UNRELIABLE_CONN = 1, /* Matches CM REQ transport type */ - IB_QPT_RELIABLE_DGRM = 2, /* Matches CM REQ transport type */ - IB_QPT_UNRELIABLE_DGRM, - IB_QPT_QP0, - IB_QPT_QP1, - IB_QPT_RAW_IPV6, - IB_QPT_RAW_ETHER, - IB_QPT_MAD, /* InfiniBand Access Layer */ - IB_QPT_QP0_ALIAS, /* InfiniBand Access Layer */ - IB_QPT_QP1_ALIAS /* InfiniBand Access Layer */ -} ib_qp_type_t; -/* -* VALUES -* IB_QPT_RELIABLE_CONN -* Reliable, connected queue pair. -* -* IB_QPT_UNRELIABLE_CONN -* Unreliable, connected queue pair. -* -* IB_QPT_RELIABLE_DGRM -* Reliable, datagram queue pair. -* -* IB_QPT_UNRELIABLE_DGRM -* Unreliable, datagram queue pair. -* -* IB_QPT_QP0 -* Queue pair 0. -* -* IB_QPT_QP1 -* Queue pair 1. -* -* IB_QPT_RAW_DGRM -* Raw datagram queue pair. -* -* IB_QPT_RAW_IPV6 -* Raw IP version 6 queue pair. -* -* IB_QPT_RAW_ETHER -* Raw Ethernet queue pair. -* -* IB_QPT_MAD -* Unreliable, datagram queue pair that will send and receive management -* datagrams with assistance from the access layer. -* -* IB_QPT_QP0_ALIAS -* Alias to queue pair 0. Aliased QPs can only be created on an aliased -* protection domain. -* -* IB_QPT_QP1_ALIAS -* Alias to queue pair 1. Aliased QPs can only be created on an aliased -* protection domain. -*****/ - -/****d* Access Layer/ib_access_t -* NAME -* ib_access_t -* -* DESCRIPTION -* Indicates the type of access is permitted on resources such as QPs, -* memory regions and memory windows. -* -* SYNOPSIS -*/ -typedef uint32_t ib_access_t; -#define IB_AC_RDMA_READ 0x00000001 -#define IB_AC_RDMA_WRITE 0x00000002 -#define IB_AC_ATOMIC 0x00000004 -#define IB_AC_LOCAL_WRITE 0x00000008 -#define IB_AC_MW_BIND 0x00000010 -/* -* NOTES -* Users may combine access rights using a bit-wise or operation to specify -* additional access. For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants -* RDMA read and write access. -*****/ - -/****d* Access Layer/ib_qp_state_t -* NAME -* ib_qp_state_t -* -* DESCRIPTION -* Indicates or sets the state of a queue pair. The current state of a queue -* pair is returned through the ib_qp_query call and set via the -* ib_qp_modify call. -* -* SYNOPSIS -*/ -typedef uint32_t ib_qp_state_t; -#define IB_QPS_RESET 0x00000001 -#define IB_QPS_INIT 0x00000002 -#define IB_QPS_RTR 0x00000004 -#define IB_QPS_RTS 0x00000008 -#define IB_QPS_SQD 0x00000010 -#define IB_QPS_SQD_DRAINING 0x00000030 -#define IB_QPS_SQD_DRAINED 0x00000050 -#define IB_QPS_SQERR 0x00000080 -#define IB_QPS_ERROR 0x00000100 -#define IB_QPS_TIME_WAIT 0xDEAD0000 /* InfiniBand Access Layer */ -/*****/ - -/****d* Access Layer/ib_apm_state_t -* NAME -* ib_apm_state_t -* -* DESCRIPTION -* The current automatic path migration state of a queue pair -* -* SYNOPSIS -*/ -typedef enum _ib_apm_state { - IB_APM_MIGRATED = 1, - IB_APM_REARM, - IB_APM_ARMED -} ib_apm_state_t; -/*****/ - -/****s* Access Layer/ib_qp_create_t -* NAME -* ib_qp_create_t -* -* DESCRIPTION -* Attributes used to initialize a queue pair at creation time. -* -* SYNOPSIS -*/ -typedef struct _ib_qp_create { - ib_qp_type_t qp_type; - ib_rdd_handle_t h_rdd; - uint32_t sq_depth; - uint32_t rq_depth; - uint32_t sq_sge; - uint32_t rq_sge; - ib_cq_handle_t h_sq_cq; - ib_cq_handle_t h_rq_cq; - boolean_t sq_signaled; -} ib_qp_create_t; -/* -* FIELDS -* type -* Specifies the type of queue pair to create. -* -* h_rdd -* A handle to a reliable datagram domain to associate with the queue -* pair. This field is ignored if the queue pair is not a reliable -* datagram type queue pair. -* -* sq_depth -* Indicates the requested maximum number of work requests that may be -* outstanding on the queue pair's send queue. This value must be less -* than or equal to the maximum reported by the channel adapter associated -* with the queue pair. -* -* rq_depth -* Indicates the requested maximum number of work requests that may be -* outstanding on the queue pair's receive queue. This value must be less -* than or equal to the maximum reported by the channel adapter associated -* with the queue pair. -* -* sq_sge -* Indicates the maximum number scatter-gather elements that may be -* given in a send work request. This value must be less -* than or equal to the maximum reported by the channel adapter associated -* with the queue pair. -* -* rq_sge -* Indicates the maximum number scatter-gather elements that may be -* given in a receive work request. This value must be less -* than or equal to the maximum reported by the channel adapter associated -* with the queue pair. -* -* h_sq_cq -* A handle to the completion queue that will be used to report send work -* request completions. This handle must be NULL if the type is -* IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS. -* -* h_rq_cq -* A handle to the completion queue that will be used to report receive -* work request completions. This handle must be NULL if the type is -* IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS. -* -* sq_signaled -* A flag that is used to indicate whether the queue pair will signal -* an event upon completion of a send work request. If set to -* TRUE, send work requests will always generate a completion -* event. If set to FALSE, a completion event will only be -* generated if the send_opt field of the send work request has the -* IB_SEND_OPT_SIGNALED flag set. -* -* SEE ALSO -* ib_qp_type_t, ib_qp_attr_t -*****/ - -/****s* Access Layer/ib_qp_attr_t -* NAME -* ib_qp_attr_t -* -* DESCRIPTION -* Queue pair attributes returned through ib_query_qp. -* -* SYNOPSIS -*/ -typedef struct _ib_qp_attr { - ib_pd_handle_t h_pd; - ib_qp_type_t qp_type; - ib_access_t access_ctrl; - uint16_t pkey_index; - uint32_t sq_depth; - uint32_t rq_depth; - uint32_t sq_sge; - uint32_t rq_sge; - uint8_t init_depth; - uint8_t resp_res; - ib_cq_handle_t h_sq_cq; - ib_cq_handle_t h_rq_cq; - ib_rdd_handle_t h_rdd; - boolean_t sq_signaled; - ib_qp_state_t state; - ib_net32_t num; - ib_net32_t dest_num; - ib_net32_t qkey; - ib_net32_t sq_psn; - ib_net32_t rq_psn; - uint8_t primary_port; - uint8_t alternate_port; - ib_av_attr_t primary_av; - ib_av_attr_t alternate_av; - ib_apm_state_t apm_state; -} ib_qp_attr_t; -/* -* FIELDS -* h_pd -* This is a handle to a protection domain associated with the queue -* pair, or NULL if the queue pair is type IB_QPT_RELIABLE_DGRM. -* -* NOTES -* Other fields are defined by the Infiniband specification. -* -* SEE ALSO -* ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t -*****/ - -/****d* Access Layer/ib_qp_opts_t -* NAME -* ib_qp_opts_t -* -* DESCRIPTION -* Optional fields supplied in the modify QP operation. -* -* SYNOPSIS -*/ -typedef uint32_t ib_qp_opts_t; -#define IB_MOD_QP_ALTERNATE_AV 0x00000001 -#define IB_MOD_QP_PKEY 0x00000002 -#define IB_MOD_QP_APM_STATE 0x00000004 -#define IB_MOD_QP_PRIMARY_AV 0x00000008 -#define IB_MOD_QP_RNR_NAK_TIMEOUT 0x00000010 -#define IB_MOD_QP_RESP_RES 0x00000020 -#define IB_MOD_QP_INIT_DEPTH 0x00000040 -#define IB_MOD_QP_PRIMARY_PORT 0x00000080 -#define IB_MOD_QP_ACCESS_CTRL 0x00000100 -#define IB_MOD_QP_QKEY 0x00000200 -#define IB_MOD_QP_SQ_DEPTH 0x00000400 -#define IB_MOD_QP_RQ_DEPTH 0x00000800 -#define IB_MOD_QP_CURRENT_STATE 0x00001000 -#define IB_MOD_QP_RETRY_CNT 0x00002000 -#define IB_MOD_QP_LOCAL_ACK_TIMEOUT 0x00004000 -#define IB_MOD_QP_RNR_RETRY_CNT 0x00008000 -/* -* SEE ALSO -* ib_qp_mod_t -*****/ - -/****s* Access Layer/ib_qp_mod_t -* NAME -* ib_qp_mod_t -* -* DESCRIPTION -* Information needed to change the state of a queue pair through the -* ib_modify_qp call. -* -* SYNOPSIS -*/ -typedef struct _ib_qp_mod { - ib_qp_state_t req_state; - union _qp_state { - struct _qp_reset { - /* - * Time, in milliseconds, that the QP needs to spend in - * the time wait state before being reused. - */ - uint32_t timewait; - } reset; - struct _qp_init { - ib_qp_opts_t opts; - uint8_t primary_port; - ib_net32_t qkey; - uint16_t pkey_index; - ib_access_t access_ctrl; - } init; - struct _qp_rtr { - ib_net32_t rq_psn; - ib_net32_t dest_qp; - ib_av_attr_t primary_av; - uint8_t resp_res; - ib_qp_opts_t opts; - ib_av_attr_t alternate_av; - ib_net32_t qkey; - uint16_t pkey_index; - ib_access_t access_ctrl; - uint32_t sq_depth; - uint32_t rq_depth; - uint8_t rnr_nak_timeout; - } rtr; - struct _qp_rts { - ib_net32_t sq_psn; - uint8_t retry_cnt; - uint8_t rnr_retry_cnt; - uint8_t rnr_nak_timeout; - uint8_t local_ack_timeout; - uint8_t init_depth; - ib_qp_opts_t opts; - ib_qp_state_t current_state; - ib_net32_t qkey; - ib_access_t access_ctrl; - uint8_t resp_res; - ib_av_attr_t primary_av; - ib_av_attr_t alternate_av; - uint32_t sq_depth; - uint32_t rq_depth; - ib_apm_state_t apm_state; - uint8_t primary_port; - uint16_t pkey_index; - } rts; - struct _qp_sqd { - boolean_t sqd_event; - } sqd; - } state; -} ib_qp_mod_t; -/* -* SEE ALSO -* ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t -*****/ - -/****s* Access Layer/ib_eec_attr_t -* NAME -* ib_eec_attr_t -* -* DESCRIPTION -* Information about an end-to-end context. -* -* SYNOPSIS -*/ -typedef struct _ib_eec_attr { - ib_qp_state_t state; - ib_rdd_handle_t h_rdd; - ib_net32_t local_eecn; - ib_net32_t sq_psn; - ib_net32_t rq_psn; - uint8_t primary_port; - uint16_t pkey_index; - uint32_t resp_res; - ib_net32_t remote_eecn; - uint32_t init_depth; - uint32_t dest_num; // ??? What is this? - ib_av_attr_t primary_av; - ib_av_attr_t alternate_av; - ib_apm_state_t apm_state; -} ib_eec_attr_t; -/* -* SEE ALSO -* ib_qp_state_t, ib_av_attr_t, ib_apm_state_t -*****/ - -/****d* Access Layer/ib_eec_opts_t -* NAME -* ib_eec_opts_t -* -* DESCRIPTION -* Optional fields supplied in the modify EEC operation. -* -* SYNOPSIS -*/ -typedef uint32_t ib_eec_opts_t; -#define IB_MOD_EEC_ALTERNATE_AV 0x00000001 -#define IB_MOD_EEC_PKEY 0x00000002 -#define IB_MOD_EEC_APM_STATE 0x00000004 -#define IB_MOD_EEC_PRIMARY_AV 0x00000008 -#define IB_MOD_EEC_RNR 0x00000010 -#define IB_MOD_EEC_RESP_RES 0x00000020 -#define IB_MOD_EEC_OUTSTANDING 0x00000040 -#define IB_MOD_EEC_PRIMARY_PORT 0x00000080 -/* -* NOTES -* -* -*****/ - -/****s* Access Layer/ib_eec_mod_t -* NAME -* ib_eec_mod_t -* -* DESCRIPTION -* Information needed to change the state of an end-to-end context through -* the ib_modify_eec function. -* -* SYNOPSIS -*/ -typedef struct _ib_eec_mod { - ib_qp_state_t req_state; - union _eec_state { - struct _eec_init { - uint8_t primary_port; - uint16_t pkey_index; - } init; - struct _eec_rtr { - ib_net32_t rq_psn; - ib_net32_t remote_eecn; - ib_av_attr_t primary_av; - uint8_t resp_res; - ib_eec_opts_t opts; - ib_av_attr_t alternate_av; - uint16_t pkey_index; - } rtr; - struct _eec_rts { - ib_net32_t sq_psn; - uint8_t retry_cnt; - uint8_t rnr_retry_cnt; - uint8_t local_ack_timeout; - uint8_t init_depth; - ib_eec_opts_t opts; - ib_av_attr_t alternate_av; - ib_apm_state_t apm_state; - ib_av_attr_t primary_av; - uint16_t pkey_index; - uint8_t primary_port; - } rts; - struct _eec_sqd { - boolean_t sqd_event; - } sqd; - } state; -} ib_eec_mod_t; -/* -* SEE ALSO -* ib_qp_state_t, ib_av_attr_t, ib_apm_state_t -*****/ - -/****d* Access Layer/ib_wr_type_t -* NAME -* ib_wr_type_t -* -* DESCRIPTION -* Identifies the type of work request posted to a queue pair. -* -* SYNOPSIS -*/ -typedef enum _ib_wr_type_t { - WR_SEND = 1, - WR_RDMA_WRITE, - WR_RDMA_READ, - WR_COMPARE_SWAP, - WR_FETCH_ADD -} ib_wr_type_t; -/*****/ - -/****s* Access Layer/ib_local_ds_t -* NAME -* ib_local_ds_t -* -* DESCRIPTION -* Local data segment information referenced by send and receive work -* requests. This is used to specify local data buffers used as part of a -* work request. -* -* SYNOPSIS -*/ -typedef struct _ib_local_ds { - void *vaddr; - uint32_t length; - uint32_t lkey; -} ib_local_ds_t; -/*****/ - -/****d* Access Layer/ib_send_opt_t -* NAME -* ib_send_opt_t -* -* DESCRIPTION -* Optional flags used when posting send work requests. These flags -* indicate specific processing for the send operation. -* -* SYNOPSIS -*/ -typedef uint32_t ib_send_opt_t; -#define IB_SEND_OPT_IMMEDIATE 0x00000001 -#define IB_SEND_OPT_FENCE 0x00000002 -#define IB_SEND_OPT_SIGNALED 0x00000004 -#define IB_SEND_OPT_SOLICITED 0x00000008 -#define IB_SEND_OPT_INLINE 0x00000010 -#define IB_SEND_OPT_LOCAL 0x00000020 -#define IB_SEND_OPT_VEND_MASK 0xFFFF0000 -/* -* VALUES -* The following flags determine the behavior of a work request when -* posted to the send side. -* -* IB_SEND_OPT_IMMEDIATE -* Send immediate data with the given request. -* -* IB_SEND_OPT_FENCE -* The operation is fenced. Complete all pending send operations -* before processing this request. -* -* IB_SEND_OPT_SIGNALED -* If the queue pair is configured for signaled completion, then -* generate a completion queue entry when this request completes. -* -* IB_SEND_OPT_SOLICITED -* Set the solicited bit on the last packet of this request. -* -* IB_SEND_OPT_INLINE -* Indicates that the requested send data should be copied into a VPD -* owned data buffer. This flag permits the user to issue send operations -* without first needing to register the buffer(s) associated with the -* send operation. Verb providers that support this operation may place -* vendor specific restrictions on the size of send operation that may -* be performed as inline. -* -* -* IB_SEND_OPT_LOCAL -* Indicates that a sent MAD request should be given to the local VPD for -* processing. MADs sent using this option are not placed on the wire. -* This send option is only valid for MAD send operations. -* -* -* IB_SEND_OPT_VEND_MASK -* This mask indicates bits reserved in the send options that may be used -* by the verbs provider to indicate vendor specific options. Bits set -* in this area of the send options are ignored by the Access Layer, but -* may have specific meaning to the underlying VPD. -* -*****/ - -/****s* Access Layer/ib_send_wr_t -* NAME -* ib_send_wr_t -* -* DESCRIPTION -* Information used to submit a work request to the send queue of a queue -* pair. -* -* SYNOPSIS -*/ -typedef struct _ib_send_wr { - struct _ib_send_wr *p_next; - uint64_t wr_id; - ib_wr_type_t wr_type; - ib_send_opt_t send_opt; - uint32_t num_ds; - ib_local_ds_t *ds_array; - ib_net32_t immediate_data; - union _send_dgrm { - struct _send_ud { - ib_net32_t remote_qp; - ib_net32_t remote_qkey; - ib_av_handle_t h_av; - } ud; - struct _send_rd { - ib_net32_t remote_qp; - ib_net32_t remote_qkey; - ib_net32_t eecn; - } rd; - struct _send_raw_ether { - ib_net16_t dest_lid; - uint8_t path_bits; - uint8_t sl; - uint8_t max_static_rate; - ib_net16_t ether_type; - } raw_ether; - struct _send_raw_ipv6 { - ib_net16_t dest_lid; - uint8_t path_bits; - uint8_t sl; - uint8_t max_static_rate; - } raw_ipv6; - } dgrm; - struct _send_remote_ops { - uint64_t vaddr; - uint32_t rkey; - ib_net64_t atomic1; - ib_net64_t atomic2; - } remote_ops; -} ib_send_wr_t; -/* -* FIELDS -* p_next -* A pointer used to chain work requests together. This permits multiple -* work requests to be posted to a queue pair through a single function -* call. This value is set to NULL to mark the end of the chain. -* -* wr_id -* A 64-bit work request identifier that is returned to the consumer -* as part of the work completion. -* -* wr_type -* The type of work request being submitted to the send queue. -* -* send_opt -* Optional send control parameters. -* -* num_ds -* Number of local data segments specified by this work request. -* -* ds_array -* A reference to an array of local data segments used by the send -* operation. -* -* immediate_data -* 32-bit field sent as part of a message send or RDMA write operation. -* This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE -* has been set. -* -* dgrm.ud.remote_qp -* Identifies the destination queue pair of an unreliable datagram send -* operation. -* -* dgrm.ud.remote_qkey -* The qkey for the destination queue pair. -* -* dgrm.ud.h_av -* An address vector that specifies the path information used to route -* the outbound datagram to the destination queue pair. -* -* dgrm.rd.remote_qp -* Identifies the destination queue pair of a reliable datagram send -* operation. -* -* dgrm.rd.remote_qkey -* The qkey for the destination queue pair. -* -* dgrm.rd.eecn -* The local end-to-end context number to use with the reliable datagram -* send operation. -* -* dgrm.raw_ether.dest_lid -* The destination LID that will receive this raw ether send. -* -* dgrm.raw_ether.path_bits -* path bits... -* -* dgrm.raw_ether.sl -* service level... -* -* dgrm.raw_ether.max_static_rate -* static rate... -* -* dgrm.raw_ether.ether_type -* ether type... -* -* dgrm.raw_ipv6.dest_lid -* The destination LID that will receive this raw ether send. -* -* dgrm.raw_ipv6.path_bits -* path bits... -* -* dgrm.raw_ipv6.sl -* service level... -* -* dgrm.raw_ipv6.max_static_rate -* static rate... -* -* remote_ops.vaddr -* The registered virtual memory address of the remote memory to access -* with an RDMA or atomic operation. -* -* remote_ops.rkey -* The rkey associated with the specified remote vaddr. This data must -* be presented exactly as obtained from the remote node. No swapping -* of data must be performed. -* -* atomic1 -* The first operand for an atomic operation. -* -* atomic2 -* The second operand for an atomic operation. -* -* NOTES -* The format of data sent over the fabric is user-defined and is considered -* opaque to the access layer. The sole exception to this are MADs posted -* to a MAD QP service. MADs are expected to match the format defined by -* the Infiniband specification and must be in network-byte order when posted -* to the MAD QP service. -* -* SEE ALSO -* ib_wr_type_t, ib_local_ds_t, ib_send_opt_t -*****/ - -/****s* Access Layer/ib_recv_wr_t -* NAME -* ib_recv_wr_t -* -* DESCRIPTION -* Information used to submit a work request to the receive queue of a queue -* pair. -* -* SYNOPSIS -*/ -typedef struct _ib_recv_wr { - struct _ib_recv_wr *p_next; - uint64_t wr_id; - uint32_t num_ds; - ib_local_ds_t *ds_array; -} ib_recv_wr_t; -/* -* FIELDS -* p_next -* A pointer used to chain work requests together. This permits multiple -* work requests to be posted to a queue pair through a single function -* call. This value is set to NULL to mark the end of the chain. -* -* wr_id -* A 64-bit work request identifier that is returned to the consumer -* as part of the work completion. -* -* num_ds -* Number of local data segments specified by this work request. -* -* ds_array -* A reference to an array of local data segments used by the send -* operation. -* -* SEE ALSO -* ib_local_ds_t -*****/ - -/****s* Access Layer/ib_bind_wr_t -* NAME -* ib_bind_wr_t -* -* DESCRIPTION -* Information used to submit a memory window bind work request to the send -* queue of a queue pair. -* -* SYNOPSIS -*/ -typedef struct _ib_bind_wr { - uint64_t wr_id; - ib_send_opt_t send_opt; - ib_mr_handle_t h_mr; - ib_access_t access_ctrl; - uint32_t current_rkey; - ib_local_ds_t local_ds; -} ib_bind_wr_t; -/* -* FIELDS -* wr_id -* A 64-bit work request identifier that is returned to the consumer -* as part of the work completion. -* -* send_opt -* Optional send control parameters. -* -* h_mr -* Handle to the memory region to which this window is being bound. -* -* access_ctrl -* Access rights for this memory window. -* -* current_rkey -* The current rkey assigned to this window for remote access. -* -* local_ds -* A reference to a local data segment used by the bind operation. -* -* SEE ALSO -* ib_send_opt_t, ib_access_t, ib_local_ds_t -*****/ - -/****d* Access Layer/ib_wc_status_t -* NAME -* ib_wc_status_t -* -* DESCRIPTION -* Indicates the status of a completed work request. These VALUES are -* returned to the user when retrieving completions. Note that success is -* identified as IB_WCS_SUCCESS, which is always zero. -* -* SYNOPSIS -*/ -typedef enum _ib_wc_status_t { - IB_WCS_SUCCESS, - IB_WCS_LOCAL_LEN_ERR, - IB_WCS_LOCAL_OP_ERR, - IB_WCS_LOCAL_EEC_OP_ERR, - IB_WCS_LOCAL_PROTECTION_ERR, - IB_WCS_WR_FLUSHED_ERR, - IB_WCS_MEM_WINDOW_BIND_ERR, - IB_WCS_REM_ACCESS_ERR, - IB_WCS_REM_OP_ERR, - IB_WCS_RNR_RETRY_ERR, - IB_WCS_TIMEOUT_RETRY_ERR, - IB_WCS_REM_INVALID_REQ_ERR, - IB_WCS_REM_INVALID_RD_REQ_ERR, - IB_WCS_INVALID_EECN, - IB_WCS_INVALID_EEC_STATE, - IB_WCS_UNMATCHED_RESPONSE, /* InfiniBand Access Layer */ - IB_WCS_CANCELED, /* InfiniBand Access Layer */ - IB_WCS_UNKNOWN /* Must be last. */ -} ib_wc_status_t; -/* -* VALUES -* IB_WCS_SUCCESS -* Work request completed successfully. -* -* IB_WCS_MAD -* The completed work request was associated with a managmenet datagram -* that requires post processing. The MAD will be returned to the user -* through a callback once all post processing has completed. -* -* IB_WCS_LOCAL_LEN_ERR -* Generated for a work request posted to the send queue when the -* total of the data segment lengths exceeds the message length of the -* channel. Generated for a work request posted to the receive queue when -* the total of the data segment lengths is too small for a -* valid incoming message. -* -* IB_WCS_LOCAL_OP_ERR -* An internal QP consistency error was generated while processing this -* work request. This may indicate that the QP was in an incorrect state -* for the requested operation. -* -* IB_WCS_LOCAL_EEC_OP_ERR -* An internal EEC consistency error was generated while processing -* this work request. This may indicate that the EEC was in an incorrect -* state for the requested operation. -* -* IB_WCS_LOCAL_PROTECTION_ERR -* The data segments of the locally posted work request did not refer to -* a valid memory region. The memory may not have been properly -* registered for the requested operation. -* -* IB_WCS_WR_FLUSHED_ERR -* The work request was flushed from the QP before being completed. -* -* IB_WCS_MEM_WINDOW_BIND_ERR -* A memory window bind operation failed due to insufficient access -* rights. -* -* IB_WCS_REM_ACCESS_ERR, -* A protection error was detected at the remote node for a RDMA or atomic -* operation. -* -* IB_WCS_REM_OP_ERR, -* The operation could not be successfully completed at the remote node. -* This may indicate that the remote QP was in an invalid state or -* contained an invalid work request. -* -* IB_WCS_RNR_RETRY_ERR, -* The RNR retry count was exceeded while trying to send this message. -* -* IB_WCS_TIMEOUT_RETRY_ERR -* The local transport timeout counter expired while trying to send this -* message. -* -* IB_WCS_REM_INVALID_REQ_ERR, -* The remote node detected an invalid message on the channel. This error -* is usually a result of one of the following: -* - The operation was not supported on receive queue. -* - There was insufficient buffers to receive a new RDMA request. -* - There was insufficient buffers to receive a new atomic operation. -* - An RDMA request was larger than 2^31 bytes. -* -* IB_WCS_REM_INVALID_RD_REQ_ERR, -* Responder detected an invalid RD message. This may be the result of an -* invalid qkey or an RDD mismatch. -* -* IB_WCS_INVALID_EECN -* An invalid EE context number was detected. -* -* IB_WCS_INVALID_EEC_STATE -* The EEC was in an invalid state for the specified request. -* -* IB_WCS_UNMATCHED_RESPONSE -* A response MAD was received for which there was no matching send. The -* send operation may have been canceled by the user or may have timed -* out. -* -* IB_WCS_CANCELED -* The completed work request was canceled by the user. -*****/ - -OSM_EXPORT const char *ib_wc_status_str[]; - -/****f* IBA Base: Types/ib_get_wc_status_str -* NAME -* ib_get_wc_status_str -* -* DESCRIPTION -* Returns a string for the specified work completion status. -* -* SYNOPSIS -*/ -static inline const char *OSM_API -ib_get_wc_status_str(IN ib_wc_status_t wc_status) -{ - if (wc_status > IB_WCS_UNKNOWN) - wc_status = IB_WCS_UNKNOWN; - return (ib_wc_status_str[wc_status]); -} - -/* -* PARAMETERS -* wc_status -* [in] work completion status value -* -* RETURN VALUES -* Pointer to the work completion status description string. -* -* NOTES -* -* SEE ALSO -*********/ - -/****d* Access Layer/ib_wc_type_t -* NAME -* ib_wc_type_t -* -* DESCRIPTION -* Indicates the type of work completion. -* -* SYNOPSIS -*/ -typedef enum _ib_wc_type_t { - IB_WC_SEND, - IB_WC_RDMA_WRITE, - IB_WC_RECV, - IB_WC_RDMA_READ, - IB_WC_MW_BIND, - IB_WC_FETCH_ADD, - IB_WC_COMPARE_SWAP, - IB_WC_RECV_RDMA_WRITE -} ib_wc_type_t; -/*****/ - -/****d* Access Layer/ib_recv_opt_t -* NAME -* ib_recv_opt_t -* -* DESCRIPTION -* Indicates optional fields valid in a receive work completion. -* -* SYNOPSIS -*/ -typedef uint32_t ib_recv_opt_t; -#define IB_RECV_OPT_IMMEDIATE 0x00000001 -#define IB_RECV_OPT_FORWARD 0x00000002 -#define IB_RECV_OPT_GRH_VALID 0x00000004 -#define IB_RECV_OPT_VEND_MASK 0xFFFF0000 -/* -* VALUES -* IB_RECV_OPT_IMMEDIATE -* Indicates that immediate data is valid for this work completion. -* -* IB_RECV_OPT_FORWARD -* Indicates that the received trap should be forwarded to the SM. -* -* IB_RECV_OPT_GRH_VALID -* Indicates presence of the global route header. When set, the -* first 40 bytes received are the GRH. -* -* IB_RECV_OPT_VEND_MASK -* This mask indicates bits reserved in the receive options that may be -* used by the verbs provider to indicate vendor specific options. Bits -* set in this area of the receive options are ignored by the Access Layer, -* but may have specific meaning to the underlying VPD. -*****/ - -/****s* Access Layer/ib_wc_t -* NAME -* ib_wc_t -* -* DESCRIPTION -* Work completion information. -* -* SYNOPSIS -*/ -typedef struct _ib_wc { - struct _ib_wc *p_next; - uint64_t wr_id; - ib_wc_type_t wc_type; - uint32_t length; - ib_wc_status_t status; - uint64_t vendor_specific; - union _wc_recv { - struct _wc_conn { - ib_recv_opt_t recv_opt; - ib_net32_t immediate_data; - } conn; - struct _wc_ud { - ib_recv_opt_t recv_opt; - ib_net32_t immediate_data; - ib_net32_t remote_qp; - uint16_t pkey_index; - ib_net16_t remote_lid; - uint8_t remote_sl; - uint8_t path_bits; - } ud; - struct _wc_rd { - ib_net32_t remote_eecn; - ib_net32_t remote_qp; - ib_net16_t remote_lid; - uint8_t remote_sl; - uint32_t free_cnt; - - } rd; - struct _wc_raw_ipv6 { - ib_net16_t remote_lid; - uint8_t remote_sl; - uint8_t path_bits; - } raw_ipv6; - struct _wc_raw_ether { - ib_net16_t remote_lid; - uint8_t remote_sl; - uint8_t path_bits; - ib_net16_t ether_type; - } raw_ether; - } recv; -} ib_wc_t; -/* -* FIELDS -* p_next -* A pointer used to chain work completions. This permits multiple -* work completions to be retrieved from a completion queue through a -* single function call. This value is set to NULL to mark the end of -* the chain. -* -* wr_id -* The 64-bit work request identifier that was specified when posting the -* work request. -* -* wc_type -* Indicates the type of work completion. -* -* -* length -* The total length of the data sent or received with the work request. -* -* status -* The result of the work request. -* -* vendor_specific -* HCA vendor specific information returned as part of the completion. -* -* recv.conn.recv_opt -* Indicates optional fields valid as part of a work request that -* completed on a connected (reliable or unreliable) queue pair. -* -* recv.conn.immediate_data -* 32-bit field received as part of an inbound message on a connected -* queue pair. This field is only valid if the recv_opt flag -* IB_RECV_OPT_IMMEDIATE has been set. -* -* recv.ud.recv_opt -* Indicates optional fields valid as part of a work request that -* completed on an unreliable datagram queue pair. -* -* recv.ud.immediate_data -* 32-bit field received as part of an inbound message on a unreliable -* datagram queue pair. This field is only valid if the recv_opt flag -* IB_RECV_OPT_IMMEDIATE has been set. -* -* recv.ud.remote_qp -* Identifies the source queue pair of a received datagram. -* -* recv.ud.pkey_index -* The pkey index for the source queue pair. This is valid only for -* GSI type QP's. -* -* recv.ud.remote_lid -* The source LID of the received datagram. -* -* recv.ud.remote_sl -* The service level used by the source of the received datagram. -* -* recv.ud.path_bits -* path bits... -* -* recv.rd.remote_eecn -* The remote end-to-end context number that sent the received message. -* -* recv.rd.remote_qp -* Identifies the source queue pair of a received message. -* -* recv.rd.remote_lid -* The source LID of the received message. -* -* recv.rd.remote_sl -* The service level used by the source of the received message. -* -* recv.rd.free_cnt -* The number of available entries in the completion queue. Reliable -* datagrams may complete out of order, so this field may be used to -* determine the number of additional completions that may occur. -* -* recv.raw_ipv6.remote_lid -* The source LID of the received message. -* -* recv.raw_ipv6.remote_sl -* The service level used by the source of the received message. -* -* recv.raw_ipv6.path_bits -* path bits... -* -* recv.raw_ether.remote_lid -* The source LID of the received message. -* -* recv.raw_ether.remote_sl -* The service level used by the source of the received message. -* -* recv.raw_ether.path_bits -* path bits... -* -* recv.raw_ether.ether_type -* ether type... -* NOTES -* When the work request completes with error, the only values that the -* consumer can depend on are the wr_id field, and the status of the -* operation. -* -* If the consumer is using the same CQ for completions from more than -* one type of QP (i.e Reliable Connected, Datagram etc), then the consumer -* must have additional information to decide what fields of the union are -* valid. -* SEE ALSO -* ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t -*****/ - -/****s* Access Layer/ib_mr_create_t -* NAME -* ib_mr_create_t -* -* DESCRIPTION -* Information required to create a registered memory region. -* -* SYNOPSIS -*/ -typedef struct _ib_mr_create { - void *vaddr; - uint64_t length; - ib_access_t access_ctrl; -} ib_mr_create_t; -/* -* FIELDS -* vaddr -* Starting virtual address of the region being registered. -* -* length -* Length of the buffer to register. -* -* access_ctrl -* Access rights of the registered region. -* -* SEE ALSO -* ib_access_t -*****/ - -/****s* Access Layer/ib_phys_create_t -* NAME -* ib_phys_create_t -* -* DESCRIPTION -* Information required to create a physical memory region. -* -* SYNOPSIS -*/ -typedef struct _ib_phys_create { - uint64_t length; - uint32_t num_bufs; - uint64_t *buf_array; - uint32_t buf_offset; - uint32_t page_size; - ib_access_t access_ctrl; -} ib_phys_create_t; -/* -* length -* The length of the memory region in bytes. -* -* num_bufs -* Number of buffers listed in the specified buffer array. -* -* buf_array -* An array of physical buffers to be registered as a single memory -* region. -* -* buf_offset -* The offset into the first physical page of the specified memory -* region to start the virtual address. -* -* page_size -* The physical page size of the memory being registered. -* -* access_ctrl -* Access rights of the registered region. -* -* SEE ALSO -* ib_access_t -*****/ - -/****s* Access Layer/ib_mr_attr_t -* NAME -* ib_mr_attr_t -* -* DESCRIPTION -* Attributes of a registered memory region. -* -* SYNOPSIS -*/ -typedef struct _ib_mr_attr { - ib_pd_handle_t h_pd; - void *local_lb; - void *local_ub; - void *remote_lb; - void *remote_ub; - ib_access_t access_ctrl; - uint32_t lkey; - uint32_t rkey; -} ib_mr_attr_t; -/* -* DESCRIPTION -* h_pd -* Handle to the protection domain for this memory region. -* -* local_lb -* The virtual address of the lower bound of protection for local -* memory access. -* -* local_ub -* The virtual address of the upper bound of protection for local -* memory access. -* -* remote_lb -* The virtual address of the lower bound of protection for remote -* memory access. -* -* remote_ub -* The virtual address of the upper bound of protection for remote -* memory access. -* -* access_ctrl -* Access rights for the specified memory region. -* -* lkey -* The lkey associated with this memory region. -* -* rkey -* The rkey associated with this memory region. -* -* NOTES -* The remote_lb, remote_ub, and rkey are only valid if remote memory access -* is enabled for this memory region. -* -* SEE ALSO -* ib_access_t -*****/ - -/****d* Access Layer/ib_ca_mod_t -* NAME -* ib_ca_mod_t -- Modify port attributes and error counters -* -* DESCRIPTION -* Specifies modifications to the port attributes of a channel adapter. -* -* SYNOPSIS -*/ -typedef uint32_t ib_ca_mod_t; -#define IB_CA_MOD_IS_CM_SUPPORTED 0x00000001 -#define IB_CA_MOD_IS_SNMP_SUPPORTED 0x00000002 -#define IB_CA_MOD_IS_DEV_MGMT_SUPPORTED 0x00000004 -#define IB_CA_MOD_IS_VEND_SUPPORTED 0x00000008 -#define IB_CA_MOD_IS_SM 0x00000010 -#define IB_CA_MOD_IS_SM_DISABLED 0x00000020 -#define IB_CA_MOD_QKEY_CTR 0x00000040 -#define IB_CA_MOD_PKEY_CTR 0x00000080 -#define IB_CA_MOD_IS_NOTICE_SUPPORTED 0x00000100 -#define IB_CA_MOD_IS_TRAP_SUPPORTED 0x00000200 -#define IB_CA_MOD_IS_APM_SUPPORTED 0x00000400 -#define IB_CA_MOD_IS_SLMAP_SUPPORTED 0x00000800 -#define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED 0x00001000 -#define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED 0x00002000 -#define IB_CA_MOD_IS_SYSGUID_SUPPORTED 0x00004000 -#define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED 0x00008000 -#define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED 0x00010000 -#define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED 0x00020000 -#define IB_CA_MOD_IS_REINIT_SUPORTED 0x00040000 -#define IB_CA_MOD_IS_LEDINFO_SUPPORTED 0x00080000 -#define IB_CA_MOD_SHUTDOWN_PORT 0x00100000 -#define IB_CA_MOD_INIT_TYPE_VALUE 0x00200000 -#define IB_CA_MOD_SYSTEM_IMAGE_GUID 0x00400000 -/* -* VALUES -* IB_CA_MOD_IS_CM_SUPPORTED -* Indicates if there is a communication manager accessible through -* the port. -* -* IB_CA_MOD_IS_SNMP_SUPPORTED -* Indicates if there is an SNMP agent accessible through the port. -* -* IB_CA_MOD_IS_DEV_MGMT_SUPPORTED -* Indicates if there is a device management agent accessible -* through the port. -* -* IB_CA_MOD_IS_VEND_SUPPORTED -* Indicates if there is a vendor supported agent accessible -* through the port. -* -* IB_CA_MOD_IS_SM -* Indicates if there is a subnet manager accessible through -* the port. -* -* IB_CA_MOD_IS_SM_DISABLED -* Indicates if the port has been disabled for configuration by the -* subnet manager. -* -* IB_CA_MOD_QKEY_CTR -* Used to reset the qkey violation counter associated with the -* port. -* -* IB_CA_MOD_PKEY_CTR -* Used to reset the pkey violation counter associated with the -* port. -* -* IB_CA_MOD_IS_NOTICE_SUPPORTED -* Indicates that this CA supports ability to generate Notices for -* Port State changes. (only applicable to switches) -* -* IB_CA_MOD_IS_TRAP_SUPPORTED -* Indicates that this management port supports ability to generate -* trap messages. (only applicable to switches) -* -* IB_CA_MOD_IS_APM_SUPPORTED -* Indicates that this port is capable of performing Automatic -* Path Migration. -* -* IB_CA_MOD_IS_SLMAP_SUPPORTED -* Indicates this port supports SLMAP capability. -* -* IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED -* Indicates that PKEY is supported in NVRAM -* -* IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED -* Indicates that MKEY is supported in NVRAM -* -* IB_CA_MOD_IS_SYSGUID_SUPPORTED -* Indicates System Image GUID support. -* -* IB_CA_MOD_IS_DR_NOTICE_SUPPORTED -* Indicate support for generating Direct Routed Notices -* -* IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED -* Indicates support for Boot Management -* -* IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED -* Indicates capability to generate notices for changes to CAPMASK -* -* IB_CA_MOD_IS_REINIT_SUPORTED -* Indicates type of node init supported. Refer to Chapter 14 for -* Initialization actions. -* -* IB_CA_MOD_IS_LEDINFO_SUPPORTED -* Indicates support for LED info. -* -* IB_CA_MOD_SHUTDOWN_PORT -* Used to modify the port active indicator. -* -* IB_CA_MOD_INIT_TYPE_VALUE -* Used to modify the init_type value for the port. -* -* IB_CA_MOD_SYSTEM_IMAGE_GUID -* Used to modify the system image GUID for the port. -*****/ - -/****d* Access Layer/ib_mr_mod_t -* NAME -* ib_mr_mod_t -* -* DESCRIPTION -* Mask used to specify which attributes of a registered memory region are -* being modified. -* -* SYNOPSIS -*/ -typedef uint32_t ib_mr_mod_t; -#define IB_MR_MOD_ADDR 0x00000001 -#define IB_MR_MOD_PD 0x00000002 -#define IB_MR_MOD_ACCESS 0x00000004 -/* -* PARAMETERS -* IB_MEM_MOD_ADDR -* The address of the memory region is being modified. -* -* IB_MEM_MOD_PD -* The protection domain associated with the memory region is being -* modified. -* -* IB_MEM_MOD_ACCESS -* The access rights the memory region are being modified. -*****/ - -/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER -* NAME -* IB_SMINFO_ATTR_MOD_HANDOVER -* -* DESCRIPTION -* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs. -* -* SOURCE -*/ -#define IB_SMINFO_ATTR_MOD_HANDOVER (CL_HTON32(0x000001)) -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE -* NAME -* IB_SMINFO_ATTR_MOD_ACKNOWLEDGE -* -* DESCRIPTION -* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs. -* -* SOURCE -*/ -#define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE (CL_HTON32(0x000002)) -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE -* NAME -* IB_SMINFO_ATTR_MOD_DISABLE -* -* DESCRIPTION -* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs. -* -* SOURCE -*/ -#define IB_SMINFO_ATTR_MOD_DISABLE (CL_HTON32(0x000003)) -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY -* NAME -* IB_SMINFO_ATTR_MOD_STANDBY -* -* DESCRIPTION -* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs. -* -* SOURCE -*/ -#define IB_SMINFO_ATTR_MOD_STANDBY (CL_HTON32(0x000004)) -/**********/ - -/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER -* NAME -* IB_SMINFO_ATTR_MOD_DISCOVER -* -* DESCRIPTION -* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs. -* -* SOURCE -*/ -#define IB_SMINFO_ATTR_MOD_DISCOVER (CL_HTON32(0x000005)) -/**********/ - -/****s* Access Layer/ib_ci_op_t -* NAME -* ib_ci_op_t -* -* DESCRIPTION -* A structure used for vendor specific CA interface communication. -* -* SYNOPSIS -*/ -typedef struct _ib_ci_op { - IN uint32_t command; - IN OUT void *p_buf OPTIONAL; - IN uint32_t buf_size; - IN OUT uint32_t num_bytes_ret; - IN OUT int32_t status; -} ib_ci_op_t; -/* -* FIELDS -* command -* A command code that is understood by the verbs provider. -* -* p_buf -* A reference to a buffer containing vendor specific data. The verbs -* provider must not access pointers in the p_buf between user-mode and -* kernel-mode. Any pointers embedded in the p_buf are invalidated by -* the user-mode/kernel-mode transition. -* -* buf_size -* The size of the buffer in bytes. -* -* num_bytes_ret -* The size in bytes of the vendor specific data returned in the buffer. -* This field is set by the verbs provider. The verbs provider should -* verify that the buffer size is sufficient to hold the data being -* returned. -* -* status -* The completion status from the verbs provider. This field should be -* initialize to indicate an error to allow detection and cleanup in -* case a communication error occurs between user-mode and kernel-mode. -* -* NOTES -* This structure is provided to allow the exchange of vendor specific -* data between the originator and the verbs provider. Users of this -* structure are expected to know the format of data in the p_buf based -* on the structure command field or the usage context. -*****/ - -END_C_DECLS -#else /* ndef __WIN__ */ -#include -#endif -#endif /* __IB_TYPES_H__ */ diff --git a/branches/opensm_3/user/include/opensm/osm_base.h b/branches/opensm_3/user/include/opensm/osm_base.h index 64c635d4..6f34f848 100644 --- a/branches/opensm_3/user/include/opensm/osm_base.h +++ b/branches/opensm_3/user/include/opensm/osm_base.h @@ -192,14 +192,13 @@ BEGIN_C_DECLS * * DESCRIPTION * Specifies the default cache directory for the db files. -* Note that the directory must appear with "/" ("\\" for windows) at the end. * * SYNOPSIS */ #ifdef __WIN__ -#define OSM_DEFAULT_CACHE_DIR "%TEMP%\\" +#define OSM_DEFAULT_CACHE_DIR OPENSM_CONFIG_DIR #else -#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm/" +#define OSM_DEFAULT_CACHE_DIR "/var/cache/opensm" #endif /***********/ /****d* OpenSM: Base/OSM_DEFAULT_LOG_FILE @@ -212,7 +211,7 @@ BEGIN_C_DECLS * SYNOPSIS */ #ifdef __WIN__ -#define OSM_DEFAULT_LOG_FILE "%TEMP%\\osm.log" +#define OSM_DEFAULT_LOG_FILE OSM_DEFAULT_TMP_DIR "osm.log" #else #define OSM_DEFAULT_LOG_FILE "/var/log/opensm.log" #endif @@ -227,15 +226,13 @@ BEGIN_C_DECLS * * SYNOPSIS */ -#ifdef __WIN__ -#define OSM_DEFAULT_CONFIG_FILE "%TEMP%\\opensm.conf" -#elif defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE) +#if defined(HAVE_DEFAULT_OPENSM_CONFIG_FILE) #define OSM_DEFAULT_CONFIG_FILE HAVE_DEFAULT_OPENSM_CONFIG_FILE #elif defined (OPENSM_CONFIG_DIR) #define OSM_DEFAULT_CONFIG_FILE OPENSM_CONFIG_DIR "/opensm.conf" #else #define OSM_DEFAULT_CONFIG_FILE "/etc/opensm/opensm.conf" -#endif /* __WIN__ */ +#endif /***********/ /****d* OpenSM: Base/OSM_DEFAULT_PARTITION_CONFIG_FILE @@ -247,15 +244,13 @@ BEGIN_C_DECLS * * SYNOPSIS */ -#ifdef __WIN__ -#define OSM_DEFAULT_PARTITION_CONFIG_FILE "%TEMP%\\osm-partitions.conf" -#elif defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE) +#if defined(HAVE_DEFAULT_PARTITION_CONFIG_FILE) #define OSM_DEFAULT_PARTITION_CONFIG_FILE HAVE_DEFAULT_PARTITION_CONFIG_FILE #elif defined(OPENSM_CONFIG_DIR) #define OSM_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "/partitions.conf" #else #define OSM_DEFAULT_PARTITION_CONFIG_FILE "/etc/opensm/partitions.conf" -#endif /* __WIN__ */ +#endif /***********/ /****d* OpenSM: Base/OSM_DEFAULT_QOS_POLICY_FILE @@ -267,15 +262,13 @@ BEGIN_C_DECLS * * SYNOPSIS */ -#ifdef __WIN__ -#define OSM_DEFAULT_QOS_POLICY_FILE "%TEMP%\\osm-qos-policy.conf" -#elif defined(HAVE_DEFAULT_QOS_POLICY_FILE) +#if defined(HAVE_DEFAULT_QOS_POLICY_FILE) #define OSM_DEFAULT_QOS_POLICY_FILE HAVE_DEFAULT_QOS_POLICY_FILE #elif defined(OPENSM_CONFIG_DIR) #define OSM_DEFAULT_QOS_POLICY_FILE OPENSM_CONFIG_DIR "/qos-policy.conf" #else #define OSM_DEFAULT_QOS_POLICY_FILE "/etc/opensm/qos-policy.conf" -#endif /* __WIN__ */ +#endif /***********/ /****d* OpenSM: Base/OSM_DEFAULT_PREFIX_ROUTES_FILE @@ -287,9 +280,7 @@ BEGIN_C_DECLS * * SYNOPSIS */ -#ifdef __WIN__ -#define OSM_DEFAULT_PREFIX_ROUTES_FILE "%TEMP%\\osm-prefix-routes.conf" -#elif defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE) +#if defined(HAVE_DEFAULT_PREFIX_ROUTES_FILE) #define OSM_DEFAULT_PREFIX_ROUTES_FILE HAVE_DEFAULT_PREFIX_ROUTES_FILE #elif defined(OPENSM_CONFIG_DIR) #define OSM_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "/prefix-routes.conf" @@ -668,7 +659,7 @@ typedef enum _osm_thread_state { /***********/ /* - * OSM_CAP are from Table 117 and C15-0.1.7 Table 186 + * OSM_CAP are from IBA 1.2.1 Table 117 and Table 188 */ /****d* OpenSM: Base/OSM_CAP_IS_TRAP_SUP diff --git a/branches/opensm_3/user/include/opensm/osm_config.h b/branches/opensm_3/user/include/opensm/osm_config.h index 4a6daf43..2b940989 100644 --- a/branches/opensm_3/user/include/opensm/osm_config.h +++ b/branches/opensm_3/user/include/opensm/osm_config.h @@ -29,23 +29,23 @@ /* Define as 1 if you want to enable the performance manager profiling code */ /* #undef ENABLE_OSM_PERF_MGR_PROFILE */ +/* Define OpenSM config directory */ +#define OPENSM_CONFIG_DIR "%ProgramFiles%\\OFED\\OpenSM" + /* Define a default node name map file */ -#define HAVE_DEFAULT_NODENAME_MAP "%TEMP%\\ib-node-name-map" +#define HAVE_DEFAULT_NODENAME_MAP OPENSM_CONFIG_DIR "\\ib-node-name-map" /* Define a default OpenSM config file */ -#undef HAVE_DEFAULT_OPENSM_CONFIG_FILE +#define HAVE_DEFAULT_OPENSM_CONFIG_FILE OPENSM_CONFIG_DIR "\\opensm.conf" /* Define a Partition config file */ -#undef HAVE_DEFAULT_PARTITION_CONFIG_FILE +#define HAVE_DEFAULT_PARTITION_CONFIG_FILE OPENSM_CONFIG_DIR "\\partitions.conf" /* Define a Prefix Routes config file */ -#undef HAVE_DEFAULT_PREFIX_ROUTES_FILE +#define HAVE_DEFAULT_PREFIX_ROUTES_FILE OPENSM_CONFIG_DIR "\\prefix-routes.conf" /* Define a QOS policy config file */ -#undef HAVE_DEFAULT_QOS_POLICY_FILE - -/* Define OpenSM config directory */ -#undef OPENSM_CONFIG_DIR +#define HAVE_DEFAULT_QOS_POLICY_FILE OPENSM_CONFIG_DIR "\\qos-policy.conf" /* Define as 1 for vapi vendor */ /* #undef OSM_VENDOR_INTF_MTL */ diff --git a/branches/opensm_3/user/include/opensm/osm_event_plugin.h b/branches/opensm_3/user/include/opensm/osm_event_plugin.h index 5550a67b..1ba26593 100644 --- a/branches/opensm_3/user/include/opensm/osm_event_plugin.h +++ b/branches/opensm_3/user/include/opensm/osm_event_plugin.h @@ -142,8 +142,8 @@ typedef struct osm_event_plugin { const char *osm_version; void *(*create) (struct osm_opensm *osm); void (*delete) (void *plugin_data); - void (*report) (void *plugin_data, - osm_epi_event_id_t event_id, void *event_data); + void (*report) (void *plugin_data, osm_epi_event_id_t event_id, + void *event_data); } osm_event_plugin_t; /** ========================================================================= diff --git a/branches/opensm_3/user/include/opensm/osm_log.h b/branches/opensm_3/user/include/opensm/osm_log.h index 93acdcbb..b115e918 100644 --- a/branches/opensm_3/user/include/opensm/osm_log.h +++ b/branches/opensm_3/user/include/opensm/osm_log.h @@ -120,6 +120,7 @@ typedef struct osm_log { boolean_t accum_log_file; boolean_t daemon; char *log_file_name; + char *log_prefix; } osm_log_t; /*********/ diff --git a/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h b/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h index 55f65288..9f65f139 100644 --- a/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h +++ b/branches/opensm_3/user/include/opensm/osm_mcast_tbl.h @@ -76,7 +76,7 @@ typedef struct osm_mcast_fwdbl { uint16_t num_entries; uint16_t max_mlid_ho; uint16_t mft_depth; - uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX]; + uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1]; } osm_mcast_tbl_t; /* * FIELDS @@ -106,7 +106,7 @@ typedef struct osm_mcast_fwdbl { * * p_mask_tbl * Pointer to a two dimensional array of port_masks for this switch. -* The first dimension is MLID, the second dimension is mask position. +* The first dimension is MLID offset, second dimension is mask position. * This pointer is null for switches that do not support multicast. * * SEE ALSO diff --git a/branches/opensm_3/user/include/opensm/osm_multicast.h b/branches/opensm_3/user/include/opensm/osm_multicast.h index 144685e7..c869342b 100644 --- a/branches/opensm_3/user/include/opensm/osm_multicast.h +++ b/branches/opensm_3/user/include/opensm/osm_multicast.h @@ -97,8 +97,8 @@ BEGIN_C_DECLS */ typedef struct osm_mgrp { cl_fmap_item_t map_item; + cl_list_item_t list_item; ib_net16_t mlid; - osm_mtree_node_t *p_root; cl_qmap_t mcm_port_tbl; ib_member_rec_t mcmember_rec; boolean_t well_known; @@ -109,15 +109,13 @@ typedef struct osm_mgrp { * map_item * Map Item for fmap linkage. Must be first element!! * +* list_item +* List item for linkage in osm_mgrp_box's mgrp_list qlist. +* * mlid * The network ordered LID of this Multicast Group (must be * >= 0xC000). * -* p_root -* Pointer to the root "tree node" in the single spanning tree -* for this multicast group. The nodes of the tree represent -* switches. Member ports are not represented in the tree. -* * mcm_port_tbl * Table (sorted by port GUID) of osm_mcm_port_t objects * representing the member ports of this multicast group. @@ -133,56 +131,66 @@ typedef struct osm_mgrp { * SEE ALSO *********/ -/****f* OpenSM: Multicast Group/osm_mgrp_new +/****s* OpenSM: Multicast Group/osm_mgrp_box_t * NAME -* osm_mgrp_new +* osm_mgrp_box_t * * DESCRIPTION -* Allocates and initializes a Multicast Group for use. +* Multicast structure which holds all multicast groups with same MLID. * * SYNOPSIS */ -osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr); +typedef struct osm_mgrp_box { + uint16_t mlid; + cl_qlist_t mgrp_list; + osm_mtree_node_t *root; +} osm_mgrp_box_t; /* -* PARAMETERS +* FIELDS * mlid -* [in] Multicast LID for this multicast group. -* -* mcmr -* [in] MCMember Record for this multicast group. +* The host ordered LID of this Multicast Group (must be +* >= 0xC000). * -* RETURN VALUES -* IB_SUCCESS if initialization was successful. +* p_root +* Pointer to the root "tree node" in the single spanning tree +* for this multicast group. The nodes of the tree represent +* switches. Member ports are not represented in the tree. * -* NOTES -* Allows calling other Multicast Group methods. +* mgrp_list +* List of multicast groups (mpgr object) having same MLID value. * * SEE ALSO -* Multicast Group, osm_mgrp_delete *********/ -/****f* OpenSM: Multicast Group/osm_mgrp_delete +/****f* OpenSM: Multicast Group/osm_mgrp_new * NAME -* osm_mgrp_delete +* osm_mgrp_new * * DESCRIPTION -* Destroys and deallocates a Multicast Group. +* Allocates and initializes a Multicast Group for use. * * SYNOPSIS */ -void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp); +osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid, + IN ib_member_rec_t * mcmr); /* * PARAMETERS -* p_mgrp -* [in] Pointer to an osm_mgrp_t object. +* subn +* [in] Pointer to osm_subn_t object. +* mlid +* [in] Multicast LID for this multicast group. +* +* mcmr +* [in] MCMember Record for this multicast group. * * RETURN VALUES -* None. +* IB_SUCCESS if initialization was successful. * * NOTES +* Allows calling other Multicast Group methods. * * SEE ALSO -* Multicast Group, osm_mgrp_new +* Multicast Group, osm_mgrp_delete *********/ /****f* OpenSM: Multicast Group/osm_mgrp_is_guid @@ -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, osm_mcm_port_t * mcm_port, ib_member_rec_t * mcmr); void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr); +void osm_mgrp_box_delete(osm_mgrp_box_t *mbox); END_C_DECLS #endif /* _OSM_MULTICAST_H_ */ diff --git a/branches/opensm_3/user/include/opensm/osm_partition.h b/branches/opensm_3/user/include/opensm/osm_partition.h index 869fce43..201802b9 100644 --- a/branches/opensm_3/user/include/opensm/osm_partition.h +++ b/branches/opensm_3/user/include/opensm/osm_partition.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -48,6 +48,7 @@ #include #include #include +#include #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { @@ -92,8 +93,8 @@ BEGIN_C_DECLS typedef struct osm_prtn { cl_map_item_t map_item; ib_net16_t pkey; - ib_net16_t mlid; uint8_t sl; + osm_mgrp_t *mgrp; cl_map_t full_guid_tbl; cl_map_t part_guid_tbl; char name[32]; @@ -106,13 +107,13 @@ typedef struct osm_prtn { * pkey * The IBA defined P_KEY of this Partition. * -* mlid -* The network ordered LID of the well known Multicast Group -* that was created for this partition. -* * sl * The Service Level (SL) associated with this Partiton. * +* mgrp +* The pointer to the well known Multicast Group +* that was created for this partition (when configured). +* * full_guid_tbl * Container of pointers to all Port objects in the Partition * with full membership, indexed by port GUID. diff --git a/branches/opensm_3/user/include/opensm/osm_pkey.h b/branches/opensm_3/user/include/opensm/osm_pkey.h index d9d1425a..28d4fa8d 100644 --- a/branches/opensm_3/user/include/opensm/osm_pkey.h +++ b/branches/opensm_3/user/include/opensm/osm_pkey.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. @@ -211,9 +212,9 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl); * *********/ -/****f* OpenSM: osm_pkey_get_num_blocks +/****f* OpenSM: osm_pkey_tbl_get_num_blocks * NAME -* osm_pkey_get_num_blocks +* osm_pkey_tbl_get_num_blocks * * DESCRIPTION * Obtain the number of blocks in IB PKey table diff --git a/branches/opensm_3/user/include/opensm/osm_port.h b/branches/opensm_3/user/include/opensm/osm_port.h index ed042be6..b5999586 100644 --- a/branches/opensm_3/user/include/opensm/osm_port.h +++ b/branches/opensm_3/user/include/opensm/osm_port.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/include/opensm/osm_port_profile.h b/branches/opensm_3/user/include/opensm/osm_port_profile.h index 304a79b3..ba08b105 100644 --- a/branches/opensm_3/user/include/opensm/osm_port_profile.h +++ b/branches/opensm_3/user/include/opensm/osm_port_profile.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * diff --git a/branches/opensm_3/user/include/opensm/osm_qos_policy.h b/branches/opensm_3/user/include/opensm/osm_qos_policy.h index 5cfa482d..864ed91c 100644 --- a/branches/opensm_3/user/include/opensm/osm_qos_policy.h +++ b/branches/opensm_3/user/include/opensm/osm_qos_policy.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/include/opensm/osm_router.h b/branches/opensm_3/user/include/opensm/osm_router.h index 774e67d0..722e6015 100644 --- a/branches/opensm_3/user/include/opensm/osm_router.h +++ b/branches/opensm_3/user/include/opensm/osm_router.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/include/opensm/osm_sa.h b/branches/opensm_3/user/include/opensm/osm_sa.h index a35db6b6..ccaddd24 100644 --- a/branches/opensm_3/user/include/opensm/osm_sa.h +++ b/branches/opensm_3/user/include/opensm/osm_sa.h @@ -125,6 +125,7 @@ typedef struct osm_sa { atomic32_t sa_trans_id; osm_sa_mad_ctrl_t mad_ctrl; cl_timer_t sr_timer; + boolean_t dirty; cl_disp_reg_handle_t cpi_disp_h; cl_disp_reg_handle_t nr_disp_h; cl_disp_reg_handle_t pir_disp_h; @@ -178,6 +179,10 @@ typedef struct osm_sa { * mad_ctrl * Mad Controller * +* dirty +* A flag that denotes that SA DB is dirty and needs +* to be written to the dump file (if dumping is enabled) +* * SEE ALSO * SM object *********/ @@ -431,7 +436,9 @@ int osm_sa_db_file_dump(struct osm_opensm *p_osm); * [in] Pointer to an osm_opensm_t object. * * RETURN VALUES -* None +* 0 if the SA DB was actually dumped +* >0 if there was no need to dump the SA DB +* <0 if some error occurred. * *********/ @@ -484,7 +491,5 @@ osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa, IN ib_net64_t comp_mask, * *********/ -osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid); - END_C_DECLS #endif /* _OSM_SA_H_ */ diff --git a/branches/opensm_3/user/include/opensm/osm_sm.h b/branches/opensm_3/user/include/opensm/osm_sm.h index 8c256a44..eeff0d51 100644 --- a/branches/opensm_3/user/include/opensm/osm_sm.h +++ b/branches/opensm_3/user/include/opensm/osm_sm.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/include/opensm/osm_subnet.h b/branches/opensm_3/user/include/opensm/osm_subnet.h index 4e9ddf44..94079f1c 100644 --- a/branches/opensm_3/user/include/opensm/osm_subnet.h +++ b/branches/opensm_3/user/include/opensm/osm_subnet.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. @@ -186,6 +186,7 @@ typedef struct osm_subn_opt { uint16_t console_port; char *port_prof_ignore_file; char *hop_weights_file; + char *dimn_ports_file; boolean_t port_profile_switch_nodes; boolean_t sweep_on_trap; char *routing_engine_names; @@ -200,12 +201,14 @@ typedef struct osm_subn_opt { char *ids_guid_file; char *guid_routing_order_file; char *sa_db_file; + boolean_t sa_db_dump; boolean_t do_mesh_analysis; boolean_t exit_on_fatal; boolean_t honor_guid2lid_file; boolean_t daemon; boolean_t sm_inactive; boolean_t babbling_port_policy; + boolean_t use_optimized_slvl; osm_qos_options_t qos_options; osm_qos_options_t qos_ca_options; osm_qos_options_t qos_sw0_options; @@ -221,8 +224,10 @@ typedef struct osm_subn_opt { char *event_db_dump_file; #endif /* ENABLE_OSM_PERF_MGR */ char *event_plugin_name; + char *event_plugin_options; char *node_name_map_name; char *prefix_routes_file; + char *log_prefix; boolean_t consolidate_ipv6_snm_req; struct osm_subn_opt *file_opts; /* used for update */ uint8_t lash_start_vl; /* starting vl to use in lash */ @@ -374,8 +379,8 @@ typedef struct osm_subn_opt { * * connect_roots * The option which will enforce root to root connectivity with -* up/down routing engine (even if this violates "pure" deadlock -* free up/down algorithm) +* up/down and fat-tree routing engines (even if this violates +* "pure" deadlock free up/down or fat-tree algorithm) * * use_ucast_cache * When TRUE enables unicast routing cache. @@ -411,6 +416,10 @@ typedef struct osm_subn_opt { * sa_db_file * Name of the SA database file. * +* sa_db_dump +* When TRUE causes OpenSM to dump SA DB at the end of every +* light sweep regardless the current verbosity level. +* * exit_on_fatal * If TRUE (default) - SM will exit on fatal subnet initialization * issues. @@ -433,6 +442,10 @@ typedef struct osm_subn_opt { * babbling_port_policy * OpenSM will enforce its "babbling" port policy. * +* use_optimized_slvl +* Use optimized SLtoVLMappingTable programming if +* device indicates it supports this. +* * perfmgr * Enable or disable the performance manager * @@ -445,8 +458,11 @@ typedef struct osm_subn_opt { * event_db_dump_file * File to dump the event database to * -* event_db_plugin -* Specify the name of the event plugin +* event_plugin_name +* Specify the name(s) of the event plugin(s) +* +* event_plugin_options +* Options string that would be passed to the plugin(s) * * qos_options * Default set of QoS options @@ -518,7 +534,7 @@ typedef struct osm_subn { boolean_t coming_out_of_standby; unsigned need_update; cl_fmap_t mgrp_mgid_tbl; - void *mgroups[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1]; + void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1]; } osm_subn_t; /* * FIELDS @@ -643,9 +659,9 @@ typedef struct osm_subn { * Container of pointers to all Multicast group objects in * the subnet. Indexed by MGID. * -* mgroups -* Array of pointers to all Multicast Group objects in the subnet. -* Indexed by MLID offset from base MLID. +* mboxes +* Array of pointers to all Multicast MLID box objects in the +* subnet. Indexed by MLID offset from base MLID. * * SEE ALSO * Subnet object @@ -942,6 +958,31 @@ struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn, * osm_port_t *********/ +/****f* OpenSM: Port/osm_get_port_by_lid_ho +* NAME +* osm_get_port_by_lid_ho +* +* DESCRIPTION +* Returns a pointer of the port object for given lid value. +* +* SYNOPSIS +*/ +struct osm_port *osm_get_port_by_lid_ho(const osm_subn_t * subn, uint16_t lid); +/* +* PARAMETERS +* subn +* [in] Pointer to the subnet data structure. +* +* lid +* [in] LID requested in hot byte order. +* +* RETURN VALUES +* The port structure pointer if found. NULL otherwise. +* +* SEE ALSO +* Subnet object, osm_port_t +*********/ + /****f* OpenSM: Port/osm_get_port_by_lid * NAME * osm_get_port_by_lid @@ -951,14 +992,18 @@ struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn, * * SYNOPSIS */ -struct osm_port *osm_get_port_by_lid(const osm_subn_t * subn, ib_net16_t lid); +static inline struct osm_port *osm_get_port_by_lid(IN osm_subn_t const * subn, + IN ib_net16_t lid) +{ + return osm_get_port_by_lid_ho(subn, cl_ntoh16(lid)); +} /* * PARAMETERS * subn * [in] Pointer to the subnet data structure. * * lid -* [in] LID requested. +* [in] LID requested in network byte order. * * RETURN VALUES * The port structure pointer if found. NULL otherwise. @@ -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 *********/ -/****f* OpenSM: Subnet/osm_get_mgrp_by_mlid +/****f* OpenSM: Subnet/osm_get_mgrp_by_mgid * NAME -* osm_get_mgrp_by_mlid +* osm_get_mgrp_by_mgid * * DESCRIPTION -* The looks for the given multicast group in the subnet table by mlid. +* The looks for the given multicast group in the subnet table by mgid. * NOTE: this code is not thread safe. Need to grab the lock before * calling it. * * SYNOPSIS */ -static inline -struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid) -{ - return p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO]; -} +struct osm_mgrp *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid); /* * PARAMETERS -* p_subn +* subn * [in] Pointer to an osm_subn_t object * -* mlid -* [in] The multicast group mlid in network order +* mgid +* [in] The multicast group MGID value * * RETURN VALUES * The multicast group structure pointer if found. NULL otherwise. *********/ -/****f* OpenSM: Helper/osm_get_physp_by_mad_addr +/****f* OpenSM: Subnet/osm_get_mbox_by_mlid * NAME -* osm_get_physp_by_mad_addr +* osm_get_mbox_by_mlid * * DESCRIPTION -* Looks for the requester physical port in the mad address. -* -* Note: This code is not thread safe. Need to grab the lock before -* calling it. +* The looks for the given multicast group in the subnet table by mlid. +* NOTE: this code is not thread safe. Need to grab the lock before +* calling it. * * SYNOPSIS */ -struct osm_physp *osm_get_physp_by_mad_addr(IN struct osm_log *p_log, - IN const osm_subn_t * p_subn, - IN struct osm_mad_addr - *p_mad_addr); +static inline struct osm_mgrp_box *osm_get_mbox_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid) +{ + return p_subn->mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO]; +} /* * PARAMETERS -* p_log -* [in] Pointer to a log object. -* * p_subn -* [in] Pointer to subnet object. +* [in] Pointer to an osm_subn_t object * -* p_mad_addr -* [in] Pointer to mad address object. +* mlid +* [in] The multicast group mlid in network order * * RETURN VALUES -* Pointer to requester physical port object if found. Null otherwise. -* -* NOTES -* -* SEE ALSO +* The multicast group structure pointer if found. NULL otherwise. *********/ /****f* OpenSM: Subnet/osm_subn_set_default_opt diff --git a/branches/opensm_3/user/include/opensm/osm_switch.h b/branches/opensm_3/user/include/opensm/osm_switch.h index 8b5ffd35..7fe11426 100644 --- a/branches/opensm_3/user/include/opensm/osm_switch.h +++ b/branches/opensm_3/user/include/opensm/osm_switch.h @@ -100,6 +100,7 @@ typedef struct osm_switch { uint16_t num_hops; uint8_t **hops; osm_port_profile_t *p_prof; + uint8_t *dimn_ports; uint8_t *lft; uint8_t *new_lft; uint16_t lft_size; @@ -109,6 +110,9 @@ typedef struct osm_switch { unsigned endport_links; unsigned need_update; void *priv; + cl_map_item_t mgrp_item; + uint32_t num_of_mcm; + uint8_t is_mc_member; } osm_switch_t; /* * FIELDS @@ -151,6 +155,15 @@ typedef struct osm_switch { * When set indicates that switch was probably reset, so * fwd tables and rest cached data should be flushed * +* mgrp_item +* map item for switch in building mcast tree +* +* num_of_mcm +* number of mcast members(ports) connected to switch +* +* is_mc_member +* whether switch is a mcast member itself +* * SEE ALSO * Switch object *********/ @@ -427,37 +440,6 @@ static inline uint8_t osm_switch_get_port_by_lid(IN const osm_switch_t * p_sw, * Switch object *********/ -/****f* OpenSM: Switch/osm_switch_get_physp_ptr -* NAME -* osm_switch_get_physp_ptr -* -* DESCRIPTION -* Gets the Physical Port Object at the specified port number. -* -* SYNOPSIS -*/ -osm_physp_t *osm_switch_get_physp_ptr(IN const osm_switch_t * p_sw, - IN uint32_t port_num); -/* -* PARAMETERS -* p_sw -* [in] Pointer to an osm_switch_t object. -* -* port_num -* [in] Port number for which to retrieve the Physical Port Object. -* -* RETURN VALUES -* Returns a pointer to the Physical Port Object object at the specified -* port number. -* A return value of zero means the port number was out of range. -* -* -* NOTES -* -* SEE ALSO -* Switch object -*********/ - /****f* OpenSM: Switch/osm_switch_get_route_by_lid * NAME * osm_switch_get_route_by_lid @@ -890,6 +872,35 @@ static inline uint8_t osm_switch_get_mft_max_position(IN osm_switch_t * p_sw) * RETURN VALUE */ +/****f* OpenSM: Switch/osm_switch_get_dimn_port +* NAME +* osm_switch_get_dimn_port +* +* DESCRIPTION +* Get the routing ordered port +* +* SYNOPSIS +*/ +static inline uint8_t osm_switch_get_dimn_port(IN const osm_switch_t * p_sw, + IN uint8_t port_num) +{ + CL_ASSERT(p_sw); + if (p_sw->dimn_ports == NULL) + return port_num; + return p_sw->dimn_ports[port_num]; +} +/* +* PARAMETERS +* p_sw +* [in] Pointer to the switch object. +* +* port_num +* [in] Port number in the switch +* +* RETURN VALUES +* Returns the port number ordered for routing purposes. +*/ + /****f* OpenSM: Switch/osm_switch_recommend_path * NAME * osm_switch_recommend_path diff --git a/branches/opensm_3/user/include/opensm/osm_ucast_cache.h b/branches/opensm_3/user/include/opensm/osm_ucast_cache.h index 6dbef5b3..af17bb20 100644 --- a/branches/opensm_3/user/include/opensm/osm_ucast_cache.h +++ b/branches/opensm_3/user/include/opensm/osm_ucast_cache.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU diff --git a/branches/opensm_3/user/include/opensm/osm_version.h b/branches/opensm_3/user/include/opensm/osm_version.h index 8f614085..5f354110 100644 --- a/branches/opensm_3/user/include/opensm/osm_version.h +++ b/branches/opensm_3/user/include/opensm/osm_version.h @@ -45,7 +45,11 @@ * * SYNOPSIS */ -#define OSM_VERSION "OpenSM 3.3.3" +#ifdef OSM_VENDOR_INTF_AL +#define OSM_VERSION "OpenSM 3.3.6" " IBAL" +#else +#define OSM_VERSION "OpenSM 3.3.6" " UMAD" +#endif /********/ #endif /* _OSM_VERSION_H_ */ diff --git a/branches/opensm_3/user/include/opensm/osm_vl15intf.h b/branches/opensm_3/user/include/opensm/osm_vl15intf.h index a286324f..a2dfa8f8 100644 --- a/branches/opensm_3/user/include/opensm/osm_vl15intf.h +++ b/branches/opensm_3/user/include/opensm/osm_vl15intf.h @@ -36,7 +36,7 @@ /* * Abstract: * Declaration of osm_vl15_t. - * This object represents an IBA subnet. + * This object represents a VL15 interface object. * This object is part of the OpenSM family of objects. */ diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_api.h b/branches/opensm_3/user/include/vendor/osm_vendor_api.h index 95f802be..9c6a4106 100644 --- a/branches/opensm_3/user/include/vendor/osm_vendor_api.h +++ b/branches/opensm_3/user/include/vendor/osm_vendor_api.h @@ -370,8 +370,8 @@ osm_vendor_send(IN osm_bind_handle_t h_bind, * * NOTES * 1. Only mads that expect a response are tracked for transaction competion. -* 2. A mad that does not expect a response is being put back immediatly after -* being sent. +* 2. A mad that does not expect a response is being put back immediately +* after being sent. * * SEE ALSO *********/ diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h index 3651911e..2b105acd 100644 --- a/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h +++ b/branches/opensm_3/user/include/vendor/osm_vendor_mlx.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -92,5 +92,8 @@ typedef struct _osm_vend_wrap { #define OSM_BIND_INVALID_HANDLE NULL #endif +/* The maximum number of retransmissions of the same MAD */ +#define OSM_DEFAULT_RETRY_COUNT 3 + END_C_DECLS #endif diff --git a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h index 625cd3b6..7bb93432 100644 --- a/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h +++ b/branches/opensm_3/user/include/vendor/osm_vendor_mlx_defs.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -52,8 +52,6 @@ BEGIN_C_DECLS /* The maximum number of outstanding MADs an RMPP sender can transmit */ #define OSMV_RMPP_RECV_WIN 16 -/* The maximum number of retransmissions of the same MAD */ -#define OSMV_MAX_RETRANSMIT 3 /* Transaction Timeout = OSMV_TXN_TIMEOUT_FACTOR * Response Timeout */ #define OSMV_TXN_TIMEOUT_FACTOR 128 /************/ diff --git a/branches/opensm_3/user/include/vendor/winosm_common.h b/branches/opensm_3/user/include/vendor/winosm_common.h index e65eb4f8..d6325368 100644 --- a/branches/opensm_3/user/include/vendor/winosm_common.h +++ b/branches/opensm_3/user/include/vendor/winosm_common.h @@ -95,11 +95,17 @@ getopt_long_only(int argc, char *const*argv, #define ETIMEDOUT (10060) #endif -extern char *osm_strdup(const char *); +extern char *strdup_expand(const char *); +extern FILE *Fopen(const char *,const char *); +#define fopen Fopen /* The following defines replace syslog.h */ -#define openlog(a,b,c) -#define closelog() + +void openlog(char *ident, int option, int facility); +void closelog(void); +#define LOG_CONS (1<<0) +#define LOG_PID (1<<2) +#define LOG_USER (1<<3) void syslog(int priority, char *fmt, ... ); @@ -172,21 +178,9 @@ GetOsmCachePath(void); * SYNOPSIS */ -/* XXX STAN verify this runtime works, it doesn't...*/ -#if 1 -#define cl_item_objX(item_ptr, obj_ptr, item_field) (void *) \ - ((uint8_t*)item_ptr - \ - ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)&(obj_ptr))) -#else -#define cl_item_objX(item_ptr, obj_ptr, item_field) (void *) \ - ((uint8_t*)item_ptr - \ - ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)(&(obj_ptr)))) -#endif - - -#define cl_item_obj(item_ptr, obj_ptr, item_field, TypeOF_Obj) TypeOF_Obj \ - ((uint8_t *)item_ptr - (uint8_t *)&( TypeOF_Obj 0)->item_field) - +#define cl_item_obj(item_ptr, obj_ptr, item_field) \ + (void*)((uint8_t*)item_ptr - \ + ((uint8_t*)(&(obj_ptr)->item_field) - (uint8_t*)(obj_ptr))) /* * PARAMETERS * item_ptr diff --git a/branches/opensm_3/user/libvendor/SOURCES b/branches/opensm_3/user/libvendor/SOURCES index 38d485a3..e6c9cd56 100644 --- a/branches/opensm_3/user/libvendor/SOURCES +++ b/branches/opensm_3/user/libvendor/SOURCES @@ -12,8 +12,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR) TARGETPATH=$(LIBPATH) !endif -!include vendor-ibal.inc -#!include vendor-umad.inc +!INCLUDE ..\mad-vendor.inc TARGETNAME=$(VENDOR_LIB) TARGETTYPE=LIBRARY @@ -54,6 +53,7 @@ C_DEFINES=$(C_DEFINES) -D__WIN__ -DHAVE_CONFIG_H -D$(VENDOR_IF) !if !$(FREEBUILD) C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG +# in cl_types_osd.h '_DEBUG_' is defined by virture of '_DEBUG" being defined. !endif LINKER_FLAGS= $(LINKER_FLAGS) /DEF:$(VENDOR_LIB).exports diff --git a/branches/opensm_3/user/libvendor/libosmvendor.map b/branches/opensm_3/user/libvendor/libosmvendor.map deleted file mode 100644 index e951e6d2..00000000 --- a/branches/opensm_3/user/libvendor/libosmvendor.map +++ /dev/null @@ -1,20 +0,0 @@ -OSMVENDOR_2.0 { - global: - umad_receiver; - osm_vendor_init; - osm_vendor_new; - osm_vendor_delete; - osm_vendor_get_all_port_attr; - osm_vendor_bind; - osm_vendor_unbind; - osm_vendor_get; - osm_vendor_put; - osm_vendor_send; - osm_vendor_local_lid_change; - osm_vendor_set_sm; - osm_vendor_set_debug; - osmv_bind_sa; - osmv_query_sa; - osm_vendor_get_guid_ca_and_port; - local: *; -}; diff --git a/branches/opensm_3/user/libvendor/libosmvendor.ver b/branches/opensm_3/user/libvendor/libosmvendor.ver index ce47b668..132452ae 100644 --- a/branches/opensm_3/user/libvendor/libosmvendor.ver +++ b/branches/opensm_3/user/libvendor/libosmvendor.ver @@ -6,4 +6,4 @@ # API_REV - advance on any added API # RUNNING_REV - advance any change to the vendor files # AGE - number of backward versions the API still supports -LIBVERSION=3:0:0 +LIBVERSION=3:3:0 diff --git a/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c b/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c index 8ff8f4d7..6a690e9b 100644 --- a/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c +++ b/branches/opensm_3/user/libvendor/osm_pkt_randomizer.c @@ -217,8 +217,6 @@ Exit: return res; } -/********************************************************************** - **********************************************************************/ boolean_t osm_pkt_randomizer_mad_drop(IN osm_log_t * p_log, IN osm_pkt_randomizer_t * p_pkt_randomizer, @@ -253,8 +251,6 @@ Exit: return res; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_pkt_randomizer_init(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer, IN osm_log_t * p_log) @@ -313,8 +309,6 @@ Exit: return (res); } -/********************************************************************** - **********************************************************************/ void osm_pkt_randomizer_destroy(IN OUT osm_pkt_randomizer_t ** pp_pkt_randomizer, IN osm_log_t * p_log) diff --git a/branches/opensm_3/user/libvendor/osm_vendor_al.c b/branches/opensm_3/user/libvendor/osm_vendor_al.c index 32a2d142..d6bad906 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_al.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_al.c @@ -44,8 +44,6 @@ * $Revision: 1.8 $ */ -// XXX #include - #ifdef OSM_VENDOR_INTF_AL /* Next available error code: 0x300 @@ -153,8 +151,7 @@ __osm_set_vend_wrap( IN osm_al_bind_info_t* const p_bind, static void AL_API -__osm_al_ca_err_callback( - IN ib_async_event_rec_t *p_async_rec ) +__osm_al_ca_err_callback( IN ib_async_event_rec_t *p_async_rec ) { osm_vendor_t *p_vend = (osm_vendor_t*)p_async_rec->context; OSM_LOG_ENTER( p_vend->p_log ); @@ -170,8 +167,7 @@ __osm_al_ca_err_callback( /********************************************************************** **********************************************************************/ static void AL_API -__osm_al_ca_destroy_callback( - IN void *context ) +__osm_al_ca_destroy_callback( IN void *context ) { osm_al_bind_info_t *p_bind = (osm_al_bind_info_t*)context; osm_vendor_t *p_vend = p_bind->p_vend; @@ -188,8 +184,7 @@ __osm_al_ca_destroy_callback( **********************************************************************/ static void AL_API -__osm_al_err_callback( - IN ib_async_event_rec_t *p_async_rec ) +__osm_al_err_callback( IN ib_async_event_rec_t *p_async_rec ) { osm_al_bind_info_t *p_bind = (osm_al_bind_info_t*)p_async_rec->context; osm_vendor_t *p_vend = p_bind->p_vend; @@ -367,7 +362,9 @@ __osm_al_rcv_callback( mad_addr.addr_type.gsi.remote_qkey = p_elem->remote_qkey; mad_addr.addr_type.gsi.pkey_ix = p_elem->pkey_index; mad_addr.addr_type.gsi.service_level = p_elem->remote_sl; - mad_addr.addr_type.gsi.global_route = FALSE; + mad_addr.addr_type.gsi.global_route = 0; /* FIXME: handle GRH */ + memset(&mad_addr.addr_type.gsi.grh_info, 0, + sizeof mad_addr.addr_type.gsi.grh_info); } /* @@ -387,7 +384,7 @@ __osm_al_rcv_callback( */ osm_log( p_vend->p_log, OSM_LOG_DEBUG, "__osm_al_rcv_callback: " - "The Mad is a response , thus handeled in __osm_al_send_callback\n"); + "The Mad is a response , thus handled in __osm_al_send_callback\n"); CL_ASSERT( p_elem->send_context1 != NULL ); CL_ASSERT( p_elem->send_context2 == NULL ); @@ -407,7 +404,7 @@ __osm_al_rcv_callback( { osm_log( p_vend->p_log, OSM_LOG_DEBUG, "__osm_al_rcv_callback: " - "The Mad is a request , thus handeled in __osm_al_rcv_callback\n"); + "The Mad is a request , thus handled in __osm_al_rcv_callback\n"); CL_ASSERT( p_elem->send_context1 == NULL ); CL_ASSERT( p_elem->send_context2 == NULL ); @@ -1052,15 +1049,15 @@ osm_vendor_bind( port_guid = p_user_bind->port_guid; osm_log( p_vend->p_log, OSM_LOG_INFO, - "osm_vendor_bind: " - "Binding to port 0x%" PRIx64 ".\n", + "osm_vendor_bind: Binding to port 0x%" PRIx64 ".\n", cl_ntoh64( port_guid ) ); if( p_vend->h_ca == 0 ) { - osm_log( p_vend->p_log, OSM_LOG_DEBUG, - "osm_vendor_bind: " - "Opening CA that owns port 0x%" PRIx64 ".\n", cl_ntoh64( port_guid )); + osm_log( p_vend->p_log, OSM_LOG_DEBUG, + "osm_vendor_bind: " + "Opening CA that owns port 0x%" PRIx64 ".\n", + cl_ntoh64( port_guid )); status = __osm_vendor_open_ca( p_vend, port_guid ); if( status != IB_SUCCESS ) @@ -1113,14 +1110,13 @@ osm_vendor_bind( qp_create.rq_depth = p_user_bind->recv_q_size; qp_create.sq_sge = OSM_AL_SQ_SGE; qp_create.rq_sge = OSM_AL_RQ_SGE; - status = ib_get_spl_qp( - p_vend->h_pd, - port_guid, - &qp_create, - p_bind, - __osm_al_err_callback, - &p_bind->pool_key, - &p_bind->h_qp ); + status = ib_get_spl_qp( p_vend->h_pd, + port_guid, + &qp_create, + p_bind, + __osm_al_err_callback, + &p_bind->pool_key, + &p_bind->h_qp ); if( status != IB_SUCCESS ) { @@ -1144,17 +1140,28 @@ osm_vendor_bind( mad_svc.mgmt_class = p_user_bind->mad_class; mad_svc.mgmt_version = p_user_bind->class_version; mad_svc.support_unsol = p_user_bind->is_responder; + mad_svc.method_array[IB_MAD_METHOD_GET] = TRUE; mad_svc.method_array[IB_MAD_METHOD_SET] = TRUE; mad_svc.method_array[IB_MAD_METHOD_DELETE] = TRUE; mad_svc.method_array[IB_MAD_METHOD_TRAP] = TRUE; mad_svc.method_array[IB_MAD_METHOD_GETTABLE] = TRUE; - - status = ib_reg_mad_svc( - p_bind->h_qp, - &mad_svc, - &p_bind->h_svc ); +#ifdef DUAL_SIDED_RMPP + mad_svc.method_array[IB_MAD_METHOD_GETMULTI] = TRUE; +#endif + /* Add in IB_MAD_METHOD_GETTRACETABLE */ + /* when supported by OpenSM */ +#if 0 + if (p_user_bind->is_report_processor) + mad_svc.method_array[IB_MAD_METHOD_REPORT] = TRUE; + + if (p_user_bind->is_trap_processor) { + mad_svc.method_array[IB_MAD_METHOD_TRAP] = TRUE; + mad_svc.method_array[IB_MAD_METHOD_TRAP_REPRESS] = TRUE; + } +#endif + status = ib_reg_mad_svc( p_bind->h_qp, &mad_svc, &p_bind->h_svc ); if( status != IB_SUCCESS ) { @@ -1172,19 +1179,19 @@ osm_vendor_bind( status = ib_create_av( p_vend->h_pd, &av, &(p_bind->h_dr_av) ); if( status != IB_SUCCESS ) { - osm_log( p_vend->p_log, OSM_LOG_ERROR, + osm_log( p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_bind: ERR 3B22: " "Unable to create address vector (%s).\n", ib_get_err_str( status ) ); - cl_free( p_bind ); - p_bind = 0; - goto Exit; + cl_free( p_bind ); + p_bind = 0; + goto Exit; } if( osm_log_is_active( p_vend->p_log, OSM_LOG_DEBUG ) ) { - osm_log( p_vend->p_log, OSM_LOG_DEBUG, + osm_log( p_vend->p_log, OSM_LOG_DEBUG, "osm_vendor_bind: " "Allocating av handle %p.\n", p_bind->h_dr_av ); } diff --git a/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c b/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c index 06602c40..79af5b44 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_ibumad.c @@ -1,8 +1,9 @@ /* - * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. + * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -325,26 +326,28 @@ static void * OSM_API umad_receiver(void *p_ptr) /* if status != 0 then we are handling recv timeout on send */ if (umad_status(p_madw->vend_wrap.umad)) { - OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5409: " - "send completed with error" - " (method=0x%X attr=0x%X trans_id=0x%" PRIx64 - ") -- dropping\n", - mad->method, cl_ntoh16(mad->attr_id), - cl_ntoh64(mad->trans_id)); + if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) { /* LID routed */ - OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, - "ERR 5410: class 0x%x LID 0x%x\n", - mad->mgmt_class, + OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5410: " + "Send completed with error -- dropping\n" + "\t\t\tClass 0x%x, Method 0x%X, Attr 0x%X, " + "TID 0x%" PRIx64 ", LID %u\n", + mad->mgmt_class, mad->method, + cl_ntoh16(mad->attr_id), + cl_ntoh64(mad->trans_id), cl_ntoh16(ib_mad_addr->lid)); } else { ib_smp_t *smp; /* Direct routed SMP */ smp = (ib_smp_t *) mad; - OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, - "ERR 5411: DR SMP Hop Ptr: 0x%X\n", - smp->hop_ptr); + OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5411: " + "DR SMP Send completed with error -- dropping\n" + "\t\t\tMethod 0x%X, Attr 0x%X, TID 0x%" PRIx64 + ", Hop Ptr: 0x%X\n", + mad->method, cl_ntoh16(mad->attr_id), + cl_ntoh64(mad->trans_id), smp->hop_ptr); osm_dump_smp_dr_path(p_vend->p_log, smp, OSM_LOG_ERROR); } @@ -353,7 +356,7 @@ static void * OSM_API umad_receiver(void *p_ptr) OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5412: " "Failed to obtain request madw for timed out MAD" - "(method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n", + " (method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n", mad->method, cl_ntoh16(mad->attr_id), cl_ntoh64(mad->trans_id)); } else { @@ -437,6 +440,7 @@ static int umad_receiver_start(osm_vendor_t * p_vend) #ifdef HAVE_LIBPTHREADS if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) < 0) return -1; + return 0; #else { @@ -472,8 +476,6 @@ static void umad_receiver_stop(umad_receiver_t * p_ur) p_ur->p_log = NULL; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_vendor_init(IN osm_vendor_t * const p_vend, IN osm_log_t * const p_log, IN const uint32_t timeout) @@ -536,8 +538,6 @@ Exit: return (r); } -/********************************************************************** - **********************************************************************/ osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log, IN const uint32_t timeout) { @@ -570,8 +570,6 @@ Exit: return (p_vend); } -/********************************************************************** - **********************************************************************/ void osm_vendor_delete(IN osm_vendor_t ** const pp_vend) { osm_vendor_close_port(*pp_vend); @@ -587,8 +585,6 @@ void osm_vendor_delete(IN osm_vendor_t ** const pp_vend) *pp_vend = NULL; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend, IN ib_port_attr_t * const p_attr_array, @@ -654,8 +650,6 @@ Exit: return r; } -/********************************************************************** - **********************************************************************/ static int osm_vendor_open_port(IN osm_vendor_t * const p_vend, IN const ib_net64_t port_guid) @@ -682,9 +676,8 @@ osm_vendor_open_port(IN osm_vendor_t * const p_vend, } for (ca = 0; ca < p_vend->ca_count; ca++) { - if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], - portguids, - OSM_UMAD_MAX_CAS)) < 0) { + if ((r = umad_get_ca_portguids(p_vend->ca_names[ca], portguids, + OSM_UMAD_MAX_PORTS_PER_CA + 1)) < 0) { OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5421: " "Unable to get CA %s port guids (%s)\n", p_vend->ca_names[ca], strerror(r)); @@ -800,8 +793,6 @@ static int set_bit(int nr, void *method_mask) return retval; } -/********************************************************************** - **********************************************************************/ osm_bind_handle_t osm_vendor_bind(IN osm_vendor_t * const p_vend, IN osm_bind_info_t * const p_user_bind, @@ -952,8 +943,6 @@ Exit: return ((osm_bind_handle_t) p_bind); } -/********************************************************************** - **********************************************************************/ static void __osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw, IN void *bind_context, IN osm_madw_t * p_req_madw) @@ -964,8 +953,6 @@ __osm_vendor_recv_dummy_cb(IN osm_madw_t * p_madw, #endif } -/********************************************************************** - **********************************************************************/ static void __osm_vendor_send_err_dummy_cb(IN void *bind_context, IN osm_madw_t * p_req_madw) @@ -976,8 +963,6 @@ __osm_vendor_send_err_dummy_cb(IN void *bind_context, #endif } -/********************************************************************** - **********************************************************************/ void osm_vendor_unbind(IN osm_bind_handle_t h_bind) { osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind; @@ -993,8 +978,6 @@ void osm_vendor_unbind(IN osm_bind_handle_t h_bind) OSM_LOG_EXIT(p_vend->p_log); } -/********************************************************************** - **********************************************************************/ ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind, IN const uint32_t mad_size, IN osm_vend_wrap_t * const p_vw) @@ -1020,8 +1003,6 @@ ib_mad_t *osm_vendor_get(IN osm_bind_handle_t h_bind, return (p_vw->umad ? umad_get_mad(p_vw->umad) : NULL); } -/********************************************************************** - **********************************************************************/ void osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw) { @@ -1049,8 +1030,6 @@ osm_vendor_put(IN osm_bind_handle_t h_bind, IN osm_vend_wrap_t * const p_vw) OSM_LOG_EXIT(p_vend->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_vendor_send(IN osm_bind_handle_t h_bind, IN osm_madw_t * const p_madw, IN boolean_t const resp_expected) @@ -1133,8 +1112,8 @@ Resp: resp_expected ? p_bind->timeout : 0, p_bind->max_retries)) < 0) { OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: " - "Send p_madw = %p of size %d failed %d (%m)\n", - p_madw, sent_mad_size, ret); + "Send p_madw = %p of size %d TID 0x%" PRIx64 " failed %d (%m)\n", + p_madw, sent_mad_size, cl_ntoh64(p_mad->trans_id), ret); if (resp_expected) { get_madw(p_vend, &p_mad->trans_id); /* remove from aging table */ p_madw->status = IB_ERROR; @@ -1156,8 +1135,6 @@ Exit: return (ret); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind) { osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *) h_bind; @@ -1169,9 +1146,6 @@ ib_api_status_t osm_vendor_local_lid_change(IN osm_bind_handle_t h_bind) return (0); } -/********************************************************************** - **********************************************************************/ - #ifndef __WIN__ void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val) @@ -1210,7 +1184,7 @@ void osm_vendor_set_sm(IN osm_bind_handle_t h_bind, IN boolean_t is_sm_val) OSM_LOG_EXIT(p_vend->p_log); } -#endif /* ! __GNUC__ */ +#endif /* ! __WIN__ */ void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level) { diff --git a/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c b/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c index 3a00865d..83b44bf5 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_ibumad_sa.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. + * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -45,9 +45,6 @@ #include #include -/***************************************************************************** - *****************************************************************************/ - /* this struct is the internal rep of the bind handle */ typedef struct _osmv_sa_bind_info { osm_bind_handle_t h_bind; @@ -58,9 +55,6 @@ typedef struct _osmv_sa_bind_info { time_t last_lids_update_sec; } osmv_sa_bind_info_t; -/***************************************************************************** - *****************************************************************************/ - /* Call back on new mad received: @@ -137,9 +131,9 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw, number of records in here */ query_res.result_cnt = (uintn_t) ((p_madw->mad_size - IB_SA_MAD_HDR_SIZE) / - ib_get_attr_size(p_sa_mad->attr_offset)); + ib_get_attr_size(p_sa_mad->attr_offset)); OSM_LOG(p_bind->p_log, OSM_LOG_DEBUG, - "Count = %u = %zu / %u (%zu)\n", + "Count = %u = %u / %u (%u)\n", query_res.result_cnt, p_madw->mad_size - IB_SA_MAD_HDR_SIZE, ib_get_attr_size(p_sa_mad->attr_offset), @@ -172,8 +166,6 @@ Exit: OSM_LOG_EXIT(p_bind->p_log); } -/***************************************************************************** - ****************************************************************************/ /* Send Error Callback: @@ -227,8 +219,6 @@ static ib_api_status_t update_umad_port(osm_vendor_t * p_vend) return IB_SUCCESS; } -/***************************************************************************** - *****************************************************************************/ osm_bind_handle_t osmv_bind_sa(IN osm_vendor_t * const p_vend, IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid) @@ -251,6 +241,8 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend, bind_info.is_report_processor = FALSE; bind_info.send_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE; bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE; + bind_info.timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC; + bind_info.retries = OSM_DEFAULT_RETRY_COUNT; /* allocate the new sa bind info */ p_sa_bind_info = @@ -296,9 +288,6 @@ Exit: return (p_sa_bind_info); } -/***************************************************************************** - *****************************************************************************/ - /****t* OSM Vendor SA Client/osmv_sa_mad_data * NAME * osmv_sa_mad_data @@ -339,8 +328,6 @@ typedef struct _osmv_sa_mad_data { * *****/ -/***************************************************************************** - *****************************************************************************/ /* Send a MAD out on the GSI interface */ static ib_api_status_t __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind, @@ -469,8 +456,6 @@ Exit: return status; } -/***************************************************************************** - *****************************************************************************/ /* * Query the SA based on the user's request. */ @@ -738,7 +723,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, #endif default: - OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 UNKNOWN\n"); + OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 UNKNOWN 0x%x (%d)\n", + p_query_req->query_type, p_query_req->query_type); CL_ASSERT(0); return IB_ERROR; } diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx.c index 15571a74..4486f00b 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_mlx.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_mlx.c @@ -762,8 +762,6 @@ get_send_txn_done: return ret; } -/********************************************************************** - **********************************************************************/ void osm_vendor_set_debug(IN osm_vendor_t * const p_vend, IN int32_t level) { diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c index 580584e5..fa168ced 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca.c @@ -262,8 +262,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ void osm_ca_info_destroy(IN osm_vendor_t * const p_vend, IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca) diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c index d7364626..91efafae 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_mlx_hca_sim.c @@ -593,8 +593,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ void osm_ca_info_destroy(IN osm_vendor_t * const p_vend, IN osm_ca_info_t * const p_ca_info, IN uint8_t num_ca) diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c index 40c95bf5..461ad27e 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_mlx_sa.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -46,9 +46,6 @@ #include #include -/***************************************************************************** - *****************************************************************************/ - /* this struct is the internal rep of the bind handle */ typedef struct _osmv_sa_bind_info { osm_bind_handle_t h_bind; @@ -62,9 +59,6 @@ typedef struct _osmv_sa_bind_info { uint16_t sm_lid; } osmv_sa_bind_info_t; -/***************************************************************************** - *****************************************************************************/ - /* Call back on new mad received: @@ -147,12 +141,12 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw, "__osmv_sa_mad_rcv_cb: Count = 0\n"); } else { - query_res.result_cnt = (uintn_t) - ((p_madw->mad_size - IB_SA_MAD_HDR_SIZE) / - ib_get_attr_size(p_sa_mad->attr_offset)); + query_res.result_cnt = + (p_madw->mad_size - IB_SA_MAD_HDR_SIZE) / + ib_get_attr_size(p_sa_mad->attr_offset); osm_log(p_bind->p_log, OSM_LOG_DEBUG, "__osmv_sa_mad_rcv_cb: " - "Count = %u = %zu / %u (%zu)\n", + "Count = %u = %u / %u (%u)\n", query_res.result_cnt, p_madw->mad_size - IB_SA_MAD_HDR_SIZE, ib_get_attr_size(p_sa_mad->attr_offset), @@ -183,8 +177,6 @@ Exit: OSM_LOG_EXIT(p_bind->p_log); } -/***************************************************************************** - ****************************************************************************/ /* Send Error Callback: @@ -314,8 +306,6 @@ Exit: return (status); } -/***************************************************************************** - *****************************************************************************/ osm_bind_handle_t osmv_bind_sa(IN osm_vendor_t * const p_vend, IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid) @@ -338,8 +328,10 @@ osmv_bind_sa(IN osm_vendor_t * const p_vend, bind_info.is_responder = TRUE; bind_info.is_trap_processor = FALSE; bind_info.is_report_processor = TRUE; - bind_info.send_q_size = 256; - bind_info.recv_q_size = 256; + bind_info.send_q_size = OSM_SM_DEFAULT_QP1_RCV_SIZE; + bind_info.recv_q_size = OSM_SM_DEFAULT_QP1_SEND_SIZE; + bind_info.timeout = OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC; + bind_info.retries = OSM_DEFAULT_RETRY_COUNT; /* allocate the new sa bind info */ p_sa_bind_info = @@ -404,9 +396,6 @@ Exit: return (p_sa_bind_info); } -/***************************************************************************** - *****************************************************************************/ - /****t* OSM Vendor SA Client/osmv_sa_mad_data * NAME * osmv_sa_mad_data @@ -447,8 +436,6 @@ typedef struct _osmv_sa_mad_data { * *****/ -/***************************************************************************** - *****************************************************************************/ /* Send a MAD out on the GSI interface */ ib_api_status_t __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind, @@ -584,8 +571,6 @@ Exit: return status; } -/***************************************************************************** - *****************************************************************************/ /* * Query the SA based on the user's request. */ @@ -593,14 +578,23 @@ ib_api_status_t osmv_query_sa(IN osm_bind_handle_t h_bind, IN const osmv_query_req_t * const p_query_req) { - osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind; + union { + ib_service_record_t svc_rec; + ib_node_record_t node_rec; + ib_portinfo_record_t port_info; + ib_path_rec_t path_rec; +#ifdef DUAL_SIDED_RMPP + ib_multipath_rec_t multipath_rec; +#endif + ib_class_port_info_t class_port_info; + } u; osmv_sa_mad_data_t sa_mad_data; + osmv_sa_bind_info_t *p_bind = (osmv_sa_bind_info_t *) h_bind; osmv_user_query_t *p_user_query; - ib_service_record_t svc_rec; - ib_node_record_t node_rec; - ib_portinfo_record_t port_info; - ib_path_rec_t path_rec; - ib_class_port_info_t class_port_info; +#ifdef DUAL_SIDED_RMPP + osmv_multipath_req_t *p_mpr_req; + int i, j; +#endif osm_log_t *p_log = p_bind->p_log; ib_api_status_t status; @@ -610,6 +604,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.method = IB_MAD_METHOD_GETTABLE; sa_mad_data.attr_mod = 0; + memset((void*)&u, 0, sizeof(u)); + /* Set the MAD attributes and component mask correctly. */ switch (p_query_req->query_type) { @@ -629,12 +625,11 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, case OSMV_QUERY_ALL_SVC_RECS: osm_log(p_log, OSM_LOG_DEBUG, "osmv_query_sa DBG:001 %s", "SVC_REC_BY_NAME\n"); - sa_mad_data.method = IB_MAD_METHOD_GETTABLE; sa_mad_data.attr_id = IB_MAD_ATTR_SERVICE_RECORD; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t)); sa_mad_data.comp_mask = 0; - sa_mad_data.p_attr = &svc_rec; + sa_mad_data.p_attr = &u.svc_rec; break; case OSMV_QUERY_SVC_REC_BY_NAME: @@ -645,8 +640,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.comp_mask = IB_SR_COMPMASK_SNAME; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t)); - sa_mad_data.p_attr = &svc_rec; - memcpy(svc_rec.service_name, p_query_req->p_query_input, + sa_mad_data.p_attr = &u.svc_rec; + memcpy(u.svc_rec.service_name, p_query_req->p_query_input, sizeof(ib_svc_name_t)); break; @@ -657,8 +652,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.comp_mask = IB_SR_COMPMASK_SID; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_service_record_t)); - sa_mad_data.p_attr = &svc_rec; - svc_rec.service_id = + sa_mad_data.p_attr = &u.svc_rec; + u.svc_rec.service_id = *(ib_net64_t *) (p_query_req->p_query_input); break; @@ -670,20 +665,19 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_class_port_info_t)); sa_mad_data.comp_mask = 0; - sa_mad_data.p_attr = &class_port_info; + sa_mad_data.p_attr = &u.class_port_info; break; case OSMV_QUERY_NODE_REC_BY_NODE_GUID: osm_log(p_log, OSM_LOG_DEBUG, "osmv_query_sa DBG:001 %s", "NODE_REC_BY_NODE_GUID\n"); - sa_mad_data.method = IB_MAD_METHOD_GETTABLE; sa_mad_data.attr_id = IB_MAD_ATTR_NODE_RECORD; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_node_record_t)); sa_mad_data.comp_mask = IB_NR_COMPMASK_NODEGUID; - sa_mad_data.p_attr = &node_rec; - node_rec.node_info.node_guid = + sa_mad_data.p_attr = &u.node_rec; + u.node_rec.node_info.node_guid = *(ib_net64_t *) (p_query_req->p_query_input); break; @@ -695,8 +689,8 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_portinfo_record_t)); sa_mad_data.comp_mask = IB_PIR_COMPMASK_LID; - sa_mad_data.p_attr = &port_info; - port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input); + sa_mad_data.p_attr = &u.port_info; + u.port_info.lid = *(ib_net16_t *) (p_query_req->p_query_input); break; case OSMV_QUERY_PORT_REC_BY_LID_AND_NUM: @@ -746,39 +740,37 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, case OSMV_QUERY_PATH_REC_BY_PORT_GUIDS: osm_log(p_log, OSM_LOG_DEBUG, "osmv_query_sa DBG:001 %s", "PATH_REC_BY_PORT_GUIDS\n"); - memset(&path_rec, 0, sizeof(ib_path_rec_t)); + memset(&u.path_rec, 0, sizeof(ib_path_rec_t)); sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_path_rec_t)); sa_mad_data.comp_mask = (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH); - path_rec.num_path = 0x7f; - sa_mad_data.p_attr = &path_rec; - ib_gid_set_default(&path_rec.dgid, + u.path_rec.num_path = 0x7f; + sa_mad_data.p_attr = &u.path_rec; + ib_gid_set_default(&u.path_rec.dgid, ((osmv_guid_pair_t *) (p_query_req-> - p_query_input))-> - dest_guid); - ib_gid_set_default(&path_rec.sgid, + p_query_input))->dest_guid); + ib_gid_set_default(&u.path_rec.sgid, ((osmv_guid_pair_t *) (p_query_req-> - p_query_input))-> - src_guid); + p_query_input))->src_guid); break; case OSMV_QUERY_PATH_REC_BY_GIDS: osm_log(p_log, OSM_LOG_DEBUG, "osmv_query_sa DBG:001 %s", "PATH_REC_BY_GIDS\n"); - memset(&path_rec, 0, sizeof(ib_path_rec_t)); + memset(&u.path_rec, 0, sizeof(ib_path_rec_t)); sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_path_rec_t)); sa_mad_data.comp_mask = - (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH); - path_rec.num_path = 0x7f; - sa_mad_data.p_attr = &path_rec; - memcpy(&path_rec.dgid, + (IB_PR_COMPMASK_DGID | IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH); + u.path_rec.num_path = 0x7f; + sa_mad_data.p_attr = &u.path_rec; + memcpy(&u.path_rec.dgid, &((osmv_gid_pair_t *) (p_query_req->p_query_input))-> dest_gid, sizeof(ib_gid_t)); - memcpy(&path_rec.sgid, + memcpy(&u.path_rec.sgid, &((osmv_gid_pair_t *) (p_query_req->p_query_input))-> src_gid, sizeof(ib_gid_t)); break; @@ -786,18 +778,18 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, case OSMV_QUERY_PATH_REC_BY_LIDS: osm_log(p_log, OSM_LOG_DEBUG, "osmv_query_sa DBG:001 %s", "PATH_REC_BY_LIDS\n"); - memset(&path_rec, 0, sizeof(ib_path_rec_t)); + memset(&u.path_rec, 0, sizeof(ib_path_rec_t)); sa_mad_data.method = IB_MAD_METHOD_GET; sa_mad_data.attr_id = IB_MAD_ATTR_PATH_RECORD; sa_mad_data.attr_offset = ib_get_attr_offset(sizeof(ib_path_rec_t)); sa_mad_data.comp_mask = (IB_PR_COMPMASK_DLID | IB_PR_COMPMASK_SLID); - sa_mad_data.p_attr = &path_rec; - path_rec.dlid = + sa_mad_data.p_attr = &u.path_rec; + u.path_rec.dlid = ((osmv_lid_pair_t *) (p_query_req->p_query_input))-> dest_lid; - path_rec.slid = + u.path_rec.slid = ((osmv_lid_pair_t *) (p_query_req->p_query_input))->src_lid; break; @@ -827,9 +819,50 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, sa_mad_data.p_attr = p_user_query->p_attr; break; +#ifdef DUAL_SIDED_RMPP + case OSMV_QUERY_MULTIPATH_REC: + OSM_LOG(p_log, OSM_LOG_DEBUG, "DBG:001 MULTIPATH_REC\n"); + /* Validate sgid/dgid counts against SA client limit */ + p_mpr_req = (osmv_multipath_req_t *) p_query_req->p_query_input; + if (p_mpr_req->sgid_count + p_mpr_req->dgid_count > + IB_MULTIPATH_MAX_GIDS) { + OSM_LOG(p_log, OSM_LOG_ERROR, "DBG:001 MULTIPATH_REC " + "SGID count %d DGID count %d max count %d\n", + p_mpr_req->sgid_count, p_mpr_req->dgid_count, + IB_MULTIPATH_MAX_GIDS); + CL_ASSERT(0); + return IB_ERROR; + } + memset(&u.multipath_rec, 0, sizeof(ib_multipath_rec_t)); + sa_mad_data.method = IB_MAD_METHOD_GETMULTI; + sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD; + sa_mad_data.attr_offset = + ib_get_attr_offset(sizeof(ib_multipath_rec_t)); + sa_mad_data.p_attr = &u.multipath_rec; + sa_mad_data.comp_mask = p_mpr_req->comp_mask; + u.multipath_rec.num_path = p_mpr_req->num_path; + if (p_mpr_req->reversible) + u.multipath_rec.num_path |= 0x80; + else + u.multipath_rec.num_path &= ~0x80; + u.multipath_rec.pkey = p_mpr_req->pkey; + ib_multipath_rec_set_sl(&u.multipath_rec, p_mpr_req->sl); + ib_multipath_rec_set_qos_class(&u.multipath_rec, 0); + u.multipath_rec.independence = p_mpr_req->independence; + u.multipath_rec.sgid_count = p_mpr_req->sgid_count; + u.multipath_rec.dgid_count = p_mpr_req->dgid_count; + j = 0; + for (i = 0; i < p_mpr_req->sgid_count; i++, j++) + u.multipath_rec.gids[j] = p_mpr_req->gids[j]; + for (i = 0; i < p_mpr_req->dgid_count; i++, j++) + u.multipath_rec.gids[j] = p_mpr_req->gids[j]; + break; +#endif + default: osm_log(p_log, OSM_LOG_ERROR, - "osmv_query_sa DBG:001 %s", "UNKNOWN\n"); + "osmv_query_sa DBG:001 UNKNOWN 0x%x (%d)\n", + p_query_req->query_type,p_query_req->query_type); CL_ASSERT(0); return IB_ERROR; } @@ -839,6 +872,3 @@ osmv_query_sa(IN osm_bind_handle_t h_bind, OSM_LOG_EXIT(p_log); return status; } - -/***************************************************************************** - *****************************************************************************/ diff --git a/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c b/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c index d837c8eb..55c312a3 100644 --- a/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c +++ b/branches/opensm_3/user/libvendor/osm_vendor_mlx_txn.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -76,7 +76,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind, CL_ASSERT(NULL != h_bind && NULL != pp_txn); osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG, - "Starting transaction 0x%llX (key=0x%llX)\n", tid, key); + "Starting transaction 0x%016" PRIx64 + " (key=0x%016" PRIx64 ")\n", tid, key); p_txn = malloc(sizeof(osmv_txn_ctx_t)); if (!p_txn) { @@ -95,7 +96,8 @@ osmv_txn_init(IN osm_bind_handle_t h_bind, if (IB_SUCCESS != st) { osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR, "osmv_txn_init: ERR 6703: " - "Failed to insert to transaction 0x%llX (key=0x%llX) to manager DB\n", + "Failed to insert to transaction 0x%016" PRIx64 + " (key=0x%016" PRIx64 ") to manager DB\n", tid, key); goto insert_txn_failed; } @@ -371,7 +373,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr, osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG, "__osmv_txnmgr_lookup: " - "Looking for key: 0x%llX in map ptr:%p\n", key, + "Looking for key: 0x%016" PRIx64 " in map ptr:%p\n", key, p_tx_mgr->p_txn_map); p_item = cl_qmap_head(p_tx_mgr->p_txn_map); @@ -379,7 +381,7 @@ __osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr, tmp_key = cl_qmap_key(p_item); osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG, "__osmv_txnmgr_lookup: " - "Found key 0x%llX \n", tmp_key); + "Found key 0x%016" PRIx64 "\n", tmp_key); p_item = cl_qmap_next(p_item); } @@ -413,7 +415,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr, osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG, "__osmv_txnmgr_insert_txn: " - "Inserting key: 0x%llX to map ptr:%p\n", key, + "Inserting key: 0x%016" PRIx64 " to map ptr:%p\n", key, p_tx_mgr->p_txn_map); memset(p_obj, 0, sizeof(cl_map_obj_t)); @@ -427,7 +429,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr_t * p_tx_mgr, tmp_key = cl_qmap_key(p_item); osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG, "__osmv_txnmgr_insert_txn: " - "Found key 0x%llX \n", tmp_key); + "Found key 0x%016" PRIx64 "\n", tmp_key); p_item = cl_qmap_next(p_item); } @@ -452,7 +454,7 @@ __osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr, osm_log(p_tx_mgr->p_log, OSM_LOG_ERROR, "__osmv_txnmgr_remove_txn: ERR 6701: " - "Could not remove the transaction 0x%llX - " + "Could not remove the transaction 0x%016" PRIx64 " - " "something is really wrong!\n", key); OSM_LOG_EXIT(p_tx_mgr->p_log); return IB_NOT_FOUND; @@ -556,14 +558,14 @@ __osmv_txn_timeout_cb(IN uint64_t key, switch (osmv_txn_get_rmpp_state(p_txn)) { case OSMV_TXN_RMPP_NONE: - if (num_regs <= OSMV_MAX_RETRANSMIT) { + if (num_regs <= OSM_DEFAULT_RETRY_COUNT) { /* We still did not exceed the limit of retransmissions. * Set the next timeout's value. */ osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG, "__osmv_txn_timeout_cb: " - "The transaction request (tid=0x%llX) timed out %d times. " - "Retrying the send.\n", + "The transaction request (tid=0x%016" PRIx64 ")" + " timed out %d times. Retrying the send.\n", osmv_txn_get_tid(p_txn), num_regs); /* resend this mad */ @@ -572,7 +574,8 @@ __osmv_txn_timeout_cb(IN uint64_t key, if (ret != IB_SUCCESS) { osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR, "__osmv_txn_timeout_cb: " - "Fail to send retry for transaction request (tid=0x%llX).\n", + "Fail to send retry for transaction" + "request (tid=0x%016" PRIx64 ").\n", osmv_txn_get_tid(p_txn)); osmv_txn_done((osm_bind_handle_t) p_bo, key, @@ -599,7 +602,8 @@ __osmv_txn_timeout_cb(IN uint64_t key, } else { osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR, "__osmv_txn_timeout_cb: ERR 6702: " - "The transaction request (tid=0x%llX) timed out (after %d retries). " + "The transaction request (0x%016" PRIx64 ") " + "timed out (after %d retries). " "Invoking the error callback.\n", osmv_txn_get_tid(p_txn), num_regs); @@ -613,12 +617,12 @@ __osmv_txn_timeout_cb(IN uint64_t key, case OSMV_TXN_RMPP_SENDER: osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG, - "RMPP sender (tid=0x%llX) did not receive ACK " + "RMPP sender (tid=0x%016" PRIx64 ") did not receive ACK " "on every segment in the current send window.\n", osmv_txn_get_tid(p_txn)); p_send_ctx = osmv_txn_get_rmpp_send_ctx(p_txn); - if (num_regs <= OSMV_MAX_RETRANSMIT) { + if (num_regs <= OSM_DEFAULT_RETRY_COUNT) { /* We still did not exceed the limit of retransmissions. * Set the next timeout's value. */ @@ -643,8 +647,9 @@ __osmv_txn_timeout_cb(IN uint64_t key, case OSMV_TXN_RMPP_RECEIVER: osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG, - "Transaction timeout on an RMPP receiver (tid=0x%llX). " - "Dropping the transaction.\n", osmv_txn_get_tid(p_txn)); + "Transaction timeout on an RMPP receiver " + "(tid=0x%016" PRIx64 "). Dropping the transaction.\n", + osmv_txn_get_tid(p_txn)); osmv_txn_done((osm_bind_handle_t) p_bo, key, TRUE /*in timeout callback */ ); diff --git a/branches/opensm_3/user/libvendor/winosm_common.c b/branches/opensm_3/user/libvendor/winosm_common.c index eaf8b128..517ef543 100644 --- a/branches/opensm_3/user/libvendor/winosm_common.c +++ b/branches/opensm_3/user/libvendor/winosm_common.c @@ -4,32 +4,106 @@ #include #include #include +#include #include <..\..\..\..\etc\user\inet.c> +/* + * Just like fopen() except the filename string is env var expanded prior + * to opening the file. Allows %TEMP%\osm.log to work. + */ +#undef fopen + +FILE *Fopen( + const char *filename, + const char *mode ) +{ + FILE *pFile; + char *fname; + + fname = strdup_expand(filename); + pFile = fopen(fname,mode); + free(fname); + return pFile; +} + #define OSM_MAX_LOG_NAME_SIZE 512 +static char *syslog_fname; +static FILE *syslog_file; +static char *syslog_id; + +void openlog(char *ident, int option, int facility) +{ + if (!syslog_fname) + syslog_fname = strdup(OSM_DEFAULT_TMP_DIR "osm.syslog"); + + if (!syslog_file) { + syslog_file = Fopen(syslog_fname,"w"); + if (syslog_file) + syslog_id = strdup(ident); + } +} + +void closelog(void) +{ + if (syslog_file) { + fprintf(syslog_file, "\n[%s] Closing syslog\n",syslog_id); + fflush(syslog_file); + fclose(syslog_file); + syslog_file = NULL; + if (syslog_id) { + free((void*)syslog_id); + syslog_id = NULL; + } + if (syslog_fname) { + free((void*)syslog_fname); + syslog_fname = NULL; + } + } +} + /* output to user-mode DebugView monitor if running */ void syslog(int prio, char *fmt, ... ) { - CHAR Buffer[1024]; - va_list argptr; - va_start(argptr,fmt); + char Buffer[1024]; + SYSTEMTIME st; + uint32_t pid = GetCurrentThreadId(); + va_list args; + + va_start(args,fmt); + _vsnprintf(Buffer, 1024, (LPSTR)fmt, args); + va_end(args); + + if (!syslog_file) { + OutputDebugStringA(Buffer); + return; + } - _vsnprintf(Buffer, 1024, (LPSTR)fmt, argptr); - OutputDebugStringA(Buffer); + GetLocalTime(&st); + fprintf(syslog_file, "[%s][%02d:%02d:%02d:%03d][%04X] %s", syslog_id, + st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pid, + Buffer); + fflush(syslog_file); } #if 0 +/* Mellanox specific WinIB_HOME env var override of %TEMP% from previous + * openSM port; Not currently utilized pending feedback. + */ char* GetOsmTempPath(void) { char* temp_path; int length; + temp_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); + if (!temp_path) + return temp_path; + length = GetTempPath(OSM_MAX_LOG_NAME_SIZE,temp_path); if (length > OSM_MAX_LOG_NAME_SIZE) { @@ -43,12 +117,11 @@ GetOsmTempPath(void) char* GetOsmCachePath(void) { - char* cache_path; + char* cache_path; char* tmp_file_name; char* winib_home, tmp; HANDLE hFile; - winib_home = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); winib_home = getenv("WinIB_HOME"); if (winib_home == NULL) { @@ -56,11 +129,11 @@ GetOsmCachePath(void) default temp path */ return GetOsmTempPath(); } - cache_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); + cache_path = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); strcpy(cache_path, winib_home); strcat(cache_path, "\\etc\\"); - tmp_file_name = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); + tmp_file_name = (char*)cl_malloc(OSM_MAX_LOG_NAME_SIZE); strcpy(tmp_file_name, cache_path); strcat(tmp_file_name, "opensm.opts"); hFile = CreateFile(tmp_file_name, @@ -78,7 +151,7 @@ GetOsmCachePath(void) /* Such file exists. This means the directory is usable */ CloseHandle(hFile); - return cache_path; + return cache_path; } #endif @@ -89,7 +162,7 @@ GetOsmCachePath(void) * Multiple Env vars are supported. */ -char *osm_strdup(const char *base) +char *strdup_expand(const char *base) { char *str,*p,*s,*es,*xs,*rc,*n; char p_env[80]; @@ -105,7 +178,7 @@ char *osm_strdup(const char *base) memcpy(p_env,s,p-s); p_env[p-s] = '\0'; - es = getenv(p_env); + es = getenv(p_env); if (!es) return str; @@ -123,185 +196,12 @@ char *osm_strdup(const char *base) /****************************************************************************/ -int optind=1; -int opterr=1; -int optopt='?'; -char *optarg; - -static int iArg=1; +#include <..\..\..\etc\user\getopt.c> int getopt_long_only(int argc, char *const*argv, const char *optstring, const struct option *longopts, int *longindex) { - char chOpt; - char tmp_str[256]; - char* tmp_arg = NULL; - char* tok=NULL; - int i; - char tokens[2] = {'='}; - - if (optind == 0) { - optind = iArg = opterr = 1; - optopt='?'; - } - - if (iArg == argc) - return (EOF); - - if (argv[iArg][0] != '-') - { - /* Does not start with a '-' we are done scanning */ - return (EOF); - } - - /*termination of scanning */ - if (!strcmp("--",argv[iArg])) { - return EOF; - } - - - /* char option : -d 5 */ - if ((argv[iArg][0] == '-') && (argv[iArg][1] != '-') ) { - optarg = get_char_option(optstring, argv, argc, iArg, &optind, &chOpt); - iArg = optind; - return chOpt; - } - - /* Look for this string in longopts */ - strcpy(tmp_str,&(argv[iArg][2])); - - /*get the option */ - tok = strtok(tmp_str,tokens); - - for (i = 0; longopts[i].name; i++) - { - if (strcmp (tok, longopts[i].name) == 0) - { - /* We have a match */ - if (longindex != NULL ) - *longindex = i; - - if (longopts[i].flag != NULL) { - *(longopts[i].flag) = longopts[i].val; - } - - - - if (longopts[i].has_arg != no_argument) - { - /*get the argument */ - - if (strchr(argv[iArg],'=') != NULL) - { - optarg = strtok(NULL,tokens); - }else { /*the next arg in cmd line is the param */ - tmp_arg = argv[iArg+1]; - if (*tmp_arg == '-') { - - /*no param is found */ - chOpt = '?'; - if ((longopts[i].has_arg == required_argument) && opterr) - { - fprintf (stderr, "Option %s requires argument\n",tok); - } - - }else - { - optarg = tmp_arg; - iArg++; - optind++; - } - } - - }/*longopts */ - - iArg++; - optind++; - if (longopts[i].flag == 0) - return (longopts[i].val); - else return 0; - - }/*end if strcmp */ - } - - return ('?'); -} - -/******************************************************************************/ -static char* get_char_option(const char* optstring, char*const* argv, int argc, - int iArg, int* opt_ind, char* opt_p) - { - char chOpt; - char* tmp_str; - char* prm = NULL; - - chOpt = argv[iArg][1]; - - /*non valid argument*/ - if (!isalpha(chOpt)) - { - chOpt = EOF; - goto end; - } - tmp_str = strchr(optstring, chOpt); - - /*the argument wasn't found in optstring */ - if (tmp_str == NULL){ - chOpt = EOF; - optopt = chOpt; - goto end; - } - - /* don't need argument */ - if (tmp_str[1] != ':' ) { - goto end; - } - - if (argv[iArg][2] != '\0') - { - // param is attached to option: -po8889 - prm = &(argv[iArg][2]); - goto end; - } - - /* must look at next argv for param at the end of arg list */ - if ((iArg)+1 == argc) { - /* no param will be found */ - if (tmp_str[2]== ':' ) { - /* optional argument ::*/ - goto end; - } - else - { - chOpt = EOF; - goto end; - } - } - - prm = &(argv[(iArg)+1][0]); - if (*prm == '-' ) - { - // next argv is a new option, so param - // not given for current option - if (tmp_str[2]== ':' ) { - /* optional argument ::*/ - goto end; - } - else - { - chOpt = EOF; - goto end; - } - } - - // next argv is the param - (*opt_ind)++; - -end: - (*opt_ind)++; - *opt_p = chOpt; - - return prm; + return getopt_long( argc, argv, optstring, longopts, longindex ); } /* getimeofday() */ diff --git a/branches/opensm_3/user/man/opensm.8.in b/branches/opensm_3/user/man/opensm.8 similarity index 95% rename from branches/opensm_3/user/man/opensm.8.in rename to branches/opensm_3/user/man/opensm.8 index 5a584e29..a45d6786 100644 --- a/branches/opensm_3/user/man/opensm.8.in +++ b/branches/opensm_3/user/man/opensm.8 @@ -93,7 +93,7 @@ Prints OpenSM version and exits. .TP \fB\-F\fR, \fB\-\-config\fR The name of the OpenSM config file. When not specified -\fB\% @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\fP will be used (if exists). +\fB\% /usr/local/etc/opensm/opensm.conf\fP will be used (if exists). .TP \fB\-c\fR, \fB\-\-create-config\fR OpenSM will dump its configuration to the specified file and exit. @@ -171,8 +171,8 @@ recalculations: one when the host goes down, and the other when the host comes back online. .TP \fB\-z\fR, \fB\-\-connect_roots\fR -This option enforces a routing engine (currently up/down -only) to make connectivity between root switches and in +This option enforces routing engines (up/down and +fat-tree) to make connectivity between root switches and in this way to be fully IBA complaint. In many cases this can violate "pure" deadlock free algorithm, so use it carefully. .TP @@ -295,21 +295,21 @@ is accumulative. .TP \fB\-P\fR, \fB\-\-Pconfig\fR This option defines the optional partition configuration file. -The default name is \fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. +The default name is \fB\%/usr/local/etc/opensm/partitions.conf\fP. .TP \fB\-\-prefix_routes_file\fR Prefix routes control how the SA responds to path record queries for off-subnet DGIDs. By default, the SA fails such queries. The .B PREFIX ROUTES section below describes the format of the configuration file. -The default path is \fB\%@OPENSM_CONFIG_DIR@/prefix\-routes.conf\fP. +The default path is \fB\%/usr/local/etc/opensm/prefix\-routes.conf\fP. .TP \fB\-Q\fR, \fB\-\-qos\fR This option enables QoS setup. It is disabled by default. .TP \fB\-Y\fR, \fB\-\-qos_policy_file\fR This option defines the optional QoS policy file. The default -name is \fB\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP. See +name is \fB\%/usr/local/etc/opensm/qos-policy.conf\fP. See QoS_management_in_OpenSM.txt in opensm doc for more information on configuring QoS policy via this file. .TP @@ -342,8 +342,8 @@ Specify the sweep time for the performance manager in seconds effect if --enable-perfmgr was specified at configure time. .TP .BI --consolidate_ipv6_snm_req -Consolidate IPv6 Solicited Node Multicast group join requests into one -multicast group per MGID PKey. +Use shared MLID for IPv6 Solicited Node Multicast groups per MGID scope +and P_Key. .TP \fB\-v\fR, \fB\-\-verbose\fR This option increases the log verbosity level. @@ -425,7 +425,7 @@ logrotate purposes. .SH PARTITION CONFIGURATION .PP The default name of OpenSM partitions configuration file is -\fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. The default may be changed +\fB\%/usr/local/etc/opensm/partitions.conf\fP. The default may be changed by using the --Pconfig (-P) option with OpenSM. The default partition will be created by OpenSM unconditionally even @@ -1065,23 +1065,23 @@ Both or one of options -U and -M can be specified together with \'-R file\'. .SH FILES .TP -.B @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@ +.B /usr/local/etc/opensm/opensm.conf default OpenSM config file. .TP -.B @OPENSM_CONFIG_DIR@/@NODENAMEMAPFILE@ +.B /usr/local/etc/opensm/ib-node-name-map default node name map file. See ibnetdiscover for more information on format. .TP -.B @OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@ +.B /usr/local/etc/opensm/partitions.conf default partition config file .TP -.B @OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@ +.B /usr/local/etc/opensm/qos-policy.conf default QOS policy config file .TP -.B @OPENSM_CONFIG_DIR@/@PREFIX_ROUTES_FILE@ +.B /usr/local/etc/opensm/prefix-routes.conf default prefix routes file. .SH AUTHORS diff --git a/branches/opensm_3/user/opensm/SOURCES b/branches/opensm_3/user/opensm/SOURCES index 14c136a6..1f0ad940 100644 --- a/branches/opensm_3/user/opensm/SOURCES +++ b/branches/opensm_3/user/opensm/SOURCES @@ -13,9 +13,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR) TARGETPATH=$(LIBPATH) !endif -# include one Vendor or the other; not both! -!include vendor-ibal.inc -#!include vendor-umad.inc +!include ..\mad-vendor.inc TARGETTYPE=PROGRAM UMTYPE=console @@ -25,92 +23,11 @@ USE_MSVCRT=1 SOURCES=\ osm.mc \ opensm.rc \ - main.c \ - osm_console.c \ - osm_console_io.c \ - osm_db_files.c \ - osm_helper.c \ - osm_db_pack.c \ - osm_drop_mgr.c \ - osm_dump.c \ - osm_event_plugin.c \ - osm_inform.c \ - osm_lid_mgr.c \ - osm_link_mgr.c \ - osm_lin_fwd_rcv.c \ - osm_log.c \ - osm_mad_pool.c \ - osm_mcast_fwd_rcv.c \ - osm_mcast_mgr.c \ - osm_mcast_tbl.c \ - osm_mcm_port.c \ - osm_mesh.c \ - osm_mtree.c \ - osm_multicast.c \ - osm_node.c \ - osm_node_desc_rcv.c \ - osm_node_info_rcv.c \ - osm_opensm.c \ - osm_perfmgr.c \ - osm_perfmgr_db.c \ - osm_pkey.c \ - osm_pkey_mgr.c \ - osm_pkey_rcv.c \ - osm_port.c \ - osm_port_info_rcv.c \ - osm_prtn.c \ - osm_prtn_config.c \ - osm_qos.c \ osm_qos_parser_y.c \ osm_qos_parser_l.c \ - osm_qos_policy.c \ - osm_remote_sm.c \ - osm_req.c \ - osm_resp.c \ - osm_router.c \ - osm_sa.c \ - osm_sa_class_port_info.c \ - osm_sa_guidinfo_record.c \ - osm_sa_informinfo.c \ - osm_sa_lft_record.c \ - osm_sa_link_record.c \ - osm_sa_mad_ctrl.c \ osm_sa_mcmember_record.c \ - osm_sa_mft_record.c \ - osm_sa_multipath_record.c \ - osm_sa_node_record.c \ osm_sa_path_record.c \ - osm_sa_pkey_record.c \ - osm_sa_portinfo_record.c \ - osm_sa_service_record.c \ - osm_sa_slvl_record.c \ - osm_sa_sminfo_record.c \ - osm_sa_sw_info_record.c \ - osm_sa_vlarb_record.c \ - osm_service.c \ - osm_slvl_map_rcv.c \ - osm_sm.c \ - osm_sminfo_rcv.c \ - osm_sm_mad_ctrl.c \ - osm_sm_state_mgr.c \ - osm_state_mgr.c \ - osm_subnet.c \ - osm_switch.c \ - osm_sw_info_rcv.c \ - osm_trap_rcv.c \ - osm_ucast_cache.c \ - osm_ucast_file.c \ - osm_ucast_ftree.c \ - osm_ucast_lash.c \ - osm_ucast_mgr.c \ - osm_ucast_updn.c \ - osm_vl15intf.c \ - osm_vl_arb_rcv.c \ - st.c \ - osm_drop_mgr.c \ - osm_prtn_config.c \ - osm_sa_mcmember_record.c \ - osm_sa_path_record.c + osm_files.c OSM_HOME=.. diff --git a/branches/opensm_3/user/opensm/libopensm.ver b/branches/opensm_3/user/opensm/libopensm.ver index e3303a60..a04beb5c 100644 --- a/branches/opensm_3/user/opensm/libopensm.ver +++ b/branches/opensm_3/user/opensm/libopensm.ver @@ -6,4 +6,4 @@ # API_REV - advance on any added API # RUNNING_REV - advance any change to the vendor files # AGE - number of backward versions the API still supports -LIBVERSION=3:4:1 +LIBVERSION=4:0:0 diff --git a/branches/opensm_3/user/opensm/main.c b/branches/opensm_3/user/opensm/main.c index bbbc269c..b377dd03 100644 --- a/branches/opensm_3/user/opensm/main.c +++ b/branches/opensm_3/user/opensm/main.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. @@ -234,8 +234,8 @@ static void show_usage(void) printf("--sm_sl \n" " Sets the SL to use to communicate with the SM/SA. Defaults to 0.\n\n"); printf("--connect_roots, -z\n" - " This option enforces a routing engine (currently\n" - " up/down only) to make connectivity between root switches\n" + " This option enforces routing engines (up/down and \n" + " fat-tree) to make connectivity between root switches\n" " and in this way be IBA compliant. In many cases,\n" " this can violate \"pure\" deadlock free algorithm, so\n" " use it carefully.\n\n"); @@ -323,6 +323,10 @@ static void show_usage(void) " This option provides the means to define a weighting\n" " factor per port for customizing the least weight\n" " hops for the routing.\n\n"); + printf("--dimn_ports_file, -O \n" + " This option provides the means to define a mapping\n" + " between ports and dimension (Order) for controlling\n" + " Dimension Order Routing (DOR).\n\n"); printf("--honor_guid2lid, -x\n" " This option forces OpenSM to honor the guid2lid file,\n" " when it comes out of Standby state, if such file exists\n" @@ -370,8 +374,10 @@ static void show_usage(void) " queries for off-subnet DGIDs. Default file is:\n" " " OSM_DEFAULT_PREFIX_ROUTES_FILE "\n\n"); printf("--consolidate_ipv6_snm_req\n" - " Consolidate IPv6 Solicited Node Multicast group joins\n" - " into 1 IB multicast group.\n\n"); + " Use shared MLID for IPv6 Solicited Node Multicast groups\n" + " per MGID scope and P_Key.\n\n"); + printf("--log_prefix \n" + " Prefix to syslog messages from OpenSM.\n\n"); printf("--verbose, -v\n" " This option increases the log verbosity level.\n" " The -v option may be specified multiple times\n" @@ -428,8 +434,6 @@ static void show_usage(void) exit(2); } -/********************************************************************** - **********************************************************************/ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid) { ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS]; @@ -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) { printf("\nError from osm_vendor_get_all_port_attr (%x)\n", status); - return (0); + return 0; } /* if num_ports is 0 - return 0 */ if (num_ports == 0) { printf("\nNo local ports detected!\n"); - return (0); + return 0; } /* If num_ports is 1, then there is only one possible port to use. * Use it. */ if (num_ports == 1) { printf("Using default GUID 0x%" PRIx64 "\n", cl_hton64(attr_array[0].port_guid)); - return (attr_array[0].port_guid); + return attr_array[0].port_guid; } /* If port_guid is 0 - use the first connected port */ if (port_guid == 0) { @@ -472,7 +476,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid) i = 0; printf("Using default GUID 0x%" PRIx64 "\n", cl_hton64(attr_array[i].port_guid)); - return (attr_array[i].port_guid); + return attr_array[i].port_guid; } if (p_osm->subn.opt.daemon) @@ -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), attr_array[i].lid, ib_get_port_state_str(attr_array[i].link_state)); - printf("\nEnter choice (1-%u): ", i); + printf("\n\t0: Exit\n"); + printf("\nEnter choice (0-%u): ", i); fflush(stdout); if (scanf("%u", &choice) <= 0) { char junk[128]; if (scanf("%s", junk) <= 0) printf("\nError: Cannot scan!\n"); - } else if (choice && choice <= num_ports) + } else if (choice == 0) + return 0; + else if (choice <= num_ports) break; - printf("\nError: Lame choice!\n"); + printf("\nError: Lame choice! Please try again.\n"); } choice--; printf("Choice guid=0x%" PRIx64 "\n", cl_ntoh64(attr_array[choice].port_guid)); - return (attr_array[choice].port_guid); + return attr_array[choice].port_guid; } -/********************************************************************** - **********************************************************************/ - #ifndef __WIN__ static int daemonize(osm_opensm_t * osm) @@ -592,8 +596,6 @@ int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm) return 0; } -/********************************************************************** - **********************************************************************/ #define SET_STR_OPT(opt, val) do { \ opt = val ? strdup(val) : NULL ; \ } while (0) @@ -616,7 +618,10 @@ opensm_main(void *OsmMainArgs) char *conf_template = NULL, *config_file = NULL; uint32_t val; const char *const short_option = - "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:"; +#ifdef __WIN__ + "?" +#endif + "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:"; /* In the array below, the 2nd parameter specifies the number @@ -633,6 +638,7 @@ opensm_main(void *OsmMainArgs) {"guid", 1, NULL, 'g'}, {"ignore_guids", 1, NULL, 'i'}, {"hop_weights_file", 1, NULL, 'w'}, + {"dimn_ports_file", 1, NULL, 'O'}, {"lmc", 1, NULL, 'l'}, {"sweep", 1, NULL, 's'}, {"timeout", 1, NULL, 't'}, @@ -683,6 +689,7 @@ opensm_main(void *OsmMainArgs) {"lash_start_vl", 1, NULL, 6}, {"sm_sl", 1, NULL, 7}, {"retries", 1, NULL, 8}, + {"log_prefix", 1, NULL, 9}, {NULL, 0, NULL, 0} /* Required at the end of the array */ }; @@ -696,6 +703,7 @@ opensm_main(void *OsmMainArgs) exit(1); } +#ifdef __WIN__ if (osm_main_args.is_service) { // incorporate Windows system event log write() // printf("%s\n", OSM_VERSION); @@ -704,6 +712,10 @@ opensm_main(void *OsmMainArgs) printf("-------------------------------------------------\n"); printf("%s\n", OSM_VERSION); } +#else + printf("-------------------------------------------------\n"); + printf("%s\n", OSM_VERSION); +#endif osm_subn_set_default_opt(&opt); @@ -775,6 +787,12 @@ opensm_main(void *OsmMainArgs) opt.hop_weights_file); break; + case 'O': + opt.dimn_ports_file = optarg; + printf(" Dimension Ports File = %s\n", + opt.dimn_ports_file); + break; + case 'g': /* Specifies port guid with which to bind. @@ -803,8 +821,8 @@ opensm_main(void *OsmMainArgs) break; case 't': - opt.transaction_timeout = strtol(optarg, NULL, 0); - printf(" Transaction timeout = %d\n", + opt.transaction_timeout = strtoul(optarg, NULL, 0); + printf(" Transaction timeout = %u\n", opt.transaction_timeout); break; @@ -872,7 +890,7 @@ opensm_main(void *OsmMainArgs) if (temp > 7) { fprintf(stderr, "ERROR: LMC must be 7 or less.\n"); - return (-1); + return -1; } opt.lmc = (uint8_t) temp; printf(" LMC = %d\n", temp); @@ -937,7 +955,7 @@ opensm_main(void *OsmMainArgs) if (0 > temp || 15 < temp) { fprintf(stderr, "ERROR: priority must be between 0 and 15\n"); - return (-1); + return -1; } opt.sm_priority = (uint8_t) temp; printf(" Priority = %d\n", temp); @@ -1047,7 +1065,7 @@ opensm_main(void *OsmMainArgs) if (temp < 0 || temp >= IB_MAX_NUM_VLS) { fprintf(stderr, "ERROR: starting lash vl must be between 0 and 15\n"); - return (-1); + return -1; } opt.lash_start_vl = (uint8_t) temp; printf(" LASH starting VL = %d\n", opt.lash_start_vl); @@ -1057,7 +1075,7 @@ opensm_main(void *OsmMainArgs) if (temp < 0 || temp > 15) { fprintf(stderr, "ERROR: SM's SL must be between 0 and 15\n"); - return (-1); + return -1; } opt.sm_sl = (uint8_t) temp; printf(" SMSL = %d\n", opt.sm_sl); @@ -1067,6 +1085,10 @@ opensm_main(void *OsmMainArgs) printf(" Transaction retries = %u\n", opt.transaction_retries); break; + case 9: + SET_STR_OPT(opt.log_prefix, optarg); + printf("Log prefix = %s\n", opt.log_prefix); + break; case 'h': case '?': case ':': @@ -1121,7 +1143,7 @@ opensm_main(void *OsmMainArgs) /* We will just exit, and not go to Exit, since we don't want the destroy to be called. */ complib_exit(); - return (status); + return status; } /* @@ -1131,6 +1153,9 @@ opensm_main(void *OsmMainArgs) if (opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID)) opt.guid = get_port_guid(&osm, opt.guid); + if (opt.guid == 0) + goto Exit; + status = osm_opensm_bind(&osm, opt.guid); if (status != IB_SUCCESS) { printf("\nError from osm_opensm_bind (0x%X)\n", status); @@ -1194,9 +1219,7 @@ main(int argc, char **argv) osm_main_args.argc = argc; osm_main_args.argv = argv; - /* If there are arguments that the executable is ran with, then this is - not running as service - just run the opensm_main. - */ + /* Is OpenSM being run as a Windows service or from a cmd line? */ for (i = 0 ; i< argc ; i++) { if (!strcmp(argv[i], "--service")) { run_as_service = TRUE; @@ -1219,7 +1242,7 @@ main(int argc, char **argv) return opensm_main( (void*)&osm_main_args ); } - /* Running as service */ + /* Running as a Windows service */ i = 0; if (!StartServiceCtrlDispatcher( DispatchTable )) { @@ -1230,34 +1253,54 @@ main(int argc, char **argv) return i; } +/* + * Carried over from previous 3.0.0 openSM port. + * Problem is that Windows service startup needs feedback as to whether openSM + * actually started up successfully or not. Windows service manager calls the + * OsmServiceStart routine which spawns a thread to run opensm. The OpenSM + * thread communicates with the OsmServiceStart thread via g_service_state. + * Once the OpenSM thread resets g_service_state from SERVICE_STATE_STARTING, + * the OsmServiceStart() will return to the Windows service manager. + * The coding problem is how to catch 'all' Error & Success startup conditions + * and reset g_service_state without hacking the entire body of OFED OpenSM + * code (Linux folks are touchy about Windows code in shared code). + * Somebody once decided that scanning osm_log (aka syslog()) message strings + * seemed was the way to solve this this problem. + * For each call to osm_log() with verbosity OSM_LOG_SYS (aka syslog() called) + * OsmReportState() is called; [see osm_log.c]. + */ void OsmReportState(IN const char *p_str) { - if ( !strcmp(p_str, "SUBNET UP\n") || - !strcmp(p_str, "SM port is down\n") || - !strcmp(p_str, "Errors during initialization\n") || - !strcmp(p_str, "Entering STANDBY state\n") ) + if ( !strcmp(p_str, "SUBNET UP\n") + || !strcmp(p_str, "SM port is down\n") + || !strcmp(p_str, "Errors during initialization\n") + || !strcmp(p_str, "Entering STANDBY state\n") ) { + /* change Service startup state to OK */ InterlockedCompareExchange( (LONG *)&g_service_state , SERVICE_STATE_STARTED_OK, SERVICE_STATE_STARTING ); if (osm_main_args.is_service) SvcDebugOut(" [OSM_SERVICE] %s", p_str); - // consider Windows system event log write() here. + // consider Windows system event log write() return; } + /* Check opt.exit_on_fatal messages */ if ( !strcmp(p_str, "Found remote SM with non-matching sm_key. Exiting\n") - || !strcmp(p_str, "Errors on subnet. Duplicate GUID found ""by link from a port to itself. ""See osm log for more details\n") - || !strcmp(p_str, "Errors on subnet. SM found duplicated guids or 12x ""link with lane reversal badly configured. ""See osm log for more details\n") - || !strcmp(p_str, "Fatal: Error restoring Guid-to-Lid persistent database\n") ) + || !strncmp(p_str, "Errors on subnet. Duplicate GUID found ",39) + || !strcmp(p_str, "Found remote SM with non-matching sm_key. Exiting\n") + || !strcmp(p_str, "FATAL: duplicated guids or 12x lane reversal\n") ) { + /* change Service startup state to Failed */ InterlockedCompareExchange( (LONG *)&g_service_state, SERVICE_STATE_START_FAILED, SERVICE_STATE_STARTING ); if (osm_main_args.is_service) SvcDebugOut(" [OSM_SERVICE] %s", p_str); + // consider Windows system event log write() here. return; } @@ -1305,10 +1348,11 @@ static char *WinErrorStr(DWORD err) void SvcDebugOut(LPSTR fmt, ... ) { CHAR Buffer[1024]; - va_list argptr; - va_start(argptr,fmt); + va_list args; - _vsnprintf(Buffer, 1024, fmt, argptr); + va_start(args,fmt); + _vsnprintf(Buffer, 1024, fmt, args); + va_end(args); OutputDebugStringA(Buffer); } @@ -1323,11 +1367,18 @@ void SvcDebugOut(LPSTR fmt, ... ) void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode ) { DWORD status=0; + char *ctl; switch(Opcode) { case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: + if (Opcode == SERVICE_CONTROL_STOP) + ctl = "STOP"; + else + ctl = "SHUTDOWN"; + syslog(LOG_INFO,"[OSM_SERVICE] SERVICE_CONTROL_%s\n",ctl); + // Do whatever it takes to stop here. osm_exit_flag = TRUE; SetEvent(osm_exit_event); @@ -1342,8 +1393,7 @@ void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode ) status = GetLastError(); } SvcDebugOut(" [OSM_SERVICE] Exit SERVICE_CONTROL_%s (%ld) '%s'\n", - (Opcode == SERVICE_CONTROL_SHUTDOWN ? "SHUTDOWN" : "STOP"), - status, WinErrorStr(status)); + ctl, status, WinErrorStr(status)); return; case SERVICE_CONTROL_INTERROGATE: @@ -1361,11 +1411,13 @@ void WINAPI OsmServiceCtrlHandler( IN DWORD Opcode ) case SERVICE_CONTROL_OSM_REOPEN_LOG_FILE: osm_usr1_flag = 1; SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_OSM_REOPEN_LOG_FILE\n"); + syslog(LOG_INFO,"[SERVICE_CONTROL] REOPEN_LOG_FILE\n"); break; case SERVICE_CONTROL_OSM_START_HEAVY_SWEEP: osm_hup_flag = 1; - SvcDebugOut(" [OSM_SERVICE] SERVICE_CONTROL_OSM_START_HEAVY_SWEEP\n"); + SvcDebugOut("[OSM_SERVICE] SERVICE_CONTROL_OSM_START_HEAVY_SWEEP\n"); + syslog(LOG_INFO,"[SERVICE_CONTROL] START_HEAVY_SWEEP\n"); break; default: diff --git a/branches/opensm_3/user/opensm/opensm.rc b/branches/opensm_3/user/opensm/opensm.rc index 5ddd4560..1a088a57 100644 --- a/branches/opensm_3/user/opensm/opensm.rc +++ b/branches/opensm_3/user/opensm/opensm.rc @@ -32,14 +32,14 @@ #include -#define VER_FILETYPE VFT_APP -#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN #ifdef _DEBUG_ -#define VER_FILEDESCRIPTION_STR "OpenSM Subnet Manager 3.3.3 (Debug)" +#define VER_FILEDESCRIPTION_STR "OpenSM Subnet Manager 3.3.6 (Debug)" #define VER_INTERNALNAME_STR "opensm.exe" #define VER_ORIGINALFILENAME_STR "opensm.exe" #else -#define VER_FILEDESCRIPTION_STR "OpenSM Subnet Manager 3.3.3" +#define VER_FILEDESCRIPTION_STR "OpenSM Subnet Manager 3.3.6" #define VER_INTERNALNAME_STR "opensm.exe" #define VER_ORIGINALFILENAME_STR "opensm.exe" #endif diff --git a/branches/opensm_3/user/opensm/osm_console.c b/branches/opensm_3/user/opensm/osm_console.c index 592f0263..1df89271 100644 --- a/branches/opensm_3/user/opensm/osm_console.c +++ b/branches/opensm_3/user/opensm/osm_console.c @@ -58,6 +58,8 @@ #include #include +extern void osm_update_node_desc(IN osm_opensm_t *osm); + struct command { char *name; void (*help_function) (FILE * out, int detail); @@ -220,6 +222,14 @@ static void help_dump_conf(FILE *out, int detail) } } +static void help_update_desc(FILE *out, int detail) +{ + fprintf(out, "update_desc\n"); + if (detail) { + fprintf(out, "update node description for all nodes\n"); + } +} + #ifdef ENABLE_OSM_PERF_MGR static void help_perfmgr(FILE * out, int detail) { @@ -318,30 +328,30 @@ static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) } } -static char *sm_state_str(int state) +static const char *sm_state_str(int state) { switch (state) { case IB_SMINFO_STATE_DISCOVERING: - return ("Discovering"); + return "Discovering"; case IB_SMINFO_STATE_STANDBY: - return ("Standby "); + return "Standby "; case IB_SMINFO_STATE_NOTACTIVE: - return ("Not Active "); + return "Not Active "; case IB_SMINFO_STATE_MASTER: - return ("Master "); + return "Master "; } - return ("UNKNOWN "); + return "UNKNOWN "; } -static char *sa_state_str(osm_sa_state_t state) +static const char *sa_state_str(osm_sa_state_t state) { switch (state) { case OSM_SA_STATE_INIT: - return ("Init"); + return "Init"; case OSM_SA_STATE_READY: - return ("Ready"); + return "Ready"; } - return ("UNKNOWN"); + return "UNKNOWN"; } static void dump_sms(osm_opensm_t * p_osm, FILE * out) @@ -451,9 +461,9 @@ static int loop_command_check_time(void) time_t cur = time(NULL); if ((loop_command.previous + loop_command.delay_s) < cur) { loop_command.previous = cur; - return (1); + return 1; } - return (0); + return 0; } static void status_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) @@ -518,9 +528,7 @@ static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) lid = (uint16_t) strtoul(p_cmd, NULL, 0); cl_plock_acquire(&p_osm->lock); - if (lid > cl_ptr_vector_get_capacity(&(p_osm->subn.port_lid_tbl))) - goto invalid_lid; - p_port = cl_ptr_vector_get(&(p_osm->subn.port_lid_tbl), lid); + p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid); if (!p_port) goto invalid_lid; @@ -1149,6 +1157,11 @@ static void dump_conf_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) osm_subn_output_conf(out, &p_osm->subn.opt); } +static void update_desc_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) +{ + osm_update_node_desc(p_osm); +} + #ifdef ENABLE_OSM_PERF_MGR static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) { @@ -1232,6 +1245,7 @@ static void version_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) static void exit_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) { + syslog(LOG_INFO, "graceful OpenSM shutdown.\n"); osm_exit_flag = 1; } @@ -1272,12 +1286,12 @@ static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) } else fprintf(out, "No file name passed\n"); } else if (!(p_regexp = malloc(sizeof(*p_regexp)))) { - fprintf(out, "No memory.\n"); + fprintf(out, "No memory\n"); break; } else if (regcomp(&p_regexp->exp, p_cmd, REG_NOSUB | REG_EXTENDED) != 0) { fprintf(out, "Cannot parse regular expression \'%s\'." - " Skipping.\n", p_cmd); + " Skipping\n", p_cmd); free(p_regexp); continue; } else { @@ -1293,7 +1307,7 @@ static void dump_portguid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out) } if (p_osm->sm.p_subn->need_update != 0) { - fprintf(out, "Subnet is not ready yet. Try again later.\n"); + fprintf(out, "Subnet is not ready yet. Try again later\n"); return; } @@ -1365,6 +1379,7 @@ const struct command console_cmds[] = { {"switchbalance", &help_switchbalance, &switchbalance_parse}, {"lidbalance", &help_lidbalance, &lidbalance_parse}, {"dump_conf", &help_dump_conf, &dump_conf_parse}, + {"update_desc", &help_update_desc, &update_desc_parse}, {"version", &help_version, &version_parse}, #ifdef ENABLE_OSM_PERF_MGR {"perfmgr", &help_perfmgr, &perfmgr_parse}, diff --git a/branches/opensm_3/user/opensm/osm_db_files.c b/branches/opensm_3/user/opensm/osm_db_files.c index 343a4b3b..5b4dedd0 100644 --- a/branches/opensm_3/user/opensm/osm_db_files.c +++ b/branches/opensm_3/user/opensm/osm_db_files.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -117,16 +117,12 @@ typedef struct osm_db_imp { * osm_db_t *********/ -/*************************************************************************** - ***************************************************************************/ void osm_db_construct(IN osm_db_t * p_db) { memset(p_db, 0, sizeof(osm_db_t)); cl_list_construct(&p_db->domains); } -/*************************************************************************** - ***************************************************************************/ void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain) { osm_db_domain_imp_t *p_domain_imp; @@ -141,8 +137,6 @@ void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain) free(p_domain_imp); } -/*************************************************************************** - ***************************************************************************/ void osm_db_destroy(IN osm_db_t * p_db) { osm_db_domain_t *p_domain; @@ -155,8 +149,6 @@ void osm_db_destroy(IN osm_db_t * p_db) free(p_db->p_db_imp); } -/*************************************************************************** - ***************************************************************************/ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log) { osm_db_imp_t *p_db_imp; @@ -169,7 +161,7 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log) p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR"); if (!p_db_imp->db_dir_name || !(*p_db_imp->db_dir_name)) - p_db_imp->db_dir_name = osm_strdup(OSM_DEFAULT_CACHE_DIR); + p_db_imp->db_dir_name = strdup_expand(OSM_DEFAULT_CACHE_DIR); /* Create the directory if it doesn't exist */ /* There is a difference in creating directory between windows and linux */ @@ -199,36 +191,36 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log) return 0; } -/*************************************************************************** - ***************************************************************************/ osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name) { osm_db_domain_t *p_domain; osm_db_domain_imp_t *p_domain_imp; - int dir_name_len; + size_t path_len; osm_log_t *p_log = p_db->p_log; FILE *p_file; OSM_LOG_ENTER(p_log); /* allocate a new domain object */ - p_domain = (osm_db_domain_t *) malloc(sizeof(osm_db_domain_t)); + p_domain = malloc(sizeof(osm_db_domain_t)); CL_ASSERT(p_domain != NULL); - p_domain_imp = - (osm_db_domain_imp_t *) malloc(sizeof(osm_db_domain_imp_t)); + p_domain_imp = malloc(sizeof(osm_db_domain_imp_t)); CL_ASSERT(p_domain_imp != NULL); - dir_name_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name); + path_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name) + + strlen(domain_name) + 2; /* set the domain file name */ - p_domain_imp->file_name = - (char *)malloc(sizeof(char) * (dir_name_len) + strlen(domain_name) + - 2); + p_domain_imp->file_name = malloc(path_len); CL_ASSERT(p_domain_imp->file_name != NULL); - strcpy(p_domain_imp->file_name, - ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name); - strcat(p_domain_imp->file_name, domain_name); + snprintf(p_domain_imp->file_name, path_len, +#ifdef __WIN__ + "%s\\%s", +#else + "%s/%s", +#endif + ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name, domain_name); /* make sure the file exists - or exit if not writable */ p_file = fopen(p_domain_imp->file_name, "a+"); @@ -258,8 +250,6 @@ Exit: return p_domain; } -/*************************************************************************** - ***************************************************************************/ int osm_db_restore(IN osm_db_domain_t * p_domain) { @@ -338,21 +328,17 @@ int osm_db_restore(IN osm_db_domain_t * p_domain) goto EndParsing; } - p_key = - (char *)malloc(sizeof(char) * - (strlen(p_first_word) + 1)); + p_key = malloc(sizeof(char) * + (strlen(p_first_word) + 1)); strcpy(p_key, p_first_word); p_rest_of_line = strtok_r(NULL, "\n", &p_last); if (p_rest_of_line != NULL) { - p_accum_val = - (char *)malloc(sizeof(char) * - (strlen - (p_rest_of_line) + - 1)); + p_accum_val = malloc(sizeof(char) * + (strlen(p_rest_of_line) + 1)); strcpy(p_accum_val, p_rest_of_line); } else { - p_accum_val = (char *)malloc(2); + p_accum_val = malloc(2); strcpy(p_accum_val, "\0"); } } else if (sLine[0] != '\n') { @@ -404,9 +390,8 @@ int osm_db_restore(IN osm_db_domain_t * p_domain) } else { /* accumulate into the value */ p_prev_val = p_accum_val; - p_accum_val = - (char *)malloc(strlen(p_prev_val) + - strlen(sLine) + 1); + p_accum_val = malloc(strlen(p_prev_val) + + strlen(sLine) + 1); strcpy(p_accum_val, p_prev_val); free(p_prev_val); strcat(p_accum_val, sLine); @@ -423,8 +408,6 @@ Exit: return status; } -/*************************************************************************** - ***************************************************************************/ static int dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg) { FILE *p_file = (FILE *) arg; @@ -446,9 +429,8 @@ int osm_db_store(IN osm_db_domain_t * p_domain) OSM_LOG_ENTER(p_log); p_domain_imp = (osm_db_domain_imp_t *) p_domain->p_domain_imp; - p_tmp_file_name = - (char *)malloc(sizeof(char) * - (strlen(p_domain_imp->file_name) + 8)); + p_tmp_file_name = malloc(sizeof(char) * + (strlen(p_domain_imp->file_name) + 8)); strcpy(p_tmp_file_name, p_domain_imp->file_name); strcat(p_tmp_file_name, ".tmp"); @@ -488,8 +470,6 @@ Exit: return status; } -/*************************************************************************** - ***************************************************************************/ /* simply de-allocate the key and the value and return the code that makes the st_foreach delete the entry */ static int clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg) @@ -511,8 +491,6 @@ int osm_db_clear(IN osm_db_domain_t * p_domain) return 0; } -/*************************************************************************** - ***************************************************************************/ static int get_key_of_tbl_entry(st_data_t key, st_data_t val, st_data_t arg) { cl_list_t *p_list = (cl_list_t *) arg; @@ -535,8 +513,6 @@ int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list) return 0; } -/*************************************************************************** - ***************************************************************************/ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key) { osm_db_domain_imp_t *p_domain_imp = @@ -553,8 +529,6 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key) return p_val; } -/*************************************************************************** - ***************************************************************************/ int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val) { osm_log_t *p_log = p_domain->p_db->p_log; @@ -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; } -/*************************************************************************** - ***************************************************************************/ int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key) { osm_log_t *p_log = p_domain->p_db->p_log; diff --git a/branches/opensm_3/user/opensm/osm_db_pack.c b/branches/opensm_3/user/opensm/osm_db_pack.c index 1112fff9..a1b61a79 100644 --- a/branches/opensm_3/user/opensm/osm_db_pack.c +++ b/branches/opensm_3/user/opensm/osm_db_pack.c @@ -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); pack_lids(min_lid, max_lid, lid_str); - return (osm_db_update(p_g2l, guid_str, lid_str)); + return osm_db_update(p_g2l, guid_str, lid_str); } int osm_db_guid2lid_delete(IN osm_db_domain_t * p_g2l, IN uint64_t guid) { char guid_str[20]; pack_guid(guid, guid_str); - return (osm_db_delete(p_g2l, guid_str)); + return osm_db_delete(p_g2l, guid_str); } diff --git a/branches/opensm_3/user/opensm/osm_drop_mgr.c b/branches/opensm_3/user/opensm/osm_drop_mgr.c index 4ebde882..d8d3e563 100644 --- a/branches/opensm_3/user/opensm/osm_drop_mgr.c +++ b/branches/opensm_3/user/opensm/osm_drop_mgr.c @@ -62,8 +62,6 @@ #include #include -/********************************************************************** - **********************************************************************/ static void drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid) { osm_router_t *p_rtr; @@ -79,8 +77,6 @@ static void drop_mgr_remove_router(osm_sm_t * sm, IN const ib_net64_t portguid) } } -/********************************************************************** - **********************************************************************/ static void drop_mgr_clean_physp(osm_sm_t * sm, IN osm_physp_t * p_physp) { osm_physp_t *p_remote_physp; @@ -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); if (p_remote_port) { - /* Let's check if this is a case of link that is lost (both ports - weren't recognized), or a "hiccup" in the subnet - in which case - the remote port was recognized, and its state is ACTIVE. - If this is just a "hiccup" - force a heavy sweep in the next sweep. - We don't want to lose that part of the subnet. */ + /* Let's check if this is a case of link that is lost + (both ports weren't recognized), or a "hiccup" in the + subnet - in which case the remote port was + recognized, and its state is ACTIVE. + If this is just a "hiccup" - force a heavy sweep in + the next sweep. We don't want to lose that part of + the subnet. */ if (p_remote_port->discovery_count && osm_physp_get_port_state(p_remote_physp) == IB_LINK_ACTIVE) { @@ -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; } - /* If the remote node is ca or router - need to remove the remote port, - since it is no longer reachable. This can be done if we reset the - discovery count of the remote port. */ + /* If the remote node is ca or router - need to remove + the remote port, since it is no longer reachable. + This can be done if we reset the discovery count + of the remote port. */ if (!p_remote_physp->p_node->sw) { p_remote_port->discovery_count = 0; OSM_LOG(sm->p_log, OSM_LOG_DEBUG, @@ -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); if (sm->ucast_mgr.cache_valid) - osm_ucast_cache_add_link(&sm->ucast_mgr, - p_physp, p_remote_physp); + osm_ucast_cache_add_link(&sm->ucast_mgr, p_physp, + p_remote_physp); osm_physp_unlink(p_physp, p_remote_physp); @@ -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); } -/********************************************************************** - **********************************************************************/ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) { ib_net64_t port_guid; @@ -183,6 +180,33 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) goto Exit; } + /* issue a notice - trap 65 */ + /* details of the notice */ + notice.generic_type = 0x83; /* is generic subn mgt type */ + ib_notice_set_prod_type_ho(¬ice, 4); /* A class manager generator */ + /* endport ceases to be reachable */ + notice.g_or_v.generic.trap_num = CL_HTON16(65); + /* The sm_base_lid is saved in network order already. */ + notice.issuer_lid = sm->p_subn->sm_base_lid; + /* following C14-72.1.2 and table 119 p725 */ + /* we need to provide the GID */ + port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix; + port_gid.unicast.interface_id = port_guid; + memcpy(&(notice.data_details.ntc_64_67.gid), + &(port_gid), sizeof(ib_gid_t)); + + /* According to page 653 - the issuer gid in this case of trap + is the SM gid, since the SM is the initiator of this trap. */ + notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix; + notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid; + + status = osm_report_notice(sm->p_log, sm->p_subn, ¬ice); + if (status != IB_SUCCESS) { + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: " + "Error sending trap reports (%s)\n", + ib_get_err_str(status)); + } + p_sm_guid_tbl = &sm->p_subn->sm_guid_tbl; p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_guid_tbl, port_guid); if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl)) { @@ -209,13 +233,8 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) drop_mgr_clean_physp(sm, p_port->p_physp); while (!cl_is_qlist_empty(&p_port->mcm_list)) { -#ifndef __WIN__ mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list), mcm_port, list_item); -#else - mcm_port = cl_item_obj(cl_qlist_head(&p_port->mcm_list), - mcm_port, list_item, (osm_mcm_port_t*)); -#endif osm_mgrp_delete_port(sm->p_subn, sm->p_log, mcm_port->mgrp, p_port->guid); } @@ -225,35 +244,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) osm_port_delete(&p_port); - /* issue a notice - trap 65 */ - - /* details of the notice */ - notice.generic_type = 0x83; /* is generic subn mgt type */ - ib_notice_set_prod_type_ho(¬ice, 4); /* A class manager generator */ - /* endport ceases to be reachable */ - notice.g_or_v.generic.trap_num = CL_HTON16(65); - /* The sm_base_lid is saved in network order already. */ - notice.issuer_lid = sm->p_subn->sm_base_lid; - /* following C14-72.1.2 and table 119 p725 */ - /* we need to provide the GID */ - port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix; - port_gid.unicast.interface_id = port_guid; - memcpy(&(notice.data_details.ntc_64_67.gid), - &(port_gid), sizeof(ib_gid_t)); - - /* According to page 653 - the issuer gid in this case of trap - is the SM gid, since the SM is the initiator of this trap. */ - notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix; - notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid; - - status = osm_report_notice(sm->p_log, sm->p_subn, ¬ice); - if (status != IB_SUCCESS) { - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0103: " - "Error sending trap reports (%s)\n", - ib_get_err_str(status)); - goto Exit; - } - OSM_LOG(sm->p_log, OSM_LOG_INFO, "Removed port with GUID:0x%016" PRIx64 " LID range [%u, %u] of node:%s\n", @@ -265,8 +255,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node) { osm_switch_t *p_sw; @@ -291,8 +279,6 @@ static void drop_mgr_remove_switch(osm_sm_t * sm, IN osm_node_t * p_node) OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node) { osm_physp_t *p_physp; @@ -349,11 +335,9 @@ static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node) osm_node_delete(&p_node); OSM_LOG_EXIT(sm->p_log); - return (return_val); + return return_val; } -/********************************************************************** - **********************************************************************/ static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node) { ib_net64_t node_guid; @@ -421,16 +405,11 @@ Exit: return; } -/********************************************************************** - **********************************************************************/ void osm_drop_mgr_process(osm_sm_t * sm) { - cl_qmap_t *p_node_guid_tbl; - cl_qmap_t *p_port_guid_tbl; - osm_port_t *p_port; - osm_port_t *p_next_port; - osm_node_t *p_node; - osm_node_t *p_next_node; + cl_qmap_t *p_node_guid_tbl, *p_port_guid_tbl; + osm_port_t *p_port, *p_next_port; + osm_node_t *p_node, *p_next_node; CL_ASSERT(sm); diff --git a/branches/opensm_3/user/opensm/osm_dump.c b/branches/opensm_3/user/opensm/osm_dump.c index 15442afc..a5c7127d 100644 --- a/branches/opensm_3/user/opensm/osm_dump.c +++ b/branches/opensm_3/user/opensm/osm_dump.c @@ -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++) { fprintf(file, "0x%04X : ", lid_ho); - p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid_ho); + p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid_ho); if (!p_port) { fprintf(file, "UNREACHABLE\n"); continue; @@ -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++) fprintf(file, " %02x", osm_switch_get_hop_count(p_sw, lid, port)); - p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid); + p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid); if (p_port) fprintf(file, " # portguid 0x016%" PRIx64, cl_ntoh64(osm_port_get_guid(p_port))); @@ -344,7 +344,7 @@ static void dump_ucast_lfts(cl_map_item_t * item, FILE * file, void *cxt) fprintf(file, "0x%04x %03u # ", lid, port); - p_port = cl_ptr_vector_get(&p_osm->subn.port_lid_tbl, lid); + p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid); if (p_port) { p_node = p_port->p_node; fprintf(file, "%s portguid 0x%016" PRIx64 ": \'%s\'", @@ -541,8 +541,6 @@ static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt) "------------------------------------------------\n"); } -/********************************************************************** - **********************************************************************/ struct dump_context { osm_opensm_t *p_osm; FILE *file; @@ -593,8 +591,6 @@ void osm_dump_qmap_to_file(osm_opensm_t * p_osm, const char *file_name, fclose(file); } -/********************************************************************** - **********************************************************************/ static void print_report(osm_opensm_t * osm, FILE * file) { diff --git a/branches/opensm_3/user/opensm/osm_event_plugin.c b/branches/opensm_3/user/opensm/osm_event_plugin.c index 72dd93ed..dbf5a641 100644 --- a/branches/opensm_3/user/opensm/osm_event_plugin.c +++ b/branches/opensm_3/user/opensm/osm_event_plugin.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Voltaire, Inc. All rights reserved. + * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2007 The Regents of the University of California. * * This software is available to you under a choice of one of two @@ -70,14 +70,14 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name) osm_epi_plugin_t *rc = NULL; if (!plugin_name || !*plugin_name) - return (NULL); + return NULL; /* find the plugin */ snprintf(lib_name, sizeof(lib_name), "lib%s.so", plugin_name); rc = malloc(sizeof(*rc)); if (!rc) - return (NULL); + return NULL; rc->handle = dlopen(lib_name, RTLD_LAZY); if (!rc->handle) { @@ -129,13 +129,13 @@ osm_epi_plugin_t *osm_epi_construct(osm_opensm_t *osm, char *plugin_name) goto Exit; rc->plugin_name = strdup(plugin_name); - return (rc); + return rc; Exit: dlclose(rc->handle); DLOPENFAIL: free(rc); - return (NULL); + return NULL; } void osm_epi_destroy(osm_epi_plugin_t * plugin) diff --git a/branches/opensm_3/user/opensm/osm_files.c b/branches/opensm_3/user/opensm/osm_files.c new file mode 100644 index 00000000..0540861c --- /dev/null +++ b/branches/opensm_3/user/opensm/osm_files.c @@ -0,0 +1,86 @@ +/* + * [4-15-2010] + * + * files moved from SOURCES to here to decrease opensm.exe build time. + * Reduced OpenSM.exe build time by 29 seconds. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + diff --git a/branches/opensm_3/user/opensm/osm_helper.c b/branches/opensm_3/user/opensm/osm_helper.c index 53aa84b2..15b6a2a6 100644 --- a/branches/opensm_3/user/opensm/osm_helper.c +++ b/branches/opensm_3/user/opensm/osm_helper.c @@ -58,7 +58,7 @@ #define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0])) /* we use two tables - one for queries and one for responses */ -static const char *__ib_sa_method_str[] = { +static const char *ib_sa_method_str[] = { "RESERVED", /* 0 */ "SubnAdmGet", /* 1 */ "SubnAdmSet", /* 2 */ @@ -84,7 +84,7 @@ static const char *__ib_sa_method_str[] = { "UNKNOWN" /* 16 */ }; -static const char *__ib_sa_resp_method_str[] = { +static const char *ib_sa_resp_method_str[] = { "RESERVED", /* 80 */ "SubnAdmGetResp", /* 81 */ "RESERVED (SetResp?)", /* 82 */ @@ -112,7 +112,7 @@ static const char *__ib_sa_resp_method_str[] = { #define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16 -static const char *__ib_sm_method_str[] = { +static const char *ib_sm_method_str[] = { "RESERVED0", /* 0 */ "SubnGet", /* 1 */ "SubnSet", /* 2 */ @@ -150,7 +150,7 @@ static const char *__ib_sm_method_str[] = { #define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21 -static const char *__ib_sm_attr_str[] = { +static const char *ib_sm_attr_str[] = { "RESERVED", /* 0 */ "ClassPortInfo", /* 1 */ "Notice", /* 2 */ @@ -189,7 +189,7 @@ static const char *__ib_sm_attr_str[] = { #define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21 -static const char *__ib_sa_attr_str[] = { +static const char *ib_sa_attr_str[] = { "RESERVED", /* 0 */ "ClassPortInfo", /* 1 */ "Notice", /* 2 */ @@ -452,8 +452,6 @@ static int sprint_uint8_arr(char *buf, size_t size, return n; } -/********************************************************************** - **********************************************************************/ const char *ib_get_sa_method_str(IN uint8_t method) { if (method & 0x80) { @@ -461,27 +459,23 @@ const char *ib_get_sa_method_str(IN uint8_t method) if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL) method = OSM_SA_METHOD_STR_UNKNOWN_VAL; /* it is a response - use the response table */ - return (__ib_sa_resp_method_str[method]); + return ib_sa_resp_method_str[method]; } else { if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL) method = OSM_SA_METHOD_STR_UNKNOWN_VAL; - return (__ib_sa_method_str[method]); + return ib_sa_method_str[method]; } } -/********************************************************************** - **********************************************************************/ const char *ib_get_sm_method_str(IN uint8_t method) { if (method & 0x80) method = (method & 0x0F) | 0x10; if (method > OSM_SM_METHOD_STR_UNKNOWN_VAL) method = OSM_SM_METHOD_STR_UNKNOWN_VAL; - return (__ib_sm_method_str[method]); + return ib_sm_method_str[method]; } -/********************************************************************** - **********************************************************************/ const char *ib_get_sm_attr_str(IN ib_net16_t attr) { uint16_t host_attr = cl_ntoh16(attr); @@ -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) host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL; - return (__ib_sm_attr_str[host_attr]); + return ib_sm_attr_str[host_attr]; } -/********************************************************************** - **********************************************************************/ const char *ib_get_sa_attr_str(IN ib_net16_t attr) { uint16_t host_attr = cl_ntoh16(attr); @@ -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) host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL; - return (__ib_sa_attr_str[host_attr]); + return ib_sa_attr_str[host_attr]; } -/********************************************************************** - **********************************************************************/ const char *ib_get_trap_str(ib_net16_t trap_num) { switch (cl_ntoh16(trap_num)) { @@ -550,8 +540,6 @@ const char *ib_get_trap_str(ib_net16_t trap_num) const ib_gid_t ib_zero_gid = { {0} }; -/********************************************************************** - **********************************************************************/ static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size, IN const char *p_prefix_str, IN const char *p_new_str, @@ -571,8 +559,6 @@ static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size, return IB_SUCCESS; } -/********************************************************************** - **********************************************************************/ static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size, IN const char *p_prefix_str, IN const ib_port_info_t * p_pi) @@ -777,8 +763,6 @@ static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size, } } -/********************************************************************** - **********************************************************************/ void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid, IN ib_net64_t port_guid, IN uint8_t port_num, IN const ib_port_info_t * p_pi, @@ -863,8 +847,6 @@ void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid, } } -/********************************************************************** - **********************************************************************/ void osm_dump_portinfo_record(IN osm_log_t * p_log, IN const ib_portinfo_record_t * p_pir, IN osm_log_level_t log_level) @@ -944,8 +926,6 @@ void osm_dump_portinfo_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_guidinfo_record(IN osm_log_t * p_log, IN const ib_guidinfo_record_t * p_gir, IN osm_log_level_t log_level) @@ -978,8 +958,6 @@ void osm_dump_guidinfo_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni, IN osm_log_level_t log_level) { @@ -1009,8 +987,6 @@ void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni, } } -/********************************************************************** - **********************************************************************/ void osm_dump_node_record(IN osm_log_t * p_log, IN const ib_node_record_t * p_nr, IN osm_log_level_t log_level) @@ -1054,8 +1030,6 @@ void osm_dump_node_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr, IN osm_log_level_t log_level) { @@ -1103,8 +1077,6 @@ void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr, } } -/********************************************************************** - **********************************************************************/ void osm_dump_multipath_record(IN osm_log_t * p_log, IN const ib_multipath_rec_t * p_mpr, IN osm_log_level_t log_level) @@ -1164,8 +1136,6 @@ void osm_dump_multipath_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr, IN osm_log_level_t log_level) { @@ -1198,8 +1168,6 @@ void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr, } } -/********************************************************************** - **********************************************************************/ void osm_dump_service_record(IN osm_log_t * p_log, IN const ib_service_record_t * p_sr, IN osm_log_level_t log_level) @@ -1291,8 +1259,6 @@ void osm_dump_service_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_inform_info(IN osm_log_t * p_log, IN const ib_inform_info_t * p_ii, IN osm_log_level_t log_level) @@ -1352,8 +1318,6 @@ void osm_dump_inform_info(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_inform_info_record(IN osm_log_t * p_log, IN const ib_inform_info_record_t * p_iir, IN osm_log_level_t log_level) @@ -1435,8 +1399,6 @@ void osm_dump_inform_info_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_link_record(IN osm_log_t * p_log, IN const ib_link_record_t * p_lr, IN osm_log_level_t log_level) @@ -1454,8 +1416,6 @@ void osm_dump_link_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_switch_info(IN osm_log_t * p_log, IN const ib_switch_info_t * p_si, IN osm_log_level_t log_level) @@ -1485,8 +1445,6 @@ void osm_dump_switch_info(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_switch_info_record(IN osm_log_t * p_log, IN const ib_switch_info_record_t * p_sir, IN osm_log_level_t log_level) @@ -1523,8 +1481,6 @@ void osm_dump_switch_info_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid, IN uint16_t block_num, IN uint8_t port_num, IN const ib_pkey_table_t * p_pkey_tbl, @@ -1547,8 +1503,6 @@ void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid, } } -/********************************************************************** - **********************************************************************/ void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid, IN uint8_t in_port_num, IN uint8_t out_port_num, IN const ib_slvl_table_t * p_slvl_tbl, @@ -1574,8 +1528,6 @@ void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid, } } -/********************************************************************** - **********************************************************************/ void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid, IN uint8_t block_num, IN uint8_t port_num, IN const ib_vl_arb_table_t * p_vla_tbl, @@ -1600,8 +1552,6 @@ void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid, } } -/********************************************************************** - **********************************************************************/ void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi, IN osm_log_level_t log_level) { @@ -1620,8 +1570,6 @@ void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi, } } -/********************************************************************** - **********************************************************************/ void osm_dump_sm_info_record(IN osm_log_t * p_log, IN const ib_sminfo_record_t * p_smir, IN osm_log_level_t log_level) @@ -1647,8 +1595,6 @@ void osm_dump_sm_info_record(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_notice(IN osm_log_t * p_log, IN const ib_mad_notice_attr_t * p_ntci, IN osm_log_level_t log_level) @@ -1842,8 +1788,6 @@ void osm_dump_notice(IN osm_log_t * p_log, } } -/********************************************************************** - **********************************************************************/ void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp, IN osm_log_level_t log_level) { @@ -1949,8 +1893,6 @@ void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp, } } -/********************************************************************** - **********************************************************************/ void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad, IN osm_log_level_t log_level) { @@ -2004,8 +1946,6 @@ void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad, } } -/********************************************************************** - **********************************************************************/ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path, IN osm_log_level_t log_level) { @@ -2013,8 +1953,8 @@ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path, char buf[BUF_SIZE]; unsigned n = 0; - n = sprintf(buf, "Directed Path Dump of %u hop path:" - "\n\t\t\t\tPath = ", p_path->hop_count); + n = sprintf(buf, "Directed Path Dump of %u hop path: " + "Path = ", p_path->hop_count); sprint_uint8_arr(buf + n, sizeof(buf) - n, p_path->path, p_path->hop_count + 1); @@ -2022,8 +1962,6 @@ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path, } } -/********************************************************************** - **********************************************************************/ void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp, IN osm_log_level_t log_level) { @@ -2031,13 +1969,13 @@ void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp, char buf[BUF_SIZE]; unsigned n; - n = sprintf(buf, "Received SMP on a %u hop path:" - "\n\t\t\t\tInitial path = ", p_smp->hop_count); + n = sprintf(buf, "Received SMP on a %u hop path: " + "Initial path = ", p_smp->hop_count); n += sprint_uint8_arr(buf + n, sizeof(buf) - n, p_smp->initial_path, p_smp->hop_count + 1); - n += sprintf(buf + n, "\n\t\t\t\tReturn path = "); + n += sprintf(buf + n, ", Return path = "); n += sprint_uint8_arr(buf + n, sizeof(buf) - n, p_smp->return_path, p_smp->hop_count + 1); @@ -2054,18 +1992,13 @@ static const char *sm_signal_str[] = { "UNKNOWN SIGNAL!!" /* 5 */ }; -/********************************************************************** - **********************************************************************/ const char *osm_get_sm_signal_str(IN osm_signal_t signal) { if (signal > OSM_SIGNAL_MAX) signal = OSM_SIGNAL_MAX; - return (sm_signal_str[signal]); + return sm_signal_str[signal]; } -/********************************************************************** - **********************************************************************/ - static const char *disp_msg_str[] = { "OSM_MSG_NONE", "OSM_MSG_MAD_NODE_INFO", @@ -2102,13 +2035,11 @@ static const char *disp_msg_str[] = { "UNKNOWN!!" }; -/********************************************************************** - **********************************************************************/ const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg) { if (msg > OSM_MSG_MAX) msg = OSM_MSG_MAX; - return (disp_msg_str[msg]); + return disp_msg_str[msg]; } static const char *port_state_str_fixed_width[] = { @@ -2120,13 +2051,11 @@ static const char *port_state_str_fixed_width[] = { "???" }; -/********************************************************************** - **********************************************************************/ const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state) { if (port_state > IB_LINK_ACTIVE) port_state = IB_LINK_ACTIVE + 1; - return (port_state_str_fixed_width[port_state]); + return port_state_str_fixed_width[port_state]; } static const char *node_type_str_fixed_width[] = { @@ -2136,17 +2065,13 @@ static const char *node_type_str_fixed_width[] = { "RT", }; -/********************************************************************** - **********************************************************************/ const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type) { if (node_type > IB_NODE_TYPE_ROUTER) node_type = 0; - return (node_type_str_fixed_width[node_type]); + return node_type_str_fixed_width[node_type]; } -/********************************************************************** - **********************************************************************/ const char *osm_get_manufacturer_str(IN uint64_t guid_ho) { /* note that the max vendor string length is 11 */ @@ -2179,62 +2104,62 @@ const char *osm_get_manufacturer_str(IN uint64_t guid_ho) switch ((uint32_t) (guid_ho >> (5 * 8))) { case OSM_VENDOR_ID_INTEL: - return (intel_str); + return intel_str; case OSM_VENDOR_ID_MELLANOX: - return (mellanox_str); + return mellanox_str; case OSM_VENDOR_ID_REDSWITCH: - return (redswitch_str); + return redswitch_str; case OSM_VENDOR_ID_SILVERSTORM: - return (silverstorm_str); + return silverstorm_str; case OSM_VENDOR_ID_TOPSPIN: - return (topspin_str); + return topspin_str; case OSM_VENDOR_ID_FUJITSU: case OSM_VENDOR_ID_FUJITSU2: - return (fujitsu_str); + return fujitsu_str; case OSM_VENDOR_ID_VOLTAIRE: - return (voltaire_str); + return voltaire_str; case OSM_VENDOR_ID_YOTTAYOTTA: - return (yotta_str); + return yotta_str; case OSM_VENDOR_ID_PATHSCALE: - return (pathscale_str); + return pathscale_str; case OSM_VENDOR_ID_IBM: - return (ibm_str); + return ibm_str; case OSM_VENDOR_ID_DIVERGENET: - return (divergenet_str); + return divergenet_str; case OSM_VENDOR_ID_FLEXTRONICS: - return (flextronics_str); + return flextronics_str; case OSM_VENDOR_ID_AGILENT: - return (agilent_str); + return agilent_str; case OSM_VENDOR_ID_OBSIDIAN: - return (obsidian_str); + return obsidian_str; case OSM_VENDOR_ID_BAYMICRO: - return (baymicro_str); + return baymicro_str; case OSM_VENDOR_ID_LSILOGIC: - return (lsilogic_str); + return lsilogic_str; case OSM_VENDOR_ID_DDN: - return (ddn_str); + return ddn_str; case OSM_VENDOR_ID_PANTA: - return (panta_str); + return panta_str; case OSM_VENDOR_ID_HP: case OSM_VENDOR_ID_HP2: case OSM_VENDOR_ID_HP3: case OSM_VENDOR_ID_HP4: - return (hp_str); + return hp_str; case OSM_VENDOR_ID_RIOWORKS: - return (rioworks_str); + return rioworks_str; case OSM_VENDOR_ID_SUN: case OSM_VENDOR_ID_SUN2: - return (sun_str); + return sun_str; case OSM_VENDOR_ID_3LEAFNTWKS: - return (leafntwks_str); + return leafntwks_str; case OSM_VENDOR_ID_XSIGO: - return (xsigo_str); + return xsigo_str; case OSM_VENDOR_ID_DELL: - return (dell_str); + return dell_str; case OSM_VENDOR_ID_SUPERMICRO: - return (supermicro_str); + return supermicro_str; default: - return (unknown_str); + return unknown_str; } } @@ -2247,14 +2172,12 @@ static const char *mtu_str_fixed_width[] = { "4096" }; -/********************************************************************** - **********************************************************************/ const char *osm_get_mtu_str(IN uint8_t mtu) { if (mtu > IB_MTU_LEN_4096) - return (mtu_str_fixed_width[0]); + return mtu_str_fixed_width[0]; else - return (mtu_str_fixed_width[mtu]); + return mtu_str_fixed_width[mtu]; } static const char *lwa_str_fixed_width[] = { @@ -2269,18 +2192,14 @@ static const char *lwa_str_fixed_width[] = { "12x" }; -/********************************************************************** - **********************************************************************/ const char *osm_get_lwa_str(IN uint8_t lwa) { if (lwa > 8) - return (lwa_str_fixed_width[0]); + return lwa_str_fixed_width[0]; else - return (lwa_str_fixed_width[lwa]); + return lwa_str_fixed_width[lwa]; } -/********************************************************************** - **********************************************************************/ static const char *lsa_str_fixed_width[] = { "???", "2.5", @@ -2292,14 +2211,11 @@ static const char *lsa_str_fixed_width[] = { const char *osm_get_lsa_str(IN uint8_t lsa) { if (lsa > 4) - return (lsa_str_fixed_width[0]); + return lsa_str_fixed_width[0]; else - return (lsa_str_fixed_width[lsa]); + return lsa_str_fixed_width[lsa]; } -/********************************************************************** - **********************************************************************/ - static const char *sm_mgr_signal_str[] = { "OSM_SM_SIGNAL_NONE", /* 0 */ "OSM_SM_SIGNAL_DISCOVERY_COMPLETED", /* 2 */ @@ -2315,13 +2231,11 @@ static const char *sm_mgr_signal_str[] = { "UNKNOWN STATE!!" /* 12 */ }; -/********************************************************************** - **********************************************************************/ const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal) { if (signal > OSM_SM_SIGNAL_MAX) signal = OSM_SM_SIGNAL_MAX; - return (sm_mgr_signal_str[signal]); + return sm_mgr_signal_str[signal]; } static const char *sm_mgr_state_str[] = { diff --git a/branches/opensm_3/user/opensm/osm_inform.c b/branches/opensm_3/user/opensm/osm_inform.c index 3c14fb22..2cdf456c 100644 --- a/branches/opensm_3/user/opensm/osm_inform.c +++ b/branches/opensm_3/user/opensm/osm_inform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -59,15 +59,11 @@ typedef struct osm_infr_match_ctxt { ib_mad_notice_attr_t *p_ntc; } osm_infr_match_ctxt_t; -/********************************************************************** - **********************************************************************/ void osm_infr_delete(IN osm_infr_t * p_infr) { free(p_infr); } -/********************************************************************** - **********************************************************************/ osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec) { osm_infr_t *p_infr; @@ -78,11 +74,9 @@ osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec) if (p_infr) memcpy(p_infr, p_infr_rec, sizeof(osm_infr_t)); - return (p_infr); + return p_infr; } -/********************************************************************** - **********************************************************************/ static void dump_all_informs(IN const osm_subn_t * p_subn, IN osm_log_t * p_log) { cl_list_item_t *p_list_item; @@ -210,8 +204,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn, IN osm_log_t * p_log, IN osm_infr_t * p_infr_rec) @@ -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; } -/********************************************************************** - **********************************************************************/ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, IN osm_infr_t * p_infr) { @@ -258,6 +248,7 @@ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, #endif cl_qlist_insert_head(&p_subn->sa_infr_list, &p_infr->list_item); + p_subn->p_osm->sa.dirty = TRUE; OSM_LOG(p_log, OSM_LOG_DEBUG, "Dump after insertion (size %d)\n", cl_qlist_count(&p_subn->sa_infr_list)); @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, IN osm_infr_t * p_infr) { @@ -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); cl_qlist_remove_item(&p_subn->sa_infr_list, &p_infr->list_item); + p_subn->p_osm->sa.dirty = TRUE; osm_infr_delete(p_infr); @@ -348,7 +338,7 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec, /* the informinfo Exit: OSM_LOG_EXIT(p_log); - return (status); + return status; } /********************************************************************** @@ -495,9 +485,8 @@ static void match_notice_to_inf_rec(IN cl_list_item_t * p_list_item, goto Exit; } - p_dest_port = - cl_ptr_vector_get(&p_subn->port_lid_tbl, - cl_ntoh16(p_infr_rec->report_addr.dest_lid)); + p_dest_port = osm_get_port_by_lid(p_subn, + p_infr_rec->report_addr.dest_lid); if (!p_dest_port) { OSM_LOG(p_log, OSM_LOG_INFO, "Cannot find destination port with LID:%u\n", @@ -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) { OSM_LOG(p_log, OSM_LOG_DEBUG, "Ignoring Notice Reports since Inform List is not initialized yet!\n"); - return (IB_ERROR); + return IB_ERROR; } if (osm_log_is_active(p_log, OSM_LOG_INFO)) @@ -624,5 +613,5 @@ ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn, OSM_LOG_EXIT(p_log); - return (IB_SUCCESS); + return IB_SUCCESS; } diff --git a/branches/opensm_3/user/opensm/osm_lid_mgr.c b/branches/opensm_3/user/opensm/osm_lid_mgr.c index 2cfa1623..50860040 100644 --- a/branches/opensm_3/user/opensm/osm_lid_mgr.c +++ b/branches/opensm_3/user/opensm/osm_lid_mgr.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -104,26 +104,20 @@ typedef struct osm_lid_mgr_range { uint16_t max_lid; } osm_lid_mgr_range_t; -/********************************************************************** - **********************************************************************/ void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr) { memset(p_mgr, 0, sizeof(*p_mgr)); } -/********************************************************************** - **********************************************************************/ void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr) { cl_list_item_t *p_item; OSM_LOG_ENTER(p_mgr->p_log); - p_item = cl_qlist_remove_head(&p_mgr->free_ranges); - while (p_item != cl_qlist_end(&p_mgr->free_ranges)) { + while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) != + cl_qlist_end(&p_mgr->free_ranges)) free((osm_lid_mgr_range_t *) p_item); - p_item = cl_qlist_remove_head(&p_mgr->free_ranges); - } OSM_LOG_EXIT(p_mgr->p_log); } @@ -154,8 +148,8 @@ static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr) goto Exit; } - p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids); - while ((cl_list_item_t *) p_item != cl_qlist_end(&guids)) { + while ((p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids)) + != (osm_db_guid_elem_t *) cl_qlist_end(&guids)) { if (osm_db_guid2lid_get(p_mgr->p_g2l, p_item->guid, &min_lid, &max_lid)) OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0311: " @@ -201,29 +195,23 @@ static void lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr) } } - if (!lids_ok) { - if (osm_db_guid2lid_delete(p_mgr->p_g2l, - p_item->guid)) - OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, - "ERR 0315: " - "failed to delete entry for " - "guid:0x%016" PRIx64 "\n", - p_item->guid); - } else { + if (lids_ok) /* mark that it was visited */ for (lid = min_lid; lid <= max_lid; lid++) p_mgr->used_lids[lid] = 1; - } + else if (osm_db_guid2lid_delete(p_mgr->p_g2l, + p_item->guid)) + OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, + "ERR 0315: failed to delete entry for " + "guid:0x%016" PRIx64 "\n", + p_item->guid); } /* got a lid */ free(p_item); - p_item = (osm_db_guid_elem_t *) cl_qlist_remove_head(&guids); } /* all guids */ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm) { ib_api_status_t status = IB_SUCCESS; @@ -278,7 +266,7 @@ ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm) Exit: OSM_LOG_EXIT(p_mgr->p_log); - return (status); + return status; } static uint16_t trim_lid(IN uint16_t lid) @@ -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) { cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl; - uint16_t max_defined_lid; - uint16_t max_persistent_lid; - uint16_t max_discovered_lid; - uint16_t lid; - uint16_t disc_min_lid; - uint16_t disc_max_lid; - uint16_t db_min_lid; - uint16_t db_max_lid; + uint16_t max_defined_lid, max_persistent_lid, max_discovered_lid; + uint16_t disc_min_lid, disc_max_lid, db_min_lid, db_max_lid; int status = 0; cl_list_item_t *p_item; boolean_t is_free; @@ -312,8 +294,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr) osm_port_t *p_port; cl_qmap_t *p_port_guid_tbl; uint8_t lmc_num_lids = (uint8_t) (1 << p_mgr->p_subn->opt.lmc); - uint16_t lmc_mask; - uint16_t req_lid, num_lids; + uint16_t lmc_mask, req_lid, num_lids, lid; OSM_LOG_ENTER(p_mgr->p_log); @@ -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 need to honor this file. */ if (p_mgr->p_subn->coming_out_of_standby == TRUE) { - if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) { + osm_db_clear(p_mgr->p_g2l); + memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids)); + if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE) OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Ignore guid2lid file when coming out of standby\n"); - osm_db_clear(p_mgr->p_g2l); - memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids)); - } else { + else { OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Honor current guid2lid file when coming out " "of standby\n"); - osm_db_clear(p_mgr->p_g2l); if (osm_db_restore(p_mgr->p_g2l)) OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0306: " "Error restoring Guid-to-Lid " "persistent database. Ignoring it\n"); + lid_mgr_validate_db(p_mgr); } } /* we need to cleanup the empty ranges list */ - p_item = cl_qlist_remove_head(&p_mgr->free_ranges); - while (p_item != cl_qlist_end(&p_mgr->free_ranges)) { + while ((p_item = cl_qlist_remove_head(&p_mgr->free_ranges)) != + cl_qlist_end(&p_mgr->free_ranges)) free((osm_lid_mgr_range_t *) p_item); - p_item = cl_qlist_remove_head(&p_mgr->free_ranges); - } /* first clean up the port_by_lid_tbl */ for (lid = 0; lid < cl_ptr_vector_get_size(p_discovered_vec); lid++) @@ -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) { OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Skipping all lids as we are reassigning them\n"); - p_range = - (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t)); + p_range = malloc(sizeof(osm_lid_mgr_range_t)); if (p_range) p_range->min_lid = 1; goto AfterScanningLids; @@ -448,10 +426,9 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr) "persistent db\n", lid); is_free = FALSE; /* check this is a discovered port */ - } else if (lid <= max_discovered_lid && (p_port = (osm_port_t *) - cl_ptr_vector_get - (p_discovered_vec, - lid))) { + } else if (lid <= max_discovered_lid && + (p_port = cl_ptr_vector_get(p_discovered_vec, + lid))) { /* we have a port. Now lets see if we can preserve its lid range. */ /* For that, we need to make sure: 1. The port has a (legal) persistency entry. Then the @@ -533,23 +510,20 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr) if (p_range) p_range->max_lid = lid; else { - p_range = (osm_lid_mgr_range_t *) - malloc(sizeof(osm_lid_mgr_range_t)); + p_range = malloc(sizeof(osm_lid_mgr_range_t)); if (p_range) { p_range->min_lid = lid; p_range->max_lid = lid; } } - } else { - /* this lid is used so we need to finalize the previous free range */ - if (p_range) { - cl_qlist_insert_tail(&p_mgr->free_ranges, - &p_range->item); - OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, - "new free lid range [%u:%u]\n", - p_range->min_lid, p_range->max_lid); - p_range = NULL; - } + /* this lid is used so we need to finalize the previous free range */ + } else if (p_range) { + cl_qlist_insert_tail(&p_mgr->free_ranges, + &p_range->item); + OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, + "new free lid range [%u:%u]\n", + p_range->min_lid, p_range->max_lid); + p_range = NULL; } } @@ -557,8 +531,7 @@ AfterScanningLids: /* after scanning all known lids we need to extend the last range to the max allowed lid */ if (!p_range) { - p_range = - (osm_lid_mgr_range_t *) malloc(sizeof(osm_lid_mgr_range_t)); + p_range = malloc(sizeof(osm_lid_mgr_range_t)); /* The p_range can be NULL in one of 2 cases: 1. If max_defined_lid == 0. In this case, we want the @@ -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 */ if (lid + num_lids - 1 <= p_range->max_lid) { /* ok let us use that range */ - if (lid + num_lids - 1 == p_range->max_lid) + if (lid + num_lids - 1 == p_range->max_lid) { /* we consumed the entire range */ cl_qlist_remove_item(&p_mgr->free_ranges, p_item); - else + free(p_item); + } else /* only update the available range */ p_range->min_lid = lid + num_lids; @@ -667,8 +641,6 @@ static void lid_mgr_find_free_lid_range(IN osm_lid_mgr_t * p_mgr, CL_ASSERT(0); } -/********************************************************************** - **********************************************************************/ static void lid_mgr_cleanup_discovered_port_lid_range(IN osm_lid_mgr_t * p_mgr, IN osm_port_t * p_port) { @@ -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); min_lid = trim_lid(min_lid); max_lid = trim_lid(max_lid); - for (lid = min_lid; lid <= max_lid; lid++) { - if ((lid < max_tbl_lid) && - (p_port == - (osm_port_t *) cl_ptr_vector_get(p_discovered_vec, lid))) + for (lid = min_lid; lid <= max_lid; lid++) + if (lid < max_tbl_lid && + p_port == cl_ptr_vector_get(p_discovered_vec, lid)) cl_ptr_vector_set(p_discovered_vec, lid, NULL); - } } /********************************************************************** @@ -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)) { *p_min_lid = min_lid; *p_max_lid = min_lid + num_lids - 1; - if (min_lid == cl_ntoh16(osm_port_get_base_lid(p_port))) { + if (min_lid == cl_ntoh16(osm_port_get_base_lid(p_port))) OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "0x%016" PRIx64 " matches its known lid:%u\n", guid, min_lid); - goto Exit; - } else { + else { OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "0x%016" PRIx64 " with lid:%u " "does not match its known lid:%u\n", @@ -741,8 +710,8 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr, p_port); /* we still need to send the setting to the target port */ lid_changed = 1; - goto Exit; } + goto NewLidSet; } else OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "0x%016" PRIx64 " has no persistent lid assigned\n", @@ -796,7 +765,6 @@ NewLidSet: for (lid = *p_min_lid; lid <= *p_max_lid; lid++) p_mgr->used_lids[lid] = 1; -Exit: /* make sure the assigned lids are marked in port_lid_tbl */ for (lid = *p_min_lid; lid <= *p_max_lid; lid++) cl_ptr_vector_set(&p_mgr->p_subn->port_lid_tbl, lid, p_port); @@ -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); } -/********************************************************************** - **********************************************************************/ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr, IN osm_port_t * p_port, IN osm_physp_t * p_physp, IN ib_net16_t lid) @@ -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. */ - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_old_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); /* Should never write back a value that is bigger then 3 in @@ -951,9 +918,8 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr, send_set = TRUE; /* calc new op_vls and mtu */ - op_vls = - osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn, - p_physp); + op_vls = osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn, + p_physp); mtu = osm_physp_calc_link_mtu(p_mgr->p_log, p_physp); ib_port_info_set_neighbor_mtu(p_pi, mtu); @@ -1143,8 +1109,6 @@ Exit: return ret; } -/********************************************************************** - **********************************************************************/ int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr) { int ret; @@ -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 if required */ OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE, - "Assigned port 0x%016" PRIx64 - ", LID [%u,%u]\n", cl_ntoh64(port_guid), - min_lid_ho, max_lid_ho); + "Assigned port 0x%016" PRIx64 ", LID [%u,%u]\n", + cl_ntoh64(port_guid), min_lid_ho, max_lid_ho); /* the proc returns the fact it sent a set port info */ if (lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp, diff --git a/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c b/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c index 909fcd33..f2567d6e 100644 --- a/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c +++ b/branches/opensm_3/user/opensm/osm_lin_fwd_rcv.c @@ -1,7 +1,8 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -49,8 +50,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_lft_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; @@ -91,8 +90,9 @@ void osm_lft_rcv_process(IN void *context, IN void *data) if (status != IB_SUCCESS) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: " "Setting forwarding table block failed (%s)" - "\n\t\t\t\tSwitch 0x%" PRIx64 "\n", - ib_get_err_str(status), cl_ntoh64(node_guid)); + ", Switch 0x%" PRIx64 " %s\n", + ib_get_err_str(status), cl_ntoh64(node_guid), + p_sw->p_node->print_desc); } } diff --git a/branches/opensm_3/user/opensm/osm_link_mgr.c b/branches/opensm_3/user/opensm/osm_link_mgr.c index 67cb7a60..75b44a3e 100644 --- a/branches/opensm_3/user/opensm/osm_link_mgr.c +++ b/branches/opensm_3/user/opensm/osm_link_mgr.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * @@ -55,15 +55,11 @@ #include #include -/********************************************************************** - **********************************************************************/ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp) { osm_opensm_t *p_osm = sm->p_subn->p_osm; - const osm_port_t *p_sm_port; - const osm_port_t *p_src_port; + const osm_port_t *p_sm_port, *p_src_port; ib_net16_t slid; - ib_net16_t smlid; uint8_t sl; OSM_LOG_ENTER(sm->p_log); @@ -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))) { /* Use default SL if lash routing is not used */ OSM_LOG_EXIT(sm->p_log); - return (sm->p_subn->opt.sm_sl); + return sm->p_subn->opt.sm_sl; } /* Find osm_port of the SM itself = dest_port */ - smlid = sm->p_subn->sm_base_lid; - p_sm_port = - cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(smlid)); + p_sm_port = osm_get_port_by_lid(sm->p_subn, sm->p_subn->sm_base_lid); /* Find osm_port of the source = p_physp */ - p_src_port = - cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(slid)); + p_src_port = osm_get_port_by_lid(sm->p_subn, slid); /* Call lash to find proper SL */ sl = osm_get_lash_sl(p_osm, p_src_port, p_sm_port); OSM_LOG_EXIT(sm->p_log); - return (sl); + return sl; } -/********************************************************************** - **********************************************************************/ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp, IN uint8_t port_state) { @@ -119,7 +110,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp, /* CAs don't have a port 0, and for switch port 0, we need to check if this is enhanced or base port 0. - For base port 0 the following parameters are not valid (p822, table 145). + For base port 0 the following parameters are not valid + (IBA 1.2.1 p.830 table 146). */ if (!p_node->sw) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4201: " @@ -156,8 +148,9 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp, esp0 = TRUE; } - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_old_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); /* Should never write back a value that is bigger then 3 in @@ -402,8 +395,6 @@ Exit: return ret; } -/********************************************************************** - **********************************************************************/ static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node, IN const uint8_t link_state) { @@ -458,8 +449,6 @@ static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node, return ret; } -/********************************************************************** - **********************************************************************/ int osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state) { cl_qmap_t *p_node_guid_tbl; diff --git a/branches/opensm_3/user/opensm/osm_log.c b/branches/opensm_3/user/opensm/osm_log.c index 696d2373..d67a0b58 100644 --- a/branches/opensm_3/user/opensm/osm_log.c +++ b/branches/opensm_3/user/opensm/osm_log.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -125,11 +125,25 @@ void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity, #endif /* __WIN__ */ /* If this is a call to syslog - always print it */ - if (!(verbosity & (OSM_LOG_SYS | p_log->level))) + if (!(verbosity & p_log->level)) return; va_start(args, p_str); - vsprintf(buffer, p_str, args); +#ifndef __WIN__ + if (p_log->log_prefix == NULL) + vsprintf(buffer, p_str, args); + else { + int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix); + vsprintf(buffer + n, p_str, args); + } +#else + if (p_log->log_prefix == NULL) + _vsnprintf(buffer, sizeof(buffer), (LPSTR)p_str, args); + else { + int n = snprintf(buffer, sizeof(buffer), "%s: ", p_log->log_prefix); + _vsnprintf(buffer + n, (sizeof(buffer) - n), (LPSTR)p_str, args); + } +#endif va_end(args); /* this is a call to the syslog */ @@ -307,7 +321,7 @@ ib_api_status_t osm_log_init_v2(IN osm_log_t * p_log, IN boolean_t flush, IN unsigned long max_size, IN boolean_t accum_log_file) { - p_log->level = log_flags; + p_log->level = log_flags | OSM_LOG_SYS; p_log->flush = flush; p_log->count = 0; p_log->max_size = max_size << 20; /* convert size in MB to bytes */ diff --git a/branches/opensm_3/user/opensm/osm_mad_pool.c b/branches/opensm_3/user/opensm/osm_mad_pool.c index 1250e71f..62dff416 100644 --- a/branches/opensm_3/user/opensm/osm_mad_pool.c +++ b/branches/opensm_3/user/opensm/osm_mad_pool.c @@ -50,8 +50,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool) { CL_ASSERT(p_pool); @@ -59,15 +57,11 @@ void osm_mad_pool_construct(IN osm_mad_pool_t * p_pool) memset(p_pool, 0, sizeof(*p_pool)); } -/********************************************************************** - **********************************************************************/ void osm_mad_pool_destroy(IN osm_mad_pool_t * p_pool) { CL_ASSERT(p_pool); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool) { p_pool->mads_out = 0; @@ -75,8 +69,6 @@ ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * p_pool) return IB_SUCCESS; } -/********************************************************************** - **********************************************************************/ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * p_pool, IN osm_bind_handle_t h_bind, IN uint32_t total_size, @@ -118,8 +110,6 @@ Exit: return p_madw; } -/********************************************************************** - **********************************************************************/ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * p_pool, IN osm_bind_handle_t h_bind, IN uint32_t total_size, @@ -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); Exit: - return (p_madw); + return p_madw; } -/********************************************************************** - **********************************************************************/ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * p_pool) { osm_madw_t *p_madw; @@ -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); cl_atomic_inc(&p_pool->mads_out); - return (p_madw); + return p_madw; } -/********************************************************************** - **********************************************************************/ void osm_mad_pool_put(IN osm_mad_pool_t * p_pool, IN osm_madw_t * p_madw) { CL_ASSERT(p_madw); diff --git a/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c b/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c index fee5860b..4e053323 100644 --- a/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c +++ b/branches/opensm_3/user/opensm/osm_mcast_fwd_rcv.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -55,8 +56,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_mft_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; @@ -109,10 +108,10 @@ void osm_mft_rcv_process(IN void *context, IN void *data) if (status != IB_SUCCESS) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0802: " "Setting MFT block failed (%s)" - "\n\t\t\t\tSwitch 0x%016" PRIx64 - ", block %u, position %u\n", - ib_get_err_str(status), - cl_ntoh64(node_guid), block_num, position); + ", Switch 0x%016" PRIx64 + " (%s), block %u, position %u\n", + ib_get_err_str(status), cl_ntoh64(node_guid), + p_sw->p_node->print_desc, block_num, position); } } diff --git a/branches/opensm_3/user/opensm/osm_mcast_mgr.c b/branches/opensm_3/user/opensm/osm_mcast_mgr.c index 095604d9..32da52f5 100644 --- a/branches/opensm_3/user/opensm/osm_mcast_mgr.c +++ b/branches/opensm_3/user/opensm/osm_mcast_mgr.c @@ -3,6 +3,7 @@ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -56,16 +57,13 @@ #include #include -/********************************************************************** - **********************************************************************/ typedef struct osm_mcast_work_obj { cl_list_item_t list_item; osm_port_t *p_port; + cl_map_item_t map_item; } osm_mcast_work_obj_t; -/********************************************************************** - **********************************************************************/ -static osm_mcast_work_obj_t *mcast_work_obj_new(IN const osm_port_t * p_port) +static osm_mcast_work_obj_t *mcast_work_obj_new(IN osm_port_t * p_port) { osm_mcast_work_obj_t *p_obj; @@ -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)); if (p_obj) { memset(p_obj, 0, sizeof(*p_obj)); - p_obj->p_port = (osm_port_t *) p_port; + p_obj->p_port = p_port; } - return (p_obj); + return p_obj; } -/********************************************************************** - **********************************************************************/ static void mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj) { free(p_wobj); } +static int make_port_list(cl_qlist_t * list, osm_mgrp_box_t * mbox) +{ + cl_qmap_t map; + cl_map_item_t *map_item; + cl_list_item_t *list_item; + osm_mgrp_t *mgrp=NULL; + osm_mcm_port_t *mcm_port=NULL; + osm_mcast_work_obj_t *wobj; + + cl_qmap_init(&map); + cl_qlist_init(list); + + for (list_item = cl_qlist_head(&mbox->mgrp_list); + list_item != cl_qlist_end(&mbox->mgrp_list); + list_item = cl_qlist_next(list_item)) { + mgrp = cl_item_obj(list_item, mgrp, list_item); + for (map_item = cl_qmap_head(&mgrp->mcm_port_tbl); + map_item != cl_qmap_end(&mgrp->mcm_port_tbl); + map_item = cl_qmap_next(map_item)) { + /* Acquire the port object for this port guid, then + create the new worker object to build the list. */ + mcm_port = cl_item_obj(map_item, mcm_port, map_item); + if (cl_qmap_get(&map, mcm_port->port->guid) != + cl_qmap_end(&map)) + continue; + wobj = mcast_work_obj_new(mcm_port->port); + if (!wobj) + return -1; + cl_qlist_insert_tail(list, &wobj->list_item); + cl_qmap_insert(&map, mcm_port->port->guid, + &wobj->map_item); + } + } + return 0; +} + +static void drop_port_list(cl_qlist_t * list) +{ + while (cl_qlist_count(list)) + mcast_work_obj_delete((osm_mcast_work_obj_t *) + cl_qlist_remove_head(list)); +} + /********************************************************************** Recursively remove nodes from the tree *********************************************************************/ @@ -101,107 +140,133 @@ static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn) if (p_mtn->child_array[i] && (p_mtn->child_array[i] != OSM_MTREE_LEAF)) mcast_mgr_purge_tree_node(p_mtn->child_array[i]); - p_mtn->child_array[i] = NULL; - } free(p_mtn); } -/********************************************************************** - **********************************************************************/ -static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_t * p_mgrp) +static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_box_t * mbox) { OSM_LOG_ENTER(sm->p_log); - if (p_mgrp->p_root) - mcast_mgr_purge_tree_node(p_mgrp->p_root); - - p_mgrp->p_root = NULL; + if (mbox->root) + mcast_mgr_purge_tree_node(mbox->root); + mbox->root = NULL; OSM_LOG_EXIT(sm->p_log); } +static void create_mgrp_switch_map(cl_qmap_t * m, cl_qlist_t * port_list) +{ + osm_mcast_work_obj_t *wobj=NULL; + osm_port_t *port; + osm_switch_t *sw; + ib_net64_t guid; + cl_list_item_t *i; + + cl_qmap_init(m); + for (i = cl_qlist_head(port_list); i != cl_qlist_end(port_list); + i = cl_qlist_next(i)) { + wobj = cl_item_obj(i, wobj, list_item); + port = wobj->p_port; + if (port->p_node->sw) { + sw = port->p_node->sw; + sw->is_mc_member = 1; + } else { + sw = port->p_physp->p_remote_physp->p_node->sw; + sw->num_of_mcm++; + } + guid = osm_node_get_node_guid(sw->p_node); + if (cl_qmap_get(m, guid) == cl_qmap_end(m)) + cl_qmap_insert(m, guid, &sw->mgrp_item); + } +} + +static void destroy_mgrp_switch_map(cl_qmap_t * m) +{ + osm_switch_t *sw=NULL; + cl_map_item_t *i; + + for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) { + sw = cl_item_obj(i, sw, mgrp_item); + sw->num_of_mcm = 0; + sw->is_mc_member = 0; + } + cl_qmap_remove_all(m); +} + /********************************************************************** + Calculate the maximal "min hops" from the given switch to any + of the group HCAs **********************************************************************/ -static float osm_mcast_mgr_compute_avg_hops(osm_sm_t * sm, - const osm_mgrp_t * p_mgrp, - const osm_switch_t * p_sw) +#ifdef OSM_VENDOR_INTF_ANAFA +static float mcast_mgr_compute_avg_hops(osm_sm_t * sm, cl_qmap_t * m, + const osm_switch_t * this_sw) { float avg_hops = 0; uint32_t hops = 0; uint32_t num_ports = 0; - const osm_mcm_port_t *p_mcm_port; - const cl_qmap_t *p_mcm_tbl; + uint16_t lid; + uint32_t least_hops; + cl_map_item_t *i; + osm_switch_t *sw; OSM_LOG_ENTER(sm->p_log); - p_mcm_tbl = &p_mgrp->mcm_port_tbl; - - /* - For each member of the multicast group, compute the - number of hops to its base LID. - */ - for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl); - p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl); - p_mcm_port = - (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) { - hops += osm_switch_get_port_least_hops(p_sw, p_mcm_port->port); - num_ports++; + for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) { + sw = cl_item_obj(i, sw, mcast_item); + lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0)); + least_hops = osm_switch_get_least_hops(this_sw, lid); + /* for all host that are MC members and attached to the switch, + we should add the (least_hops + 1) * number_of_such_hosts. + If switch itself is in the MC, we should add the least_hops only */ + hops += (least_hops + 1) * sw->num_of_mcm + + least_hops * sw->is_mc_member; + num_ports += sw->num_of_mcm + sw->is_mc_member; } - /* - We should be here if there aren't any ports in the group. - */ + /* We shouldn't be here if there aren't any ports in the group. */ CL_ASSERT(num_ports); - if (num_ports != 0) - avg_hops = (float)(hops / num_ports); + avg_hops = (float)(hops / num_ports); OSM_LOG_EXIT(sm->p_log); return avg_hops; } - -/********************************************************************** - Calculate the maximal "min hops" from the given switch to any - of the group HCAs - **********************************************************************/ -static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm, - const osm_mgrp_t * p_mgrp, - const osm_switch_t * p_sw) +#else +static float mcast_mgr_compute_max_hops(osm_sm_t * sm, cl_qmap_t * m, + const osm_switch_t * this_sw) { - uint32_t max_hops = 0; - uint32_t hops = 0; - const osm_mcm_port_t *p_mcm_port; - const cl_qmap_t *p_mcm_tbl; + uint32_t max_hops = 0, hops; + uint16_t lid; + cl_map_item_t *i; + osm_switch_t *sw=NULL; OSM_LOG_ENTER(sm->p_log); - p_mcm_tbl = &p_mgrp->mcm_port_tbl; - /* For each member of the multicast group, compute the number of hops to its base LID. */ - for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl); - p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl); - p_mcm_port = - (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) { - hops = osm_switch_get_port_least_hops(p_sw, p_mcm_port->port); + for (i = cl_qmap_head(m); i != cl_qmap_end(m); i = cl_qmap_next(i)) { + sw = cl_item_obj(i, sw, mgrp_item); + lid = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0)); + hops = osm_switch_get_least_hops(this_sw, lid); + if (!sw->is_mc_member) + hops += 1; if (hops > max_hops) max_hops = hops; } - if (max_hops == 0) - /* - We should be here if there aren't any ports in the group. - */ - max_hops = 10001; /* see later - we use it to realize no hops */ + /* Note that at this point we might get (max_hops == 0), + which means that there's only one member in the mcast + group, and it's the current switch */ OSM_LOG_EXIT(sm->p_log); return (float)max_hops; } +#endif /********************************************************************** This function attempts to locate the optimal switch for the @@ -210,35 +275,30 @@ static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm, of the multicast group. **********************************************************************/ static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm, - const osm_mgrp_t * p_mgrp) + cl_qlist_t * list) { + cl_qmap_t mgrp_sw_map; cl_qmap_t *p_sw_tbl; - const osm_switch_t *p_sw; - const osm_switch_t *p_best_sw = NULL; + osm_switch_t *p_sw, *p_best_sw = NULL; float hops = 0; float best_hops = 10000; /* any big # will do */ -#ifdef OSM_VENDOR_INTF_ANAFA - boolean_t use_avg_hops = TRUE; /* anafa2 - bug hca on switch *//* use max hops for root */ -#else - boolean_t use_avg_hops = FALSE; /* use max hops for root */ -#endif OSM_LOG_ENTER(sm->p_log); p_sw_tbl = &sm->p_subn->sw_guid_tbl; - CL_ASSERT(!osm_mgrp_is_empty(p_mgrp)); - + create_mgrp_switch_map(&mgrp_sw_map, list); for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl); p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl); p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) { if (!osm_switch_supports_mcast(p_sw)) continue; - if (use_avg_hops) - hops = osm_mcast_mgr_compute_avg_hops(sm, p_mgrp, p_sw); - else - hops = osm_mcast_mgr_compute_max_hops(sm, p_mgrp, p_sw); +#ifdef OSM_VENDOR_INTF_ANAFA + hops = mcast_mgr_compute_avg_hops(sm, &mgrp_sw_map, p_sw); +#else + hops = mcast_mgr_compute_max_hops(sm, &mgrp_sw_map, p_sw); +#endif OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Switch 0x%016" PRIx64 ", hops = %f\n", @@ -252,24 +312,24 @@ static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm, if (p_best_sw) OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Best switch is 0x%" PRIx64 ", hops = %f\n", + "Best switch is 0x%" PRIx64 " (%s), hops = %f\n", cl_ntoh64(osm_node_get_node_guid(p_best_sw->p_node)), - best_hops); + p_best_sw->p_node->print_desc, best_hops); else OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "No multicast capable switches detected\n"); + destroy_mgrp_switch_map(&mgrp_sw_map); OSM_LOG_EXIT(sm->p_log); - return (osm_switch_t *) p_best_sw; + return p_best_sw; } /********************************************************************** - This function returns the existing or optimal root swtich for the tree. + This function returns the existing or optimal root switch for the tree. **********************************************************************/ -static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, - const osm_mgrp_t * p_mgrp) +static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list) { - const osm_switch_t *p_sw = NULL; + osm_switch_t *p_sw = NULL; OSM_LOG_ENTER(sm->p_log); @@ -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. - Very bad ... */ - p_sw = mcast_mgr_find_optimal_switch(sm, p_mgrp); + p_sw = mcast_mgr_find_optimal_switch(sm, list); OSM_LOG_EXIT(sm->p_log); - return (osm_switch_t *) p_sw; + return p_sw; } -/********************************************************************** - **********************************************************************/ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw, uint32_t block_num, uint32_t position) { @@ -324,23 +382,21 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw, if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num, (uint8_t) position, block)) { - block_id_ho = block_num + (position << 28); OSM_LOG(sm->p_log, OSM_LOG_DEBUG, - "Writing MFT block %u position %u to switch 0x%" PRIx64 "\n", - block_num, position, + "Writing MFT block %u position %u to switch 0x%" PRIx64 + "\n", block_num, position, cl_ntoh64(context.mft_context.node_guid)); status = osm_req_set(sm, p_path, (void *)block, sizeof(block), IB_MAD_ATTR_MCAST_FWD_TBL, cl_hton32(block_id_ho), CL_DISP_MSGID_NONE, &context); - if (status != IB_SUCCESS) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: " - "Sending multicast fwd. tbl. block failed (%s)\n", - ib_get_err_str(status)); + "Sending multicast fwd. tbl. block to %s failed (%s)\n", + p_node->print_desc, ib_get_err_str(status)); ret = -1; } } @@ -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 contains the group members that must be routed from this switch. **********************************************************************/ -static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp, +static void mcast_mgr_subdivide(osm_sm_t * sm, uint16_t mlid_ho, osm_switch_t * p_sw, cl_qlist_t * p_list, cl_qlist_t * list_array, uint8_t array_size) { uint8_t port_num; - uint16_t mlid_ho; boolean_t ignore_existing; osm_mcast_work_obj_t *p_wobj; OSM_LOG_ENTER(sm->p_log); - mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)); - /* For Multicast Groups, we don't want to count on previous configurations - since we can easily generate a storm @@ -384,40 +437,36 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp, port_num = osm_switch_recommend_mcast_path(p_sw, p_wobj->p_port, mlid_ho, ignore_existing); - if (port_num == OSM_NO_PATH) { /* This typically occurs if the switch does not support multicast and the multicast tree must branch at this switch. */ - uint64_t node_guid_ho = - cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)); OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A03: " "Error routing MLID 0x%X through switch 0x%" - PRIx64 "\n" + PRIx64 " %s\n" "\t\t\t\tNo multicast paths from this switch " - "for port with LID %u\n", mlid_ho, node_guid_ho, + "for port with LID %u\n", mlid_ho, + cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)), + p_sw->p_node->print_desc, cl_ntoh16(osm_port_get_base_lid (p_wobj->p_port))); - mcast_work_obj_delete(p_wobj); continue; } if (port_num > array_size) { - uint64_t node_guid_ho = - cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)); OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A04: " "Error routing MLID 0x%X through switch 0x%" - PRIx64 "\n" + PRIx64 " %s\n" "\t\t\t\tNo multicast paths from this switch " - "to port with LID %u\n", mlid_ho, node_guid_ho, + "to port with LID %u\n", mlid_ho, + cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)), + p_sw->p_node->print_desc, cl_ntoh16(osm_port_get_base_lid (p_wobj->p_port))); - mcast_work_obj_delete(p_wobj); - /* This is means OpenSM has a bug. */ CL_ASSERT(FALSE); continue; @@ -429,23 +478,20 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp, OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ -static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * p_list) +static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * list) { - osm_mcast_work_obj_t *p_wobj; - - OSM_LOG_ENTER(sm->p_log); - - while ((p_wobj = (osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list)) - != (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) { - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A06: " - "Unable to route for port 0x%" PRIx64 "\n", - osm_port_get_guid(p_wobj->p_port)); - mcast_work_obj_delete(p_wobj); + if (osm_log_is_active(sm->p_log, OSM_LOG_ERROR)) { + osm_mcast_work_obj_t *wobj=NULL; + cl_list_item_t *i; + for (i = cl_qlist_head(list); i != cl_qlist_end(list); + i = cl_qlist_next(i)) { + wobj = cl_item_obj(i, wobj, list_item); + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A06: " + "Unable to route for port 0x%" PRIx64 "\n", + osm_port_get_guid(wobj->p_port)); + } } - - OSM_LOG_EXIT(sm->p_log); + drop_port_list(list); } /********************************************************************** @@ -455,7 +501,7 @@ static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * p_list) The function returns the newly created mtree node element. **********************************************************************/ -static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp, +static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, uint16_t mlid_ho, osm_switch_t * p_sw, cl_qlist_t * p_list, uint8_t depth, uint8_t upstream_port, @@ -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; uint8_t i; ib_net64_t node_guid; - uint64_t node_guid_ho; osm_mcast_work_obj_t *p_wobj; cl_qlist_t *p_port_list; size_t count; - uint16_t mlid_ho; osm_mcast_tbl_t *p_tbl; OSM_LOG_ENTER(sm->p_log); @@ -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); node_guid = osm_node_get_node_guid(p_sw->p_node); - node_guid_ho = cl_ntoh64(node_guid); - mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)); OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Routing MLID 0x%X through switch 0x%" PRIx64 - ", %u nodes at depth %u\n", - mlid_ho, node_guid_ho, cl_qlist_count(p_list), depth); + " %s, %u nodes at depth %u\n", + mlid_ho, cl_ntoh64(node_guid), p_sw->p_node->print_desc, + cl_qlist_count(p_list), depth); CL_ASSERT(cl_qlist_count(p_list) > 0); @@ -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. */ OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A14: " - "Switch 0x%" PRIx64 " does not support multicast\n", - node_guid_ho); + "Switch 0x%" PRIx64 " %s does not support multicast\n", + cl_ntoh64(node_guid), p_sw->p_node->print_desc); /* Deallocate all the work objects on this branch of the tree. @@ -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: " "Unable to allocate list array\n"); mcast_mgr_purge_list(sm, p_list); + osm_mtree_destroy(p_mtn); + p_mtn = NULL; goto Exit; } @@ -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++) cl_qlist_init(&list_array[i]); - mcast_mgr_subdivide(sm, p_mgrp, p_sw, p_list, list_array, max_children); + mcast_mgr_subdivide(sm, mlid_ho, p_sw, p_list, list_array, max_children); p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw); @@ -602,7 +647,7 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp, continue; /* No routes down this port. */ OSM_LOG(sm->p_log, OSM_LOG_DEBUG, - "Routing %zu destinations via switch port %u\n", + "Routing %u destinations via switch port %u\n", count, i); /* @@ -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); p_mtn->child_array[i] = - mcast_mgr_branch(sm, p_mgrp, p_remote_node->sw, + mcast_mgr_branch(sm, mlid_ho, p_remote_node->sw, p_port_list, depth, osm_physp_get_port_num (p_remote_physp), p_max_depth); @@ -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", cl_ntoh64(osm_port_get_guid(p_wobj->p_port)), i); - mcast_work_obj_delete(p_wobj); } } @@ -674,39 +718,38 @@ Exit: return p_mtn; } -/********************************************************************** - **********************************************************************/ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm, - osm_mgrp_t * p_mgrp) + osm_mgrp_box_t * mbox) { - const cl_qmap_t *p_mcm_tbl; - const osm_mcm_port_t *p_mcm_port; - uint32_t num_ports; cl_qlist_t port_list; + uint32_t num_ports; osm_switch_t *p_sw; - osm_mcast_work_obj_t *p_wobj; ib_api_status_t status = IB_SUCCESS; uint8_t max_depth = 0; - uint32_t count; OSM_LOG_ENTER(sm->p_log); - cl_qlist_init(&port_list); - /* TO DO - for now, just blow away the old tree. In the future we'll need to construct the tree based on multicast forwarding table information if the user wants to preserve existing multicast routes. */ - mcast_mgr_purge_tree(sm, p_mgrp); + mcast_mgr_purge_tree(sm, mbox); + + /* build the first "subset" containing all member ports */ + if (make_port_list(&port_list, mbox)) { + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: " + "Insufficient memory to make port list\n"); + status = IB_ERROR; + goto Exit; + } - p_mcm_tbl = &p_mgrp->mcm_port_tbl; - num_ports = cl_qmap_count(p_mcm_tbl); + num_ports = cl_qlist_count(&port_list); if (num_ports == 0) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "MLID 0x%X has no members - nothing to do\n", - cl_ntoh16(osm_mgrp_get_mlid(p_mgrp))); + mbox->mlid); goto Exit; } @@ -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 tree for this multicast group. */ - p_sw = mcast_mgr_find_root_switch(sm, p_mgrp); + p_sw = mcast_mgr_find_root_switch(sm, &port_list); if (p_sw == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A08: " "Unable to locate a suitable switch for group 0x%X\n", - cl_ntoh16(osm_mgrp_get_mlid(p_mgrp))); + mbox->mlid); + drop_port_list(&port_list); status = IB_ERROR; goto Exit; } - /* - Build the first "subset" containing all member ports. - */ - for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl); - p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl); - p_mcm_port = - (osm_mcm_port_t *) cl_qmap_next(&p_mcm_port->map_item)) { - /* - Acquire the port object for this port guid, then create - the new worker object to build the list. - */ - p_wobj = mcast_work_obj_new(p_mcm_port->port); - if (p_wobj == NULL) { - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: " - "Insufficient memory to route port 0x%016" - PRIx64 "\n", - cl_ntoh64(osm_port_get_guid(p_mcm_port->port))); - continue; - } - - cl_qlist_insert_tail(&port_list, &p_wobj->list_item); - } - - count = cl_qlist_count(&port_list); - p_mgrp->p_root = mcast_mgr_branch(sm, p_mgrp, p_sw, &port_list, 0, 0, - &max_depth); + mbox->root = mcast_mgr_branch(sm, mbox->mlid, p_sw, &port_list, 0, 0, + &max_depth); OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Configured MLID 0x%X for %u ports, max tree depth = %u\n", - cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth); - + mbox->mlid, num_ports, max_depth); Exit: OSM_LOG_EXIT(sm->p_log); return status; @@ -773,8 +792,6 @@ Exit: #if 0 /* unused */ -/********************************************************************** - **********************************************************************/ void osm_mcast_mgr_set_table(osm_sm_t * sm, IN const osm_mgrp_t * p_mgrp, IN const osm_mtree_node_t * p_mtn) { @@ -819,8 +836,6 @@ void osm_mcast_mgr_set_table(osm_sm_t * sm, IN const osm_mgrp_t * p_mgrp, } #endif -/********************************************************************** - **********************************************************************/ static void mcast_mgr_clear(osm_sm_t * sm, uint16_t mlid) { osm_switch_t *p_sw; @@ -971,7 +986,7 @@ Exit: static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid) { ib_api_status_t status = IB_SUCCESS; - osm_mgrp_t *mgrp; + osm_mgrp_box_t *mbox; OSM_LOG_ENTER(sm->p_log); @@ -983,9 +998,9 @@ static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid) port in the group. */ mcast_mgr_clear(sm, mlid); - mgrp = osm_get_mgrp_by_mlid(sm->p_subn, cl_hton16(mlid)); - if (mgrp) { - status = mcast_mgr_build_spanning_tree(sm, mgrp); + mbox = osm_get_mbox_by_mlid(sm->p_subn, cl_hton16(mlid)); + if (mbox) { + status = mcast_mgr_build_spanning_tree(sm, mbox); if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A17: " "Unable to create spanning tree (%s) for mlid " @@ -996,8 +1011,6 @@ static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid) return status; } -/********************************************************************** - **********************************************************************/ static int mcast_mgr_set_mftables(osm_sm_t * sm) { cl_qmap_t *p_sw_tbl = &sm->p_subn->sw_guid_tbl; @@ -1051,7 +1064,7 @@ static int alloc_mfts(osm_sm_t * sm) for (i = sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i >= 0; i--) - if (sm->p_subn->mgroups[i]) + if (sm->p_subn->mboxes[i]) break; if (i < 0) return 0; @@ -1060,15 +1073,13 @@ static int alloc_mfts(osm_sm_t * sm) for (item = cl_qmap_head(&sm->p_subn->sw_guid_tbl); item != cl_qmap_end(&sm->p_subn->sw_guid_tbl); item = cl_qmap_next(item)) { - p_sw = (osm_switch_t *)item; + p_sw = (osm_switch_t *) item; if (osm_mcast_tbl_realloc(&p_sw->mcast_tbl, i)) return -1; } return 0; } -/********************************************************************** - **********************************************************************/ int osm_mcast_mgr_process(osm_sm_t * sm) { int i, ret = 0; @@ -1090,12 +1101,13 @@ int osm_mcast_mgr_process(osm_sm_t * sm) if (alloc_mfts(sm)) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A07: alloc_mfts failed\n"); + ret = -1; goto exit; } for (i = 0; i <= sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i++) - if (sm->p_subn->mgroups[i] || sm->mlids_req[i]) + if (sm->p_subn->mboxes[i] || sm->mlids_req[i]) mcast_mgr_process_mlid(sm, i + IB_LID_MCAST_START_HO); memset(sm->mlids_req, 0, sm->mlids_req_max); @@ -1134,6 +1146,7 @@ int osm_mcast_mgr_process_mgroups(osm_sm_t * sm) if (alloc_mfts(sm)) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A09: alloc_mfts failed\n"); + ret = -1; goto exit; } diff --git a/branches/opensm_3/user/opensm/osm_mcast_tbl.c b/branches/opensm_3/user/opensm/osm_mcast_tbl.c index 13df4c47..0121c58b 100644 --- a/branches/opensm_3/user/opensm/osm_mcast_tbl.c +++ b/branches/opensm_3/user/opensm/osm_mcast_tbl.c @@ -51,8 +51,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports, IN uint16_t capacity) { @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl) { free(p_tbl->p_mask_tbl); } -/********************************************************************** - **********************************************************************/ void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho, IN uint8_t port) { @@ -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; } -/********************************************************************** - **********************************************************************/ int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset) { size_t mft_depth, size; - uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX]; + uint16_t (*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1]; if (mlid_offset < p_tbl->mft_depth) goto done; @@ -147,8 +139,6 @@ done: return 0; } -/********************************************************************** - **********************************************************************/ boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho, IN uint8_t port_num) { @@ -174,8 +164,6 @@ boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl, return FALSE; } -/********************************************************************** - **********************************************************************/ boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho) { @@ -198,8 +186,6 @@ boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl, return (result != 0); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl, IN const ib_net16_t * p_block, IN int16_t block_num, @@ -231,11 +217,8 @@ ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl, return IB_SUCCESS; } -/********************************************************************** - **********************************************************************/ void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho) { - uint8_t i; unsigned mlid_offset; CL_ASSERT(p_tbl); @@ -243,12 +226,11 @@ void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho) mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; if (p_tbl->p_mask_tbl && mlid_offset < p_tbl->mft_depth) - for (i = 0; i <= p_tbl->max_position; i++) - (*p_tbl->p_mask_tbl)[mlid_offset][i] = 0; + memset((uint8_t *)p_tbl->p_mask_tbl + mlid_offset * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8, + 0, + (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8); } -/********************************************************************** - **********************************************************************/ boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl, IN int16_t block_num, IN uint8_t position, OUT ib_net16_t * p_block) diff --git a/branches/opensm_3/user/opensm/osm_mcm_port.c b/branches/opensm_3/user/opensm/osm_mcm_port.c index 7b36db91..17a6117d 100644 --- a/branches/opensm_3/user/opensm/osm_mcm_port.c +++ b/branches/opensm_3/user/opensm/osm_mcm_port.c @@ -49,8 +49,6 @@ #include #include -/********************************************************************** - **********************************************************************/ osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp, IN ib_member_rec_t *mcmr, IN boolean_t proxy) { @@ -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; } - return (p_mcm); + return p_mcm; } -/********************************************************************** - **********************************************************************/ void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm) { CL_ASSERT(p_mcm); diff --git a/branches/opensm_3/user/opensm/osm_mtree.c b/branches/opensm_3/user/opensm/osm_mtree.c index f4b9acf1..f36993c9 100644 --- a/branches/opensm_3/user/opensm/osm_mtree.c +++ b/branches/opensm_3/user/opensm/osm_mtree.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -82,8 +82,6 @@ void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn) free(p_mtn); } -/********************************************************************** - **********************************************************************/ #if 0 static void mtree_dump(IN osm_mtree_node_t * p_mtn) { diff --git a/branches/opensm_3/user/opensm/osm_multicast.c b/branches/opensm_3/user/opensm/osm_multicast.c index dfa9b24e..1dab4302 100644 --- a/branches/opensm_3/user/opensm/osm_multicast.c +++ b/branches/opensm_3/user/opensm/osm_multicast.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -51,9 +51,26 @@ #include #include -/********************************************************************** - **********************************************************************/ -void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp) +static osm_mgrp_box_t *mgrp_box_new(uint16_t mlid) +{ + osm_mgrp_box_t *mbox = malloc(sizeof(*mbox)); + if (!mbox) + return NULL; + + memset(mbox, 0, sizeof(*mbox)); + mbox->mlid = mlid; + cl_qlist_init(&mbox->mgrp_list); + + return mbox; +} + +void mgrp_box_delete(osm_mgrp_box_t *mbox) +{ + osm_mtree_destroy(mbox->root); + free(mbox); +} + +void mgrp_delete(IN osm_mgrp_t * p_mgrp) { osm_mcm_port_t *p_mcm_port; osm_mcm_port_t *p_next_mcm_port; @@ -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); osm_mcm_port_delete(p_mcm_port); } - /* destroy the mtree_node structure */ - osm_mtree_destroy(p_mgrp->p_root); free(p_mgrp); } -osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr) +void osm_mgrp_box_delete(osm_mgrp_box_t *mbox) +{ + osm_mgrp_t *mgrp=NULL; + while(cl_qlist_count(&mbox->mgrp_list)) { + mgrp = cl_item_obj(cl_qlist_remove_head(&mbox->mgrp_list), + mgrp, list_item); + mgrp_delete(mgrp); + } + mgrp_box_delete(mbox); +} + +osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid, + IN ib_member_rec_t * mcmr) { osm_mgrp_t *p_mgrp; + osm_mgrp_box_t *mbox; p_mgrp = (osm_mgrp_t *) malloc(sizeof(*p_mgrp)); if (!p_mgrp) @@ -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; p_mgrp->mcmember_rec = *mcmr; + mbox = osm_get_mbox_by_mlid(subn, p_mgrp->mlid); + if (!mbox && !(mbox = mgrp_box_new(cl_ntoh16(p_mgrp->mlid)))) { + free(p_mgrp); + return NULL; + } + + cl_qlist_insert_tail(&mbox->mgrp_list, &p_mgrp->list_item); + subn->mboxes[mbox->mlid - IB_LID_MCAST_START_HO] = mbox; + + cl_fmap_insert(&subn->mgrp_mgid_tbl, &p_mgrp->mcmember_rec.mgid, + &p_mgrp->map_item); + return p_mgrp; } -/********************************************************************** - **********************************************************************/ void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp) { + osm_mgrp_box_t *mbox; osm_mcm_port_t *mcm_port; if (mgrp->full_members) return; - osm_mtree_destroy(mgrp->p_root); - mgrp->p_root = NULL; - while (cl_qmap_count(&mgrp->mcm_port_tbl)) { mcm_port = (osm_mcm_port_t *)cl_qmap_head(&mgrp->mcm_port_tbl); cl_qmap_remove_item(&mgrp->mcm_port_tbl, &mcm_port->map_item); @@ -115,12 +151,16 @@ void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp) return; cl_fmap_remove_item(&subn->mgrp_mgid_tbl, &mgrp->map_item); - subn->mgroups[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL; + + mbox = osm_get_mbox_by_mlid(subn, mgrp->mlid); + cl_qlist_remove_item(&mbox->mgrp_list, &mgrp->list_item); + if (cl_is_qlist_empty(&mbox->mgrp_list)) { + subn->mboxes[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL; + mgrp_box_delete(mbox); + } free(mgrp); } -/********************************************************************** - **********************************************************************/ static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp, unsigned num) { @@ -148,8 +188,6 @@ static void mgrp_send_notice(osm_subn_t * subn, osm_log_t * log, ib_get_err_str(status)); } -/********************************************************************** - **********************************************************************/ osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log, IN osm_mgrp_t * mgrp, osm_port_t *port, IN ib_member_rec_t *mcmr, IN boolean_t proxy) @@ -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) mgrp_send_notice(subn, log, mgrp, 66); + subn->p_osm->sa.dirty = TRUE; return mcm_port; } @@ -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); osm_mgrp_cleanup(subn, mgrp); } + + subn->p_osm->sa.dirty = TRUE; } void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp, @@ -274,8 +315,6 @@ void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp, } } -/********************************************************************** - **********************************************************************/ osm_mcm_port_t *osm_mgrp_get_mcm_port(IN const osm_mgrp_t * p_mgrp, IN ib_net64_t port_guid) { diff --git a/branches/opensm_3/user/opensm/osm_node.c b/branches/opensm_3/user/opensm/osm_node.c index bc32ede9..e6d7ccd3 100644 --- a/branches/opensm_3/user/opensm/osm_node.c +++ b/branches/opensm_3/user/opensm/osm_node.c @@ -49,8 +49,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_node_init_physp(IN osm_node_t * p_node, uint8_t port_num, IN const osm_madw_t * p_madw) { @@ -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); } -/********************************************************************** - **********************************************************************/ osm_node_t *osm_node_new(IN const osm_madw_t * p_madw) { osm_node_t *p_node; @@ -122,11 +118,9 @@ osm_node_t *osm_node_new(IN const osm_madw_t * p_madw) p_madw); p_node->print_desc = strdup(OSM_NODE_DESC_UNKNOWN); - return (p_node); + return p_node; } -/********************************************************************** - **********************************************************************/ static void node_destroy(IN osm_node_t * p_node) { uint16_t i; @@ -138,13 +132,10 @@ static void node_destroy(IN osm_node_t * p_node) osm_physp_destroy(&p_node->physp_table[i]); /* cleanup printable node_desc field */ - if (p_node->print_desc) { + if (p_node->print_desc) free(p_node->print_desc); - } } -/********************************************************************** - **********************************************************************/ void osm_node_delete(IN OUT osm_node_t ** p_node) { CL_ASSERT(p_node && *p_node); @@ -153,8 +144,6 @@ void osm_node_delete(IN OUT osm_node_t ** p_node) *p_node = NULL; } -/********************************************************************** - **********************************************************************/ void osm_node_link(IN osm_node_t * p_node, IN uint8_t port_num, IN osm_node_t * p_remote_node, IN uint8_t remote_port_num) { @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num, IN osm_node_t * p_remote_node, IN uint8_t remote_port_num) { @@ -197,8 +184,6 @@ void osm_node_unlink(IN osm_node_t * p_node, IN uint8_t port_num, } } -/********************************************************************** - **********************************************************************/ boolean_t osm_node_link_exists(IN osm_node_t * p_node, IN uint8_t port_num, IN osm_node_t * p_remote_node, IN uint8_t remote_port_num) @@ -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); p_remote_physp = osm_node_get_physp_ptr(p_remote_node, remote_port_num); - return (osm_physp_link_exists(p_physp, p_remote_physp)); + return osm_physp_link_exists(p_physp, p_remote_physp); } -/********************************************************************** - **********************************************************************/ boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node, IN uint8_t port_num, IN osm_node_t * p_remote_node, @@ -234,18 +217,14 @@ boolean_t osm_node_link_has_valid_ports(IN osm_node_t * p_node, return (p_physp && p_remote_physp); } -/********************************************************************** - **********************************************************************/ boolean_t osm_node_has_any_link(IN osm_node_t * p_node, IN uint8_t port_num) { osm_physp_t *p_physp; CL_ASSERT(port_num < p_node->physp_tbl_size); p_physp = osm_node_get_physp_ptr(p_node, port_num); - return (osm_physp_has_any_link(p_physp)); + return osm_physp_has_any_link(p_physp); } -/********************************************************************** - **********************************************************************/ osm_node_t *osm_node_get_remote_node(IN osm_node_t * p_node, IN uint8_t port_num, OUT uint8_t * p_remote_port_num) @@ -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); if (!p_physp || !osm_physp_has_any_link(p_physp)) - return (NULL); + return NULL; p_remote_physp = osm_physp_get_remote(p_physp); if (p_remote_port_num) *p_remote_port_num = osm_physp_get_port_num(p_remote_physp); - return (osm_physp_get_node_ptr(p_remote_physp)); + return osm_physp_get_node_ptr(p_remote_physp); } /********************************************************************** @@ -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); if (p_physp) { p_remote_physp = osm_physp_get_remote(p_physp); - return (osm_physp_get_base_lid(p_remote_physp)); + return osm_physp_get_base_lid(p_remote_physp); } - return (0); + return 0; } diff --git a/branches/opensm_3/user/opensm/osm_node_desc_rcv.c b/branches/opensm_3/user/opensm/osm_node_desc_rcv.c index f1612904..53161fa1 100644 --- a/branches/opensm_3/user/opensm/osm_node_desc_rcv.c +++ b/branches/opensm_3/user/opensm/osm_node_desc_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -55,8 +55,6 @@ #include #include -/********************************************************************** - **********************************************************************/ static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node, IN const ib_node_desc_t * p_nd) { @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_nd_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_node_info_rcv.c b/branches/opensm_3/user/opensm/osm_node_info_rcv.c index 34cbf6ba..3e18d0f2 100755 --- a/branches/opensm_3/user/opensm/osm_node_info_rcv.c +++ b/branches/opensm_3/user/opensm/osm_node_info_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -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 that is not configured correctly. We will try to recover by querying NodeInfo again. - In order to catch even fast port moving to new location(s) and - back we will count up to 5. - Some crazy reconnections (newly created switch loop right before - targeted CA) will not be catched this way. So in worst case - - report GUID duplication and request new discovery. - When switch node is targeted NodeInfo querying will be done in - opposite order, this is much stronger check, unfortunately it is - impossible with CAs. + In order to catch even fast port moving to new location(s) + and back we will count up to 5. + Some crazy reconnections (newly created switch loop right + before targeted CA) will not be catched this way. So in worst + case - report GUID duplication and request new discovery. + When switch node is targeted NodeInfo querying will be done + in opposite order, this is much stronger check, unfortunately + it is impossible with CAs. */ p_physp = osm_node_get_physp_ptr(p_node, port_num); if (p_ni_context->dup_count > 5) { @@ -250,8 +250,6 @@ _exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** -**********************************************************************/ static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node, IN const osm_madw_t * madw) { @@ -432,7 +430,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm, } /* If we are a master, then this means the port is new on the subnet. - Mark it as new - need to send trap 64 on these ports. + Mark it as new - need to send trap 64 for these ports. The condition that we are master is true, since if we are in discovering state (meaning we woke up from standby or we are just initializing), then these ports may be new to us, but are not new on the subnet. @@ -460,8 +458,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node, IN const osm_madw_t * p_madw) { @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_ni_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_opensm.c b/branches/opensm_3/user/opensm/osm_opensm.c index 70821926..7c988d14 100644 --- a/branches/opensm_3/user/opensm/osm_opensm.c +++ b/branches/opensm_3/user/opensm/osm_opensm.c @@ -81,8 +81,6 @@ const static struct routing_engine_module routing_modules[] = { {NULL, NULL} }; -/********************************************************************** - **********************************************************************/ const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type) { switch (type) { @@ -106,8 +104,6 @@ const char *osm_routing_engine_type_str(IN osm_routing_engine_type_t type) return "unknown"; } -/********************************************************************** - **********************************************************************/ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str) { /* For legacy reasons, consider a NULL pointer and the string @@ -132,8 +128,6 @@ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str) return OSM_ROUTING_ENGINE_TYPE_UNKNOWN; } -/********************************************************************** - **********************************************************************/ static void append_routing_engine(osm_opensm_t *osm, struct osm_routing_engine *routing_engine) { @@ -207,8 +201,6 @@ static void setup_routing_engines(osm_opensm_t *osm, const char *engine_names) setup_routing_engine(osm, "minhop"); } -/********************************************************************** - **********************************************************************/ void osm_opensm_construct(IN osm_opensm_t * p_osm) { memset(p_osm, 0, sizeof(*p_osm)); @@ -222,8 +214,6 @@ void osm_opensm_construct(IN osm_opensm_t * p_osm) osm_log_construct(&p_osm->log); } -/********************************************************************** - **********************************************************************/ static void destroy_routing_engines(osm_opensm_t *osm) { struct osm_routing_engine *r, *next; @@ -238,8 +228,6 @@ static void destroy_routing_engines(osm_opensm_t *osm) } } -/********************************************************************** - **********************************************************************/ static void destroy_plugins(osm_opensm_t *osm) { osm_epi_plugin_t *p; @@ -333,8 +321,6 @@ static void load_plugins(osm_opensm_t *osm, const char *plugin_names) free(p_names); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm, IN const osm_subn_opt_t * p_opt) { @@ -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, p_opt->log_max_size, p_opt->accum_log_file); if (status != IB_SUCCESS) - return (status); + return status; + p_osm->log.log_prefix = p_opt->log_prefix; /* If there is a log level defined - add the OSM_VERSION to it */ osm_log(&p_osm->log, @@ -448,11 +435,9 @@ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm, Exit: OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "]\n"); /* Format Waived */ - return (status); + return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid) { ib_api_status_t status; @@ -480,11 +465,9 @@ ib_api_status_t osm_opensm_bind(IN osm_opensm_t * p_osm, IN ib_net64_t guid) Exit: OSM_LOG_EXIT(&p_osm->log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ void osm_opensm_report_event(osm_opensm_t *osm, osm_epi_event_id_t event_id, void *event_data) { diff --git a/branches/opensm_3/user/opensm/osm_perfmgr.c b/branches/opensm_3/user/opensm/osm_perfmgr.c index 50aa280d..ce271aa5 100644 --- a/branches/opensm_3/user/opensm/osm_perfmgr.c +++ b/branches/opensm_3/user/opensm/osm_perfmgr.c @@ -283,7 +283,7 @@ ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * pm, ib_net64_t port_guid) Exit: OSM_LOG_EXIT(pm->log); - return (status); + return status; } /********************************************************************** @@ -407,7 +407,7 @@ static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr, } OSM_LOG_EXIT(perfmgr->log); - return (status); + return status; } /********************************************************************** @@ -821,8 +821,6 @@ static void perfmgr_sweep(void *arg) cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000); } -/********************************************************************** - **********************************************************************/ void osm_perfmgr_shutdown(osm_perfmgr_t * pm) { OSM_LOG_ENTER(pm->log); @@ -832,8 +830,6 @@ void osm_perfmgr_shutdown(osm_perfmgr_t * pm) OSM_LOG_EXIT(pm->log); } -/********************************************************************** - **********************************************************************/ void osm_perfmgr_destroy(osm_perfmgr_t * pm) { OSM_LOG_ENTER(pm->log); diff --git a/branches/opensm_3/user/opensm/osm_perfmgr_db.c b/branches/opensm_3/user/opensm/osm_perfmgr_db.c index 256cce2f..ee0a92a1 100644 --- a/branches/opensm_3/user/opensm/osm_perfmgr_db.c +++ b/branches/opensm_3/user/opensm/osm_perfmgr_db.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Voltaire, Inc. All rights reserved. + * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2007 The Regents of the University of California. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -57,13 +57,13 @@ perfmgr_db_t *perfmgr_db_construct(osm_perfmgr_t *perfmgr) { perfmgr_db_t *db = malloc(sizeof(*db)); if (!db) - return (NULL); + return NULL; cl_qmap_init(&db->pc_data); cl_plock_construct(&db->lock); cl_plock_init(&db->lock); db->perfmgr = perfmgr; - return ((void *)db); + return db; } /** ========================================================================= @@ -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); if (rc == end) - return (NULL); - return ((db_node_t *) rc); + return NULL; + return (db_node_t *) rc; } static inline perfmgr_db_err_t bad_node_port(db_node_t * node, uint8_t port) { if (!node) - return (PERFMGR_EVENT_DB_GUIDNOTFOUND); + return PERFMGR_EVENT_DB_GUIDNOTFOUND; if (port >= node->num_ports || (!node->esp0 && port == 0)) - return (PERFMGR_EVENT_DB_PORTNOTFOUND); - return (PERFMGR_EVENT_DB_SUCCESS); + return PERFMGR_EVENT_DB_PORTNOTFOUND; + return PERFMGR_EVENT_DB_SUCCESS; } /** ========================================================================= @@ -115,7 +115,7 @@ static db_node_t *malloc_node(uint64_t guid, boolean_t esp0, time_t cur_time = 0; db_node_t *rc = malloc(sizeof(*rc)); if (!rc) - return (NULL); + return NULL; rc->ports = calloc(num_ports, sizeof(db_port_t)); if (!rc->ports) @@ -132,11 +132,11 @@ static db_node_t *malloc_node(uint64_t guid, boolean_t esp0, } snprintf(rc->node_name, sizeof(rc->node_name), "%s", name); - return (rc); + return rc; free_rc: free(rc); - return (NULL); + return NULL; } /** ========================================================================= @@ -157,12 +157,10 @@ static perfmgr_db_err_t insert(perfmgr_db_t * db, db_node_t * node) (cl_map_item_t *) node); if ((void *)rc != (void *)node) - return (PERFMGR_EVENT_DB_FAIL); - return (PERFMGR_EVENT_DB_SUCCESS); + return PERFMGR_EVENT_DB_FAIL; + return PERFMGR_EVENT_DB_SUCCESS; } -/********************************************************************** - **********************************************************************/ perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0, uint8_t num_ports, char *name) @@ -185,7 +183,7 @@ perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid, boolean_t esp0, } Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } /********************************************************************** @@ -326,7 +324,7 @@ perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port, Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid, @@ -346,7 +344,7 @@ perfmgr_db_err_t perfmgr_db_get_prev_err(perfmgr_db_t * db, uint64_t guid, Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } perfmgr_db_err_t @@ -368,7 +366,7 @@ perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid, uint8_t port) Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } static inline void @@ -451,7 +449,7 @@ perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port, Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid, @@ -471,7 +469,7 @@ perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid, Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } perfmgr_db_err_t @@ -493,7 +491,7 @@ perfmgr_db_clear_prev_dc(perfmgr_db_t * db, uint64_t guid, uint8_t port) Exit: cl_plock_release(&db->lock); - return (rc); + return rc; } static void clear_counters(cl_map_item_t * const p_map_item, void *context) @@ -678,8 +676,6 @@ typedef struct { perfmgr_db_dump_t dump_type; } dump_context_t; -/********************************************************************** - **********************************************************************/ static void db_dump(cl_map_item_t * const p_map_item, void *context) { db_node_t *node = (db_node_t *) p_map_item; @@ -753,14 +749,14 @@ perfmgr_db_dump(perfmgr_db_t * db, char *file, perfmgr_db_dump_t dump_type) context.fp = fopen(file, "w+"); if (!context.fp) - return (PERFMGR_EVENT_DB_FAIL); + return PERFMGR_EVENT_DB_FAIL; context.dump_type = dump_type; cl_plock_acquire(&db->lock); cl_qmap_apply_func(&db->pc_data, db_dump, (void *)&context); cl_plock_release(&db->lock); fclose(context.fp); - return (PERFMGR_EVENT_DB_SUCCESS); + return PERFMGR_EVENT_DB_SUCCESS; } /********************************************************************** diff --git a/branches/opensm_3/user/opensm/osm_pkey.c b/branches/opensm_3/user/opensm/osm_pkey.c index 21df9279..de4fbb5a 100644 --- a/branches/opensm_3/user/opensm/osm_pkey.c +++ b/branches/opensm_3/user/opensm/osm_pkey.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -54,8 +54,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl) { cl_ptr_vector_construct(&p_pkey_tbl->blocks); @@ -63,8 +61,6 @@ void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl) cl_map_construct(&p_pkey_tbl->keys); } -/********************************************************************** - **********************************************************************/ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl) { ib_pkey_table_t *p_block; @@ -87,8 +83,6 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl) cl_map_destroy(&p_pkey_tbl->keys); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl) { cl_ptr_vector_init(&p_pkey_tbl->blocks, 0, 1); @@ -100,8 +94,6 @@ ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl) return IB_SUCCESS; } -/********************************************************************** - **********************************************************************/ void osm_pkey_tbl_init_new_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl) { ib_pkey_table_t *p_block; @@ -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)); } -/********************************************************************** - **********************************************************************/ void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl) { cl_list_item_t *p_item; @@ -124,8 +114,6 @@ void osm_pkey_tbl_cleanup_pending(IN osm_pkey_tbl_t * p_pkey_tbl) } } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl, IN uint16_t block, IN ib_pkey_table_t * p_tbl) { @@ -194,8 +182,6 @@ ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl, return IB_SUCCESS; } -/********************************************************************** - **********************************************************************/ /* Store the given pkey in the "new" blocks array. Also, make sure the regular block exists. @@ -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; } -/********************************************************************** - **********************************************************************/ boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl, OUT uint16_t * p_block_idx, OUT uint8_t * p_pkey_idx) @@ -253,8 +237,6 @@ boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl, return FALSE; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl, IN uint16_t * p_pkey, OUT uint16_t * p_block_idx, @@ -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; } -/********************************************************************** - **********************************************************************/ static boolean_t match_pkey(IN const ib_net16_t * pkey1, IN const ib_net16_t * pkey2) { /* if both pkeys are not full member - this is not a match */ if (!(ib_pkey_is_full_member(*pkey1) || ib_pkey_is_full_member(*pkey2))) - return (FALSE); + return FALSE; /* compare if the bases are the same. if they are - then this is a match */ @@ -299,8 +279,6 @@ static boolean_t match_pkey(IN const ib_net16_t * pkey1, return TRUE; } -/********************************************************************** - **********************************************************************/ boolean_t osm_physp_share_this_pkey(IN const osm_physp_t * p_physp1, IN const osm_physp_t * p_physp2, IN ib_net16_t pkey) @@ -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)); } -/********************************************************************** - **********************************************************************/ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1, IN const osm_physp_t * p_physp2) { @@ -354,8 +330,6 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1, return 0; } -/********************************************************************** - **********************************************************************/ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log, IN const osm_physp_t * p_physp_1, IN const osm_physp_t * p_physp_2) @@ -383,8 +357,6 @@ boolean_t osm_physp_share_pkey(IN osm_log_t * p_log, (p_physp_1, p_physp_2)); } -/********************************************************************** - **********************************************************************/ boolean_t osm_port_share_pkey(IN osm_log_t * p_log, IN const osm_port_t * p_port_1, IN const osm_port_t * p_port_2) @@ -415,8 +387,6 @@ Exit: return ret; } -/********************************************************************** - **********************************************************************/ boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey, IN const osm_physp_t * p_physp) { diff --git a/branches/opensm_3/user/opensm/osm_pkey_mgr.c b/branches/opensm_3/user/opensm/osm_pkey_mgr.c index 85162a60..379079c6 100644 --- a/branches/opensm_3/user/opensm/osm_pkey_mgr.c +++ b/branches/opensm_3/user/opensm/osm_pkey_mgr.c @@ -1,7 +1,8 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -52,8 +53,6 @@ #include #include -/********************************************************************** - **********************************************************************/ /* The max number of pkey blocks for a physical port is located in a different place for switch external ports (SwitchInfo) and the @@ -73,8 +72,6 @@ pkey_mgr_get_physp_max_blocks(IN const osm_subn_t * p_subn, return ((num_pkeys + 31) / 32); } -/********************************************************************** - **********************************************************************/ /* * Insert new pending pkey entry to the specific port pkey table * pending pkeys. New entries are inserted at the back. @@ -117,8 +114,8 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log, &p_pending->index) != IB_SUCCESS) { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0503: " - "Failed to obtain P_Key 0x%04x block and index for node " - "0x%016" PRIx64 " port %u\n", + "Failed to obtain P_Key 0x%04x block and index " + "for node 0x%016" PRIx64 " port %u\n", cl_ntoh16(ib_pkey_get_base(pkey)), cl_ntoh64(osm_node_get_node_guid(p_node)), osm_physp_get_port_num(p_physp)); @@ -136,8 +133,6 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log, osm_physp_get_port_num(p_physp)); } -/********************************************************************** - **********************************************************************/ static void pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm, const osm_prtn_t * p_prtn, @@ -163,8 +158,6 @@ pkey_mgr_process_partition_table(osm_log_t * p_log, osm_sm_t * sm, } } -/********************************************************************** - **********************************************************************/ static ib_api_status_t pkey_mgr_update_pkey_entry(IN osm_sm_t * sm, IN const osm_physp_t * p_physp, @@ -187,8 +180,6 @@ pkey_mgr_update_pkey_entry(IN osm_sm_t * sm, cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm, IN osm_physp_t * p_physp, IN const boolean_t enforce) @@ -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)) { OSM_LOG(p_log, OSM_LOG_DEBUG, "No need to update PortInfo for " - "node 0x%016" PRIx64 " port %u\n", + "node 0x%016" PRIx64 " port %u (%s)\n", cl_ntoh64(osm_node_get_node_guid (osm_physp_get_node_ptr(p_physp))), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); return IB_SUCCESS; } - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); p_pi = (ib_port_info_t *) payload; if (enforce == TRUE) @@ -236,21 +229,21 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm, if (status != IB_SUCCESS) OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: " "Failed to set PortInfo for " - "node 0x%016" PRIx64 " port %u\n", + "node 0x%016" PRIx64 " port %u (%s)\n", cl_ntoh64(osm_node_get_node_guid (osm_physp_get_node_ptr(p_physp))), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); else OSM_LOG(p_log, OSM_LOG_DEBUG, - "Set PortInfo for node 0x%016" PRIx64 " port %u\n", + "Set PortInfo for node 0x%016" PRIx64 " port %u (%s)\n", cl_ntoh64(osm_node_get_node_guid (osm_physp_get_node_ptr(p_physp))), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); return status; } -/********************************************************************** - **********************************************************************/ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm, const osm_port_t * const p_port) { @@ -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) { OSM_LOG(p_log, OSM_LOG_INFO, "Max number of blocks reduced from %u to %u " - "for node 0x%016" PRIx64 " port %u\n", + "for node 0x%016" PRIx64 " port %u (%s)\n", p_pkey_tbl->max_blocks, max_num_of_blocks, cl_ntoh64(osm_node_get_node_guid(p_node)), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); } p_pkey_tbl->max_blocks = max_num_of_blocks; @@ -313,11 +307,12 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm, if (!found) { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0504: " "Failed to find empty space for new pkey 0x%04x " - "for node 0x%016" PRIx64 " port %u\n", + "for node 0x%016" PRIx64 " port %u (%s)\n", cl_ntoh16(p_pending->pkey), cl_ntoh64(osm_node_get_node_guid (p_node)), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); } else { block_index = last_free_block_index; pkey_index = last_free_pkey_index++; @@ -331,12 +326,13 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm, p_pending->pkey)) { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0505: " "Failed to set PKey 0x%04x in block %u idx %u " - "for node 0x%016" PRIx64 " port %u\n", + "for node 0x%016" PRIx64 " port %u (%s)\n", cl_ntoh16(p_pending->pkey), block_index, pkey_index, cl_ntoh64(osm_node_get_node_guid (p_node)), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); } } @@ -361,16 +357,18 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm, if (status == IB_SUCCESS) OSM_LOG(p_log, OSM_LOG_DEBUG, "Updated pkey table block %d for node 0x%016" - PRIx64 " port %u\n", block_index, + PRIx64 " port %u (%s)\n", block_index, cl_ntoh64(osm_node_get_node_guid(p_node)), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); else { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: " "pkey_mgr_update_pkey_entry() failed to update " "pkey table block %d for node 0x%016" PRIx64 - " port %u\n", block_index, + " port %u (%s)\n", block_index, cl_ntoh64(osm_node_get_node_guid(p_node)), - osm_physp_get_port_num(p_physp)); + osm_physp_get_port_num(p_physp), + p_physp->p_node->print_desc); ret = -1; } } @@ -378,8 +376,6 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm, return ret; } -/********************************************************************** - **********************************************************************/ static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm, const osm_subn_t * p_subn, const osm_port_t * const p_port, @@ -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) { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0508: " "Not enough pkey entries (%u < %u) on switch 0x%016" - PRIx64 " port %u. Clearing Enforcement bit\n", + PRIx64 " port %u (%s). Clearing Enforcement bit\n", peer_max_blocks, num_of_blocks, cl_ntoh64(osm_node_get_node_guid(p_node)), - osm_physp_get_port_num(peer)); + osm_physp_get_port_num(peer), + p_node->print_desc); enforce = FALSE; ret = -1; } @@ -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: " "pkey_mgr_update_pkey_entry() failed to update " "pkey table block %d for node 0x%016" - PRIx64 " port %u\n", block_index, + PRIx64 " port %u (%s)\n", block_index, cl_ntoh64(osm_node_get_node_guid (p_node)), - osm_physp_get_port_num(peer)); + osm_physp_get_port_num(peer), + p_node->print_desc); ret = -1; } } @@ -459,15 +457,13 @@ static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm, if (!ret) OSM_LOG(p_log, OSM_LOG_DEBUG, "Pkey table was updated for node 0x%016" PRIx64 - " port %u\n", + " port %u (%s)\n", cl_ntoh64(osm_node_get_node_guid(p_node)), - osm_physp_get_port_num(peer)); + osm_physp_get_port_num(peer), p_node->print_desc); return ret; } -/********************************************************************** - **********************************************************************/ int osm_pkey_mgr_process(IN osm_opensm_t * p_osm) { cl_qmap_t *p_tbl; diff --git a/branches/opensm_3/user/opensm/osm_pkey_rcv.c b/branches/opensm_3/user/opensm/osm_pkey_rcv.c index 43991d95..709ef0b4 100644 --- a/branches/opensm_3/user/opensm/osm_pkey_rcv.c +++ b/branches/opensm_3/user/opensm/osm_pkey_rcv.c @@ -48,8 +48,6 @@ #include #include -/********************************************************************** - **********************************************************************/ /* * WE ONLY RECEIVE GET or SET responses */ @@ -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: " "No port object for port with GUID 0x%" PRIx64 "\n\t\t\t\tfor parent node GUID 0x%" PRIx64 - ", TID 0x%" PRIx64 "\n", - cl_ntoh64(port_guid), + ", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid), cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id)); goto Exit; } diff --git a/branches/opensm_3/user/opensm/osm_port.c b/branches/opensm_3/user/opensm/osm_port.c index f447ac03..11cd01dd 100644 --- a/branches/opensm_3/user/opensm/osm_port.c +++ b/branches/opensm_3/user/opensm/osm_port.c @@ -53,8 +53,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_physp_construct(IN osm_physp_t * p_physp) { memset(p_physp, 0, sizeof(*p_physp)); @@ -63,8 +61,6 @@ void osm_physp_construct(IN osm_physp_t * p_physp) osm_pkey_tbl_construct(&p_physp->pkeys); } -/********************************************************************** - **********************************************************************/ void osm_physp_destroy(IN osm_physp_t * p_physp) { size_t num_slvl, i; @@ -85,8 +81,6 @@ void osm_physp_destroy(IN osm_physp_t * p_physp) } } -/********************************************************************** - **********************************************************************/ void osm_physp_init(IN osm_physp_t * p_physp, IN ib_net64_t port_guid, IN uint8_t port_num, IN const struct osm_node *p_node, IN osm_bind_handle_t h_bind, IN uint8_t hop_count, @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_port_delete(IN OUT osm_port_t ** pp_port) { free(*pp_port); *pp_port = NULL; } -/********************************************************************** - **********************************************************************/ osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni, IN osm_node_t * p_parent_node) { @@ -170,8 +160,6 @@ osm_port_t *osm_port_new(IN const ib_node_info_t * p_ni, return p_port; } -/********************************************************************** - **********************************************************************/ void osm_port_get_lid_range_ho(IN const osm_port_t * p_port, IN uint16_t * p_min_lid, IN uint16_t * p_max_lid) { @@ -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); } -/********************************************************************** - **********************************************************************/ uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log, IN const osm_physp_t * p_physp) { @@ -236,8 +222,6 @@ uint8_t osm_physp_calc_link_mtu(IN osm_log_t * p_log, return mtu; } -/********************************************************************** - **********************************************************************/ uint8_t osm_physp_calc_link_op_vls(IN osm_log_t * p_log, IN const osm_subn_t * p_subn, IN const osm_physp_t * p_physp) @@ -386,8 +370,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ static void physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp, IN cl_map_t * p_visited_map, IN osm_bind_handle_t * h_bind) @@ -435,8 +417,6 @@ static void physp_update_new_dr_path(IN osm_physp_t const *p_dest_physp, cl_list_destroy(&tmpPortsList); } -/********************************************************************** - **********************************************************************/ void osm_physp_replace_dr_path_with_alternate_dr_path(IN osm_log_t * p_log, IN osm_subn_t const *p_subn, IN osm_physp_t const @@ -595,8 +575,6 @@ Exit: cl_map_destroy(&visited_map); } -/********************************************************************** - **********************************************************************/ boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp) { osm_physp_t *p_remote_physp; @@ -609,8 +587,6 @@ boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp) return TRUE; } -/********************************************************************** - **********************************************************************/ void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn, IN osm_physp_t * p_physp, IN ib_pkey_table_t * p_pkey_tbl, diff --git a/branches/opensm_3/user/opensm/osm_port_info_rcv.c b/branches/opensm_3/user/opensm/osm_port_info_rcv.c index ae61978f..ad3e81f6 100644 --- a/branches/opensm_3/user/opensm/osm_port_info_rcv.c +++ b/branches/opensm_3/user/opensm/osm_port_info_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -46,6 +46,7 @@ #endif /* HAVE_CONFIG_H */ #include +#include #include #include #include @@ -63,22 +64,18 @@ #include #include -/********************************************************************** - **********************************************************************/ static void pi_rcv_check_and_fix_lid(osm_log_t * log, ib_port_info_t * pi, osm_physp_t * p) { if (cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO) { OSM_LOG(log, OSM_LOG_ERROR, "ERR 0F04: " "Got invalid base LID %u from the network. " - "Corrected to %u.\n", cl_ntoh16(pi->base_lid), + "Corrected to %u\n", cl_ntoh16(pi->base_lid), cl_ntoh16(p->port_info.base_lid)); pi->base_lid = p->port_info.base_lid; } } -/********************************************************************** - **********************************************************************/ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp, IN const ib_port_info_t * p_pi) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm, IN osm_node_t * p_node, IN osm_physp_t * p_physp, @@ -336,8 +331,6 @@ static void pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm, } #define IBM_VENDOR_ID (0x5076) -/********************************************************************** - **********************************************************************/ static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm, IN osm_node_t * p_node, IN osm_physp_t * p_physp) { @@ -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; if (!p_node->sw || port_num == 0) - /* The maximum blocks is defined by the node info partition cap for CA, - router, and switch management ports. */ + /* The maximum blocks is defined by the node info partition cap + for CA, router, and switch management ports. */ max_blocks = (cl_ntoh16(p_node->node_info.partition_cap) + IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1) @@ -405,8 +398,6 @@ Exit: OSM_LOG_EXIT(p_log); } -/********************************************************************** - **********************************************************************/ static void pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm, IN osm_node_t * p_node, IN osm_physp_t * p_physp) @@ -418,8 +409,6 @@ static void pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm, OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * p_node, IN uint8_t port_num, IN osm_madw_t * p_madw) { @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_pi_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_prtn.c b/branches/opensm_3/user/opensm/osm_prtn.c index cf916235..f2493ba5 100644 --- a/branches/opensm_3/user/opensm/osm_prtn.c +++ b/branches/opensm_3/user/opensm/osm_prtn.c @@ -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); if (!type || osm_node_get_type(p_port->p_node) == type) { status = osm_prtn_add_port(p_log, p_subn, p, - osm_port_get_guid(p_port), full); + osm_port_get_guid(p_port), + full); if (status != IB_SUCCESS) goto _err; } @@ -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)); if (p_mgrp) { p_mgrp->well_known = TRUE; - p->mlid = p_mgrp->mlid; + p->mgrp = p_mgrp; } /* workaround for TS */ @@ -240,8 +241,8 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn, &p_mgrp); if (p_mgrp) { p_mgrp->well_known = TRUE; - if (!p->mlid) - p->mlid = p_mgrp->mlid; + if (!p->mgrp) + p->mgrp = p_mgrp; } return status; diff --git a/branches/opensm_3/user/opensm/osm_qos.c b/branches/opensm_3/user/opensm/osm_qos.c index 70be991a..45991b42 100644 --- a/branches/opensm_3/user/opensm/osm_qos.c +++ b/branches/opensm_3/user/opensm/osm_qos.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -77,6 +78,7 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm, osm_madw_context_t context; uint32_t attr_mod; unsigned vl_mask, i; + ib_api_status_t status; vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1; @@ -96,10 +98,17 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm, context.vla_context.set_method = TRUE; attr_mod = ((block_num + 1) << 16) | port_num; - return osm_req_set(sm, osm_physp_get_dr_path_ptr(p), - (uint8_t *) & block, sizeof(block), - IB_MAD_ATTR_VL_ARBITRATION, cl_hton32(attr_mod), - CL_DISP_MSGID_NONE, &context); + status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p), + (uint8_t *) & block, sizeof(block), + IB_MAD_ATTR_VL_ARBITRATION, cl_hton32(attr_mod), + CL_DISP_MSGID_NONE, &context); + if (status != IB_SUCCESS) + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 6202 : " + "failed to update VLArbitration tables " + "for port %" PRIx64 " block %u\n", + cl_ntoh64(p->port_guid), block_num); + + return status; } static ib_api_status_t vlarb_update(osm_sm_t * sm, osm_physp_t * p, @@ -149,14 +158,14 @@ static ib_api_status_t vlarb_update(osm_sm_t * sm, osm_physp_t * p, } static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p, - uint8_t in_port, uint8_t out_port, + uint8_t in_port, uint32_t attr_mod, unsigned force_update, const ib_slvl_table_t * sl2vl_table) { osm_madw_context_t context; ib_slvl_table_t tbl, *p_tbl; osm_node_t *p_node = osm_physp_get_node_ptr(p); - uint32_t attr_mod; + ib_api_status_t status; unsigned vl_mask; uint8_t vl1, vl2; int i; @@ -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); context.slvl_context.port_guid = osm_physp_get_port_guid(p); context.slvl_context.set_method = TRUE; - attr_mod = in_port << 8 | out_port; - return osm_req_set(sm, osm_physp_get_dr_path_ptr(p), - (uint8_t *) & tbl, sizeof(tbl), - IB_MAD_ATTR_SLVL_TABLE, cl_hton32(attr_mod), - CL_DISP_MSGID_NONE, &context); + status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p), + (uint8_t *) & tbl, sizeof(tbl), + IB_MAD_ATTR_SLVL_TABLE, cl_hton32(attr_mod), + CL_DISP_MSGID_NONE, &context); + if (status != IB_SUCCESS) + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 6203 : " + "failed to update SL2VLMapping tables " + "for port %" PRIx64 ", attr_mod 0x%x\n", + cl_ntoh64(p->port_guid), attr_mod); + return status; } -static ib_api_status_t sl2vl_update(osm_sm_t * sm, osm_port_t * p_port, - osm_physp_t * p, uint8_t port_num, - unsigned force_update, - const struct qos_config *qcfg) +static int qos_extports_setup(osm_sm_t * sm, osm_node_t *node, + const struct qos_config *qcfg) { - ib_api_status_t status; - uint8_t i, num_ports; - osm_physp_t *p_physp; - - if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH) { - if (ib_port_info_get_vl_cap(&p->port_info) == 1) { - /* Check port 0's capability mask */ - p_physp = p_port->p_physp; - if (! - (p_physp->port_info. - capability_mask & IB_PORT_CAP_HAS_SL_MAP)) - return IB_SUCCESS; - } - num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p)); - } else { - if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP)) - return IB_SUCCESS; - num_ports = 1; + osm_physp_t *p0, *p; + unsigned force_update; + unsigned num_ports = osm_node_get_num_physp(node); + int ret = 0; + unsigned i, j; + + for (i = 1; i < num_ports; i++) { + p = osm_node_get_physp_ptr(node, i); + force_update = p->need_update || sm->p_subn->need_update; + p->vl_high_limit = qcfg->vl_high_limit; + if (vlarb_update(sm, p, p->port_num, force_update, qcfg)) + ret = -1; } - for (i = 0; i < num_ports; i++) { - status = sl2vl_update_table(sm, p, i, port_num, force_update, - &qcfg->sl2vl); - if (status != IB_SUCCESS) - return status; + p0 = osm_node_get_physp_ptr(node, 0); + if (!(p0->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP)) + return ret; + + if (ib_switch_info_get_opt_sl2vlmapping(&node->sw->switch_info) && + sm->p_subn->opt.use_optimized_slvl) { + p = osm_node_get_physp_ptr(node, 1); + force_update = p->need_update || sm->p_subn->need_update; + return sl2vl_update_table(sm, p, 1, 0x30000, force_update, + &qcfg->sl2vl); } - return IB_SUCCESS; + for (i = 1; i < num_ports; i++) { + p = osm_node_get_physp_ptr(node, i); + force_update = p->need_update || sm->p_subn->need_update; + for (j = 0; j < num_ports; j++) + if (sl2vl_update_table(sm, p, i, i << 8 | j, + force_update, &qcfg->sl2vl)) + ret = -1; + } + + return ret; } -static int qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm, - osm_port_t * p_port, osm_physp_t * p, - uint8_t port_num, unsigned force_update, - const struct qos_config *qcfg) +static int qos_endport_setup(osm_sm_t * sm, osm_physp_t * p, + const struct qos_config *qcfg) { - ib_api_status_t status; + unsigned force_update = p->need_update || sm->p_subn->need_update; - /* OpVLs should be ok at this moment - just use it */ - - /* setup VL high limit on the physp later to be updated by link mgr */ p->vl_high_limit = qcfg->vl_high_limit; - - /* setup VLArbitration */ - status = vlarb_update(sm, p, port_num, force_update, qcfg); - if (status != IB_SUCCESS) { - OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6202 : " - "failed to update VLArbitration tables " - "for port %" PRIx64 " #%d\n", - cl_ntoh64(p->port_guid), port_num); + if (vlarb_update(sm, p, 0, force_update, qcfg)) return -1; - } - /* setup SL2VL tables */ - status = sl2vl_update(sm, p_port, p, port_num, force_update, qcfg); - if (status != IB_SUCCESS) { - OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6203 : " - "failed to update SL2VLMapping tables " - "for port %" PRIx64 " #%d\n", - cl_ntoh64(p->port_guid), port_num); + if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP)) + return 0; + + if (sl2vl_update_table(sm, p, 0, 0, force_update, &qcfg->sl2vl)) return -1; - } return 0; } @@ -264,12 +267,8 @@ int osm_qos_setup(osm_opensm_t * p_osm) cl_qmap_t *p_tbl; cl_map_item_t *p_next; osm_port_t *p_port; - uint32_t num_physp; - osm_physp_t *p_physp; osm_node_t *p_node; - unsigned force_update; int ret = 0; - uint8_t i; if (!p_osm->subn.opt.qos) return 0; @@ -298,18 +297,9 @@ int osm_qos_setup(osm_opensm_t * p_osm) p_node = p_port->p_node; if (p_node->sw) { - num_physp = osm_node_get_num_physp(p_node); - for (i = 1; i < num_physp; i++) { - p_physp = osm_node_get_physp_ptr(p_node, i); - if (!p_physp) - continue; - force_update = p_physp->need_update || - p_osm->subn.need_update; - if (qos_physp_setup(&p_osm->log, &p_osm->sm, - p_port, p_physp, i, - force_update, &swe_config)) - ret = -1; - } + if (qos_extports_setup(&p_osm->sm, p_node, &swe_config)) + ret = -1; + /* skip base port 0 */ if (!ib_switch_info_is_enhanced_port0 (&p_node->sw->switch_info)) @@ -321,13 +311,7 @@ int osm_qos_setup(osm_opensm_t * p_osm) else cfg = &ca_config; - p_physp = p_port->p_physp; - if (!p_physp) - continue; - - force_update = p_physp->need_update || p_osm->subn.need_update; - if (qos_physp_setup(&p_osm->log, &p_osm->sm, p_port, p_physp, - 0, force_update, cfg)) + if (qos_endport_setup(&p_osm->sm, p_port->p_physp, cfg)) ret = -1; } diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_l.c b/branches/opensm_3/user/opensm/osm_qos_parser_l.c index 88ae32f2..e7526615 100644 --- a/branches/opensm_3/user/opensm/osm_qos_parser_l.c +++ b/branches/opensm_3/user/opensm/osm_qos_parser_l.c @@ -815,7 +815,7 @@ char *yytext; #line 2 "osm_qos_parser_l.l" /* * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_l.l b/branches/opensm_3/user/opensm/osm_qos_parser_l.l index a2c475d0..a31c79ee 100644 --- a/branches/opensm_3/user/opensm/osm_qos_parser_l.l +++ b/branches/opensm_3/user/opensm/osm_qos_parser_l.l @@ -1,7 +1,7 @@ %{ /* * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_y.c b/branches/opensm_3/user/opensm/osm_qos_parser_y.c index 08488271..68c32556 100644 --- a/branches/opensm_3/user/opensm/osm_qos_parser_y.c +++ b/branches/opensm_3/user/opensm/osm_qos_parser_y.c @@ -72,7 +72,7 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 HNR Consulting. All rights reserved. * @@ -132,6 +132,7 @@ #ifdef __WIN__ #define malloc #define free +#define fopen Fopen #endif #define OSM_QOS_POLICY_MAX_LINE_LEN 1024*10 diff --git a/branches/opensm_3/user/opensm/osm_qos_parser_y.y b/branches/opensm_3/user/opensm/osm_qos_parser_y.y index 1934bc5b..f5c9ba0d 100644 --- a/branches/opensm_3/user/opensm/osm_qos_parser_y.y +++ b/branches/opensm_3/user/opensm/osm_qos_parser_y.y @@ -1,7 +1,7 @@ %{ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 HNR Consulting. All rights reserved. * @@ -58,6 +58,7 @@ #include #include #ifdef __WIN__ +/* prevent redefinition in windows header files */ #define malloc #define free #endif diff --git a/branches/opensm_3/user/opensm/osm_qos_policy.c b/branches/opensm_3/user/opensm/osm_qos_policy.c index 3bf6cda7..8156c9df 100644 --- a/branches/opensm_3/user/opensm/osm_qos_policy.c +++ b/branches/opensm_3/user/opensm/osm_qos_policy.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. @@ -772,7 +772,6 @@ static void __qos_policy_validate_pkey( uint8_t sl; uint32_t flow; uint8_t hop; - osm_mgrp_t * p_mgrp; if (!p_qos_policy || !p_qos_match_rule || !p_prtn) return; @@ -792,31 +791,21 @@ static void __qos_policy_validate_pkey( /* If this partition is an IPoIB partition, there should be a matching MCast group. Fix this group's SL too */ - - if (!p_prtn->mlid) - return; - - p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy->p_subn, p_prtn->mlid); - if (!p_mgrp) { - OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR, - "ERR AC16: MCast group for partition with " - "pkey 0x%04X not found\n", - cl_ntoh16(p_prtn->pkey)); + if (!p_prtn->mgrp) return; - } - CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) == + CL_ASSERT((cl_ntoh16(p_prtn->mgrp->mcmember_rec.pkey) & 0x7fff) == (cl_ntoh16(p_prtn->pkey) & 0x7fff)); - ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop, + ib_member_get_sl_flow_hop(p_prtn->mgrp->mcmember_rec.sl_flow_hop, &sl, &flow, &hop); if (sl != p_prtn->sl) { OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG, "Updating MCGroup (MLID 0x%04x) SL to " "match partition SL (%u)\n", - cl_hton16(p_mgrp->mcmember_rec.mlid), + cl_hton16(p_prtn->mgrp->mcmember_rec.mlid), p_prtn->sl); - p_mgrp->mcmember_rec.sl_flow_hop = + p_prtn->mgrp->mcmember_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop); } } diff --git a/branches/opensm_3/user/opensm/osm_remote_sm.c b/branches/opensm_3/user/opensm/osm_remote_sm.c index c9ea8dae..6b8bd1c9 100644 --- a/branches/opensm_3/user/opensm/osm_remote_sm.c +++ b/branches/opensm_3/user/opensm/osm_remote_sm.c @@ -47,22 +47,16 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm) { memset(p_sm, 0, sizeof(*p_sm)); } -/********************************************************************** - **********************************************************************/ void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm) { memset(p_sm, 0, sizeof(*p_sm)); } -/********************************************************************** - **********************************************************************/ void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, IN const osm_port_t * p_port, IN const ib_sm_info_t * p_smi) { diff --git a/branches/opensm_3/user/opensm/osm_req.c b/branches/opensm_3/user/opensm/osm_req.c index bf3dd8a9..fe7d134c 100644 --- a/branches/opensm_3/user/opensm/osm_req.c +++ b/branches/opensm_3/user/opensm/osm_req.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -84,7 +84,6 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path, p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind, MAD_BLOCK_SIZE, NULL); - if (p_madw == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 1101: Unable to acquire MAD\n"); @@ -155,7 +154,6 @@ ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path, p_madw = osm_mad_pool_get(sm->p_mad_pool, p_path->h_bind, MAD_BLOCK_SIZE, NULL); - if (p_madw == NULL) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 1102: Unable to acquire MAD\n"); @@ -203,8 +201,7 @@ int osm_send_trap144(osm_sm_t * sm, ib_net16_t local) osm_madw_t *madw; ib_smp_t *smp; ib_mad_notice_attr_t *ntc; - osm_port_t *port; - osm_port_t *smport; + osm_port_t *port, *smport; ib_port_info_t *pi; port = osm_get_port_by_guid(sm->p_subn, sm->p_subn->sm_port_guid); diff --git a/branches/opensm_3/user/opensm/osm_resp.c b/branches/opensm_3/user/opensm/osm_resp.c index bbce937f..22d5a808 100644 --- a/branches/opensm_3/user/opensm/osm_resp.c +++ b/branches/opensm_3/user/opensm/osm_resp.c @@ -56,8 +56,6 @@ #include #include -/********************************************************************** - **********************************************************************/ static void resp_make_resp_smp(IN osm_sm_t * sm, IN const ib_smp_t * p_src_smp, IN ib_net16_t status, IN const uint8_t * p_payload, @@ -94,8 +92,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_resp_send(IN osm_sm_t * sm, IN const osm_madw_t * p_req_madw, IN ib_net16_t mad_status, diff --git a/branches/opensm_3/user/opensm/osm_router.c b/branches/opensm_3/user/opensm/osm_router.c index d19dd667..c10b7bee 100644 --- a/branches/opensm_3/user/opensm/osm_router.c +++ b/branches/opensm_3/user/opensm/osm_router.c @@ -49,16 +49,12 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_router_delete(IN OUT osm_router_t ** pp_rtr) { free(*pp_rtr); *pp_rtr = NULL; } -/********************************************************************** - **********************************************************************/ osm_router_t *osm_router_new(IN osm_port_t * p_port) { osm_router_t *p_rtr; diff --git a/branches/opensm_3/user/opensm/osm_sa.c b/branches/opensm_3/user/opensm/osm_sa.c index dcc49ca8..279fd953 100644 --- a/branches/opensm_3/user/opensm/osm_sa.c +++ b/branches/opensm_3/user/opensm/osm_sa.c @@ -1,8 +1,9 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. + * Copyright (c) 2010 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -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); extern void osm_sr_rcv_lease_cb(IN void *context); -/********************************************************************** - **********************************************************************/ void osm_sa_construct(IN osm_sa_t * p_sa) { memset(p_sa, 0, sizeof(*p_sa)); @@ -101,8 +100,6 @@ void osm_sa_construct(IN osm_sa_t * p_sa) cl_timer_construct(&p_sa->sr_timer); } -/********************************************************************** - **********************************************************************/ void osm_sa_shutdown(IN osm_sa_t * p_sa) { ib_api_status_t status; @@ -138,8 +135,6 @@ void osm_sa_shutdown(IN osm_sa_t * p_sa) OSM_LOG_EXIT(p_sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sa_destroy(IN osm_sa_t * p_sa) { OSM_LOG_ENTER(p_sa->p_log); @@ -151,8 +146,6 @@ void osm_sa_destroy(IN osm_sa_t * p_sa) OSM_LOG_EXIT(p_sa->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sa_init(IN osm_sm_t * p_sm, IN osm_sa_t * p_sa, IN osm_subn_t * p_subn, IN osm_vendor_t * p_vendor, IN osm_mad_pool_t * p_mad_pool, @@ -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; Exit: OSM_LOG_EXIT(p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sa_bind(IN osm_sa_t * p_sa, IN ib_net64_t port_guid) { ib_api_status_t status; @@ -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) */ resp_sa_mad->sm_key = 0; - /* Fill in the offset (paylen will be done by the rmpp SAR) */ - resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0; +#ifdef DUAL_SIDED_RMPP + if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP || + resp_sa_mad->method == IB_MAD_METHOD_GETMULTI_RESP) { +#else + if (resp_sa_mad->method == IB_MAD_METHOD_GETTABLE_RESP) { +#endif + /* Fill in the offset (paylen will be done by the rmpp SAR) */ + resp_sa_mad->attr_offset = num_rec ? ib_get_attr_offset(attr_size) : 0; + } p = ib_sa_mad_get_payload_ptr(resp_sa_mad); @@ -503,8 +501,6 @@ Exit: } } -/********************************************************************** - **********************************************************************/ /* * SA DB Dumper * @@ -696,18 +692,15 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file) { struct opensm_dump_context dump_context; osm_mgrp_t *p_mgrp; - int i; dump_context.p_osm = p_osm; dump_context.file = file; OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast\n"); cl_plock_acquire(&p_osm->lock); - for (i = 0; i <= p_osm->subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO; - i++) { - p_mgrp = p_osm->subn.mgroups[i]; - if (p_mgrp) - sa_dump_one_mgrp(p_mgrp, &dump_context); - } + for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&p_osm->subn.mgrp_mgid_tbl); + p_mgrp != (osm_mgrp_t *) cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl); + p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item)) + sa_dump_one_mgrp(p_mgrp, &dump_context); OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform\n"); cl_qlist_apply_func(&p_osm->subn.sa_infr_list, sa_dump_one_inform, &dump_context); @@ -719,7 +712,13 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file) int osm_sa_db_file_dump(osm_opensm_t * p_osm) { - return opensm_dump_to_file(p_osm, "opensm-sa.dump", sa_dump_all_sa); + int res = 1; + if (p_osm->sa.dirty) { + res = opensm_dump_to_file( + p_osm, "opensm-sa.dump", sa_dump_all_sa); + p_osm->sa.dirty = FALSE; + } + return res; } /* @@ -734,10 +733,9 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid, cl_plock_excl_acquire(&p_osm->lock); - p_mgrp = osm_get_mgrp_by_mlid(&p_osm->subn, mlid); + p_mgrp = osm_get_mgrp_by_mgid(&p_osm->subn, &p_mcm_rec->mgid); if (p_mgrp) { - if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid, - sizeof(ib_gid_t))) { + if (p_mgrp->mlid == mlid) { OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "mgrp %04x is already here.", cl_ntoh16(mlid)); goto _out; @@ -917,6 +915,12 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm) unsigned rereg_clients = 0; unsigned lineno; + if (!p_osm->subn.first_time_master_sweep) { + OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE, + "Not first sweep - skip SA DB restore\n"); + return 0; + } + file_name = p_osm->subn.opt.sa_db_file; if (!file_name) { OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE, @@ -932,6 +936,10 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm) return -1; } + OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE, + "Restoring SA DB from file \'%s\'\n", + file_name); + lineno = 0; while (fgets(line, sizeof(line) - 1, file) != NULL) { @@ -1108,8 +1116,16 @@ int osm_sa_db_file_load(osm_opensm_t * p_osm) } } - if (!rereg_clients) - p_osm->subn.opt.no_clients_rereg = TRUE; + /* + * If loading succeeded, do whatever 'no_clients_rereg' says. + * If loading failed at some point, turn off the 'no_clients_rereg' + * option (turn on re-registartion requests). + */ + if (rereg_clients) + p_osm->subn.opt.no_clients_rereg = FALSE; + + /* We've just finished loading SA DB file - clear the "dirty" flag */ + p_osm->sa.dirty = FALSE; _error: fclose(file); diff --git a/branches/opensm_3/user/opensm/osm_sa_class_port_info.c b/branches/opensm_3/user/opensm/osm_sa_class_port_info.c index 855a889e..b3dd7979 100644 --- a/branches/opensm_3/user/opensm/osm_sa_class_port_info.c +++ b/branches/opensm_3/user/opensm/osm_sa_class_port_info.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -66,8 +66,6 @@ const static uint32_t msecs_to_rtv_table[MAX_MSECS_TO_RTV] = { 1099511, 2199023, 4398046, 8796093 }; -/********************************************************************** - **********************************************************************/ static void cpi_rcv_respond(IN osm_sa_t * sa, IN const osm_madw_t * p_madw) { osm_madw_t *p_resp_madw; diff --git a/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c b/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c index 771c0a00..b99cc2cf 100644 --- a/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_guidinfo_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -70,8 +70,6 @@ typedef struct osm_gir_search_ctxt { const osm_physp_t *p_req_physp; } osm_gir_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa, IN const osm_node_t * p_node, IN cl_qlist_t * p_list, @@ -109,11 +107,9 @@ static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void sa_gir_create_gir(IN osm_sa_t * sa, IN osm_node_t * p_node, IN cl_qlist_t * p_list, IN ib_net64_t const match_port_guid, @@ -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); } -/********************************************************************** - **********************************************************************/ static void sa_gir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_gir_search_ctxt_t *p_ctxt = cxt; @@ -285,8 +279,6 @@ Exit: OSM_LOG_EXIT(p_ctxt->sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_gir_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_informinfo.c b/branches/opensm_3/user/opensm/osm_sa_informinfo.c index 530273c0..4cfe5792 100644 --- a/branches/opensm_3/user/opensm/osm_sa_informinfo.c +++ b/branches/opensm_3/user/opensm/osm_sa_informinfo.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -89,12 +89,8 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa, boolean_t valid = TRUE; osm_physp_t *p_requester_physp; osm_port_t *p_port; - osm_physp_t *p_physp; ib_net64_t portguid; - ib_net16_t lid_range_begin; - ib_net16_t lid_range_end; - ib_net16_t lid; - const cl_ptr_vector_t *p_tbl; + uint16_t lid_range_begin, lid_range_end, lid; OSM_LOG_ENTER(sa->p_log); @@ -109,7 +105,6 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa, interface_id; p_port = osm_get_port_by_guid(sa->p_subn, portguid); - if (p_port == NULL) { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4301: " "Invalid port guid: 0x%016" PRIx64 "\n", @@ -118,19 +113,18 @@ static boolean_t validate_ports_access_rights(IN osm_sa_t * sa, goto Exit; } - /* get the destination InformInfo physical port */ - p_physp = p_port->p_physp; - - /* make sure that the requester and destination port can access each other - according to the current partitioning. */ + /* make sure that the requester and destination port can access + each other according to the current partitioning. */ if (!osm_physp_share_pkey - (sa->p_log, p_physp, p_requester_physp)) { + (sa->p_log, p_port->p_physp, p_requester_physp)) { OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "port and requester don't share pkey\n"); valid = FALSE; goto Exit; } } else { + size_t lids_size; + /* gid is zero - check if LID range is defined */ lid_range_begin = cl_ntoh16(p_infr_rec->inform_record.inform_info. @@ -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. lid_range_end); - /* lid_range_end is set to zero if no range desired. In this case - - just make it equal to the lid_range_begin. */ + lids_size = cl_ptr_vector_get_size(&sa->p_subn->port_lid_tbl); + + /* lid_range_end is set to zero if no range desired. In this + case - just make it equal to the lid_range_begin. */ if (lid_range_end == 0) lid_range_end = lid_range_begin; + else if (lid_range_end >= lids_size) + lid_range_end = lids_size - 1; + + if (lid_range_begin >= lids_size) { + /* requested lids are out of range */ + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: " + "Given LIDs (%u-%u) are out of range (%zu)\n", + lid_range_begin, lid_range_end, lids_size); + valid = FALSE; + goto Exit; + } /* go over all defined lids within the range and make sure that the requester port can access them according to current partitioning. */ for (lid = lid_range_begin; lid <= lid_range_end; lid++) { - p_tbl = &sa->p_subn->port_lid_tbl; - if (cl_ptr_vector_get_size(p_tbl) > lid) - p_port = cl_ptr_vector_get(p_tbl, lid); - else { - /* lid requested is out of range */ - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4302: " - "Given LID (%u) is out of range:%u\n", - lid, cl_ptr_vector_get_size(p_tbl)); - valid = FALSE; - goto Exit; - } + p_port = osm_get_port_by_lid_ho(sa->p_subn, lid); if (p_port == NULL) continue; - p_physp = p_port->p_physp; /* make sure that the requester and destination port can access each other according to the current partitioning. */ if (!osm_physp_share_pkey - (sa->p_log, p_physp, p_requester_physp)) { + (sa->p_log, p_port->p_physp, p_requester_physp)) { OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "port and requester don't share pkey\n"); valid = FALSE; @@ -183,8 +179,6 @@ Exit: return valid; } -/********************************************************************** - **********************************************************************/ static boolean_t validate_infr(IN osm_sa_t * sa, IN osm_infr_t * p_infr_rec) { boolean_t valid = TRUE; @@ -237,8 +231,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa, IN const osm_infr_t * p_infr, osm_iir_search_ctxt_t * p_ctxt) @@ -281,8 +273,8 @@ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa, /* get the subscriber InformInfo physical port */ p_subscriber_physp = p_subscriber_port->p_physp; - /* make sure that the requester and subscriber port can access each other - according to the current partitioning. */ + /* make sure that the requester and subscriber port can access each + other according to the current partitioning. */ if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_subscriber_physp)) { OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "requester and subscriber ports don't share pkey\n"); @@ -304,8 +296,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * p_list_item, IN void *context) { @@ -549,8 +539,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************* -**********************************************************************/ void osm_infr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; @@ -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); if (p_sa_mad->method != IB_MAD_METHOD_SET) { - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, - "Unsupported Method (%s)\n", + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n", ib_get_sa_method_str(p_sa_mad->method)); osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR); goto Exit; @@ -579,8 +566,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************* -**********************************************************************/ void osm_infir_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; diff --git a/branches/opensm_3/user/opensm/osm_sa_lft_record.c b/branches/opensm_3/user/opensm/osm_sa_lft_record.c index d0812646..96b86e28 100644 --- a/branches/opensm_3/user/opensm/osm_sa_lft_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_lft_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -67,8 +67,6 @@ typedef struct osm_lftr_search_ctxt { const osm_physp_t *p_req_physp; } osm_lftr_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa, IN const osm_switch_t * p_sw, IN cl_qlist_t * p_list, @@ -105,11 +103,9 @@ static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void lftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_lftr_search_ctxt_t *p_ctxt = cxt; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_lftr_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_link_record.c b/branches/opensm_3/user/opensm/osm_sa_link_record.c index 8b9f5afa..966a3af7 100644 --- a/branches/opensm_3/user/opensm/osm_sa_link_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_link_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -60,8 +60,6 @@ typedef struct osm_lr_item { ib_link_record_t link_rec; } osm_lr_item_t; -/********************************************************************** - **********************************************************************/ static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid, IN ib_net16_t to_lid, IN uint8_t from_port, IN uint8_t to_port, IN cl_qlist_t * p_list) @@ -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); } -/********************************************************************** - **********************************************************************/ static ib_net16_t get_base_lid(IN const osm_physp_t * p_physp) { if (p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) @@ -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); } -/********************************************************************** - **********************************************************************/ static void lr_rcv_get_physp_link(IN osm_sa_t * sa, IN const ib_link_record_t * p_lr, IN const osm_physp_t * p_src_physp, @@ -198,8 +192,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void lr_rcv_get_port_links(IN osm_sa_t * sa, IN const ib_link_record_t * p_lr, IN const osm_port_t * p_src_port, @@ -417,8 +409,6 @@ Exit: return sa_status; } -/********************************************************************** - **********************************************************************/ void osm_lr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; diff --git a/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c b/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c index 8fe30f31..81aa30d4 100644 --- a/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c +++ b/branches/opensm_3/user/opensm/osm_sa_mad_ctrl.c @@ -102,11 +102,11 @@ static void sa_mad_ctrl_process(IN osm_sa_mad_ctrl_t * p_ctrl, /* If the dispatcher is showing us that it is overloaded - there is no point in placing the request in. We should instead provide - immediate response - IB_RESOURCE_BUSY + there is no point in placing the request in. We should instead + provide immediate response - IB_RESOURCE_BUSY But how do we know? - The dispatcher reports back the number of outstanding messages and the - time the last message stayed in the queue. + The dispatcher reports back the number of outstanding messages and + the time the last message stayed in the queue. HACK: Actually, we cannot send a mad from within the receive callback; thus - we will just drop it. */ @@ -447,8 +447,6 @@ static void sa_mad_ctrl_send_err_callback(IN void *context, * SEE ALSO *********/ -/********************************************************************** - **********************************************************************/ void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * p_ctrl) { CL_ASSERT(p_ctrl); @@ -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; } -/********************************************************************** - **********************************************************************/ void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * p_ctrl) { CL_ASSERT(p_ctrl); cl_disp_unregister(p_ctrl->h_disp); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * p_ctrl, IN osm_sa_t * sa, IN osm_mad_pool_t * p_mad_pool, @@ -504,8 +498,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * p_ctrl, IN ib_net64_t port_guid) { @@ -553,8 +545,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * p_ctrl) { ib_api_status_t status = IB_SUCCESS; diff --git a/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c b/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c index 5bb499dc..6698d6fb 100644 --- a/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_mcmember_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * @@ -114,33 +114,69 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid) /********************************************************************* Get a new unused mlid by scanning all the used ones in the subnet. **********************************************************************/ -static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_net16_t requested_mlid) +/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */ +/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */ +/* Where Z is the scope, XXXX is the P_Key, and + * YYYYYY is the last 24 bits of the port guid */ +#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL) +#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL) +#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL) +#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL) + +static int compare_ipv6_snm_mgids(const void *m1, const void *m2) +{ + return memcmp(m1, m2, sizeof(ib_gid_t) - 6); +} + +static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid) +{ + osm_mgrp_t *m = (osm_mgrp_t *)cl_fmap_match(&subn->mgrp_mgid_tbl, mgid, + compare_ipv6_snm_mgids); + if (m != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl)) + return m->mlid; + return 0; +} + +static unsigned match_ipv6_snm_mgid(ib_gid_t * mgid) +{ + return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE && + (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE); +} + +static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr) { osm_subn_t *p_subn = sa->p_subn; + ib_net16_t requested_mlid = mcmr->mlid; unsigned i, max; if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO && cl_ntoh16(requested_mlid) <= p_subn->max_mcast_lid_ho - && !osm_get_mgrp_by_mlid(p_subn, requested_mlid)) + && !osm_get_mbox_by_mlid(p_subn, requested_mlid)) return requested_mlid; + if (sa->p_subn->opt.consolidate_ipv6_snm_req + && match_ipv6_snm_mgid(&mcmr->mgid) + && (requested_mlid = find_ipv6_snm_mlid(sa->p_subn, &mcmr->mgid))) { + char str[INET6_ADDRSTRLEN]; + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + "Special Case Solicited Node Mcast Join for MGID %s\n", + inet_ntop(AF_INET6, mcmr->mgid.raw, str, sizeof(str))); + return requested_mlid; + } + max = p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1; for (i = 0; i < max; i++) - if (!sa->p_subn->mgroups[i]) + if (!sa->p_subn->mboxes[i]) return cl_hton16(i + IB_LID_MCAST_START_HO); return 0; } -/********************************************************************** - **********************************************************************/ static inline boolean_t check_join_comp_mask(ib_net64_t comp_mask) { return ((comp_mask & JOIN_MC_COMP_MASK) == JOIN_MC_COMP_MASK); } -/********************************************************************** - **********************************************************************/ static boolean_t check_create_comp_mask(ib_net64_t comp_mask, ib_member_rec_t * p_recvd_mcmember_rec) { @@ -211,7 +247,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, switch (mtu_sel) { case 0: /* Greater than MTU specified */ if (mtu_mgrp <= mtu_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has MTU %x, " "which is not greater than %x\n", mtu_mgrp, mtu_required); @@ -220,7 +256,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, break; case 1: /* Less than MTU specified */ if (mtu_mgrp >= mtu_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has MTU %x, " "which is not less than %x\n", mtu_mgrp, mtu_required); @@ -229,7 +265,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, break; case 2: /* Exactly MTU specified */ if (mtu_mgrp != mtu_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has MTU %x, " "which is not equal to %x\n", mtu_mgrp, mtu_required); @@ -250,7 +286,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, switch (rate_sel) { case 0: /* Greater than RATE specified */ if (rate_mgrp <= rate_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not greater than %x\n", rate_mgrp, rate_required); @@ -259,7 +295,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, break; case 1: /* Less than RATE specified */ if (rate_mgrp >= rate_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not less than %x\n", rate_mgrp, rate_required); @@ -268,7 +304,7 @@ static boolean_t validate_more_comp_fields(osm_log_t * p_log, break; case 2: /* Exactly RATE specified */ if (rate_mgrp != rate_required) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested mcast group has RATE %x, " "which is not equal to %x\n", rate_mgrp, rate_required); @@ -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); mtu_mgrp = (uint8_t) (p_mgrp->mcmember_rec.mtu & 0x3F); if (mtu_required < mtu_mgrp) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Port's MTU %x is less than %x\n", mtu_required, mtu_mgrp); return FALSE; @@ -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); rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F); if (rate_required < rate_mgrp) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Port's RATE %x is less than %x\n", rate_required, rate_mgrp); return FALSE; @@ -397,8 +433,6 @@ static boolean_t validate_modify(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp, return TRUE; } -/********************************************************************** - **********************************************************************/ /* * Check legality of the requested MGID DELETE * o15-0.1.14 = VALID DELETE: @@ -469,8 +503,6 @@ static boolean_t validate_delete(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp, return TRUE; } -/********************************************************************** - **********************************************************************/ /* * Check legality of the requested MGID (note this does not hold for SA * created MGIDs) @@ -590,7 +622,7 @@ static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (valid); + return valid; } /********************************************************************** @@ -634,7 +666,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, switch (mtu_sel) { case 0: /* Greater than MTU specified */ if (port_mtu && mtu_required >= port_mtu) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested MTU %x >= the port\'s mtu:%x\n", mtu_required, port_mtu); return FALSE; @@ -662,7 +694,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, } /* make sure it still be in the range */ if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Calculated MTU %x is out of range\n", mtu); return FALSE; } @@ -681,7 +713,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, switch (rate_sel) { case 0: /* Greater than RATE specified */ if (port_rate && rate_required >= port_rate) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Requested RATE %x >= the port\'s rate:%x\n", rate_required, port_rate); return FALSE; @@ -709,7 +741,7 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, } /* make sure it still is in the range */ if (rate < IB_MIN_RATE || rate > IB_MAX_RATE) { - OSM_LOG(p_log, OSM_LOG_DEBUG, + OSM_LOG(p_log, OSM_LOG_VERBOSE, "Calculated RATE %x is out of range\n", rate); return FALSE; } @@ -720,80 +752,73 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa, return TRUE; } +static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask, + ib_member_rec_t * mcmr) +{ + static uint32_t uniq_count; + ib_gid_t *mgid = &mcmr->mgid; + uint8_t scope; + unsigned i; + + /* use the given scope state only if requested! */ + if (comp_mask & IB_MCR_COMPMASK_SCOPE) + ib_member_get_scope_state(mcmr->scope_state, &scope, NULL); + else + /* to guarantee no collision with other subnets use local scope! */ + scope = IB_MC_SCOPE_LINK_LOCAL; + + mgid->raw[0] = 0xff; + mgid->raw[1] = 0x10 | scope; + mgid->raw[2] = 0xa0; + mgid->raw[3] = 0x1b; + + /* HACK: use the SA port gid to make it globally unique */ + memcpy(&mgid->raw[4], &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t)); + + for (i = 0; i < 1000; i++) { + memcpy(&mgid->raw[10], &uniq_count, 4); + uniq_count++; + if (!osm_get_mgrp_by_mgid(sa->p_subn, mgid)) + return 1; + } + + return 0; +} + /********************************************************************** Call this function to create a new mgrp. **********************************************************************/ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa, IN ib_net64_t comp_mask, IN const ib_member_rec_t * - const p_recvd_mcmember_rec, + p_recvd_mcmember_rec, IN const osm_physp_t * p_physp, OUT osm_mgrp_t ** pp_mgrp) { ib_net16_t mlid; - unsigned zero_mgid = 1; - uint8_t scope; - ib_gid_t *p_mgid; ib_api_status_t status = IB_SUCCESS; ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec; /* copy for modifications */ OSM_LOG_ENTER(sa->p_log); - /* but what if the given MGID was not 0 ? */ - if (p_recvd_mcmember_rec->mgid.unicast.prefix != 0 || - p_recvd_mcmember_rec->mgid.unicast.interface_id != 0) - zero_mgid = 0; - - /* - we allocate a new mlid number before we might use it - for MGID ... - */ - mlid = get_new_mlid(sa, mcm_rec.mlid); - if (mlid == 0) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: " - "get_new_mlid failed request mlid 0x%04x\n", - cl_ntoh16(mcm_rec.mlid)); - status = IB_SA_MAD_STATUS_NO_RESOURCES; - goto Exit; - } - - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, - "Obtained new mlid 0x%X\n", cl_ntoh16(mlid)); - /* we need to create the new MGID if it was not defined */ - if (zero_mgid) { + if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) { /* create a new MGID */ char gid_str[INET6_ADDRSTRLEN]; - /* use the given scope state only if requested! */ - if (comp_mask & IB_MCR_COMPMASK_SCOPE) - ib_member_get_scope_state(p_recvd_mcmember_rec-> - scope_state, &scope, NULL); - else - /* to guarantee no collision with other subnets use local scope! */ - scope = IB_MC_SCOPE_LINK_LOCAL; - - p_mgid = &(mcm_rec.mgid); - p_mgid->raw[0] = 0xFF; - p_mgid->raw[1] = 0x10 | scope; - p_mgid->raw[2] = 0xA0; - p_mgid->raw[3] = 0x1B; - - /* HACK: use the SA port gid to make it globally unique */ - memcpy((&p_mgid->raw[4]), - &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t)); - - /* HACK: how do we get a unique number - use the mlid twice */ - memcpy(&p_mgid->raw[10], &mlid, sizeof(uint16_t)); - memcpy(&p_mgid->raw[12], &mlid, sizeof(uint16_t)); + if (!build_new_mgid(sa, comp_mask, &mcm_rec)) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B23: " + "cannot allocate unique MGID value\n"); + status = IB_SA_MAD_STATUS_NO_RESOURCES; + goto Exit; + } OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Allocated new MGID:%s\n", - inet_ntop(AF_INET6, p_mgid->raw, gid_str, + inet_ntop(AF_INET6, mcm_rec.mgid.raw, gid_str, sizeof gid_str)); } else if (!validate_requested_mgid(sa, &mcm_rec)) { /* a specific MGID was requested so validate the resulting MGID */ OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B22: " "Invalid requested MGID\n"); - free_mlid(sa, mlid); status = IB_SA_MAD_STATUS_REQ_INVALID; goto Exit; } @@ -803,14 +828,25 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa, FALSE) { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B26: " "Requested MGRP parameters are not realizable\n"); - free_mlid(sa, mlid); status = IB_SA_MAD_STATUS_REQ_INVALID; goto Exit; } - /* create a new MC Group */ + mlid = get_new_mlid(sa, &mcm_rec); + if (mlid == 0) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: " + "get_new_mlid failed request mlid 0x%04x\n", + cl_ntoh16(mcm_rec.mlid)); + status = IB_SA_MAD_STATUS_NO_RESOURCES; + goto Exit; + } + + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n", + cl_ntoh16(mlid)); + mcm_rec.mlid = mlid; - *pp_mgrp = osm_mgrp_new(mlid, &mcm_rec); + /* create a new MC Group */ + *pp_mgrp = osm_mgrp_new(sa->p_subn, mlid, &mcm_rec); if (*pp_mgrp == NULL) { OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B08: " "osm_mgrp_new failed\n"); @@ -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; (*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6; /* exactly */ - /* Insert the new group in the data base */ - cl_fmap_insert(&sa->p_subn->mgrp_mgid_tbl, - &(*pp_mgrp)->mcmember_rec.mgid, &(*pp_mgrp)->map_item); - sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = *pp_mgrp; - Exit: OSM_LOG_EXIT(sa->p_log); return status; } -/********************************************************************** - **********************************************************************/ -#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL) -#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL) -#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL) -#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL) - -/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */ -/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */ -/* Where Z is the scope, XXXX is the P_Key, and - * YYYYYY is the last 24 bits of the port guid */ -static unsigned match_and_update_ipv6_snm_mgid(ib_gid_t * mgid) -{ - if ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE && - (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE) { - mgid->unicast.prefix &= PREFIX_MASK; - mgid->unicast.interface_id &= INT_ID_MASK; - return 1; - } - return 0; -} - -osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid) -{ - osm_mgrp_t *mg; - - if (sa->p_subn->opt.consolidate_ipv6_snm_req && - match_and_update_ipv6_snm_mgid(p_mgid)) { - char gid_str[INET6_ADDRSTRLEN]; - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, - "Special Case Solicited Node Mcast Join for MGID %s\n", - inet_ntop(AF_INET6, p_mgid->raw, gid_str, - sizeof gid_str)); - } - - mg = (osm_mgrp_t *)cl_fmap_get(&sa->p_subn->mgrp_mgid_tbl, p_mgid); - if (mg != (osm_mgrp_t *)cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl)) - return mg; - - return NULL; -} - /********************************************************************** Call this function to find or create a new mgrp. **********************************************************************/ @@ -890,7 +879,8 @@ ib_api_status_t osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa, { osm_mgrp_t *mgrp; - if ((mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid))) { + if ((mgrp = osm_get_mgrp_by_mgid(sa->p_subn, + &p_recvd_mcmember_rec->mgid))) { *pp_mgrp = mgrp; return IB_SUCCESS; } @@ -924,7 +914,7 @@ static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) } CL_PLOCK_EXCL_ACQUIRE(sa->p_lock); - p_mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid); + p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid); if (!p_mgrp) { char gid_str[INET6_ADDRSTRLEN]; CL_PLOCK_RELEASE(sa->p_lock); @@ -1023,21 +1013,21 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw) goto Exit; } - if (!osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) { + proxy = (p_physp != p_request_physp); + + if (proxy && !osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) { CL_PLOCK_RELEASE(sa->p_lock); - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "Port and requester don't share pkey\n"); osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID); goto Exit; } - proxy = (p_physp != p_request_physp); - ib_member_get_scope_state(p_recvd_mcmember_rec->scope_state, NULL, &join_state); /* do we need to create a new group? */ - p_mgrp = osm_get_mgrp_by_mgid(sa, &p_recvd_mcmember_rec->mgid); + p_mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &p_recvd_mcmember_rec->mgid); if (!p_mgrp) { /* check for JoinState.FullMember = 1 o15.0.1.9 */ if ((join_state & 0x01) != 0x01) { @@ -1206,7 +1196,7 @@ static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } /********************************************************************** @@ -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; boolean_t trusted_req; osm_mgrp_t *p_mgrp; - int i; OSM_LOG_ENTER(sa->p_log); @@ -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); /* simply go over all MCGs and match */ - for (i = 0; i <= sa->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; - i++) { - p_mgrp = sa->p_subn->mgroups[i]; - if (p_mgrp) - mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp, - p_req_physp, trusted_req, &rec_list); - } + for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&sa->p_subn->mgrp_mgid_tbl); + p_mgrp != (osm_mgrp_t *) cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl); + p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item)) + mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp, + p_req_physp, trusted_req, &rec_list); CL_PLOCK_RELEASE(sa->p_lock); @@ -1442,8 +1429,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_mcmr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; diff --git a/branches/opensm_3/user/opensm/osm_sa_mft_record.c b/branches/opensm_3/user/opensm/osm_sa_mft_record.c index 2e865dc6..a38ee51c 100644 --- a/branches/opensm_3/user/opensm/osm_sa_mft_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_mft_record.c @@ -67,8 +67,6 @@ typedef struct osm_mftr_search_ctxt { const osm_physp_t *p_req_physp; } osm_mftr_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa, IN osm_switch_t * p_sw, IN cl_qlist_t * p_list, @@ -110,11 +108,9 @@ static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_mftr_search_ctxt_t *p_ctxt = cxt; @@ -209,8 +205,6 @@ static void mftr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) position); } -/********************************************************************** - **********************************************************************/ void osm_mftr_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_multipath_record.c b/branches/opensm_3/user/opensm/osm_sa_multipath_record.c index 70899672..9712bd5c 100644 --- a/branches/opensm_3/user/opensm/osm_sa_multipath_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_multipath_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -81,8 +81,6 @@ typedef struct osm_path_parms { int hops; } osm_path_parms_t; -/********************************************************************** - **********************************************************************/ static boolean_t sa_multipath_rec_is_tavor_port(IN const osm_port_t * p_port) { osm_node_t const *p_node; @@ -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)))); } -/********************************************************************** - **********************************************************************/ static boolean_t sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr, IN const osm_port_t * p_src_port, @@ -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 */ if (!sa_multipath_rec_is_tavor_port(p_src_port) && !sa_multipath_rec_is_tavor_port(p_dest_port)) - return (FALSE); + return FALSE; /* we can apply the patch if either: @@ -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 */ case 2: /* exact match */ if (IB_MTU_LEN_1024 < required_mtu) - return (FALSE); + return FALSE; break; case 1: /* must be less than */ @@ -137,7 +133,7 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr, case 3: /* largest available */ /* the ULP intentionally requested */ /* the largest MTU possible */ - return (FALSE); + return FALSE; break; default: @@ -147,11 +143,9 @@ sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t * p_mpr, } } - return (TRUE); + return TRUE; } -/********************************************************************** - **********************************************************************/ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, IN const ib_multipath_rec_t * p_mpr, @@ -735,11 +729,9 @@ static ib_api_status_t mpr_rcv_get_path_parms(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void mpr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN uint16_t src_lid_ho, IN uint16_t dest_lid_ho, @@ -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); } -/********************************************************************** - **********************************************************************/ static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa, IN const ib_multipath_rec_t * p_mpr, @@ -861,11 +851,9 @@ static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (p_pr_item); + return p_pr_item; } -/********************************************************************** - **********************************************************************/ static uint32_t mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa, IN const ib_multipath_rec_t * p_mpr, IN const osm_port_t * p_req_port, @@ -1049,8 +1037,6 @@ Exit: #undef min #define min(x,y) (((x) < (y)) ? (x) : (y)) -/********************************************************************** - **********************************************************************/ static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa, IN const ib_multipath_rec_t * @@ -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; } -/********************************************************************** - **********************************************************************/ static ib_net16_t mpr_rcv_get_gids(IN osm_sa_t * sa, IN const ib_gid_t * gids, IN int ngids, IN int is_sgid, OUT osm_port_t ** pp_port) @@ -1188,8 +1172,6 @@ Exit: return ib_status; } -/********************************************************************** - **********************************************************************/ static ib_net16_t mpr_rcv_get_end_points(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, OUT osm_port_t ** pp_ports, @@ -1239,14 +1221,12 @@ static ib_net16_t mpr_rcv_get_end_points(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (sa_status); + return sa_status; } #define hash_lids(a, b, lmc) \ (((((a) >> (lmc)) << 4) | ((b) >> (lmc))) % 103) -/********************************************************************** - **********************************************************************/ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa, IN const ib_multipath_rec_t * p_mpr, IN const osm_port_t * p_req_port, @@ -1360,8 +1340,6 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa, OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void mpr_rcv_process_pairs(IN osm_sa_t * sa, IN const ib_multipath_rec_t * p_mpr, IN osm_port_t * p_req_port, @@ -1404,8 +1382,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_mpr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; diff --git a/branches/opensm_3/user/opensm/osm_sa_node_record.c b/branches/opensm_3/user/opensm/osm_sa_node_record.c index b9d7f04e..8a2f83a4 100644 --- a/branches/opensm_3/user/opensm/osm_sa_node_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_node_record.c @@ -67,8 +67,6 @@ typedef struct osm_nr_search_ctxt { const osm_physp_t *p_req_physp; } osm_nr_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa, IN const osm_node_t * p_node, IN cl_qlist_t * p_list, @@ -105,11 +103,9 @@ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void nr_rcv_create_nr(IN osm_sa_t * sa, IN osm_node_t * p_node, IN cl_qlist_t * p_list, IN ib_net64_t const match_port_guid, @@ -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); } -/********************************************************************** - **********************************************************************/ static void nr_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *context) { const osm_nr_search_ctxt_t *p_ctxt = context; @@ -277,8 +271,6 @@ Exit: OSM_LOG_EXIT(p_ctxt->sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_nr_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_path_record.c b/branches/opensm_3/user/opensm/osm_sa_path_record.c index 1b81bc8c..203a191c 100644 --- a/branches/opensm_3/user/opensm/osm_sa_path_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_path_record.c @@ -1,9 +1,10 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. + * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -69,6 +70,8 @@ #include #include +#define MAX_HOPS 64 + typedef struct osm_pr_item { cl_list_item_t list_item; ib_path_rec_t path_rec; @@ -83,8 +86,6 @@ typedef struct osm_path_parms { boolean_t reversible; } osm_path_parms_t; -/********************************************************************** - **********************************************************************/ static inline boolean_t sa_path_rec_is_tavor_port(IN const osm_port_t * p_port) { osm_node_t const *p_node; @@ -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)))); } -/********************************************************************** - **********************************************************************/ static boolean_t sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr, IN const osm_port_t * p_src_port, @@ -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 */ if (!sa_path_rec_is_tavor_port(p_src_port) && !sa_path_rec_is_tavor_port(p_dest_port)) - return (FALSE); + return FALSE; /* we can apply the patch if either: @@ -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 */ case 2: /* exact match */ if (IB_MTU_LEN_1024 < required_mtu) - return (FALSE); + return FALSE; break; case 1: /* must be less than */ @@ -139,7 +138,7 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr, case 3: /* largest available */ /* the ULP intentionally requested */ /* the largest MTU possible */ - return (FALSE); + return FALSE; default: /* if we're here, there's a bug in ib_path_rec_mtu_sel() */ @@ -148,11 +147,9 @@ sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * p_pr, } } - return (TRUE); + return TRUE; } -/********************************************************************** - **********************************************************************/ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, IN const ib_path_rec_t * p_pr, IN const osm_port_t * p_src_port, @@ -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; uint16_t valid_sl_mask = 0xffff; int is_lash; + int hops = 0; OSM_LOG_ENTER(sa->p_log); @@ -375,6 +373,23 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, goto Exit; } } + + /* update number of hops traversed */ + hops++; + if (hops > MAX_HOPS) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, + "Path from GUID 0x%016" PRIx64 " (%s) to" + " lid %u GUID 0x%016" PRIx64 " (%s) needs" + " more than %d hops, max %d hops allowed\n", + cl_ntoh64(osm_physp_get_port_guid(p_src_physp)), + p_src_physp->p_node->print_desc, dest_lid_ho, + cl_ntoh64(osm_physp_get_port_guid + (p_dest_physp)), + p_dest_physp->p_node->print_desc, hops, + MAX_HOPS); + status = IB_NOT_FOUND; + goto Exit; + } } /* @@ -649,7 +664,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, } /* - * Set PathRecord SL. + * Set PathRecord SL */ is_lash = (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_LASH); @@ -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); Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN const ib_gid_t * p_dgid, @@ -762,16 +775,12 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port, { const osm_physp_t *p_src_physp; const osm_physp_t *p_dest_physp; - boolean_t is_nonzero_gid = 0; OSM_LOG_ENTER(sa->p_log); p_src_physp = p_src_port->p_physp; if (p_dgid) - is_nonzero_gid = ib_gid_is_notzero(p_dgid); - - if (is_nonzero_gid) p_pr->dgid = *p_dgid; else { p_dest_physp = p_dest_port->p_physp; @@ -791,7 +800,7 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port, p_pr->hop_flow_raw &= cl_hton32(1 << 31); /* Only set HopLimit if going through a router */ - if (is_nonzero_gid) + if (p_dgid) p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX); p_pr->pkey = p_parms->pkey; @@ -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); } -/********************************************************************** - **********************************************************************/ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa, IN const ib_path_rec_t * p_pr, IN const osm_port_t * p_src_port, @@ -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 ... see Vol1 Ver1.2 p900 l16 */ - if (comp_mask & IB_PR_COMPMASK_REVERSIBLE) { - if ((!path_parms.reversible && (p_pr->num_path & 0x80))) { - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, - "Requested reversible path but failed to get one\n"); - - free(p_pr_item); - p_pr_item = NULL; - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_REVERSIBLE) && + !path_parms.reversible && (p_pr->num_path & 0x80)) { + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + "Requested reversible path but failed to get one\n"); + free(p_pr_item); + p_pr_item = NULL; + goto Exit; } pr_rcv_build_pr(sa, p_src_port, p_dest_port, p_dgid, src_lid_ho, @@ -885,22 +890,19 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (p_pr_item); + return p_pr_item; } -/********************************************************************** - **********************************************************************/ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, - IN const osm_madw_t * p_madw, + IN const ib_sa_mad_t *sa_mad, IN const osm_port_t * p_req_port, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN const ib_gid_t * p_dgid, - IN const ib_net64_t comp_mask, IN cl_qlist_t * p_list) { - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; + const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad); + ib_net64_t comp_mask = sa_mad->comp_mask; osm_pr_item_t *p_pr_item; uint16_t src_lid_min_ho; uint16_t src_lid_max_ho; @@ -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. */ goto Exit; - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); - /* We shouldn't be here if the paths are disqualified in some way... Thus, we assume every possible connection is valid. @@ -979,17 +978,15 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, /* Refine our search if the client specified end-point LIDs */ - if (comp_mask & IB_PR_COMPMASK_DLID) { - dest_lid_min_ho = cl_ntoh16(p_pr->dlid); - dest_lid_max_ho = cl_ntoh16(p_pr->dlid); - } else + if (comp_mask & IB_PR_COMPMASK_DLID) + dest_lid_max_ho = dest_lid_min_ho = cl_ntoh16(p_pr->dlid); + else osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho, &dest_lid_max_ho); - if (comp_mask & IB_PR_COMPMASK_SLID) { - src_lid_min_ho = cl_ntoh16(p_pr->slid); - src_lid_max_ho = cl_ntoh16(p_pr->slid); - } else + if (comp_mask & IB_PR_COMPMASK_SLID) + src_lid_max_ho = src_lid_min_ho = cl_ntoh16(p_pr->slid); + else osm_port_get_lid_range_ho(p_src_port, &src_lid_min_ho, &src_lid_max_ho); @@ -1020,13 +1017,12 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa, path_num = 0; /* If SubnAdmGet, assume NumbPaths 1 (1.2 erratum) */ - if (p_sa_mad->method != IB_MAD_METHOD_GET) - if (comp_mask & IB_PR_COMPMASK_NUMBPATH) - iterations = ib_path_rec_num_path(p_pr); - else - iterations = (unsigned) (-1); - else + if (sa_mad->method == IB_MAD_METHOD_GET) iterations = 1; + else if (comp_mask & IB_PR_COMPMASK_NUMBPATH) + iterations = ib_path_rec_num_path(p_pr); + else + iterations = (unsigned) (-1); while (path_num < iterations) { /* @@ -1111,8 +1107,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ /* Find the router port that is configured to handle this prefix, if any */ static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix) { @@ -1147,16 +1141,14 @@ static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix) } static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa, - IN const osm_madw_t * p_madw, + IN const ib_sa_mad_t *sa_mad, OUT const osm_port_t ** pp_src_port, OUT const osm_port_t ** pp_dest_port, - OUT ib_gid_t * p_dgid) + OUT const ib_gid_t ** pp_dgid) { - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - ib_net64_t comp_mask; + const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad); + ib_net64_t comp_mask = sa_mad->comp_mask; ib_net64_t dest_guid; - ib_api_status_t status; ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS; OSM_LOG_ENTER(sa->p_log); @@ -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. */ - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); - - comp_mask = p_sa_mad->comp_mask; - /* Check a few easy disqualifying cases up front before getting into the endpoints. @@ -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" PRIx64 "\n", cl_ntoh64(p_pr->sgid.unicast.prefix)); - sa_status = IB_SA_MAD_STATUS_INVALID_GID; goto Exit; } @@ -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, "No source port with GUID 0x%016" PRIx64 "\n", cl_ntoh64(p_pr->sgid.unicast.interface_id)); - sa_status = IB_SA_MAD_STATUS_INVALID_GID; goto Exit; } - } else { - *pp_src_port = 0; - if (comp_mask & IB_PR_COMPMASK_SLID) { - status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl, - cl_ntoh16(p_pr->slid), - (void **)pp_src_port); - - if ((status != CL_SUCCESS) || (*pp_src_port == NULL)) { - /* - This 'error' is the client's fault (bad lid) so - don't enter it as an error in our own log. - Return an error response to the client. - */ - OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, - "No source port with LID %u\n", - cl_ntoh16(p_pr->slid)); - - sa_status = IB_SA_MAD_STATUS_NO_RECORDS; - goto Exit; - } + } else if (comp_mask & IB_PR_COMPMASK_SLID) { + *pp_src_port = osm_get_port_by_lid(sa->p_subn, p_pr->slid); + if (!*pp_src_port) { + /* + This 'error' is the client's fault (bad lid) so + don't enter it as an error in our own log. + Return an error response to the client. + */ + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No source port " + "with LID %u\n", cl_ntoh16(p_pr->slid)); + sa_status = IB_SA_MAD_STATUS_NO_RECORDS; + goto Exit; } - } - - if (p_dgid) - memset(p_dgid, 0, sizeof(*p_dgid)); + } else + *pp_src_port = NULL; if (comp_mask & IB_PR_COMPMASK_DGID) { if (!ib_gid_is_link_local(&p_pr->dgid) && @@ -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; goto Exit; } + if (pp_dgid) + *pp_dgid = &p_pr->dgid; } else dest_guid = p_pr->dgid.unicast.interface_id; @@ -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, "No dest port with GUID 0x%016" PRIx64 "\n", cl_ntoh64(dest_guid)); - sa_status = IB_SA_MAD_STATUS_INVALID_GID; goto Exit; } - - if (p_dgid) - *p_dgid = p_pr->dgid; - } else { - *pp_dest_port = 0; - if (comp_mask & IB_PR_COMPMASK_DLID) { - status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl, - cl_ntoh16(p_pr->dlid), - (void **)pp_dest_port); - - if ((status != CL_SUCCESS) || (*pp_dest_port == NULL)) { - /* - This 'error' is the client's fault (bad lid) - so don't enter it as an error in our own log. - Return an error response to the client. - */ - OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, - "No dest port with LID %u\n", - cl_ntoh16(p_pr->dlid)); - - sa_status = IB_SA_MAD_STATUS_NO_RECORDS; - goto Exit; - } + } else if (comp_mask & IB_PR_COMPMASK_DLID) { + *pp_dest_port = osm_get_port_by_lid(sa->p_subn, p_pr->dlid); + if (!*pp_dest_port) { + /* + This 'error' is the client's fault (bad lid) + so don't enter it as an error in our own log. + Return an error response to the client. + */ + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, "No dest port " + "with LID %u\n", cl_ntoh16(p_pr->dlid)); + sa_status = IB_SA_MAD_STATUS_NO_RECORDS; + goto Exit; } - } + } else + *pp_dest_port = NULL; Exit: OSM_LOG_EXIT(sa->p_log); - return (sa_status); + return sa_status; } -/********************************************************************** - **********************************************************************/ -static void pr_rcv_process_world(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, +static void pr_rcv_process_world(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad, IN const osm_port_t * requester_port, IN const ib_gid_t * p_dgid, - IN const ib_net64_t comp_mask, IN cl_qlist_t * p_list) { const cl_qmap_t *p_tbl; @@ -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)) { p_src_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_src_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_src_port, p_dest_port, - p_dgid, comp_mask, p_list); + p_dgid, p_list); + if (sa_mad->method == IB_MAD_METHOD_GET && + cl_qlist_count(p_list) > 0) + goto Exit; p_src_port = (osm_port_t *) cl_qmap_next(&p_src_port->map_item); @@ -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); } +Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ -static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, +static void pr_rcv_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad, IN const osm_port_t * requester_port, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN const ib_gid_t * p_dgid, - IN const ib_net64_t comp_mask, IN cl_qlist_t * p_list) { const cl_qmap_t *p_tbl; @@ -1372,9 +1336,12 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, */ p_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_src_port, p_port, p_dgid, - comp_mask, p_list); + p_list); + if (sa_mad->method == IB_MAD_METHOD_GET && + cl_qlist_count(p_list) > 0) + break; p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item); } } else { @@ -1383,9 +1350,12 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, */ p_port = (osm_port_t *) cl_qmap_head(p_tbl); while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) { - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, + pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_port, p_dest_port, p_dgid, - comp_mask, p_list); + p_list); + if (sa_mad->method == IB_MAD_METHOD_GET && + cl_qlist_count(p_list) > 0) + break; p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item); } } @@ -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); } -/********************************************************************** - **********************************************************************/ -static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, +static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad, IN const osm_port_t * requester_port, IN const osm_port_t * p_src_port, IN const osm_port_t * p_dest_port, IN const ib_gid_t * p_dgid, - IN const ib_net64_t comp_mask, IN cl_qlist_t * p_list) { OSM_LOG_ENTER(sa->p_log); - pr_rcv_get_port_pair_paths(sa, p_madw, requester_port, p_src_port, - p_dest_port, p_dgid, comp_mask, p_list); + pr_rcv_get_port_pair_paths(sa, sa_mad, requester_port, p_src_port, + p_dest_port, p_dgid, p_list); OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ -static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw) -{ - ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - osm_mgrp_t *mgrp; - - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); - - if (!(p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID)) { - OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, - "discard multicast target SA PR with wildcarded MGID"); - return NULL; - } - - mgrp = osm_get_mgrp_by_mgid(sa, &p_pr->dgid); - if (!mgrp) { - char gid_str[INET6_ADDRSTRLEN]; - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: " - "No MC group found for PathRecord destination GID %s\n", - inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, - sizeof gid_str)); - return NULL; - } - - return mgrp; -} - -/********************************************************************** - **********************************************************************/ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, - IN const osm_madw_t * p_madw, + IN const ib_sa_mad_t * sa_mad, IN const osm_mgrp_t * p_mgrp) { - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - ib_net64_t comp_mask; + const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad); + ib_net64_t comp_mask = sa_mad->comp_mask; const osm_port_t *port; ib_api_status_t status = IB_ERROR; uint32_t flow_label; - uint8_t sl; - uint8_t hop_limit; + uint8_t sl, hop_limit; OSM_LOG_ENTER(sa->p_log); - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); - - comp_mask = p_sa_mad->comp_mask; - - /* check that MLID of the MC group matchs the PathRecord DLID */ + /* check that MLID of the MC group matches the PathRecord DLID */ if ((comp_mask & IB_PR_COMPMASK_DLID) && p_mgrp->mlid != p_pr->dlid) goto Exit; @@ -1482,109 +1410,127 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, } /* Also, MTU, rate, packet lifetime, and raw traffic requested are not currently checked */ - if (comp_mask & IB_PR_COMPMASK_PKEY) { - if (p_pr->pkey != p_mgrp->mcmember_rec.pkey) - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_PKEY) && + p_pr->pkey != p_mgrp->mcmember_rec.pkey) + goto Exit; ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop, &sl, &flow_label, &hop_limit); - if (comp_mask & IB_PR_COMPMASK_SL) { - if (ib_path_rec_sl(p_pr) != sl) - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_SL) && ib_path_rec_sl(p_pr) != sl) + goto Exit; /* If SubnAdmGet, assume NumbPaths of 1 (1.2 erratum) */ if ((comp_mask & IB_PR_COMPMASK_NUMBPATH) && - (p_sa_mad->method != IB_MAD_METHOD_GET)) { - if (ib_path_rec_num_path(p_pr) == 0) - goto Exit; - } + sa_mad->method != IB_MAD_METHOD_GET && + ib_path_rec_num_path(p_pr) == 0) + goto Exit; - if (comp_mask & IB_PR_COMPMASK_FLOWLABEL) { - if (ib_path_rec_flow_lbl(p_pr) != flow_label) - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_FLOWLABEL) && + ib_path_rec_flow_lbl(p_pr) != flow_label) + goto Exit; - if (comp_mask & IB_PR_COMPMASK_HOPLIMIT) { - if (ib_path_rec_hop_limit(p_pr) != hop_limit) - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_HOPLIMIT) && + ib_path_rec_hop_limit(p_pr) != hop_limit) + goto Exit; - if (comp_mask & IB_PR_COMPMASK_TCLASS) { - if (p_pr->tclass != p_mgrp->mcmember_rec.tclass) - goto Exit; - } + if ((comp_mask & IB_PR_COMPMASK_TCLASS) && + p_pr->tclass != p_mgrp->mcmember_rec.tclass) + goto Exit; status = IB_SUCCESS; Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ -static int pr_rcv_check_mcast_dest(osm_sa_t * sa, IN const osm_madw_t * p_madw) +static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad, + cl_qlist_t *list) { - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - ib_net64_t comp_mask; - int is_multicast = 0; - - OSM_LOG_ENTER(sa->p_log); + ib_path_rec_t *pr = ib_sa_mad_get_payload_ptr(sa_mad); + osm_mgrp_t *mgrp; + ib_api_status_t status; + osm_pr_item_t *pr_item; + uint32_t flow_label; + uint8_t sl, hop_limit; - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n"); - comp_mask = p_sa_mad->comp_mask; + mgrp = osm_get_mgrp_by_mgid(sa->p_subn, &pr->dgid); + if (!mgrp) { + char gid_str[INET6_ADDRSTRLEN]; + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: " + "No MC group found for PathRecord destination GID %s\n", + inet_ntop(AF_INET6, pr->dgid.raw, gid_str, + sizeof gid_str)); + return; + } - if (comp_mask & IB_PR_COMPMASK_DGID) { - is_multicast = ib_gid_is_multicast(&p_pr->dgid); - if (!is_multicast) - goto Exit; + /* Make sure the rest of the PathRecord matches the MC group attributes */ + status = pr_match_mgrp_attributes(sa, sa_mad, mgrp); + if (status != IB_SUCCESS) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F19: " + "MC group attributes don't match PathRecord request\n"); + return; } - if (comp_mask & IB_PR_COMPMASK_DLID) { - if (cl_ntoh16(p_pr->dlid) >= IB_LID_MCAST_START_HO && - cl_ntoh16(p_pr->dlid) <= IB_LID_MCAST_END_HO) - is_multicast = 1; - else if (is_multicast) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F12: " - "PathRecord request indicates MGID but not MLID\n"); - is_multicast = -1; - } + pr_item = malloc(sizeof(*pr_item)); + if (pr_item == NULL) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: " + "Unable to allocate path record for MC group\n"); + return; } + memset(pr_item, 0, sizeof(*pr_item)); -Exit: - OSM_LOG_EXIT(sa->p_log); - return (is_multicast); + /* Copy PathRecord request into response */ + pr_item->path_rec = *pr; + + /* Now, use the MC info to cruft up the PathRecord response */ + pr_item->path_rec.dgid = mgrp->mcmember_rec.mgid; + pr_item->path_rec.dlid = mgrp->mcmember_rec.mlid; + pr_item->path_rec.tclass = mgrp->mcmember_rec.tclass; + pr_item->path_rec.num_path = 1; + pr_item->path_rec.pkey = mgrp->mcmember_rec.pkey; + + /* MTU, rate, and packet lifetime should be exactly */ + pr_item->path_rec.mtu = (2 << 6) | mgrp->mcmember_rec.mtu; + pr_item->path_rec.rate = (2 << 6) | mgrp->mcmember_rec.rate; + pr_item->path_rec.pkt_life = (2 << 6) | mgrp->mcmember_rec.pkt_life; + + /* SL, Hop Limit, and Flow Label */ + ib_member_get_sl_flow_hop(mgrp->mcmember_rec.sl_flow_hop, + &sl, &flow_label, &hop_limit); + ib_path_rec_set_sl(&pr_item->path_rec, sl); + ib_path_rec_set_qos_class(&pr_item->path_rec, 0); + + /* HopLimit is not yet set in non link local MC groups */ + /* If it were, this would not be needed */ + if (ib_mgid_get_scope(&mgrp->mcmember_rec.mgid) != + IB_MC_SCOPE_LINK_LOCAL) + hop_limit = IB_HOPLIMIT_MAX; + + pr_item->path_rec.hop_flow_raw = + cl_hton32(hop_limit) | (flow_label << 8); + + cl_qlist_insert_tail(list, &pr_item->list_item); } -/********************************************************************** - **********************************************************************/ void osm_pr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; osm_madw_t *p_madw = data; - const ib_path_rec_t *p_pr; - const ib_sa_mad_t *p_sa_mad; - const osm_port_t *p_src_port; - const osm_port_t *p_dest_port; + const ib_sa_mad_t *p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); + ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); cl_qlist_t pr_list; - ib_gid_t dgid; - ib_net16_t sa_status; + const ib_gid_t *p_dgid = NULL; + const osm_port_t *p_src_port, *p_dest_port; osm_port_t *requester_port; - int ret; OSM_LOG_ENTER(sa->p_log); CL_ASSERT(p_madw); - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); - CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD); /* we only support SubnAdmGet and SubnAdmGetTable methods */ @@ -1619,120 +1565,39 @@ void osm_pr_rcv_process(IN void *context, IN void *data) cl_plock_acquire(sa->p_lock); /* Handle multicast destinations separately */ - if ((ret = pr_rcv_check_mcast_dest(sa, p_madw)) < 0) { - /* Multicast DGID with unicast DLID */ - cl_plock_release(sa->p_lock); - osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_INVALID_FIELD); - goto Exit; + if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID) && + ib_gid_is_multicast(&p_pr->dgid)) { + pr_process_multicast(sa, p_sa_mad, &pr_list); + goto Unlock; } - if (ret > 0) - goto McastDest; - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n"); - sa_status = pr_rcv_get_end_points(sa, p_madw, &p_src_port, &p_dest_port, - &dgid); - - if (sa_status == IB_SA_MAD_STATUS_SUCCESS) { - /* - What happens next depends on the type of endpoint information - that was specified.... - */ - if (p_src_port) { - if (p_dest_port) - pr_rcv_process_pair(sa, p_madw, requester_port, - p_src_port, p_dest_port, - &dgid, p_sa_mad->comp_mask, - &pr_list); - else - pr_rcv_process_half(sa, p_madw, requester_port, - p_src_port, NULL, &dgid, - p_sa_mad->comp_mask, - &pr_list); - } else { - if (p_dest_port) - pr_rcv_process_half(sa, p_madw, requester_port, - NULL, p_dest_port, &dgid, - p_sa_mad->comp_mask, - &pr_list); - else - /* - Katie, bar the door! - */ - pr_rcv_process_world(sa, p_madw, requester_port, - &dgid, p_sa_mad->comp_mask, - &pr_list); - } - } - goto Unlock; - -McastDest: - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Multicast destination requested\n"); - { - osm_mgrp_t *p_mgrp = NULL; - ib_api_status_t status; - osm_pr_item_t *p_pr_item; - uint32_t flow_label; - uint8_t sl; - uint8_t hop_limit; - - /* First, get the MC info */ - p_mgrp = pr_get_mgrp(sa, p_madw); - if (!p_mgrp) - goto Unlock; - - /* Make sure the rest of the PathRecord matches the MC group attributes */ - status = pr_match_mgrp_attributes(sa, p_madw, p_mgrp); - if (status != IB_SUCCESS) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F19: " - "MC group attributes don't match PathRecord request\n"); - goto Unlock; - } - - p_pr_item = malloc(sizeof(*p_pr_item)); - if (p_pr_item == NULL) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: " - "Unable to allocate path record for MC group\n"); - goto Unlock; - } - memset(p_pr_item, 0, sizeof(*p_pr_item)); - - /* Copy PathRecord request into response */ - p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) - ib_sa_mad_get_payload_ptr(p_sa_mad); - p_pr_item->path_rec = *p_pr; - - /* Now, use the MC info to cruft up the PathRecord response */ - p_pr_item->path_rec.dgid = p_mgrp->mcmember_rec.mgid; - p_pr_item->path_rec.dlid = p_mgrp->mcmember_rec.mlid; - p_pr_item->path_rec.tclass = p_mgrp->mcmember_rec.tclass; - p_pr_item->path_rec.num_path = 1; - p_pr_item->path_rec.pkey = p_mgrp->mcmember_rec.pkey; - - /* MTU, rate, and packet lifetime should be exactly */ - p_pr_item->path_rec.mtu = (2 << 6) | p_mgrp->mcmember_rec.mtu; - p_pr_item->path_rec.rate = (2 << 6) | p_mgrp->mcmember_rec.rate; - p_pr_item->path_rec.pkt_life = - (2 << 6) | p_mgrp->mcmember_rec.pkt_life; - - /* SL, Hop Limit, and Flow Label */ - ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop, - &sl, &flow_label, &hop_limit); - ib_path_rec_set_sl(&p_pr_item->path_rec, sl); - ib_path_rec_set_qos_class(&p_pr_item->path_rec, 0); - - /* HopLimit is not yet set in non link local MC groups */ - /* If it were, this would not be needed */ - if (ib_mgid_get_scope(&p_mgrp->mcmember_rec.mgid) != - IB_MC_SCOPE_LINK_LOCAL) - hop_limit = IB_HOPLIMIT_MAX; - - p_pr_item->path_rec.hop_flow_raw = - cl_hton32(hop_limit) | (flow_label << 8); - - cl_qlist_insert_tail(&pr_list, &p_pr_item->list_item); + if (pr_rcv_get_end_points(sa, p_sa_mad, &p_src_port, &p_dest_port, + &p_dgid) != IB_SA_MAD_STATUS_SUCCESS) + goto Unlock; + /* + What happens next depends on the type of endpoint information + that was specified.... + */ + if (p_src_port) { + if (p_dest_port) + pr_rcv_process_pair(sa, p_sa_mad, requester_port, + p_src_port, p_dest_port, p_dgid, + &pr_list); + else + pr_rcv_process_half(sa, p_sa_mad, requester_port, + p_src_port, NULL, p_dgid, &pr_list); + } else { + if (p_dest_port) + pr_rcv_process_half(sa, p_sa_mad, requester_port, + NULL, p_dest_port, p_dgid, &pr_list); + else + /* + Katie, bar the door! + */ + pr_rcv_process_world(sa, p_sa_mad, requester_port, + p_dgid, &pr_list); } Unlock: diff --git a/branches/opensm_3/user/opensm/osm_sa_pkey_record.c b/branches/opensm_3/user/opensm/osm_sa_pkey_record.c index 3314a84a..0bbc7f53 100644 --- a/branches/opensm_3/user/opensm/osm_sa_pkey_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_pkey_record.c @@ -64,8 +64,6 @@ typedef struct osm_pkey_search_ctxt { const osm_physp_t *p_req_physp; } osm_pkey_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static void sa_pkey_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp, IN osm_pkey_search_ctxt_t * p_ctxt, IN uint16_t block) @@ -109,8 +107,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_pkey_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp, osm_pkey_search_ctxt_t * p_ctxt) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void sa_pkey_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port, osm_pkey_search_ctxt_t * p_ctxt) { @@ -201,8 +195,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_pkey_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_port_t *p_port = (osm_port_t *) p_map_item; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; @@ -223,7 +213,6 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data) const ib_pkey_table_t *p_pkey; cl_qlist_t rec_list; osm_pkey_search_ctxt_t context; - ib_api_status_t status = IB_SUCCESS; ib_net64_t comp_mask; osm_physp_t *p_req_physp; @@ -301,23 +290,15 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data) */ if (comp_mask & IB_PKEY_COMPMASK_LID) { p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid); - if (!p_port) { - status = IB_NOT_FOUND; + if (!p_port) OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 460B: " "No port found with LID %u\n", cl_ntoh16(p_rcvd_rec->lid)); - } - } - - if (status == IB_SUCCESS) { - /* if we got a unique port - no need for a port search */ - if (p_port) - /* this does the loop on all the port phys ports */ - sa_pkey_by_comp_mask(sa, p_port, &context); else - cl_qmap_apply_func(&sa->p_subn->port_guid_tbl, - sa_pkey_by_comp_mask_cb, &context); - } + sa_pkey_by_comp_mask(sa, p_port, &context); + } else + cl_qmap_apply_func(&sa->p_subn->port_guid_tbl, + sa_pkey_by_comp_mask_cb, &context); cl_plock_release(sa->p_lock); diff --git a/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c b/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c index 95898bae..8702d6bd 100644 --- a/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_portinfo_record.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -72,8 +72,6 @@ typedef struct osm_pir_search_ctxt { boolean_t is_enhanced_comp_mask; } osm_pir_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa, IN const osm_physp_t * p_physp, IN cl_qlist_t * p_list, @@ -108,11 +106,9 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void sa_pir_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp, IN osm_pir_search_ctxt_t * p_ctxt) { @@ -157,8 +153,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_pir_check_physp(IN osm_sa_t * sa, IN const osm_physp_t * p_physp, osm_pir_search_ctxt_t * p_ctxt) { @@ -385,8 +379,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_pir_by_comp_mask(IN osm_sa_t * sa, IN osm_node_t * p_node, osm_pir_search_ctxt_t * p_ctxt) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void sa_pir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt) { osm_node_t *p_node = (osm_node_t *) p_map_item; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_pir_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; osm_madw_t *p_madw = data; const ib_sa_mad_t *p_rcvd_mad; const ib_portinfo_record_t *p_rcvd_rec; - const cl_ptr_vector_t *p_tbl; const osm_port_t *p_port = NULL; const ib_port_info_t *p_pi; cl_qlist_t rec_list; osm_pir_search_ctxt_t context; - ib_api_status_t status = IB_SUCCESS; ib_net64_t comp_mask; osm_physp_t *p_req_physp; @@ -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)) osm_dump_portinfo_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG); - p_tbl = &sa->p_subn->port_lid_tbl; p_pi = &p_rcvd_rec->port_info; cl_qlist_init(&rec_list); @@ -514,41 +499,21 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data) cl_plock_acquire(sa->p_lock); - CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000); - /* If the user specified a LID, it obviously narrows our work load, since we don't have to search every port */ - if (comp_mask & IB_PIR_COMPMASK_LID) { + if (comp_mask & (IB_PIR_COMPMASK_LID | IB_PIR_COMPMASK_BASELID)) { p_port = osm_get_port_by_lid(sa->p_subn, p_rcvd_rec->lid); - if (!p_port) { - status = IB_NOT_FOUND; - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2109: " - "No port found with LID %u\n", - cl_ntoh16(p_rcvd_rec->lid)); - } - } else if (comp_mask & IB_PIR_COMPMASK_BASELID) { - if ((uint16_t) cl_ptr_vector_get_size(p_tbl) > - cl_ntoh16(p_pi->base_lid)) - p_port = cl_ptr_vector_get(p_tbl, - cl_ntoh16(p_pi->base_lid)); - else { - status = IB_NOT_FOUND; - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2103: " - "Given LID (%u) is out of range:%u\n", - cl_ntoh16(p_pi->base_lid), - cl_ptr_vector_get_size(p_tbl)); - } - } - - if (status == IB_SUCCESS) { if (p_port) sa_pir_by_comp_mask(sa, p_port->p_node, &context); else - cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, - sa_pir_by_comp_mask_cb, &context); - } + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2109: " + "No port found with LID %u\n", + cl_ntoh16(p_rcvd_rec->lid)); + } else + cl_qmap_apply_func(&sa->p_subn->node_guid_tbl, + sa_pir_by_comp_mask_cb, &context); cl_plock_release(sa->p_lock); diff --git a/branches/opensm_3/user/opensm/osm_sa_service_record.c b/branches/opensm_3/user/opensm/osm_sa_service_record.c index 686429f6..e007e020 100644 --- a/branches/opensm_3/user/opensm/osm_sa_service_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_service_record.c @@ -76,8 +76,6 @@ typedef struct osm_sr_search_ctxt { const osm_physp_t *p_req_physp; } osm_sr_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static boolean_t match_service_pkey_with_ports_pkey(IN osm_sa_t * sa, IN const osm_madw_t * p_madw, @@ -137,8 +135,6 @@ Exit: return valid; } -/********************************************************************** - **********************************************************************/ static boolean_t match_name_to_key_association(IN osm_sa_t * sa, ib_service_record_t * p_service_rec, @@ -158,8 +154,6 @@ match_name_to_key_association(IN osm_sa_t * sa, return TRUE; } -/********************************************************************** - **********************************************************************/ static boolean_t validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * p_madw) { boolean_t valid = TRUE; @@ -196,8 +190,6 @@ Exit: return valid; } -/********************************************************************** - **********************************************************************/ static void sr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw, IN cl_qlist_t * p_list) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void get_matching_sr(IN cl_list_item_t * p_list_item, IN void *context) { osm_sr_search_ctxt_t *p_ctxt = context; @@ -447,8 +437,6 @@ Exit: return; } -/********************************************************************** - **********************************************************************/ static void sr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw) { ib_sa_mad_t *p_sa_mad; @@ -509,8 +497,6 @@ Exit: return; } -/********************************************************************** - **********************************************************************/ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw) { ib_sa_mad_t *p_sa_mad; @@ -613,8 +599,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw) { ib_sa_mad_t *p_sa_mad; @@ -681,8 +665,6 @@ Exit: return; } -/********************************************************************** - **********************************************************************/ void osm_sr_rcv_process(IN void *context, IN void *data) { osm_sa_t *sa = context; @@ -737,8 +719,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sr_rcv_lease_cb(IN void *context) { osm_sa_t *sa = context; diff --git a/branches/opensm_3/user/opensm/osm_sa_slvl_record.c b/branches/opensm_3/user/opensm/osm_sa_slvl_record.c index 44122c98..5dbbb6a9 100644 --- a/branches/opensm_3/user/opensm/osm_sa_slvl_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_slvl_record.c @@ -71,8 +71,6 @@ typedef struct osm_slvl_search_ctxt { const osm_physp_t *p_req_physp; } osm_slvl_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static void sa_slvl_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp, IN osm_slvl_search_ctxt_t * p_ctxt, IN uint8_t in_port_idx) @@ -116,8 +114,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_slvl_by_comp_mask(IN osm_sa_t * sa, IN const osm_port_t * p_port, osm_slvl_search_ctxt_t * p_ctxt) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void sa_slvl_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_port_t *p_port = (osm_port_t *) p_map_item; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c b/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c index 810ff5fb..3b772630 100644 --- a/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_sminfo_record.c @@ -114,8 +114,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ static void sa_smir_by_comp_mask(IN osm_sa_t * sa, IN const osm_remote_sm_t * p_rem_sm, osm_smir_search_ctxt_t * p_ctxt) @@ -153,8 +151,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_smir_by_comp_mask_cb(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_remote_sm_t *p_rem_sm = (osm_remote_sm_t *) p_map_item; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_smir_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c b/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c index 6b901b76..a58c6f59 100644 --- a/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_sw_info_record.c @@ -67,8 +67,6 @@ typedef struct osm_sir_search_ctxt { const osm_physp_t *p_req_physp; } osm_sir_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa, IN const osm_switch_t * p_sw, IN cl_qlist_t * p_list, @@ -99,11 +97,9 @@ static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa, Exit: OSM_LOG_EXIT(sa->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ static void sir_rcv_create_sir(IN osm_sa_t * sa, IN const osm_switch_t * p_sw, IN cl_qlist_t * p_list, IN ib_net16_t match_lid, IN const osm_physp_t * p_req_physp) @@ -166,8 +162,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sir_rcv_by_comp_mask(IN cl_map_item_t * p_map_item, IN void *cxt) { const osm_sir_search_ctxt_t *p_ctxt = cxt; @@ -195,8 +189,6 @@ Exit: OSM_LOG_EXIT(p_ctxt->sa->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sir_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c b/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c index c590650a..92a34d4a 100644 --- a/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c +++ b/branches/opensm_3/user/opensm/osm_sa_vlarb_record.c @@ -71,8 +71,6 @@ typedef struct osm_vl_arb_search_ctxt { const osm_physp_t *p_req_physp; } osm_vl_arb_search_ctxt_t; -/********************************************************************** - **********************************************************************/ static void sa_vl_arb_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp, IN osm_vl_arb_search_ctxt_t * p_ctxt, IN uint8_t block) @@ -115,8 +113,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_vl_arb_check_physp(IN osm_sa_t * sa, IN osm_physp_t * p_physp, osm_vl_arb_search_ctxt_t * p_ctxt) { @@ -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); } -/********************************************************************** - **********************************************************************/ static void sa_vl_arb_by_comp_mask(osm_sa_t * sa, IN const osm_port_t * p_port, osm_vl_arb_search_ctxt_t * p_ctxt) { @@ -203,8 +197,6 @@ Exit: OSM_LOG_EXIT(sa->p_log); } -/********************************************************************** - **********************************************************************/ static void sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * p_map_item, void *cxt) { const osm_port_t *p_port = (osm_port_t *) p_map_item; @@ -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); } -/********************************************************************** - **********************************************************************/ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data) { osm_sa_t *sa = ctx; diff --git a/branches/opensm_3/user/opensm/osm_service.c b/branches/opensm_3/user/opensm/osm_service.c index f6b2c44c..bf7c7522 100644 --- a/branches/opensm_3/user/opensm/osm_service.c +++ b/branches/opensm_3/user/opensm/osm_service.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -46,16 +46,13 @@ #include #include #include +#include -/********************************************************************** - **********************************************************************/ void osm_svcr_delete(IN osm_svcr_t * p_svcr) { free(p_svcr); } -/********************************************************************** - **********************************************************************/ void osm_svcr_init(IN osm_svcr_t * p_svcr, IN const ib_service_record_t * p_svc_rec) { @@ -70,8 +67,6 @@ void osm_svcr_init(IN osm_svcr_t * p_svcr, p_svcr->service_record = *p_svc_rec; } -/********************************************************************** - **********************************************************************/ osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec) { osm_svcr_t *p_svcr; @@ -87,8 +82,6 @@ osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec) return p_svcr; } -/********************************************************************** - **********************************************************************/ static cl_status_t match_rid_of_svc_rec(IN const cl_list_item_t * p_list_item, IN void *context) { @@ -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; } -/********************************************************************** - **********************************************************************/ osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn, IN osm_log_t * p_log, IN ib_service_record_t * p_svc_rec) @@ -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; } -/********************************************************************** - **********************************************************************/ void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, IN osm_svcr_t * p_svcr) { @@ -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"); cl_qlist_insert_head(&p_subn->sa_sr_list, &p_svcr->list_item); + p_subn->p_osm->sa.dirty = TRUE; OSM_LOG_EXIT(p_log); } @@ -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); cl_qlist_remove_item(&p_subn->sa_sr_list, &p_svcr->list_item); + p_subn->p_osm->sa.dirty = TRUE; OSM_LOG_EXIT(p_log); } diff --git a/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c b/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c index bf611213..351bf5bd 100644 --- a/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c +++ b/branches/opensm_3/user/opensm/osm_slvl_map_rcv.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -55,8 +56,6 @@ #include #include -/********************************************************************** - **********************************************************************/ /* * WE ONLY RECEIVE GET or SET responses */ @@ -72,7 +71,9 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data) osm_slvl_context_t *p_context; ib_net64_t port_guid; ib_net64_t node_guid; - uint8_t out_port_num, in_port_num; + uint32_t attr_mod; + uint8_t startinport, endinport, startoutport, endoutport; + uint8_t in_port, out_port; CL_ASSERT(sm); @@ -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); if (!p_port) { - cl_plock_release(sm->p_lock); OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C06: " "No port object for port with GUID 0x%" PRIx64 "\n\t\t\t\tfor parent node GUID 0x%" PRIx64 @@ -107,42 +107,53 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data) /* in case of a non switch node the attr modifier should be ignored */ if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) { - out_port_num = - (uint8_t) cl_ntoh32(p_smp->attr_mod & 0xFF000000); - in_port_num = - (uint8_t) cl_ntoh32((p_smp->attr_mod & 0x00FF0000) << 8); - p_physp = osm_node_get_physp_ptr(p_node, out_port_num); + unsigned num_ports = osm_node_get_num_physp(p_node) - 1; + attr_mod = cl_ntoh32(p_smp->attr_mod); + + if (attr_mod & 0x10000) { + startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; + endoutport = osm_node_get_num_physp(p_node) - 1; + } else + startoutport = endoutport = attr_mod & 0xff; + + if (attr_mod & 0x20000) { + startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1; + endinport = osm_node_get_num_physp(p_node) - 1; + } else + startinport = endinport = (attr_mod >> 8) & 0xff; + + if (startinport > num_ports || startoutport > num_ports) { + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C07" + "Invalid attribute modifier 0x%x received in" + " response from switch 0x%" PRIx64 "\n", + cl_ntoh32(attr_mod), cl_ntoh64(node_guid)); + goto Exit; + } + } else { - p_physp = p_port->p_physp; - out_port_num = p_physp->port_num; - in_port_num = 0; + startoutport = endoutport = p_port->p_physp->port_num; + startinport = endinport = 0; } - /* - We do not care if this is a result of a set or get - - all we want is to update the subnet. - */ - OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Got SLtoVL get response in_port_num %u out_port_num %u with " - "GUID 0x%" PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%" - PRIx64 "\n", in_port_num, out_port_num, cl_ntoh64(port_guid), - cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id)); - - /* - Determine if we encountered a new Physical Port. - If so, Ignore it. - */ - if (!p_physp) { - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "Got invalid port number %u\n", out_port_num); - goto Exit; + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received SLtoVL GetResp" + " in_port_num %u out_port_num %u with GUID 0x%" PRIx64 + " for parent node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n", + startinport == endinport ? startinport : 0xff, + startoutport == endoutport ? startoutport : 0xff, + cl_ntoh64(port_guid), cl_ntoh64(node_guid), + cl_ntoh64(p_smp->trans_id)); + + osm_dump_slvl_map_table(sm->p_log, port_guid, + startinport == endinport ? startinport : 0xff, + startoutport == endoutport ? startoutport : 0xff, + p_slvl_tbl, OSM_LOG_DEBUG); + + for (out_port = startoutport; out_port <= endoutport; out_port++) { + p_physp = osm_node_get_physp_ptr(p_node, out_port); + for (in_port = startinport; in_port <= endinport; in_port++) + osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port); } - osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num, - out_port_num, p_slvl_tbl, OSM_LOG_DEBUG); - - osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num); - Exit: cl_plock_release(sm->p_lock); diff --git a/branches/opensm_3/user/opensm/osm_sm.c b/branches/opensm_3/user/opensm/osm_sm.c index a3460062..9687f0e6 100644 --- a/branches/opensm_3/user/opensm/osm_sm.c +++ b/branches/opensm_3/user/opensm/osm_sm.c @@ -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); extern void osm_sm_state_mgr_polling_callback(IN void *context); -/********************************************************************** - **********************************************************************/ static void sm_process(osm_sm_t * sm, osm_signal_t signal) { #ifdef ENABLE_OSM_PERF_MGR @@ -151,8 +149,6 @@ static void sweep_fail_process(IN void *context, IN void *p_data) sm->p_subn->force_heavy_sweep = TRUE; } -/********************************************************************** - **********************************************************************/ void osm_sm_construct(IN osm_sm_t * p_sm) { memset(p_sm, 0, sizeof(*p_sm)); @@ -170,8 +166,6 @@ void osm_sm_construct(IN osm_sm_t * p_sm) osm_ucast_mgr_construct(&p_sm->ucast_mgr); } -/********************************************************************** - **********************************************************************/ void osm_sm_shutdown(IN osm_sm_t * p_sm) { boolean_t signal_event = FALSE; @@ -219,8 +213,6 @@ void osm_sm_shutdown(IN osm_sm_t * p_sm) OSM_LOG_EXIT(p_sm->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sm_destroy(IN osm_sm_t * p_sm) { OSM_LOG_ENTER(p_sm->p_log); @@ -239,8 +231,6 @@ void osm_sm_destroy(IN osm_sm_t * p_sm) OSM_LOG_EXIT(p_sm->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn, IN osm_db_t * p_db, IN osm_vendor_t * p_vendor, IN osm_mad_pool_t * p_mad_pool, @@ -396,11 +386,9 @@ ib_api_status_t osm_sm_init(IN osm_sm_t * p_sm, IN osm_subn_t * p_subn, Exit: OSM_LOG_EXIT(p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal) { cl_spinlock_acquire(&p_sm->signal_lock); @@ -409,8 +397,6 @@ void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal) cl_spinlock_release(&p_sm->signal_lock); } -/********************************************************************** - **********************************************************************/ void osm_sm_sweep(IN osm_sm_t * p_sm) { OSM_LOG_ENTER(p_sm->p_log); @@ -418,8 +404,6 @@ void osm_sm_sweep(IN osm_sm_t * p_sm) OSM_LOG_EXIT(p_sm->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid) { ib_api_status_t status; @@ -437,11 +421,9 @@ ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid) Exit: OSM_LOG_EXIT(p_sm->p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ void osm_sm_reroute_mlid(osm_sm_t * sm, ib_net16_t mlid) { mlid = cl_ntoh16(mlid) - IB_LID_MCAST_START_HO; diff --git a/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c b/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c index c059b5f0..a74f11ed 100644 --- a/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c +++ b/branches/opensm_3/user/opensm/osm_sm_mad_ctrl.c @@ -3,6 +3,7 @@ * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -257,12 +258,10 @@ static void sm_mad_ctrl_process_get_resp(IN osm_sm_mad_ctrl_t * p_ctrl, "Unsupported attribute 0x%X\n", cl_ntoh16(p_smp->attr_id)); osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); + osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); goto Exit; } - if (msg_id == CL_DISP_MSGID_NONE) - goto Exit; - /* Post this MAD to the dispatcher for asynchronous processing by the appropriate controller. @@ -319,14 +318,6 @@ static void sm_mad_ctrl_process_get(IN osm_sm_mad_ctrl_t * p_ctrl, OSM_LOG(p_ctrl->p_log, OSM_LOG_VERBOSE, "Ignoring SubnGet MAD - unsupported attribute 0x%X\n", cl_ntoh16(p_smp->attr_id)); - break; - } - - if (msg_id == CL_DISP_MSGID_NONE) { - /* - There is an unknown MAD attribute type for which there is - no recipient. Simply retire the MAD here. - */ osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); goto Exit; } @@ -397,14 +388,6 @@ static void sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * p_ctrl, "Unsupported attribute 0x%X\n", cl_ntoh16(p_smp->attr_id)); osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); - break; - } - - if (msg_id == CL_DISP_MSGID_NONE) { - /* - There is an unknown MAD attribute type for which there is - no recipient. Simply retire the MAD here. - */ osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); goto Exit; } @@ -484,14 +467,6 @@ static void sm_mad_ctrl_process_trap(IN osm_sm_mad_ctrl_t * p_ctrl, "Unsupported attribute 0x%X\n", cl_ntoh16(p_smp->attr_id)); osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); - break; - } - - if (msg_id == CL_DISP_MSGID_NONE) { - /* - There is an unknown MAD attribute type for which there is - no recipient. Simply retire the MAD here. - */ osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); goto Exit; } @@ -552,6 +527,7 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl, */ switch (p_smp->attr_id) { case IB_MAD_ATTR_NOTICE: + sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw); break; default: cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown); @@ -559,14 +535,42 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl, "Unsupported attribute 0x%X\n", cl_ntoh16(p_smp->attr_id)); osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); + osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); break; } - osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); - OSM_LOG_EXIT(p_ctrl->p_log); } +static void log_rcv_cb_error(osm_log_t *p_log, ib_smp_t *p_smp, ib_net16_t status) +{ + char buf[BUF_SIZE]; + uint32_t i; + + if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) { + char ipath[BUF_SIZE], rpath[BUF_SIZE]; + int ni = sprintf(ipath, "%d", p_smp->initial_path[0]); + int nr = sprintf(rpath, "%d", p_smp->return_path[0]); + for (i = 1; i <= p_smp->hop_count; i++) { + ni += sprintf(ipath + ni, ",%d", p_smp->initial_path[i]); + nr += sprintf(rpath + nr, ",%d", p_smp->return_path[i]); + } + snprintf(buf, sizeof(buf), + "\n\t\t\tInitial path: %s Return path: %s", + ipath, rpath); + } + + OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 3111: " + "Received MAD with error status = 0x%X\n" + "\t\t\t%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "%s\n", + cl_ntoh16(status), ib_get_sm_method_str(p_smp->method), + ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod), + cl_ntoh64(p_smp->trans_id), + p_smp->mgmt_class == IB_MCLASS_SUBN_DIR ? buf : ""); + + osm_dump_dr_smp(p_log, p_smp, OSM_LOG_VERBOSE); +} + /* * PARAMETERS * @@ -635,11 +639,8 @@ static void sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, else status = p_smp->status; - if (status != 0) { - OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3111: " - "Error status = 0x%X\n", cl_ntoh16(status)); - osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); - } + if (status != 0) + log_rcv_cb_error(p_ctrl->p_log, p_smp, status); switch (p_smp->method) { case IB_MAD_METHOD_GET_RESP: @@ -708,9 +709,14 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw) CL_ASSERT(p_madw); + p_smp = osm_madw_get_smp_ptr(p_madw); OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3113: " - "MAD completed in error (%s)\n", - ib_get_err_str(p_madw->status)); + "MAD completed in error (%s): " + "%s(%s), attr_mod 0x%x, TID 0x%" PRIx64 "\n", + ib_get_err_str(p_madw->status), + ib_get_sm_method_str(p_smp->method), + ib_get_sm_attr_str(p_smp->attr_id), cl_ntoh32(p_smp->attr_mod), + cl_ntoh64(p_smp->trans_id)); /* If this was a SubnSet MAD, then this error might indicate a problem @@ -718,15 +724,12 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw) such a problem. The subnet will not be up, and the next sweep should be a heavy sweep as well. */ - p_smp = osm_madw_get_smp_ptr(p_madw); if (p_smp->method == IB_MAD_METHOD_SET && (p_smp->attr_id == IB_MAD_ATTR_PORT_INFO || p_smp->attr_id == IB_MAD_ATTR_MCAST_FWD_TBL || p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO || p_smp->attr_id == IB_MAD_ATTR_LIN_FWD_TBL || - p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE || - p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE || - p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION)) { + p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE)) { OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3119: " "Set method failed for attribute 0x%X (%s)\n", cl_ntoh16(p_smp->attr_id), @@ -734,6 +737,8 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw) p_ctrl->p_subn->subnet_initialization_error = TRUE; } + osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_VERBOSE); + /* Since we did not get any response we suspect the DR path used for the target port. @@ -764,10 +769,6 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw) An error occurred. No response was received to a request MAD. Retire the original request MAD. */ - - osm_dump_dr_smp(p_ctrl->p_log, osm_madw_get_smp_ptr(p_madw), - OSM_LOG_ERROR); - sm_mad_ctrl_update_wire_stats(p_ctrl); if (osm_madw_get_err_msg(p_madw) != CL_DISP_MSGID_NONE) { @@ -801,8 +802,6 @@ static void sm_mad_ctrl_send_err_cb(IN void *context, IN osm_madw_t * p_madw) * SEE ALSO *********/ -/********************************************************************** - **********************************************************************/ void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl) { CL_ASSERT(p_ctrl); @@ -810,8 +809,6 @@ void osm_sm_mad_ctrl_construct(IN osm_sm_mad_ctrl_t * p_ctrl) p_ctrl->h_disp = CL_DISP_INVALID_HANDLE; } -/********************************************************************** - **********************************************************************/ void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl) { CL_ASSERT(p_ctrl); @@ -821,8 +818,6 @@ void osm_sm_mad_ctrl_destroy(IN osm_sm_mad_ctrl_t * p_ctrl) cl_disp_unregister(p_ctrl->h_disp); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_mad_ctrl_init(IN osm_sm_mad_ctrl_t * p_ctrl, IN osm_subn_t * p_subn, IN osm_mad_pool_t * p_mad_pool, @@ -863,8 +858,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_mad_ctrl_bind(IN osm_sm_mad_ctrl_t * p_ctrl, IN ib_net64_t port_guid) { diff --git a/branches/opensm_3/user/opensm/osm_sm_state_mgr.c b/branches/opensm_3/user/opensm/osm_sm_state_mgr.c index db148d49..a8acd3d2 100644 --- a/branches/opensm_3/user/opensm/osm_sm_state_mgr.c +++ b/branches/opensm_3/user/opensm/osm_sm_state_mgr.c @@ -61,8 +61,6 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_report_sm_state(osm_sm_t * sm) { char buf[64]; @@ -73,8 +71,6 @@ void osm_report_sm_state(osm_sm_t * sm) OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf); } -/********************************************************************** - **********************************************************************/ static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm) { osm_madw_context_t context; @@ -124,8 +120,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void sm_state_mgr_start_polling(osm_sm_t * sm) { uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout; @@ -156,8 +150,6 @@ static void sm_state_mgr_start_polling(osm_sm_t * sm) OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sm_state_mgr_polling_callback(IN void *context) { osm_sm_t *sm = context; @@ -221,8 +213,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void sm_state_mgr_signal_error(osm_sm_t * sm, IN osm_sm_signal_t signal) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3207: " @@ -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)); } -/********************************************************************** - **********************************************************************/ void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm) { OSM_LOG_ENTER(sm->p_log); @@ -240,8 +228,6 @@ void osm_sm_state_mgr_signal_master_is_alive(osm_sm_t * sm) OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm, IN osm_sm_signal_t signal) { @@ -464,8 +450,6 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm, return status; } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_sm_state_mgr_check_legality(osm_sm_t * sm, IN osm_sm_signal_t signal) { diff --git a/branches/opensm_3/user/opensm/osm_sminfo_rcv.c b/branches/opensm_3/user/opensm/osm_sminfo_rcv.c index 97a90f5b..48d801f3 100755 --- a/branches/opensm_3/user/opensm/osm_sminfo_rcv.c +++ b/branches/opensm_3/user/opensm/osm_sminfo_rcv.c @@ -74,8 +74,6 @@ static boolean_t smi_rcv_remote_sm_is_higher(IN osm_sm_t * sm, } -/********************************************************************** - **********************************************************************/ static void smi_rcv_process_get_request(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) { @@ -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; } -/********************************************************************** - **********************************************************************/ static void smi_rcv_process_set_request(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) { @@ -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); if (status != IB_SUCCESS) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F07: " - "Failed check of legality of needed SM transition. AttributeModifier:0x%X RemoteState:%s\n", + "Failed check of legality of needed SM transition. " + "AttributeModifier:0x%X RemoteState:%s\n", p_smp->attr_mod, osm_get_sm_mgr_state_str(ib_sminfo_get_state(sm_smi))); status = osm_resp_send(sm, p_madw, 7, payload); @@ -299,8 +296,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static int smi_rcv_process_get_sm(IN osm_sm_t * sm, IN const osm_remote_sm_t * p_sm, boolean_t light_sweep) @@ -416,8 +411,6 @@ static int smi_rcv_process_get_sm(IN osm_sm_t * sm, return 0; } -/********************************************************************** - **********************************************************************/ static void smi_rcv_process_get_response(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) { @@ -511,8 +504,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ static void smi_rcv_process_set_response(IN osm_sm_t * sm, IN const osm_madw_t * p_madw) { @@ -548,8 +539,6 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ void osm_sminfo_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_state_mgr.c b/branches/opensm_3/user/opensm/osm_state_mgr.c index d8c5509d..8eace476 100644 --- a/branches/opensm_3/user/opensm/osm_state_mgr.c +++ b/branches/opensm_3/user/opensm/osm_state_mgr.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. @@ -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); extern int osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state); -/********************************************************************** - **********************************************************************/ static void state_mgr_up_msg(IN const osm_sm_t * sm) { /* @@ -88,8 +87,6 @@ static void state_mgr_up_msg(IN const osm_sm_t * sm) "SUBNET UP" : "SUBNET UP (sweep disabled)"); } -/********************************************************************** - **********************************************************************/ static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item, IN void *context) { @@ -98,8 +95,6 @@ static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item, p_node->discovery_count = 0; } -/********************************************************************** - **********************************************************************/ static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item, IN void *context) { @@ -108,8 +103,6 @@ static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item, p_port->discovery_count = 0; } -/********************************************************************** - **********************************************************************/ static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item, IN void *context) { @@ -118,8 +111,6 @@ static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item, p_sw->need_update = 1; } -/********************************************************************** - **********************************************************************/ static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context) { osm_node_t *p_node; @@ -143,10 +134,10 @@ static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context) status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0, OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context); - if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3304: " - "Request for SwitchInfo failed\n"); + "Request for SwitchInfo failed (%s)\n", + ib_get_err_str(status)); OSM_LOG_EXIT(sm->p_log); } @@ -184,15 +175,14 @@ static void state_mgr_get_remote_port_info(IN osm_sm_t * sm, mad_context.pi_context.light_sweep = TRUE; mad_context.pi_context.active_transition = FALSE; - /* note that with some negative logic - if the query failed it means that - * there is no point in going to heavy sweep */ - status = osm_req_get(sm, &rem_node_dr_path, - IB_MAD_ATTR_PORT_INFO, 0, CL_DISP_MSGID_NONE, - &mad_context); - + /* note that with some negative logic - if the query failed it means + * that there is no point in going to heavy sweep */ + status = osm_req_get(sm, &rem_node_dr_path, IB_MAD_ATTR_PORT_INFO, 0, + CL_DISP_MSGID_NONE, &mad_context); if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332E: " - "Request for PortInfo failed\n"); + "Request for PortInfo failed (%s)\n", + ib_get_err_str(status)); Exit: OSM_LOG_EXIT(sm->p_log); @@ -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); status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0, CL_DISP_MSGID_NONE, NULL); - if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3305: " - "Request for NodeInfo failed\n"); + "Request for NodeInfo failed (%s)\n", + ib_get_err_str(status)); } else { OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "No bound ports. Deferring sweep...\n"); @@ -451,19 +441,20 @@ static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm) CL_DISP_MSGID_NONE, &context); if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3311: " - "Request for NodeInfo failed\n"); + "Request for NodeInfo failed (%s)\n", + ib_get_err_str(status)); break; case IB_NODE_TYPE_SWITCH: - /* Need to go over all the ports of the switch, and send a node_info - * from them. This doesn't include the port 0 of the switch, which - * hosts the SM. - * Note: We'll send another switchInfo on port 0, since if no ports - * are connected, we still want to get some response, and have the - * subnet come up. + /* Need to go over all the ports of the switch, and send a + * node_info from them. This doesn't include the port 0 of the + * switch, which hosts the SM. + * Note: We'll send another switchInfo on port 0, since if no + * ports are connected, we still want to get some response, and + * have the subnet come up. */ num_ports = osm_node_get_num_physp(p_node); - for (port_num = 0; port_num < num_ports; port_num++) { + for (port_num = 1; port_num < num_ports; port_num++) { /* go through the port only if the port is not DOWN */ p_ext_physp = osm_node_get_physp_ptr(p_node, port_num); if (p_ext_physp && ib_port_info_get_port_state @@ -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, CL_DISP_MSGID_NONE, &context); - if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3312: " - "Request for NodeInfo failed\n"); + "Request for NodeInfo failed (%s)\n", + ib_get_err_str(status)); } } break; @@ -506,11 +497,14 @@ static void query_sm_info(cl_map_item_t * item, void *cxt) #ifndef __WIN__ osm_remote_sm_t *r_sm = cl_item_obj(item, r_sm, map_item); #else - osm_remote_sm_t *r_sm = cl_item_obj(item, r_sm, map_item,(osm_remote_sm_t *)); + osm_remote_sm_t *r_sm=NULL; #endif osm_sm_t *sm = cxt; ib_api_status_t ret; +#ifdef __WIN__ + r_sm = cl_item_obj(item, r_sm, map_item); +#endif context.smi_context.port_guid = r_sm->p_port->guid; context.smi_context.set_method = FALSE; context.smi_context.light_sweep = TRUE; @@ -523,11 +517,7 @@ static void query_sm_info(cl_map_item_t * item, void *cxt) ib_get_err_str(ret)); } -/********************************************************************** - During a light sweep, check each node to see if the node description - is valid and if not issue a ND query. -**********************************************************************/ -static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) +static void state_mgr_update_node_desc(IN cl_map_item_t * obj, IN void *context) { osm_madw_context_t mad_context; osm_node_t *p_node = (osm_node_t *) obj; @@ -540,14 +530,8 @@ static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) CL_ASSERT(p_node); - if (p_node->print_desc - && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN)) - /* if ND is valid, do nothing */ - goto exit; - - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "ERR 3319: Unknown node description for node GUID " - "0x%016" PRIx64 ". Reissuing ND query\n", + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, + "Updating NodeDesc for 0x%016" PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node))); /* get a physp to request from. */ @@ -576,6 +560,43 @@ exit: OSM_LOG_EXIT(sm->p_log); } +void osm_update_node_desc(IN osm_opensm_t *osm) +{ + CL_PLOCK_ACQUIRE(&osm->lock); + cl_qmap_apply_func(&osm->subn.node_guid_tbl, state_mgr_update_node_desc, + &osm->sm); + CL_PLOCK_RELEASE(&osm->lock); +} + +/********************************************************************** + During a light sweep, check each node to see if the node description + is valid and if not issue a ND query. +**********************************************************************/ +static void state_mgr_get_node_desc(IN cl_map_item_t * obj, IN void *context) +{ + osm_node_t *p_node = (osm_node_t *) obj; + osm_sm_t *sm = context; + + OSM_LOG_ENTER(sm->p_log); + + CL_ASSERT(p_node); + + if (p_node->print_desc + && strcmp(p_node->print_desc, OSM_NODE_DESC_UNKNOWN)) + /* if ND is valid, do nothing */ + goto exit; + + OSM_LOG(sm->p_log, OSM_LOG_ERROR, + "ERR 3319: Unknown node description for node GUID " + "0x%016" PRIx64 ". Reissuing ND query\n", + cl_ntoh64(osm_node_get_node_guid(p_node))); + + state_mgr_update_node_desc(obj, context); + +exit: + OSM_LOG_EXIT(sm->p_log); +} + /********************************************************************** Initiates a lightweight sweep of the subnet. Used during normal sweeps after the subnet is up. @@ -631,7 +652,7 @@ static ib_api_status_t state_mgr_light_sweep_start(IN osm_sm_t * sm) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3315: " "Unknown remote side for node 0x%016" PRIx64 - "(%s) port %u. Adding to light sweep sampling list\n", + " (%s) port %u. Adding to light sweep sampling list\n", cl_ntoh64(osm_node_get_node_guid (p_node)), p_node->print_desc, port_num); @@ -848,7 +869,7 @@ static void state_mgr_report_new_ports(IN osm_sm_t * sm) /* details of the notice */ notice.generic_type = 0x83; /* is generic subn mgt type */ ib_notice_set_prod_type_ho(¬ice, 4); /* A Class Manager generator */ - /* endport becomes to be reachable */ + /* endport becomes reachable */ notice.g_or_v.generic.trap_num = CL_HTON16(64); /* The sm_base_lid is saved in network order already. */ notice.issuer_lid = sm->p_subn->sm_base_lid; @@ -875,7 +896,7 @@ static void state_mgr_report_new_ports(IN osm_sm_t * sm) osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho); OSM_LOG(sm->p_log, OSM_LOG_INFO, "Discovered new port with GUID:0x%016" PRIx64 - " LID range [%u,%u] of node:%s\n", + " LID range [%u,%u] of node: %s\n", cl_ntoh64(port_gid.unicast.interface_id), min_lid_ho, max_lid_ho, p_port->p_node ? p_port->p_node-> @@ -1017,16 +1038,15 @@ static void cleanup_switch(cl_map_item_t * item, void *log) if (memcmp(sw->lft, sw->new_lft, sw->max_lid_ho + 1)) osm_log(log, OSM_LOG_ERROR, "ERR 331D: " - "LFT of switch 0x%016" PRIx64 " is not up to date\n", - cl_ntoh64(sw->p_node->node_info.node_guid)); + "LFT of switch 0x%016" PRIx64 " (%s) is not up to date\n", + cl_ntoh64(sw->p_node->node_info.node_guid), + sw->p_node->print_desc); else { free(sw->new_lft); sw->new_lft = NULL; } } -/********************************************************************** - **********************************************************************/ int wait_for_pending_transactions(osm_stats_t * stats) { #ifdef HAVE_LIBPTHREAD @@ -1094,6 +1114,8 @@ static void do_sweep(osm_sm_t * sm) if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats)) return; if (!sm->p_subn->force_heavy_sweep) { + if (sm->p_subn->opt.sa_db_dump) + osm_sa_db_file_dump(sm->p_subn->p_osm); OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "LIGHT SWEEP COMPLETE"); return; @@ -1141,7 +1163,7 @@ static void do_sweep(osm_sm_t * sm) } /* go to heavy sweep */ -_repeat_discovery: +repeat_discovery: /* First of all - unset all flags */ sm->p_subn->force_heavy_sweep = FALSE; @@ -1178,7 +1200,7 @@ _repeat_discovery: wait_for_pending_transactions(&sm->p_subn->p_osm->stats)) return; - /* discovery completed - check other sm presense */ + /* discovery completed - check other sm presence */ if (sm->master_sm_found) { /* * Call the sm_state_mgr with signal @@ -1195,7 +1217,7 @@ _repeat_discovery: /* if new sweep requested - don't bother with the rest */ if (sm->p_subn->force_heavy_sweep) - goto _repeat_discovery; + goto repeat_discovery; OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "HEAVY SWEEP COMPLETE"); @@ -1358,7 +1380,8 @@ _repeat_discovery: state_mgr_up_msg(sm); sm->p_subn->first_time_master_sweep = FALSE; - if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) + if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE) || + sm->p_subn->opt.sa_db_dump) osm_sa_db_file_dump(sm->p_subn->p_osm); } @@ -1401,11 +1424,9 @@ void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal) case OSM_SIGNAL_SWEEP: do_sweep(sm); break; - case OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST: do_process_mgrp_queue(sm); break; - default: CL_ASSERT(FALSE); OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3320: " diff --git a/branches/opensm_3/user/opensm/osm_subnet.c b/branches/opensm_3/user/opensm/osm_subnet.c index 5b45699b..6461a1b4 100644 --- a/branches/opensm_3/user/opensm/osm_subnet.c +++ b/branches/opensm_3/user/opensm/osm_subnet.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. @@ -299,8 +299,8 @@ static const opt_rec_t opt_tbl[] = { { "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 }, { "console", OPT_OFFSET(console), opts_parse_charp, NULL, 0 }, { "console_port", OPT_OFFSET(console_port), opts_parse_uint16, NULL, 0 }, - { "transaction_timeout", OPT_OFFSET(transaction_timeout), opts_parse_uint32, NULL, 1 }, - { "transaction_retries", OPT_OFFSET(transaction_retries), opts_parse_uint32, NULL, 1 }, + { "transaction_timeout", OPT_OFFSET(transaction_timeout), opts_parse_uint32, NULL, 0 }, + { "transaction_retries", OPT_OFFSET(transaction_retries), opts_parse_uint32, NULL, 0 }, { "max_msg_fifo_timeout", OPT_OFFSET(max_msg_fifo_timeout), opts_parse_uint32, NULL, 1 }, { "sm_priority", OPT_OFFSET(sm_priority), opts_parse_uint8, opts_setup_sm_priority, 1 }, { "lmc", OPT_OFFSET(lmc), opts_parse_uint8, NULL, 1 }, @@ -324,11 +324,12 @@ static const opt_rec_t opt_tbl[] = { { "force_heavy_sweep", OPT_OFFSET(force_heavy_sweep), opts_parse_boolean, NULL, 1 }, { "port_prof_ignore_file", OPT_OFFSET(port_prof_ignore_file), opts_parse_charp, NULL, 0 }, { "hop_weights_file", OPT_OFFSET(hop_weights_file), opts_parse_charp, NULL, 0 }, + { "dimn_ports_file", OPT_OFFSET(dimn_ports_file), opts_parse_charp, NULL, 0 }, { "port_profile_switch_nodes", OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 }, { "sweep_on_trap", OPT_OFFSET(sweep_on_trap), opts_parse_boolean, NULL, 1 }, { "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, NULL, 0 }, { "connect_roots", OPT_OFFSET(connect_roots), opts_parse_boolean, NULL, 1 }, - { "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 1 }, + { "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 0 }, { "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 }, { "log_max_size", OPT_OFFSET(log_max_size), opts_parse_uint32, opts_setup_log_max_size, 1 }, { "log_flags", OPT_OFFSET(log_flags), opts_parse_uint8, opts_setup_log_flags, 1 }, @@ -348,12 +349,14 @@ static const opt_rec_t opt_tbl[] = { { "ids_guid_file", OPT_OFFSET(ids_guid_file), opts_parse_charp, NULL, 0 }, { "guid_routing_order_file", OPT_OFFSET(guid_routing_order_file), opts_parse_charp, NULL, 0 }, { "sa_db_file", OPT_OFFSET(sa_db_file), opts_parse_charp, NULL, 0 }, + { "sa_db_dump", OPT_OFFSET(sa_db_dump), opts_parse_boolean, NULL, 1 }, { "do_mesh_analysis", OPT_OFFSET(do_mesh_analysis), opts_parse_boolean, NULL, 1 }, { "exit_on_fatal", OPT_OFFSET(exit_on_fatal), opts_parse_boolean, NULL, 1 }, { "honor_guid2lid_file", OPT_OFFSET(honor_guid2lid_file), opts_parse_boolean, NULL, 1 }, { "daemon", OPT_OFFSET(daemon), opts_parse_boolean, NULL, 0 }, { "sm_inactive", OPT_OFFSET(sm_inactive), opts_parse_boolean, NULL, 1 }, { "babbling_port_policy", OPT_OFFSET(babbling_port_policy), opts_parse_boolean, NULL, 1 }, + { "use_optimized_slvl", OPT_OFFSET(use_optimized_slvl), opts_parse_boolean, NULL, 1 }, #ifdef ENABLE_OSM_PERF_MGR { "perfmgr", OPT_OFFSET(perfmgr), opts_parse_boolean, NULL, 0 }, { "perfmgr_redir", OPT_OFFSET(perfmgr_redir), opts_parse_boolean, NULL, 0 }, @@ -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 }, #endif /* ENABLE_OSM_PERF_MGR */ { "event_plugin_name", OPT_OFFSET(event_plugin_name), opts_parse_charp, NULL, 0 }, + { "event_plugin_options", OPT_OFFSET(event_plugin_options), opts_parse_charp, NULL, 0 }, { "node_name_map_name", OPT_OFFSET(node_name_map_name), opts_parse_charp, NULL, 0 }, { "qos_max_vls", OPT_OFFSET(qos_options.max_vls), opts_parse_uint32, NULL, 1 }, { "qos_high_limit", OPT_OFFSET(qos_options.high_limit), opts_parse_int32, NULL, 1 }, @@ -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 }, { "lash_start_vl", OPT_OFFSET(lash_start_vl), opts_parse_uint8, NULL, 1 }, { "sm_sl", OPT_OFFSET(sm_sl), opts_parse_uint8, NULL, 1 }, + { "log_prefix", OPT_OFFSET(log_prefix), opts_parse_charp, NULL, 1 }, {0} }; -/********************************************************************** - **********************************************************************/ static int compar_mgids(const void *m1, const void *m2) { return memcmp(m1, m2, sizeof(ib_gid_t)); @@ -420,8 +423,6 @@ void osm_subn_construct(IN osm_subn_t * p_subn) cl_fmap_init(&p_subn->mgrp_mgid_tbl, compar_mgids); } -/********************************************************************** - **********************************************************************/ void osm_subn_destroy(IN osm_subn_t * p_subn) { int i; @@ -430,7 +431,6 @@ void osm_subn_destroy(IN osm_subn_t * p_subn) osm_switch_t *p_sw, *p_next_sw; osm_remote_sm_t *p_rsm, *p_next_rsm; osm_prtn_t *p_prtn, *p_next_prtn; - osm_mgrp_t *p_mgrp; osm_infr_t *p_infr, *p_next_infr; /* it might be a good idea to de-allocate all known objects */ @@ -476,12 +476,9 @@ void osm_subn_destroy(IN osm_subn_t * p_subn) cl_fmap_remove_all(&p_subn->mgrp_mgid_tbl); for (i = 0; i <= p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; - i++) { - p_mgrp = p_subn->mgroups[i]; - p_subn->mgroups[i] = NULL; - if (p_mgrp) - osm_mgrp_delete(p_mgrp); - } + i++) + if (p_subn->mboxes[i]) + osm_mgrp_box_delete(p_subn->mboxes[i]); p_next_infr = (osm_infr_t *) cl_qlist_head(&p_subn->sa_infr_list); while (p_next_infr != @@ -501,8 +498,6 @@ void osm_subn_destroy(IN osm_subn_t * p_subn) } } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm, IN const osm_subn_opt_t * p_opt) { @@ -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, OSM_SUBNET_VECTOR_GROW_SIZE); if (status != CL_SUCCESS) - return (status); + return status; status = cl_ptr_vector_set_capacity(&p_subn->port_lid_tbl, OSM_SUBNET_VECTOR_CAPACITY); if (status != CL_SUCCESS) - return (status); + return status; /* LID zero is not valid. NULL out this entry for the @@ -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; } -/********************************************************************** - **********************************************************************/ osm_port_t *osm_get_port_by_mad_addr(IN osm_log_t * p_log, IN const osm_subn_t * p_subn, IN osm_mad_addr_t * p_mad_addr) { - const cl_ptr_vector_t *p_port_lid_tbl; - osm_port_t *p_port = NULL; - - /* Find the port gid of the request in the subnet */ - p_port_lid_tbl = &p_subn->port_lid_tbl; - - CL_ASSERT(cl_ptr_vector_get_size(p_port_lid_tbl) < 0x10000); - - if ((uint16_t) cl_ptr_vector_get_size(p_port_lid_tbl) > - cl_ntoh16(p_mad_addr->dest_lid)) { - p_port = - cl_ptr_vector_get(p_port_lid_tbl, - cl_ntoh16(p_mad_addr->dest_lid)); - } else { - /* The dest_lid is not in the subnet table - this is an error */ + osm_port_t *port = osm_get_port_by_lid(p_subn, p_mad_addr->dest_lid); + if (!port) OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7504: " "Lid is out of range: %u\n", cl_ntoh16(p_mad_addr->dest_lid)); - } - return p_port; + return port; } ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log, @@ -579,7 +558,7 @@ ib_api_status_t osm_get_gid_by_mad_addr(IN osm_log_t * p_log, if (p_gid == NULL) { OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 7505: " "Provided output GID is NULL\n"); - return (IB_INVALID_PARAMETER); + return IB_INVALID_PARAMETER; } p_port = osm_get_port_by_mad_addr(p_log, p_subn, p_mad_addr); @@ -605,8 +584,6 @@ osm_physp_t *osm_get_physp_by_mad_addr(IN osm_log_t * p_log, return p_port->p_physp; } -/********************************************************************** - **********************************************************************/ osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn, IN uint64_t guid) { @@ -618,8 +595,6 @@ osm_switch_t *osm_get_switch_by_guid(IN const osm_subn_t * p_subn, return p_switch; } -/********************************************************************** - **********************************************************************/ osm_node_t *osm_get_node_by_guid(IN osm_subn_t const *p_subn, IN uint64_t guid) { osm_node_t *p_node; @@ -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; } -/********************************************************************** - **********************************************************************/ osm_port_t *osm_get_port_by_guid(IN osm_subn_t const *p_subn, IN ib_net64_t guid) { osm_port_t *p_port; @@ -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; } -/********************************************************************** - **********************************************************************/ -osm_port_t *osm_get_port_by_lid(IN osm_subn_t const * subn, IN ib_net16_t lid) +osm_port_t *osm_get_port_by_lid_ho(IN osm_subn_t const * subn, IN uint16_t lid) { - lid = cl_ntoh16(lid); if (lid < cl_ptr_vector_get_size(&subn->port_lid_tbl)) return cl_ptr_vector_get(&subn->port_lid_tbl, lid); return NULL; } -/********************************************************************** - **********************************************************************/ +osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_subn_t * subn, IN ib_gid_t * mgid) +{ + osm_mgrp_t *mgrp; + + mgrp= (osm_mgrp_t *)cl_fmap_get(&subn->mgrp_mgid_tbl, mgid); + if (mgrp != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl)) + return mgrp; + return NULL; +} + static void subn_set_default_qos_options(IN osm_qos_options_t * opt) { opt->max_vls = OSM_DEFAULT_QOS_MAX_VLS; @@ -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)); } -/********************************************************************** - **********************************************************************/ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) { memset(p_opt, 0, sizeof(osm_subn_opt_t)); @@ -727,6 +703,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) p_opt->daemon = FALSE; p_opt->sm_inactive = FALSE; p_opt->babbling_port_policy = FALSE; + p_opt->use_optimized_slvl = FALSE; #ifdef ENABLE_OSM_PERF_MGR p_opt->perfmgr = FALSE; p_opt->perfmgr_redir = TRUE; @@ -737,21 +714,23 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) #endif /* ENABLE_OSM_PERF_MGR */ p_opt->event_plugin_name = NULL; + p_opt->event_plugin_options = NULL; p_opt->node_name_map_name = NULL; p_opt->dump_files_dir = getenv("OSM_TMP_DIR"); if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir)) p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR; - p_opt->dump_files_dir = osm_strdup(p_opt->dump_files_dir); - p_opt->log_file = osm_strdup(OSM_DEFAULT_LOG_FILE); + p_opt->dump_files_dir = strdup(p_opt->dump_files_dir); + p_opt->log_file = strdup(OSM_DEFAULT_LOG_FILE); p_opt->log_max_size = 0; - p_opt->partition_config_file = osm_strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE); + p_opt->partition_config_file = strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE); p_opt->no_partition_enforcement = FALSE; p_opt->qos = FALSE; - p_opt->qos_policy_file = osm_strdup(OSM_DEFAULT_QOS_POLICY_FILE); + p_opt->qos_policy_file = strdup(OSM_DEFAULT_QOS_POLICY_FILE); p_opt->accum_log_file = TRUE; p_opt->port_prof_ignore_file = NULL; p_opt->hop_weights_file = NULL; + p_opt->dimn_ports_file = NULL; p_opt->port_profile_switch_nodes = FALSE; p_opt->sweep_on_trap = TRUE; p_opt->use_ucast_cache = FALSE; @@ -766,14 +745,16 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt) p_opt->ids_guid_file = NULL; p_opt->guid_routing_order_file = NULL; p_opt->sa_db_file = NULL; + p_opt->sa_db_dump = FALSE; p_opt->do_mesh_analysis = FALSE; p_opt->exit_on_fatal = TRUE; p_opt->enable_quirks = FALSE; p_opt->no_clients_rereg = FALSE; - p_opt->prefix_routes_file = osm_strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE); + p_opt->prefix_routes_file = strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE); p_opt->consolidate_ipv6_snm_req = FALSE; p_opt->lash_start_vl = 0; p_opt->sm_sl = OSM_DEFAULT_SL; + p_opt->log_prefix = NULL; subn_init_qos_options(&p_opt->qos_options, NULL); subn_init_qos_options(&p_opt->qos_ca_options, NULL); subn_init_qos_options(&p_opt->qos_sw0_options, NULL); @@ -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); } -/********************************************************************** - **********************************************************************/ static char *clean_val(char *val) { char *p = val; @@ -805,8 +784,6 @@ static char *clean_val(char *val) return val; } -/********************************************************************** - **********************************************************************/ static int subn_dump_qos_options(FILE * file, const char *set_name, const char *prefix, osm_qos_options_t * opt) { @@ -823,8 +800,6 @@ static int subn_dump_qos_options(FILE * file, const char *set_name, prefix, opt->vlarb_low, prefix, opt->sl2vl); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t append_prefix_route(IN osm_subn_t * p_subn, uint64_t prefix, uint64_t guid) { @@ -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; } -/********************************************************************** - **********************************************************************/ static void subn_verify_max_vls(unsigned *max_vls, const char *prefix, unsigned dflt) { if (!*max_vls || *max_vls > 15) { @@ -1156,8 +1129,6 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts) return 0; } -/********************************************************************** - **********************************************************************/ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts) { char line[1024]; @@ -1271,8 +1242,6 @@ int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn) return 0; } -/********************************************************************** - **********************************************************************/ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) { fprintf(out, @@ -1404,6 +1373,11 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) "hop_weights_file %s\n\n", p_opts->hop_weights_file ? p_opts->hop_weights_file : null_str); + fprintf(out, + "# The file holding non-default port order per switch for DOR routing \n" + "dimn_ports_file %s\n\n", + p_opts->dimn_ports_file ? p_opts->dimn_ports_file : null_str); + fprintf(out, "# Routing engine\n" "# Multiple routing engines can be specified separated by\n" @@ -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", p_opts->sa_db_file ? p_opts->sa_db_file : null_str); + fprintf(out, + "# If TRUE causes OpenSM to dump SA database at the end of\n" + "# every light sweep, regardless of the verbosity level\n" + "sa_db_dump %s\n\n", + p_opts->sa_db_dump ? "TRUE" : "FALSE"); + fprintf(out, "#\n# HANDOVER - MULTIPLE SMs OPTIONS\n#\n" "# SM priority used for deciding who is the master\n" @@ -1503,7 +1483,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) "max_wire_smps %u\n\n" "# The maximum time in [msec] allowed for a transaction to complete\n" "transaction_timeout %u\n\n" - " The maximum number of retries allowed for a transaction to complete\n" + "# The maximum number of retries allowed for a transaction to complete\n" "transaction_retries %u\n\n" "# Maximal time in [msec] a message can stay in the incoming message queue.\n" "# If there is more than one message in the queue and the last message\n" @@ -1525,10 +1505,13 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) "# SM Inactive\n" "sm_inactive %s\n\n" "# Babbling Port Policy\n" - "babbling_port_policy %s\n\n", + "babbling_port_policy %s\n\n" + "# Use Optimized SLtoVLMapping programming if supported by device\n" + "use_optimized_slvl %s\n\n", p_opts->daemon ? "TRUE" : "FALSE", p_opts->sm_inactive ? "TRUE" : "FALSE", - p_opts->babbling_port_policy ? "TRUE" : "FALSE"); + p_opts->babbling_port_policy ? "TRUE" : "FALSE", + p_opts->use_optimized_slvl ? "TRUE" : "FALSE"); #ifdef ENABLE_OSM_PERF_MGR fprintf(out, @@ -1555,8 +1538,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts) fprintf(out, "#\n# Event Plugin Options\n#\n" - "event_plugin_name %s\n\n", p_opts->event_plugin_name ? - p_opts->event_plugin_name : null_str); + "# Event plugin name(s)\n" + "event_plugin_name %s\n\n" + "# Options string that would be passed to the plugin(s)\n" + "event_plugin_options %s\n\n", + p_opts->event_plugin_name ? + p_opts->event_plugin_name : null_str, + p_opts->event_plugin_options ? + p_opts->event_plugin_options : null_str); fprintf(out, "#\n# Node name map for mapping node's to more descriptive node descriptions\n" @@ -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", p_opts->consolidate_ipv6_snm_req ? "TRUE" : "FALSE"); + fprintf(out, "# Log prefix\nlog_prefix %s\n\n", p_opts->log_prefix); + /* optional string attributes ... */ return 0; diff --git a/branches/opensm_3/user/opensm/osm_sw_info_rcv.c b/branches/opensm_3/user/opensm/osm_sw_info_rcv.c index 58f61ef6..f79aca73 100644 --- a/branches/opensm_3/user/opensm/osm_sw_info_rcv.c +++ b/branches/opensm_3/user/opensm/osm_sw_info_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -319,8 +319,6 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm, return is_change_detected; } -/********************************************************************** - **********************************************************************/ void osm_si_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_switch.c b/branches/opensm_3/user/opensm/osm_switch.c index 984bd1c5..9581c4c9 100644 --- a/branches/opensm_3/user/opensm/osm_switch.c +++ b/branches/opensm_3/user/opensm/osm_switch.c @@ -51,8 +51,6 @@ #include #include -/********************************************************************** - **********************************************************************/ cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho, IN uint8_t port_num, IN uint8_t num_hops) { @@ -72,8 +70,6 @@ cl_status_t osm_switch_set_hops(IN osm_switch_t * p_sw, IN uint16_t lid_ho, return 0; } -/********************************************************************** - **********************************************************************/ void osm_switch_delete(IN OUT osm_switch_t ** pp_sw) { osm_switch_t *p_sw = *pp_sw; @@ -82,6 +78,8 @@ void osm_switch_delete(IN OUT osm_switch_t ** pp_sw) osm_mcast_tbl_destroy(&p_sw->mcast_tbl); if (p_sw->p_prof) free(p_sw->p_prof); + if (p_sw->dimn_ports) + free(p_sw->dimn_ports); if (p_sw->lft) free(p_sw->lft); if (p_sw->new_lft) @@ -96,8 +94,6 @@ void osm_switch_delete(IN OUT osm_switch_t ** pp_sw) *pp_sw = NULL; } -/********************************************************************** - **********************************************************************/ osm_switch_t *osm_switch_new(IN osm_node_t * p_node, IN const osm_madw_t * p_madw) { @@ -149,8 +145,6 @@ err: return NULL; } -/********************************************************************** - **********************************************************************/ boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw, IN uint16_t block_id, OUT uint8_t * p_block) { @@ -167,8 +161,6 @@ boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw, return TRUE; } -/********************************************************************** - **********************************************************************/ static struct osm_remote_node * switch_find_guid_common(IN const osm_switch_t * p_sw, IN struct osm_remote_guids_count *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); } -/********************************************************************** - **********************************************************************/ uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw, IN osm_port_t * p_port, IN uint16_t lid_ho, IN unsigned start_from, @@ -353,7 +343,7 @@ uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw, /* port number starts with one and num_ports is 1 + num phys ports */ for (i = start_from; i < start_from + num_ports; i++) { - port_num = i%num_ports; + port_num = osm_switch_get_dimn_port(p_sw, i % num_ports); if (!port_num || osm_switch_get_hop_count(p_sw, base_lid, port_num) != least_hops) @@ -478,8 +468,6 @@ uint8_t osm_switch_recommend_path(IN const osm_switch_t * p_sw, return best_port; } -/********************************************************************** - **********************************************************************/ void osm_switch_clear_hops(IN osm_switch_t * p_sw) { unsigned i; @@ -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); } -/********************************************************************** - **********************************************************************/ static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids) { uint16_t lft_size; @@ -510,8 +496,6 @@ static int alloc_lft(IN osm_switch_t * p_sw, uint16_t lids) return 0; } -/********************************************************************** - **********************************************************************/ int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids) { uint8_t **hops; @@ -551,8 +535,6 @@ int osm_switch_prepare_path_rebuild(IN osm_switch_t * p_sw, IN uint16_t max_lids return 0; } -/********************************************************************** - **********************************************************************/ uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw, IN const osm_port_t * p_port) { @@ -577,8 +559,6 @@ uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw, } } -/********************************************************************** - **********************************************************************/ uint8_t osm_switch_recommend_mcast_path(IN osm_switch_t * p_sw, IN osm_port_t * p_port, IN uint16_t mlid_ho, diff --git a/branches/opensm_3/user/opensm/osm_trap_rcv.c b/branches/opensm_3/user/opensm/osm_trap_rcv.c index 0e04921b..3a78e37a 100644 --- a/branches/opensm_3/user/opensm/osm_trap_rcv.c +++ b/branches/opensm_3/user/opensm/osm_trap_rcv.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -81,23 +81,10 @@ extern void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t *p_physp); * **********************************************************************/ -typedef struct osm_trap_agingracker_context { - osm_log_t *p_log; - osm_physp_t *p_physp; -} osm_trap_aging_tracker_context_t; - -/********************************************************************** - **********************************************************************/ static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm, - IN uint16_t lid, IN uint8_t num) + IN ib_net16_t lid, IN uint8_t num) { - cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl); - osm_port_t *p_port; - - if (lid > cl_ptr_vector_get_size(p_vec)) - return NULL; - - p_port = (osm_port_t *) cl_ptr_vector_get(p_vec, lid); + osm_port_t *p_port = osm_get_port_by_lid(sm->p_subn, lid); if (!p_port) return NULL; @@ -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); } -/********************************************************************** - **********************************************************************/ -uint64_t -osm_trap_rcv_aging_tracker_callback(IN uint64_t key, - IN uint32_t num_regs, IN void *context) +static uint64_t aging_tracker_callback(IN uint64_t key, IN uint32_t num_regs, + IN void *context) { osm_sm_t *sm = context; - uint16_t lid; + ib_net16_t lid; uint8_t port_num; osm_physp_t *p_physp; @@ -124,20 +108,20 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key, /* We got an exit flag - do nothing */ return 0; - lid = cl_ntoh16((uint16_t) ((key & 0x0000FFFF00000000ULL) >> 32)); + lid = (ib_net16_t) ((key & 0x0000FFFF00000000ULL) >> 32); port_num = (uint8_t) ((key & 0x00FF000000000000ULL) >> 48); p_physp = get_physp_by_lid_and_num(sm, lid, port_num); if (!p_physp) OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Cannot find port num:%u with lid:%u\n", - port_num, lid); + port_num, cl_ntoh16(lid)); /* make sure the physp is still valid */ /* If the health port was false - set it to true */ else if (!osm_physp_is_healthy(p_physp)) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Clearing health bit of port num:%u with lid:%u\n", - port_num, lid); + port_num, cl_ntoh16(lid)); /* Clear its health bit */ osm_physp_set_health(p_physp, TRUE); @@ -192,28 +176,18 @@ static uint32_t trap_calc_crc32(void *buffer, uint32_t count) return crc; } -/******************************************************************** - ********************************************************************/ - /* The key is created in the following manner: port_num lid crc \______/ \___/ \___/ 16b 16b 32b */ -static void -trap_get_key(IN uint16_t lid, IN uint8_t port_num, - IN ib_mad_notice_attr_t * p_ntci, OUT uint64_t * trap_key) +static uint64_t trap_get_key(IN uint16_t lid, IN uint8_t port_num, + IN ib_mad_notice_attr_t * p_ntci) { - uint32_t crc = 0; - - CL_ASSERT(trap_key); - - crc = trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t)); - *trap_key = ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc; + uint32_t crc = trap_calc_crc32(p_ntci, sizeof(ib_mad_notice_attr_t)); + return ((uint64_t) port_num << 48) | ((uint64_t) lid << 32) | crc; } -/********************************************************************** - **********************************************************************/ static int print_num_received(IN uint32_t num_received) { uint32_t i; @@ -237,7 +211,6 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p) uint8_t payload[IB_SMP_DATA_SIZE]; osm_madw_context_t context; ib_port_info_t *pi = (ib_port_info_t *)payload; - int ret; /* select the nearest port to master opensm */ if (p->p_remote_physp && @@ -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 */ /* but peer port has been observed not to respond to SM requests */ - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3810: " - "Disabling physical port 0x%016" PRIx64 " num:%u\n", - cl_ntoh64(osm_physp_get_port_guid(p)), p->port_num); - memcpy(payload, &p->port_info, sizeof(ib_port_info_t)); /* Set port to disabled/down */ @@ -264,15 +233,10 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p) context.pi_context.light_sweep = FALSE; context.pi_context.active_transition = FALSE; - ret = osm_req_set(sm, osm_physp_get_dr_path_ptr(p), - payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO, - cl_hton32(osm_physp_get_port_num(p)), - CL_DISP_MSGID_NONE, &context); - if (ret) - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: " - "Request to set PortInfo failed\n"); - - return ret; + return osm_req_set(sm, osm_physp_get_dr_path_ptr(p), + payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO, + cl_hton32(osm_physp_get_port_num(p)), + CL_DISP_MSGID_NONE, &context); } static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci, @@ -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)); } -/********************************************************************** - **********************************************************************/ -static void -trap_rcv_process_request(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw) +static int shutup_noisy_port(osm_sm_t *sm, ib_net16_t lid, uint8_t port, + unsigned num) +{ + osm_physp_t *p = get_physp_by_lid_and_num(sm, lid, port); + if (!p) { + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3805: " + "Failed to find physical port by lid:%u num:%u\n", + cl_ntoh16(lid), port); + return -1; + } + + /* When babbling port policy option is enabled and + Threshold for disabling a "babbling" port is exceeded */ + if (sm->p_subn->opt.babbling_port_policy && num >= 250) { + OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, + "Disabling noisy physical port 0x%016" PRIx64 + ": lid %u, num %u\n", + cl_ntoh64(osm_physp_get_port_guid(p)), + cl_ntoh16(lid), port); + if (disable_port(sm, p)) + OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3811: " + "Failed to disable.\n"); + else + return 1; + } + + /* check if the current state of the p_physp is healthy. If + it is - then this is a first change of state. Run a heavy sweep. */ + if (osm_physp_is_healthy(p)) { + OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, + "Marking unhealthy physical port by lid:%u num:%u\n", + cl_ntoh16(lid), port); + osm_physp_set_health(p, FALSE); + return 2; + } + return 0; +} + +static void trap_rcv_process_request(IN osm_sm_t * sm, + IN const osm_madw_t * p_madw) { uint8_t payload[sizeof(ib_mad_notice_attr_t)]; ib_smp_t *p_smp; @@ -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; uint32_t num_received; osm_physp_t *p_physp; - cl_ptr_vector_t *p_tbl; osm_port_t *p_port; ib_net16_t source_lid = 0; boolean_t is_gsi = TRUE; @@ -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; /* The source_lid should be based on the source_lid from the trap */ source_lid = p_ntci->data_details.ntc_129_131.lid; - } - - /* If physp_change_trap is TRUE - the key will include the port number. - If not - the port_number in the key will be zero. */ - if (physp_change_trap == TRUE) { port_num = p_ntci->data_details.ntc_129_131.port_num; - trap_get_key(source_lid, port_num, p_ntci, &trap_key); - } else - trap_get_key(source_lid, 0, p_ntci, &trap_key); + } /* try to find it in the aging tracker */ - num_received = - cl_event_wheel_num_regs(&sm->trap_aging_tracker, - trap_key); + trap_key = trap_get_key(source_lid, port_num, p_ntci); + num_received = cl_event_wheel_num_regs(&sm->trap_aging_tracker, + trap_key); /* Now we know how many times it provided this trap */ if (num_received > 10) { if (print_num_received(num_received)) - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3804: " + OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Received trap %u times consecutively\n", num_received); /* @@ -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. */ if (physp_change_trap == TRUE) { - /* get the port */ - p_physp = get_physp_by_lid_and_num(sm, - cl_ntoh16 - (p_ntci-> - data_details. - ntc_129_131. - lid), - port_num); - - if (!p_physp) - OSM_LOG(sm->p_log, OSM_LOG_ERROR, - "ERR 3805: " - "Failed to find physical port by lid:%u num:%u\n", - cl_ntoh16(p_ntci->data_details. - ntc_129_131.lid), - p_ntci->data_details. - ntc_129_131.port_num); - else { - /* When babbling port policy option is enabled and - Threshold for disabling a "babbling" port is exceeded */ - if (sm->p_subn->opt. - babbling_port_policy - && num_received >= 250 - && disable_port(sm, p_physp) == 0) - goto Exit; - - OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Marking unhealthy physical port by lid:%u num:%u\n", - cl_ntoh16(p_ntci->data_details. - ntc_129_131.lid), - p_ntci->data_details. - ntc_129_131.port_num); - /* check if the current state of the p_physp is healthy. If - it is - then this is a first change of state. Run a heavy sweep. - if it is not - no need to mark it again - just restart the timer. */ - if (osm_physp_is_healthy(p_physp)) { - osm_physp_set_health(p_physp, - FALSE); - /* Make sure we sweep again - force a heavy sweep. */ - /* The sweep should be done only after the re-registration, or - else we'll be losing track of the timer. */ - run_heavy_sweep = TRUE; - } - /* If we are marking the port as unhealthy - we want to - keep this for a longer period of time than the - OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT. Use the - OSM_DEFAULT_UNHEALTHY_TIMEOUT */ - event_wheel_timeout = - OSM_DEFAULT_UNHEALTHY_TIMEOUT; - } + int ret = shutup_noisy_port(sm, source_lid, + port_num, + num_received); + if (ret == 1) /* port disabled */ + goto Exit; + else if (ret == 2) /* unhealthy - run sweep */ + run_heavy_sweep = TRUE; + /* in any case increase timeout interval */ + event_wheel_timeout = + OSM_DEFAULT_UNHEALTHY_TIMEOUT; } } @@ -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 the healthy bit. If not - no need to use a callback. */ if (physp_change_trap == TRUE) - 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 */ - sm /* no context */ ); + cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, + cl_get_time_stamp() + event_wheel_timeout, + aging_tracker_callback, sm); else - cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, NULL, /* no callback */ - NULL /* no context */ ); + cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, + cl_get_time_stamp() + event_wheel_timeout, + NULL, NULL); /* If was already registered do nothing more */ if (num_received > 10 && run_heavy_sweep == FALSE) { if (print_num_received(num_received)) OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Continuously received this trap %u times. Ignoring\n", - num_received); + "Ignoring noisy traps.\n"); goto Exit; } } /* Check for node description update. IB Spec v1.2.1 pg 823 */ - if (ib_notice_is_generic(p_ntci) && - cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 && + if (!ib_notice_is_generic(p_ntci)) + goto check_sweep; + if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 && p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES && p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) { OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node description update\n"); @@ -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, "ERR 3812: No physical port found for " "trap 144: \"node description update\"\n"); - } + goto check_sweep; + } else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) + /* this assumes that trap 145 content is not broken? */ + p_physp->p_node->node_info.sys_guid = + p_ntci->data_details.ntc_145.new_sys_guid; +check_sweep: /* do a sweep if we received a trap */ if (sm->p_subn->opt.sweep_on_trap) { /* if this is trap number 128 or run_heavy_sweep is TRUE - update the force_heavy_sweep flag of the subnet. - Sweep also on traps 144/145 - these traps signal a change of - certain port capabilities/system image guid. + Sweep also on traps 144 - these traps signal a change of + certain port capabilities. TODO: In the future this can be changed to just getting PortInfo on this port instead of sweeping the entire subnet. */ if (ib_notice_is_generic(p_ntci) && (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 || cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 || - cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145 || run_heavy_sweep)) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Forcing heavy sweep. Received trap:%u\n", @@ -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)); } else { /* Need to use the IssuerLID */ - p_tbl = &sm->p_subn->port_lid_tbl; - - CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000); - - if ((uint16_t) cl_ptr_vector_get_size(p_tbl) <= - cl_ntoh16(source_lid)) { - /* the source lid is out of range */ - OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "source lid is out of range:%u\n", - cl_ntoh16(source_lid)); - - goto Exit; - } - p_port = cl_ptr_vector_get(p_tbl, cl_ntoh16(source_lid)); - if (p_port == 0) { - /* We have the lid - but no corresponding port */ + p_port = osm_get_port_by_lid(sm->p_subn, source_lid); + if (!p_port) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Cannot find port corresponding to lid:%u\n", cl_ntoh16(source_lid)); @@ -640,11 +584,8 @@ Exit: OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** -**********************************************************************/ -static void -trap_rcv_process_response(IN osm_sm_t * sm, - IN const osm_madw_t * const p_madw) +static void trap_rcv_process_response(IN osm_sm_t * sm, + IN const osm_madw_t * p_madw) { OSM_LOG_ENTER(sm->p_log); @@ -655,8 +596,6 @@ trap_rcv_process_response(IN osm_sm_t * sm, OSM_LOG_EXIT(sm->p_log); } -/********************************************************************** - **********************************************************************/ void osm_trap_rcv_process(IN void *context, IN void *data) { osm_sm_t *sm = context; diff --git a/branches/opensm_3/user/opensm/osm_ucast_cache.c b/branches/opensm_3/user/opensm/osm_ucast_cache.c index 004824cb..c84e0660 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_cache.c +++ b/branches/opensm_3/user/opensm/osm_ucast_cache.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2008-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2008,2009 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2008-2009 Mellanox Technologies LTD. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -76,33 +76,21 @@ typedef struct cache_switch { cache_port_t ports[0]; } cache_switch_t; -/********************************************************************** - **********************************************************************/ - static uint16_t cache_sw_get_base_lid_ho(cache_switch_t * p_sw) { return p_sw->ports[0].remote_lid_ho; } -/********************************************************************** - **********************************************************************/ - static boolean_t cache_sw_is_leaf(cache_switch_t * p_sw) { return p_sw->ports[0].is_leaf; } -/********************************************************************** - **********************************************************************/ - static void cache_sw_set_leaf(cache_switch_t * p_sw) { p_sw->ports[0].is_leaf = TRUE; } -/********************************************************************** - **********************************************************************/ - static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports) { cache_switch_t *p_cache_sw = malloc(sizeof(cache_switch_t) + @@ -122,9 +110,6 @@ static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports) return p_cache_sw; } -/********************************************************************** - **********************************************************************/ - static void cache_sw_destroy(cache_switch_t * p_sw) { if (!p_sw) @@ -137,9 +122,6 @@ static void cache_sw_destroy(cache_switch_t * p_sw) free(p_sw); } -/********************************************************************** - **********************************************************************/ - static cache_switch_t *cache_get_sw(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho) { cache_switch_t *p_cache_sw = (cache_switch_t *) @@ -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; } -/********************************************************************** - **********************************************************************/ static void cache_add_sw_link(osm_ucast_mgr_t * p_mgr, osm_physp_t *p, uint16_t remote_lid_ho, boolean_t is_ca) { @@ -200,9 +180,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ - static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr) { cache_switch_t *p_sw; @@ -232,9 +209,6 @@ static void cache_cleanup_switches(osm_ucast_mgr_t * p_mgr) } } -/********************************************************************** - **********************************************************************/ - static void cache_check_link_change(osm_ucast_mgr_t * p_mgr, osm_physp_t * p_physp_1, osm_physp_t * p_physp_2) @@ -264,9 +238,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ - static void cache_remove_port(osm_ucast_mgr_t * p_mgr, uint16_t lid_ho, uint8_t port_num, uint16_t remote_lid_ho, boolean_t is_ca) @@ -327,9 +298,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } /* cache_remove_port() */ -/********************************************************************** - **********************************************************************/ - static void cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr, cache_switch_t * p_cache_sw, osm_switch_t * p_sw) @@ -357,9 +325,6 @@ cache_restore_ucast_info(osm_ucast_mgr_t * p_mgr, p_cache_sw->hops = NULL; } -/********************************************************************** - **********************************************************************/ - static void ucast_cache_dump(osm_ucast_mgr_t * p_mgr) { cache_switch_t *p_sw; @@ -395,9 +360,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ - void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr) { cache_switch_t *p_sw; @@ -424,9 +386,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ - static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr) { cache_switch_t *p_cache_sw; @@ -776,9 +735,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } /* osm_ucast_cache_validate() */ -/********************************************************************** - **********************************************************************/ - void osm_ucast_cache_check_new_link(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node_1, uint8_t port_num_1, osm_node_t * p_node_2, uint8_t port_num_2) @@ -850,9 +806,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } /* osm_ucast_cache_check_new_link() */ -/********************************************************************** - **********************************************************************/ - void osm_ucast_cache_add_link(osm_ucast_mgr_t * p_mgr, osm_physp_t * p_physp1, osm_physp_t * p_physp2) { @@ -927,9 +880,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } /* osm_ucast_cache_add_link() */ -/********************************************************************** - **********************************************************************/ - void osm_ucast_cache_add_node(osm_ucast_mgr_t * p_mgr, osm_node_t * p_node) { uint16_t lid_ho; @@ -1040,9 +990,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } /* osm_ucast_cache_add_node() */ -/********************************************************************** - **********************************************************************/ - int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr) { cl_qmap_t *tbl = &p_mgr->p_subn->sw_guid_tbl; @@ -1079,6 +1026,3 @@ int osm_ucast_cache_process(osm_ucast_mgr_t * p_mgr) return 0; } - -/********************************************************************** - **********************************************************************/ diff --git a/branches/opensm_3/user/opensm/osm_ucast_file.c b/branches/opensm_3/user/opensm/osm_ucast_file.c index 907bd33e..f1cd5973 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_file.c +++ b/branches/opensm_3/user/opensm/osm_ucast_file.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2006-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2008,2009 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2006,2008-2009 Mellanox Technologies LTD. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU diff --git a/branches/opensm_3/user/opensm/osm_ucast_ftree.c b/branches/opensm_3/user/opensm/osm_ucast_ftree.c index 9b1b14c1..a66be414 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_ftree.c +++ b/branches/opensm_3/user/opensm/osm_ucast_ftree.c @@ -1975,7 +1975,7 @@ static inline int port_group_compare_load_down(const ftree_port_group_t * p1, * as it is much faster. * * Important note: - * This function and __osm_ftree_bubble_sort_down must NOT be factorized. + * This function and bubble_sort_down must NOT be factorized. * Although most of the code is the same and a function pointer could be used * for the compareason function, it would prevent the compareason function to be inlined * and cost a great deal to performances. @@ -2047,13 +2047,13 @@ bubble_sort_siblings(ftree_port_group_t ** p_group_array, uint32_t nmemb) /* * Function: Sorts an array of port group. Order is decide through - * __osm_ftree_port_group_compare_load_down ( up counters, least load remote switch, biggest GUID) + * port_group_compare_load_down ( up counters, least load remote switch, biggest GUID) * Given : A port group array and its length. Each port group points to a remote switch (not a HCA) * As the list is mostly sorted, we used a bubble sort instead of qsort * as it is much faster. * * Important note: - * This function and __osm_ftree_bubble_sort_up must NOT be factorized. + * This function and bubble_sort_up must NOT be factorized. * Although most of the code is the same and a function pointer could be used * for the compareason function, it would prevent the compareason function to be inlined * and cost a great deal to performances. @@ -2949,6 +2949,89 @@ static void fabric_route_to_switches(IN ftree_fabric_t * p_ftree) /*************************************************** ***************************************************/ +static void fabric_route_roots(IN ftree_fabric_t * p_ftree) +{ + uint16_t lid; + uint8_t port_num; + osm_port_t *p_port; + ftree_sw_t *p_sw; + ftree_sw_t *p_leaf_sw; + + OSM_LOG_ENTER(&p_ftree->p_osm->log); + + /* + * We need a switch that will accomodate all the down/up turns in + * the fabric. Having these turn in a single place in the fabric + * will not create credit loops. + * So we need to select this switch. + * The idea here is to chose leaf with the highest index. I don't + * have any theory to back me up on this. It's just a general thought + * that this way the switch that might be a bottleneck for many mcast + * groups will be far away from the OpenSM, so it will draw the + * multicast traffic away from the SM. + */ + + p_leaf_sw = p_ftree->leaf_switches[p_ftree->leaf_switches_num-1]; + + /* + * Now go over all the switches in the fabric that + * have lower rank, and route the missing LIDs to + * the selected leaf switch. + * In short, this leaf switch now poses a target + * for all those missing LIDs. + */ + + for (p_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl); + p_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl); + p_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item)) { + + if (p_sw->rank >= p_ftree->leaf_switch_rank) + continue; + + for (lid = 1; lid <= p_leaf_sw->p_osm_sw->max_lid_ho; lid ++) { + + if (p_sw->p_osm_sw->new_lft[lid] != OSM_NO_PATH || + p_leaf_sw->hops[lid] == OSM_NO_PATH) + continue; + + p_port = osm_get_port_by_lid_ho(&p_ftree->p_osm->subn, + lid); + + /* we're interested only in switches */ + if (!p_port || !p_port->p_node->sw) + continue; + + /* + * the missing LID will be routed through the same + * port that routes to the selected leaf switch + */ + port_num = p_sw->p_osm_sw->new_lft[p_leaf_sw->base_lid]; + + OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG, + "Switch %s: setting path to LID %u " + "through port %u\n", + tuple_to_str(p_sw->tuple), lid, port_num); + + /* set local lft */ + p_sw->p_osm_sw->new_lft[lid] = port_num; + + /* + * Set local min hop table. + * The distance to the target LID is a distance + * to the selected leaf switch plus the distance + * from the leaf to the target LID. + */ + sw_set_hops(p_sw, lid, port_num, + p_sw->hops[p_leaf_sw->base_lid] + + p_leaf_sw->hops[lid], TRUE); + } + } + + OSM_LOG_EXIT(&p_ftree->p_osm->log); +} /* fabric_route_roots() */ + +/***************************************************/ + static int fabric_populate_nodes(IN ftree_fabric_t * p_ftree) { osm_node_t *p_osm_node; @@ -3586,7 +3669,7 @@ static int fabric_rank(IN ftree_fabric_t * p_ftree) if (res) goto Exit; - OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO, + OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "FatTree max switch rank is %u\n", p_ftree->max_switch_rank); Exit: @@ -3644,7 +3727,7 @@ static void fabric_set_leaf_rank(IN ftree_fabric_t * p_ftree) p_ftree->leaf_switch_rank = p_sw->rank; } - OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_INFO, + OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "FatTree leaf switch rank is %u\n", p_ftree->leaf_switch_rank); OSM_LOG_EXIT(&p_ftree->p_osm->log); } /* fabric_set_leaf_rank() */ @@ -3772,7 +3855,7 @@ static int construct_fabric(IN void *context) fabric_clear(p_ftree); if (p_ftree->p_osm->subn.opt.lmc > 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "LMC > 0 is not supported by fat-tree routing.\n" "Falling back to default routing\n"); status = -1; @@ -3780,7 +3863,7 @@ static int construct_fabric(IN void *context) } if (cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl) < 2) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric has %u switches - topology is not fat-tree.\n" "Falling back to default routing\n", cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl)); @@ -3790,7 +3873,7 @@ static int construct_fabric(IN void *context) if ((cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl) - cl_qmap_count(&p_ftree->p_osm->subn.sw_guid_tbl)) < 2) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric has %u nodes (%u switches) - topology is not fat-tree.\n" "Falling back to default routing\n", cl_qmap_count(&p_ftree->p_osm->subn.node_guid_tbl), @@ -3807,7 +3890,7 @@ static int construct_fabric(IN void *context) OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Populating FatTree Switch and CA tables\n"); if (fabric_populate_nodes(p_ftree) != 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric topology is not fat-tree - " "falling back to default routing\n"); status = -1; @@ -3817,7 +3900,7 @@ static int construct_fabric(IN void *context) OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Reading guid files provided by user\n"); if (fabric_read_guid_files(p_ftree) != 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Failed reading guid files - " "falling back to default routing\n"); status = -1; @@ -3825,8 +3908,8 @@ static int construct_fabric(IN void *context) } if (cl_qmap_count(&p_ftree->hca_tbl) < 2) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, - "Fabric has %u CAa - topology is not fat-tree.\n" + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, + "Fabric has %u CAs - topology is not fat-tree.\n" "Falling back to default routing\n", cl_qmap_count(&p_ftree->hca_tbl)); status = -1; @@ -3839,7 +3922,7 @@ static int construct_fabric(IN void *context) whole tree rank after filling ports and marking CNs. */ OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Ranking FatTree\n"); if (fabric_rank(p_ftree) != 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Failed ranking the tree\n"); status = -1; goto Exit; @@ -3853,12 +3936,12 @@ static int construct_fabric(IN void *context) OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, "Populating CA & switch ports\n"); if (fabric_populate_ports(p_ftree) != 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric topology is not a fat-tree\n"); status = -1; goto Exit; } else if (p_ftree->cn_num == 0) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric has no valid compute nodes\n"); status = -1; goto Exit; @@ -3870,7 +3953,7 @@ static int construct_fabric(IN void *context) if (fabric_get_rank(p_ftree) > FAT_TREE_MAX_RANK || fabric_get_rank(p_ftree) < FAT_TREE_MIN_RANK) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric rank is %u (should be between %u and %u)\n", fabric_get_rank(p_ftree), FAT_TREE_MIN_RANK, FAT_TREE_MAX_RANK); @@ -3883,7 +3966,7 @@ static int construct_fabric(IN void *context) As a by-product, this function also runs basic topology validation - it checks that all the CNs are at the same rank. */ if (fabric_mark_leaf_switches(p_ftree)) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric topology is not a fat-tree\n"); status = -1; goto Exit; @@ -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. In any case, the first and the last switches in the array are REAL leafs. */ if (fabric_create_leaf_switch_array(p_ftree)) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric topology is not a fat-tree\n"); status = -1; goto Exit; @@ -3921,7 +4004,7 @@ static int construct_fabric(IN void *context) guid file hasn't been provided by user */ if (!fabric_roots_provided(p_ftree) && !fabric_validate_topology(p_ftree)) { - osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS, + osm_log(&p_ftree->p_osm->log, OSM_LOG_INFO, "Fabric topology is not a fat-tree\n"); status = -1; goto Exit; @@ -3978,6 +4061,13 @@ static int do_routing(IN void *context) "Filling switch forwarding tables for switch-to-switch paths\n"); fabric_route_to_switches(p_ftree); + if (p_ftree->p_osm->subn.opt.connect_roots) { + OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE, + "Connecting switches that are unreachable within " + "Up/Down rules\n"); + fabric_route_roots(p_ftree); + } + /* for each switch, set its fwd table */ cl_qmap_apply_func(&p_ftree->sw_tbl, set_sw_fwd_table, (void *)p_ftree); diff --git a/branches/opensm_3/user/opensm/osm_ucast_lash.c b/branches/opensm_3/user/opensm/osm_ucast_lash.c index 528eac6f..f635cfc7 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_lash.c +++ b/branches/opensm_3/user/opensm/osm_ucast_lash.c @@ -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); for (lid = 1; lid <= max_lid_ho; lid++) { - port = cl_ptr_vector_get(&p_subn->port_lid_tbl, lid); + port = osm_get_port_by_lid_ho(p_subn, lid); if (!port) continue; @@ -1259,7 +1259,7 @@ static lash_t *lash_create(osm_opensm_t * p_osm) p_lash->p_osm = p_osm; - return (p_lash); + return p_lash; } static void lash_delete(void *context) diff --git a/branches/opensm_3/user/opensm/osm_ucast_mgr.c b/branches/opensm_3/user/opensm/osm_ucast_mgr.c index 229ad5a3..9ccd5832 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_mgr.c +++ b/branches/opensm_3/user/opensm/osm_ucast_mgr.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -59,15 +60,11 @@ #include #include -/********************************************************************** - **********************************************************************/ void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr) { memset(p_mgr, 0, sizeof(*p_mgr)); } -/********************************************************************** - **********************************************************************/ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr) { CL_ASSERT(p_mgr); @@ -80,8 +77,6 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr) OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr, IN osm_sm_t * sm) { ib_api_status_t status = IB_SUCCESS; @@ -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); OSM_LOG_EXIT(p_mgr->p_log); - return (status); + return status; } /********************************************************************** @@ -130,8 +125,6 @@ static void ucast_mgr_process_hop_0_1(IN cl_map_item_t * p_map_item, } } -/********************************************************************** - **********************************************************************/ static void ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * p_mgr, IN osm_switch_t * p_this_sw, IN osm_switch_t * p_remote_sw, @@ -180,8 +173,6 @@ static void ucast_mgr_process_neighbor(IN osm_ucast_mgr_t * p_mgr, OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ static struct osm_remote_node *find_and_add_remote_sys(osm_switch_t * sw, uint8_t port, boolean_t dor, struct @@ -312,8 +303,6 @@ Exit: OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ static void alloc_ports_priv(osm_ucast_mgr_t * mgr) { cl_qmap_t *port_tbl = &mgr->p_subn->port_guid_tbl; @@ -390,11 +379,8 @@ static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item, #ifndef __WIN__ osm_port_t *port=cl_item_obj(item, port, list_item); #else - osm_port_t *port=NULL; - //osm_port_t *port2=NULL; - port = cl_item_obj(item, port, list_item,(osm_port_t *)); - //port2 = cl_item_objX(item, port, list_item); - //CL_ASSERT(port == port2); + osm_port_t *port=NULL; // skip uninitialized var err + port = cl_item_obj(item, port, list_item); #endif ucast_mgr_process_port(p_mgr, p_sw, port, i); } @@ -406,8 +392,6 @@ static void ucast_mgr_process_tbl(IN cl_map_item_t * p_map_item, OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item, IN void *context) { @@ -458,8 +442,6 @@ static void ucast_mgr_process_neighbors(IN cl_map_item_t * p_map_item, OSM_LOG_EXIT(p_mgr->p_log); } -/********************************************************************** - **********************************************************************/ static int set_hop_wf(void *ctx, uint64_t guid, char *p) { osm_ucast_mgr_t *m = ctx; @@ -512,8 +494,102 @@ static void set_default_hop_wf(cl_map_item_t * p_map_item, void *ctx) } } -/********************************************************************** - **********************************************************************/ +static int set_dimn_ports(void *ctx, uint64_t guid, char *p) +{ + osm_subn_t *p_subn = ctx; + osm_node_t *node = osm_get_node_by_guid(p_subn, cl_hton64(guid)); + osm_switch_t *sw; + uint8_t *dimn_ports = NULL; + uint8_t port; + unsigned int *ports = NULL; + const int bpw = sizeof(*ports)*8; + int words; + int i = 1; /* port 0 maps to port 0 */ + + if (!node || !(sw = node->sw)) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE, + "switch with guid 0x%016" PRIx64 " is not found\n", + guid); + return 0; + } + + if (sw->dimn_ports) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE, + "switch with guid 0x%016" PRIx64 " already listed\n", + guid); + return 0; + } + + dimn_ports = malloc(sizeof(*dimn_ports)*sw->num_ports); + if (!dimn_ports) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, + "ERR 3A07: cannot allocate memory for dimn_ports\n"); + return -1; + } + memset(dimn_ports, 0, sizeof(*dimn_ports)*sw->num_ports); + + /* the ports array is for record keeping of which ports have + * been seen */ + words = (sw->num_ports + bpw - 1)/bpw; + ports = malloc(words*sizeof(*ports)); + if (!ports) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, + "ERR 3A08: cannot allocate memory for ports\n"); + return -1; + } + memset(ports, 0, words*sizeof(*ports)); + + while ((*p != '\0') && (*p != '#')) { + char *e; + + port = strtoul(p, &e, 0); + if ((p == e) || (port == 0) || (port >= sw->num_ports) || + !osm_node_get_physp_ptr(node, port)) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE, + "bad port %d specified for guid 0x%016" PRIx64 "\n", + port, guid); + free(dimn_ports); + free(ports); + return 0; + } + + if (ports[port/bpw] & (1u << (port%bpw))) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_VERBOSE, + "port %d already specified for guid 0x%016" PRIx64 "\n", + port, guid); + free(dimn_ports); + free(ports); + return 0; + } + + ports[port/bpw] |= (1u << (port%bpw)); + dimn_ports[i++] = port; + + p = e; + while (isspace(*p)) { + p++; + } + } + + if (i > 1) { + for (port = 1; port < sw->num_ports; port++) { + /* fill out the rest of the dimn_ports array + * in sequence using the remaining unspecified + * ports. + */ + if (!(ports[port/bpw] & (1u << (port%bpw)))) { + dimn_ports[i++] = port; + } + } + sw->dimn_ports = dimn_ports; + } else { + free(dimn_ports); + } + + free(ports); + return 0; +} + int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr) { uint32_t i; @@ -595,8 +671,6 @@ int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr) return 0; } -/********************************************************************** - **********************************************************************/ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn) { osm_switch_t *p_sw; @@ -607,7 +681,7 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn) for (p_sw = (osm_switch_t *) cl_qmap_head(&p_subn->sw_guid_tbl); p_sw != (osm_switch_t *) cl_qmap_end(&p_subn->sw_guid_tbl); - p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) + p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) { if (osm_switch_prepare_path_rebuild(p_sw, lids)) { OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A0B: " "cannot setup switch 0x%016" PRIx64 "\n", @@ -615,12 +689,27 @@ static int ucast_mgr_setup_all_switches(osm_subn_t * p_subn) (p_sw->p_node))); return -1; } + if (p_sw->dimn_ports) { + free(p_sw->dimn_ports); + p_sw->dimn_ports = NULL; + } + } + + if (p_subn->opt.dimn_ports_file) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_DEBUG, + "Fetching dimension ports file \'%s\'\n", + p_subn->opt.dimn_ports_file); + if (parse_node_map(p_subn->opt.dimn_ports_file, + set_dimn_ports, p_subn)) { + OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A05: " + "cannot parse dimn_ports_file \'%s\'\n", + p_subn->opt.dimn_ports_file); + } + } return 0; } -/********************************************************************** - **********************************************************************/ static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p) { osm_ucast_mgr_t *m = ctx; @@ -757,6 +846,7 @@ static void sort_ports_by_switch_load(osm_ucast_mgr_t * m) for (i = 0; i < num; i++) add_sw_endports_to_order_list(s[i], m); + free(s); } static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr) @@ -798,8 +888,6 @@ static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr) return 0; } -/********************************************************************** - **********************************************************************/ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item, IN void *cxt) { @@ -946,8 +1034,6 @@ void osm_ucast_mgr_set_fwd_tables(osm_ucast_mgr_t * p_mgr) ucast_mgr_pipeline_fwd_tbl(p_mgr); } -/********************************************************************** - **********************************************************************/ static int ucast_mgr_route(struct osm_routing_engine *r, osm_opensm_t * osm) { int ret; diff --git a/branches/opensm_3/user/opensm/osm_ucast_updn.c b/branches/opensm_3/user/opensm/osm_ucast_updn.c index a28e9dd1..e6674889 100644 --- a/branches/opensm_3/user/opensm/osm_ucast_updn.c +++ b/branches/opensm_3/user/opensm/osm_ucast_updn.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -77,8 +77,6 @@ struct updn_node { unsigned visited; }; -/********************************************************************** - **********************************************************************/ /* This function returns direction based on rank and guid info of current & remote ports */ static updn_switch_dir_t updn_get_dir(unsigned cur_rank, unsigned rem_rank, @@ -204,8 +202,6 @@ static int updn_bfs_by_node(IN osm_log_t * p_log, IN osm_subn_t * p_subn, return 0; } -/********************************************************************** - **********************************************************************/ /* NOTE : PLS check if we need to decide that the first */ /* rank is a SWITCH for BFS purpose */ static int updn_subn_rank(IN updn_t * p_updn) @@ -283,28 +279,22 @@ static int updn_subn_rank(IN updn_t * p_updn) return 0; } -/********************************************************************** - **********************************************************************/ /* hack: preserve min hops entries to any other root switches */ -static void updn_clear_non_root_hops(updn_t * p_updn, osm_switch_t * p_sw) +static void updn_clear_non_root_hops(updn_t * updn, osm_switch_t * sw) { - osm_port_t *p_port; + osm_port_t *port; unsigned i; - for (i = 0; i < p_sw->num_hops; i++) - if (p_sw->hops[i]) { - p_port = - cl_ptr_vector_get(&p_updn->p_osm->subn.port_lid_tbl, - i); - if (!p_port || !p_port->p_node->sw - || ((struct updn_node *)p_port->p_node->sw->priv)-> + for (i = 0; i < sw->num_hops; i++) + if (sw->hops[i]) { + port = osm_get_port_by_lid_ho(&updn->p_osm->subn, i); + if (!port || !port->p_node->sw + || ((struct updn_node *)port->p_node->sw->priv)-> rank != 0) - memset(p_sw->hops[i], 0xff, p_sw->num_ports); + memset(sw->hops[i], 0xff, sw->num_ports); } } -/********************************************************************** - **********************************************************************/ static int updn_set_min_hop_table(IN updn_t * p_updn) { osm_subn_t *p_subn = &p_updn->p_osm->subn; @@ -351,8 +341,6 @@ static int updn_set_min_hop_table(IN updn_t * p_updn) return 0; } -/********************************************************************** - **********************************************************************/ static int updn_build_lid_matrices(IN updn_t * p_updn) { int status; @@ -389,8 +377,6 @@ _exit: return status; } -/********************************************************************** - **********************************************************************/ static struct updn_node *create_updn_node(osm_switch_t * sw) { struct updn_node *u; @@ -411,8 +397,6 @@ static void delete_updn_node(struct updn_node *u) free(u); } -/********************************************************************** - **********************************************************************/ /* Find Root nodes automatically by Min Hop Table info */ static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn) { @@ -517,8 +501,6 @@ _exit: return; } -/********************************************************************** - **********************************************************************/ static void dump_roots(cl_map_item_t *item, FILE *file, void *cxt) { osm_switch_t *sw = (osm_switch_t *)item; @@ -662,8 +644,6 @@ static int updn_lid_matrices(void *ctx) return ret; } -/********************************************************************** - **********************************************************************/ static void updn_delete(void *context) { free(context); diff --git a/branches/opensm_3/user/opensm/osm_vl15intf.c b/branches/opensm_3/user/opensm/osm_vl15intf.c index 1100076a..863120f0 100644 --- a/branches/opensm_3/user/opensm/osm_vl15intf.c +++ b/branches/opensm_3/user/opensm/osm_vl15intf.c @@ -1,6 +1,7 @@ /* + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2006,2009 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -53,9 +54,6 @@ #include #include -/********************************************************************** - **********************************************************************/ - static void vl15_send_mad(osm_vl15_t * p_vl, osm_madw_t * p_madw) { ib_api_status_t status; @@ -180,8 +178,6 @@ static void vl15_poller(IN void *p_ptr) OSM_LOG_EXIT(p_vl->p_log); } -/********************************************************************** - **********************************************************************/ void osm_vl15_construct(IN osm_vl15_t * p_vl) { memset(p_vl, 0, sizeof(*p_vl)); @@ -194,8 +190,6 @@ void osm_vl15_construct(IN osm_vl15_t * p_vl) cl_thread_construct(&p_vl->poller); } -/********************************************************************** - **********************************************************************/ void osm_vl15_destroy(IN osm_vl15_t * p_vl, IN struct osm_mad_pool *p_pool) { osm_madw_t *p_madw; @@ -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); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osm_vl15_init(IN osm_vl15_t * p_vl, IN osm_vendor_t * p_vend, IN osm_log_t * p_log, IN osm_stats_t * p_stats, IN int32_t max_wire_smps) @@ -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"); Exit: OSM_LOG_EXIT(p_log); - return (status); + return status; } -/********************************************************************** - **********************************************************************/ void osm_vl15_poll(IN osm_vl15_t * p_vl) { OSM_LOG_ENTER(p_vl->p_log); @@ -303,8 +293,6 @@ void osm_vl15_poll(IN osm_vl15_t * p_vl) OSM_LOG_EXIT(p_vl->p_log); } -/********************************************************************** - **********************************************************************/ void osm_vl15_post(IN osm_vl15_t * p_vl, IN osm_madw_t * p_madw) { OSM_LOG_ENTER(p_vl->p_log); diff --git a/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c b/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c index 07fbbba6..37e30bd1 100644 --- a/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c +++ b/branches/opensm_3/user/opensm/osm_vl_arb_rcv.c @@ -2,6 +2,8 @@ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2010 HNR Consulting. All rights reserved. + * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -55,8 +57,6 @@ #include #include -/********************************************************************** - **********************************************************************/ /* * WE ONLY RECEIVE GET or SET responses */ @@ -93,12 +93,10 @@ void osm_vla_rcv_process(IN void *context, IN void *data) cl_plock_excl_acquire(sm->p_lock); p_port = osm_get_port_by_guid(sm->p_subn, port_guid); if (!p_port) { - cl_plock_release(sm->p_lock); OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3F06: " "No port object for port with GUID 0x%" PRIx64 "\n\t\t\t\tfor parent node GUID 0x%" PRIx64 - ", TID 0x%" PRIx64 "\n", - cl_ntoh64(port_guid), + ", TID 0x%" PRIx64 "\n", cl_ntoh64(port_guid), cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id)); goto Exit; } @@ -136,15 +134,14 @@ void osm_vla_rcv_process(IN void *context, IN void *data) goto Exit; } - osm_dump_vl_arb_table(sm->p_log, - port_guid, block_num, - port_num, p_vla_tbl, OSM_LOG_DEBUG); - if ((block_num < 1) || (block_num > 4)) { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "Got invalid block number 0x%X\n", block_num); goto Exit; } + + osm_dump_vl_arb_table(sm->p_log, port_guid, block_num, port_num, + p_vla_tbl, OSM_LOG_DEBUG); osm_physp_set_vla_tbl(p_physp, p_vla_tbl, block_num); Exit: diff --git a/branches/opensm_3/user/opensm/st.c b/branches/opensm_3/user/opensm/st.c index 4712aff9..676b1c23 100644 --- a/branches/opensm_3/user/opensm/st.c +++ b/branches/opensm_3/user/opensm/st.c @@ -172,9 +172,9 @@ static int new_size(int size) static int collision = 0; static int init_st = 0; -static void stat_col() +static void stat_col(void) { - FILE *f = fopen("/var/log/osm_st_col", "w"); + FILE *f = fopen(OSM_DEFAULT_TMP_DIR "osm_st_col", "w"); fprintf(f, "collision: %d\n", collision); fclose(f); } diff --git a/branches/opensm_3/user/osmtest/SOURCES b/branches/opensm_3/user/osmtest/SOURCES index 2804ffc8..1027e8d7 100644 --- a/branches/opensm_3/user/osmtest/SOURCES +++ b/branches/opensm_3/user/osmtest/SOURCES @@ -12,11 +12,7 @@ TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR) TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR) !endif -# include only one vendor definition - -!include ..\opensm\vendor-ibal.inc -#!include ..\opensm\vendor-umad.inc - +!include ..\mad-vendor.inc TARGETTYPE=PROGRAM UMTYPE=console @@ -24,14 +20,14 @@ USE_MSVCRT=1 OVR_DIR=..\addon -SOURCES=\ +SOURCES=osmtest.rc \ osmt_files.c \ osmt_slvl_vl_arb.c \ osmt_service.c \ osmt_multicast.c \ osmt_inform.c \ osmtest.c \ - main.c \ + main.c OSM_HOME=.. diff --git a/branches/opensm_3/user/osmtest/main.c b/branches/opensm_3/user/osmtest/main.c index b2e1cb82..a8f41fe3 100644 --- a/branches/opensm_3/user/osmtest/main.c +++ b/branches/opensm_3/user/osmtest/main.c @@ -61,8 +61,6 @@ #define OSMT_DEFAULT_TRAP_WAIT_TIMEOUT_SEC 10 #define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL) -/********************************************************************** - **********************************************************************/ boolean_t osmt_is_debug(void) { #if defined( _DEBUG_ ) @@ -72,8 +70,6 @@ boolean_t osmt_is_debug(void) #endif /* defined( _DEBUG_ ) */ } -/********************************************************************** - **********************************************************************/ void show_usage() { printf @@ -207,8 +203,6 @@ void show_usage() " the transaction timeout with the -t option\n\n"); } -/********************************************************************** - **********************************************************************/ static void print_all_guids(IN osmtest_t * p_osmt) { ib_api_status_t status; @@ -235,8 +229,6 @@ static void print_all_guids(IN osmtest_t * p_osmt) cl_hton64(attr_array[i].port_guid)); } -/********************************************************************** - **********************************************************************/ ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid) { ib_api_status_t status; @@ -273,8 +265,6 @@ ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid) return 0; } -/********************************************************************** - **********************************************************************/ int main(int argc, char *argv[]) { static osmtest_t osm_test; @@ -286,7 +276,11 @@ int main(int argc, char *argv[]) int32_t vendor_debug = 0; char flow_name[64]; uint32_t next_option; - const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh"; + const char *const short_option = +#ifdef __WIN__ + "?" +#endif + "f:l:m:M:d:g:s:t:i:pcvVh"; /* * In the array below, the 2nd parameter specified the number @@ -316,13 +310,6 @@ int main(int argc, char *argv[]) {NULL, 0, NULL, 0} /* Required at end of array */ }; -#ifdef __WIN__ - if ( !strcmp(argv[1],"/?") ) { - show_usage(); - return 0; - } -#endif - /* Make sure that the opensm, complib and osmtest were compiled using same modes (debug/free) */ if (osm_is_debug() != cl_is_debug() || osm_is_debug() != osmt_is_debug() @@ -559,6 +546,9 @@ int main(int argc, char *argv[]) } break; +#ifdef __WIN__ + case '?': +#endif case 'h': show_usage(); return 0; diff --git a/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c b/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c index 6e2cd385..f603ade2 100644 --- a/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c +++ b/branches/opensm_3/user/osmtest/osmt_mtl_regular_qp.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2009 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * diff --git a/branches/opensm_3/user/osmtest/osmt_multicast.c b/branches/opensm_3/user/osmtest/osmt_multicast.c index 363a059f..ed8577c2 100644 --- a/branches/opensm_3/user/osmtest/osmt_multicast.c +++ b/branches/opensm_3/user/osmtest/osmt_multicast.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two @@ -51,9 +51,6 @@ #include #include "osmtest.h" -/********************************************************************** - **********************************************************************/ - static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt) { uint32_t i; @@ -126,9 +123,6 @@ static void __osmt_print_all_multicast_records(IN osmtest_t * const p_osmt) } -/********************************************************************** - **********************************************************************/ - static cl_status_t __match_mgids(IN const void *const p_object, IN void *context) { @@ -143,9 +137,6 @@ __match_mgids(IN const void *const p_object, IN void *context) return CL_NOT_FOUND; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_query_mcast(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -273,9 +264,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ - /* given a multicast request send and wait for response. */ ib_api_status_t osmt_send_mcast_request(IN osmtest_t * const p_osmt, @@ -381,9 +369,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ - void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt, IN OUT ib_member_rec_t * p_mc_req) { diff --git a/branches/opensm_3/user/osmtest/osmt_service.c b/branches/opensm_3/user/osmtest/osmt_service.c index e9b5bed5..9921c26f 100644 --- a/branches/opensm_3/user/osmtest/osmt_service.c +++ b/branches/opensm_3/user/osmtest/osmt_service.c @@ -55,8 +55,6 @@ #include #include "osmtest.h" -/********************************************************************** - **********************************************************************/ ib_api_status_t osmt_register_service(IN osmtest_t * const p_osmt, @@ -160,9 +158,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_register_service_with_full_key(IN osmtest_t * const p_osmt, IN ib_net64_t service_id, @@ -284,9 +279,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_register_service_with_data(IN osmtest_t * const p_osmt, IN ib_net64_t service_id, @@ -440,9 +432,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_get_service_by_id_and_name(IN osmtest_t * const p_osmt, IN uint32_t rec_num, @@ -569,9 +558,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_get_service_by_id(IN osmtest_t * const p_osmt, IN uint32_t rec_num, @@ -694,9 +680,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_get_service_by_name_and_key(IN osmtest_t * const p_osmt, IN char *sr_name, @@ -828,9 +811,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_get_service_by_name(IN osmtest_t * const p_osmt, IN char *sr_name, @@ -945,9 +925,6 @@ Exit: return status; } -/********************************************************************** - **********************************************************************/ - #ifdef VENDOR_RMPP_SUPPORT ib_api_status_t osmt_get_all_services_and_check_names(IN osmtest_t * const p_osmt, @@ -1068,9 +1045,6 @@ Exit: } #endif -/********************************************************************** - **********************************************************************/ - ib_api_status_t osmt_delete_service_by_name(IN osmtest_t * const p_osmt, IN uint8_t IsServiceExist, @@ -1174,9 +1148,6 @@ ExitNoDel: return status; } -/********************************************************************** - **********************************************************************/ - /* * Run a complete service records flow: * - register a service diff --git a/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c b/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c index 14615e39..e82e7d8d 100644 --- a/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c +++ b/branches/opensm_3/user/osmtest/osmt_slvl_vl_arb.c @@ -51,8 +51,6 @@ #include #include "osmtest.h" -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_vl_arb_table(IN osmtest_t * const p_osmt, IN FILE * fh, diff --git a/branches/opensm_3/user/osmtest/osmtest.c b/branches/opensm_3/user/osmtest/osmtest.c index 5c7dcd73..4c03370c 100644 --- a/branches/opensm_3/user/osmtest/osmtest.c +++ b/branches/opensm_3/user/osmtest/osmtest.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -247,8 +247,6 @@ static const char ib_mad_status_str_insuf_comps[] = "IB_SA_MAD_STATUS_INSUF_COMPS"; static const char generic_or_str[] = " | "; -/********************************************************************** - **********************************************************************/ const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad) { static char line[512]; @@ -378,8 +376,6 @@ const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad) return (line); } -/********************************************************************** - **********************************************************************/ void subnet_construct(IN subnet_t * const p_subn) { cl_qmap_init(&p_subn->link_tbl); @@ -396,8 +392,6 @@ void subnet_construct(IN subnet_t * const p_subn) cl_qmap_init(&p_subn->path_tbl); } -/********************************************************************** - **********************************************************************/ cl_status_t subnet_init(IN subnet_t * const p_subn) { cl_status_t status = IB_SUCCESS; @@ -407,8 +401,6 @@ cl_status_t subnet_init(IN subnet_t * const p_subn) return (status); } -/********************************************************************** - **********************************************************************/ void osmtest_construct(IN osmtest_t * const p_osmt) { memset(p_osmt, 0, sizeof(*p_osmt)); @@ -416,8 +408,6 @@ void osmtest_construct(IN osmtest_t * const p_osmt) subnet_construct(&p_osmt->exp_subn); } -/********************************************************************** - **********************************************************************/ void osmtest_destroy(IN osmtest_t * const p_osmt) { cl_map_item_t *p_item, *p_next_item; @@ -475,8 +465,6 @@ void osmtest_destroy(IN osmtest_t * const p_osmt) osm_log_destroy(&p_osmt->log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_init(IN osmtest_t * const p_osmt, IN const osmtest_opt_t * const p_opt, @@ -530,8 +518,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ void osmtest_query_res_cb(IN osmv_query_res_t * p_rec) { osmtest_req_context_t *const p_ctxt = @@ -550,8 +536,6 @@ void osmtest_query_res_cb(IN osmv_query_res_t * p_rec) OSM_LOG_EXIT(&p_osmt->log); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_get_all_recs(IN osmtest_t * const p_osmt, IN ib_net16_t const attr_id, @@ -579,7 +563,7 @@ osmtest_get_all_recs(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.attr_id = attr_id; - user.attr_offset = cl_ntoh16((uint16_t) (attr_size >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) (attr_size >> 3)); req.query_type = OSMV_QUERY_USER_DEFINED; req.timeout_ms = p_osmt->opt.transaction_timeout; @@ -618,8 +602,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_validate_sa_class_port_info(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -705,8 +687,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_get_node_rec(IN osmtest_t * const p_osmt, IN ib_net64_t const node_guid, @@ -739,7 +719,7 @@ osmtest_get_node_rec(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.comp_mask = IB_NR_COMPMASK_NODEGUID; user.attr_id = IB_MAD_ATTR_NODE_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -813,7 +793,7 @@ osmtest_get_node_rec_by_lid(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.comp_mask = IB_NR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_NODE_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -856,8 +836,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt, IN ib_net64_t sguid, @@ -921,8 +899,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_get_path_rec_by_gid_pair(IN osmtest_t * const p_osmt, IN ib_gid_t sgid, @@ -989,8 +965,6 @@ Exit: } #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP) -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_get_multipath_rec(IN osmtest_t * const p_osmt, IN osmv_multipath_req_t * p_request, @@ -1051,8 +1025,6 @@ Exit: } #endif -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_get_port_rec(IN osmtest_t * const p_osmt, IN ib_net16_t const lid, @@ -1085,7 +1057,7 @@ osmtest_get_port_rec(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.comp_mask = IB_PIR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_PORTINFO_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -1125,8 +1097,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_get_port_rec_by_num(IN osmtest_t * const p_osmt, IN ib_net16_t const lid, @@ -1202,8 +1172,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_port_recs_large(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -1265,8 +1233,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_node_recs_large(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -1329,8 +1295,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_path_recs_large(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -1392,8 +1356,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_path_recs_by_guid(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -1504,8 +1466,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_port_recs_small(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -1569,8 +1529,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_get_local_port_lmc(IN osmtest_t * const p_osmt, IN ib_net16_t lid, OUT uint8_t * const p_lmc) @@ -1702,8 +1660,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_port_info(IN osmtest_t * const p_osmt, IN FILE * fh, @@ -1798,8 +1754,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_path_info(IN osmtest_t * const p_osmt, IN FILE * fh, IN const ib_path_rec_t * const p_rec) @@ -1848,8 +1802,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_node_info(IN osmtest_t * const p_osmt, IN FILE * fh, IN const ib_node_record_t * const p_rec) @@ -1908,8 +1860,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_link(IN osmtest_t * const p_osmt, IN FILE * fh, IN const ib_link_record_t * const p_rec) @@ -1942,8 +1892,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh) { @@ -1977,7 +1925,7 @@ osmtest_write_all_link_recs(IN osmtest_t * const p_osmt, IN FILE * fh) num_recs = context.result.result_cnt; OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, - "Received %zu records\n", num_recs); + "Received %u records\n", num_recs); result = fprintf(fh, "#\n" "# Link Records\n" "#\n"); if (result < 0) { @@ -2010,8 +1958,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt, IN ib_net16_t slid, @@ -2043,7 +1989,7 @@ osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt, req.sm_key = 0; OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, - "Query for path from 0x%X to 0x%X\n", slid, dlid); + "Query for path (by lid pair) from 0x%X to 0x%X\n", slid, dlid); status = osmv_query_sa(p_osmt->h_bind, &req); if (status != IB_SUCCESS) { OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0053: " @@ -2064,7 +2010,6 @@ osmtest_get_path_rec_by_lid_pair(IN osmtest_t * const p_osmt, ((*p_context).result. p_result_madw))); } - goto Exit; } Exit: @@ -2108,7 +2053,7 @@ osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh) */ num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); result = fprintf(fh, "#\n" "# Node Records\n" "#\n"); if (result < 0) { @@ -2173,7 +2118,7 @@ osmtest_write_all_port_recs(IN osmtest_t * const p_osmt, IN FILE * fh) */ num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); result = fprintf(fh, "#\n" "# PortInfo Records\n" "#\n"); if (result < 0) { @@ -2239,7 +2184,7 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) */ num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); result = fprintf(fh, "#\n" "# Path Records\n" "#\n"); if (result < 0) { @@ -2269,7 +2214,7 @@ Exit: return (status); } -#else +#else /* !VENDOR_RMPP_SUPPORT */ /* * NON RMPP BASED QUERY FOR ALL NODES: BASED ON THE MAX LID GIVEN BY THE USER */ @@ -2582,8 +2527,6 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) #endif -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_create_inventory_file(IN osmtest_t * const p_osmt) { @@ -2627,8 +2570,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_stress_large_rmpp_pr(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -2706,8 +2647,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_stress_large_rmpp(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -2790,8 +2729,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_stress_small_rmpp(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -2867,8 +2804,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_stress_path_recs_by_lid(IN osmtest_t * const p_osmt, OUT uint32_t * const p_num_recs, @@ -2885,7 +2820,11 @@ osmtest_stress_path_recs_by_lid(IN osmtest_t * const p_osmt, memset(&context, 0, sizeof(context)); slid = cl_ntoh16(p_osmt->local_port.lid); +#ifdef OSM_VENDOR_INTF_AL + dlid = p_osmt->local_port.sm_lid; // already in correct byte-order +#else dlid = cl_ntoh16(p_osmt->local_port.sm_lid); +#endif /* * Do a blocking query for the PathRecord. @@ -2929,8 +2868,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_stress_get_pr(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -3007,8 +2944,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static void osmtest_prepare_db_generic(IN osmtest_t * const p_osmt, IN cl_qmap_t * const p_tbl) @@ -3027,8 +2962,6 @@ osmtest_prepare_db_generic(IN osmtest_t * const p_osmt, OSM_LOG_EXIT(&p_osmt->log); } -/********************************************************************** - **********************************************************************/ static void osmtest_prepare_db(IN osmtest_t * const p_osmt) { OSM_LOG_ENTER(&p_osmt->log); @@ -3039,8 +2972,6 @@ static void osmtest_prepare_db(IN osmtest_t * const p_osmt) OSM_LOG_EXIT(&p_osmt->log); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt) { const node_t *p_node; @@ -3071,8 +3002,6 @@ static ib_api_status_t osmtest_check_missing_nodes(IN osmtest_t * const p_osmt) return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt) { const port_t *p_port; @@ -3104,8 +3033,6 @@ static ib_api_status_t osmtest_check_missing_ports(IN osmtest_t * const p_osmt) return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_check_missing_paths(IN osmtest_t * const p_osmt) { const path_t *p_path; @@ -3139,15 +3066,11 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ inline uint32_t osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec) { return (p_rec->dlid << 16 | p_rec->slid); } -/********************************************************************** - **********************************************************************/ static boolean_t osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt, IN const path_t * const p_path) @@ -3161,8 +3084,6 @@ osmtest_path_rec_kay_is_valid(IN osmtest_t * const p_osmt, return (TRUE); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_path_data(IN osmtest_t * const p_osmt, IN path_t * const p_path, @@ -3272,8 +3193,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_node_data(IN osmtest_t * const p_osmt, IN node_t * const p_node, @@ -3451,8 +3370,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_node_rec(IN osmtest_t * const p_osmt, IN const ib_node_record_t * const p_rec) @@ -3484,8 +3401,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_port_data(IN osmtest_t * const p_osmt, IN port_t * const p_port, @@ -3963,8 +3878,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_port_rec(IN osmtest_t * const p_osmt, IN const ib_portinfo_record_t * const p_rec) @@ -3998,8 +3911,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_path_rec(IN osmtest_t * const p_osmt, IN const ib_path_rec_t * const p_rec) @@ -4033,8 +3944,6 @@ Exit: #ifdef VENDOR_RMPP_SUPPORT ib_net64_t portguid = 0; -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt) { @@ -4063,7 +3972,7 @@ osmtest_validate_all_node_recs(IN osmtest_t * const p_osmt) num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); /* @@ -4108,8 +4017,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt) { @@ -4137,7 +4044,7 @@ osmtest_validate_all_guidinfo_recs(IN osmtest_t * const p_osmt) num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); /* No validation as yet */ @@ -4156,8 +4063,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt) { @@ -4186,7 +4091,7 @@ osmtest_validate_all_path_recs(IN osmtest_t * const p_osmt) num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %u records\n", num_recs); /* @@ -4269,7 +4174,7 @@ osmtest_get_link_rec_by_lid(IN osmtest_t * const p_osmt, if (to_lid) user.comp_mask |= IB_LR_COMPMASK_TO_LID; user.attr_id = IB_MAD_ATTR_LINK_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4347,7 +4252,7 @@ osmtest_get_guidinfo_rec_by_lid(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.comp_mask = IB_GIR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_GUIDINFO_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4426,7 +4331,7 @@ osmtest_get_pkeytbl_rec_by_lid(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.comp_mask = IB_PKEY_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_PKEY_TBL_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4505,7 +4410,7 @@ osmtest_get_sw_info_rec_by_lid(IN osmtest_t * const p_osmt, if (lid) user.comp_mask = IB_SWIR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_SWITCH_INFO_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4584,7 +4489,7 @@ osmtest_get_lft_rec_by_lid(IN osmtest_t * const p_osmt, if (lid) user.comp_mask = IB_LFTR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_LFT_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4663,7 +4568,7 @@ osmtest_get_mft_rec_by_lid(IN osmtest_t * const p_osmt, if (lid) user.comp_mask = IB_MFTR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_MFT_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -4707,8 +4612,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_sminfo_record_request(IN osmtest_t * const p_osmt, IN uint8_t method, @@ -4737,7 +4640,7 @@ osmtest_sminfo_record_request(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.attr_id = IB_MAD_ATTR_SMINFO_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); p_sm_info_opt = p_options; if (p_sm_info_opt->sm_guid != 0) { record.sm_info.guid = p_sm_info_opt->sm_guid; @@ -4804,8 +4707,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_informinfo_request(IN osmtest_t * const p_osmt, IN ib_net16_t attr_id, @@ -4839,7 +4740,7 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt, p_context->p_osmt = p_osmt; user.attr_id = attr_id; if (attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD) { - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); p_inform_info_rec_opt = p_options; if (p_inform_info_rec_opt->subscriber_gid.unicast.prefix != 0 && p_inform_info_rec_opt->subscriber_gid.unicast. @@ -4853,7 +4754,7 @@ osmtest_informinfo_request(IN osmtest_t * const p_osmt, user.comp_mask |= IB_IIR_COMPMASK_ENUM; user.p_attr = &record; } else { - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(rec) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(rec)); /* comp mask bits below are for InformInfoRecord rather than InformInfo */ /* as currently no comp mask bits defined for InformInfo!!! */ user.comp_mask = IB_IIR_COMPMASK_SUBSCRIBE; @@ -4918,8 +4819,6 @@ Exit: } #endif -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt, IN path_t * const p_path) @@ -4945,7 +4844,7 @@ osmtest_validate_single_path_rec_lid_pair(IN osmtest_t * const p_osmt, num_recs = context.result.result_cnt; if (num_recs != 1) { OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0103: " - "Too many records. Expected 1, received %zu\n", + "Too many records. Expected 1, received %u\n", num_recs); status = IB_ERROR; @@ -4975,8 +4874,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt, IN ib_net16_t const lid, @@ -5006,7 +4903,7 @@ osmtest_validate_single_node_rec_lid(IN osmtest_t * const p_osmt, context.p_osmt = p_osmt; user.comp_mask = IB_NR_COMPMASK_LID; user.attr_id = IB_MAD_ATTR_NODE_RECORD; - user.attr_offset = cl_ntoh16((uint16_t) (sizeof(record) >> 3)); + user.attr_offset = ib_get_attr_offset((uint16_t) sizeof(record)); user.p_attr = &record; req.query_type = OSMV_QUERY_USER_DEFINED; @@ -5073,8 +4970,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_port_rec_lid(IN osmtest_t * const p_osmt, IN port_t * const p_port) @@ -5122,8 +5017,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt, IN const osmv_guid_pair_t * @@ -5183,7 +5076,7 @@ osmtest_validate_single_path_rec_guid_pair(IN osmtest_t * const p_osmt, } num_recs = context.result.result_cnt; - OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "%zu records\n", num_recs); + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "%u records\n", num_recs); for (i = 0; i < num_recs; i++) { p_rec = @@ -5242,8 +5135,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_path_recs(IN osmtest_t * const p_osmt) { @@ -5326,8 +5217,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_node_recs(IN osmtest_t * const p_osmt) { @@ -5380,8 +5269,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_single_port_recs(IN osmtest_t * const p_osmt) { @@ -5432,8 +5319,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_validate_against_db(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; @@ -6146,8 +6031,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static const osmtest_token_t *str_get_token(IN char *const p_str) { const osmtest_token_t *p_tok; @@ -6194,8 +6077,6 @@ static void str_skip_token(IN char line[], IN OUT uint32_t * const p_offset) } } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_parse_node(IN osmtest_t * const p_osmt, IN FILE * const fh, IN OUT uint32_t * const p_line_num) @@ -6421,8 +6302,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_parse_port(IN osmtest_t * const p_osmt, IN FILE * const fh, IN OUT uint32_t * const p_line_num) @@ -6828,8 +6707,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_parse_path(IN osmtest_t * const p_osmt, IN FILE * const fh, IN OUT uint32_t * const p_line_num) @@ -6989,8 +6866,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_parse_link(IN osmtest_t * const p_osmt, IN FILE * const fh, IN OUT uint32_t * const p_line_num) @@ -7070,8 +6945,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ static ib_api_status_t osmtest_create_db(IN osmtest_t * const p_osmt) { FILE *fh; @@ -7214,8 +7087,6 @@ osmtest_get_user_port(IN osmtest_t * const p_osmt, return (choice - 1); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_bind(IN osmtest_t * p_osmt, IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL) @@ -7295,8 +7166,6 @@ Exit: return (status); } -/********************************************************************** - **********************************************************************/ ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt) { ib_api_status_t status = IB_SUCCESS; diff --git a/branches/opensm_3/user/osmtest/osmtest.rc b/branches/opensm_3/user/osmtest/osmtest.rc index 39920632..1b71a2d5 100644 --- a/branches/opensm_3/user/osmtest/osmtest.rc +++ b/branches/opensm_3/user/osmtest/osmtest.rc @@ -31,14 +31,14 @@ #include -#define VER_FILETYPE VFT_APP -#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN #ifdef _DEBUG_ -#define VER_FILEDESCRIPTION_STR "OpenSM Test Application (Debug)" +#define VER_FILEDESCRIPTION_STR "OpenSM Test Application 3.3.6 (Debug)" #define VER_INTERNALNAME_STR "osmtest.exe" #define VER_ORIGINALFILENAME_STR "osmtest.exe" #else -#define VER_FILEDESCRIPTION_STR "OpenSM Test Application" +#define VER_FILEDESCRIPTION_STR "OpenSM Test Application 3.3.6" #define VER_INTERNALNAME_STR "osmtest.exe" #define VER_ORIGINALFILENAME_STR "osmtest.exe" #endif diff --git a/branches/opensm_3/user/osmtest/vendor-ibal.inc b/branches/opensm_3/user/osmtest/vendor-ibal.inc new file mode 100644 index 00000000..303cdd49 --- /dev/null +++ b/branches/opensm_3/user/osmtest/vendor-ibal.inc @@ -0,0 +1,2 @@ + +!INCLUDE ..\opensm\vendor-ibal.inc diff --git a/branches/opensm_3/user/osmtest/vendor-umad.inc b/branches/opensm_3/user/osmtest/vendor-umad.inc new file mode 100644 index 00000000..d106d80f --- /dev/null +++ b/branches/opensm_3/user/osmtest/vendor-umad.inc @@ -0,0 +1,2 @@ + +!INCLUDE ..\opensm\vendor-umad.inc diff --git a/branches/opensm_3/user/scripts/opensm.init.in b/branches/opensm_3/user/scripts/opensm.init.in deleted file mode 100644 index 997dce5a..00000000 --- a/branches/opensm_3/user/scripts/opensm.init.in +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -# -# opensm: Manage OpenSM -# -# chkconfig: - 09 91 -# description: Manage OpenSM -# -### BEGIN INIT INFO -# Provides: opensm -# Required-Start: $syslog -# Default-Start: none -# Default-Stop: 0 1 6 -# Description: Manage OpenSM -### END INIT INFO -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright 2006 PathScale, Inc. All Rights Reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -# Source function library. -if [[ -s /etc/init.d/functions ]]; then - . /etc/init.d/functions - rc_status() { :; } - rc_exit() { exit $RETVAL; } -fi -if [[ -s /etc/rc.status ]]; then - . /etc/rc.status - failure() { rc_status -v; } - success() { rc_status -v; } -fi - -CONFIG=@sysconfdir@/sysconfig/opensm -if [[ -s $CONFIG ]]; then - . $CONFIG -fi - -start () { - echo -n "Starting opensm: " - @sbindir@/opensm --daemon $OPTIONS > /dev/null - if [[ $RETVAL -eq 0 ]]; then - touch /var/lock/subsys/opensm - success - else - failure - fi - echo -} - -stop () { - echo -n "Shutting down opensm: " - killproc opensm - if [[ $RETVAL -eq 0 ]]; then - rm -f /var/lock/subsys/opensm - success - else - failure - fi - echo -} - -Xstatus () { - pid="`pidof opensm`" - ret=$? - if [ $ret -eq 0 ] ; then - echo "OpenSM is running... pid=$pid" - else - echo "OpenSM is not running." - fi -} - -restart() { - stop - start -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - Xstatus - ;; - restart | force-reload | reload) - restart - ;; - try-restart | condrestart) - [ -e /var/lock/subsys/opensm ] && restart - ;; - resweep) - killall -HUP opensm - RETVAL=$? - ;; - rotatelog) - killall -USR1 opensm - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|resweep|rotatelog}" - RETVAL=1 - ;; -esac - -_rc_status_all=$RETVAL -rc_exit diff --git a/branches/opensm_3/user/scripts/opensm.logrotate b/branches/opensm_3/user/scripts/opensm.logrotate deleted file mode 100644 index ee5a455f..00000000 --- a/branches/opensm_3/user/scripts/opensm.logrotate +++ /dev/null @@ -1,7 +0,0 @@ -/var/log/opensm.log { - missingok - notifempty - copytruncate - weekly - compress -} diff --git a/branches/opensm_3/user/scripts/opensm.sysconfig b/branches/opensm_3/user/scripts/opensm.sysconfig deleted file mode 100644 index 2d723503..00000000 --- a/branches/opensm_3/user/scripts/opensm.sysconfig +++ /dev/null @@ -1,2 +0,0 @@ -# It will be used for sldd.sh -OSM_HOSTS="" diff --git a/branches/opensm_3/user/scripts/osm-regress.bat b/branches/opensm_3/user/scripts/osm-regress.bat new file mode 100644 index 00000000..9229f91e --- /dev/null +++ b/branches/opensm_3/user/scripts/osm-regress.bat @@ -0,0 +1,45 @@ +@echo off +setlocal + +rem requires cmd.exe /E /V, make it so... JLP +set F=on +set F=off +if "!F!" == "off" goto OK + +%comspec% /E:on /V:on /C %0 %1 %2 +exit /B %ERRORLEVEL% + +:OK + +if "%1" == "" ( +:usage + echo usage: osm-regress results-filename {exit-on-error} + exit /B 1 +) +if exist "%1" del /Q "%1" + +rem if not exist "osmtest.dat" ( +rem echo missing inventory file .\osmtest.dat ? +rem exit /B 1 +rem ) + +rem set T=..\..\..\bin\user\objchk_wlh_amd64\amd64\osmtest.exe +set T=osmtest.exe + +rem Event forwarding test 'e' is not yet implemented [3.3.5] + +set TESTS="c" "v" "m -M1" "m -M2" "m -M3" "m -M4" "f -s1" "f -s2" "f -s3" "f -s4" "s" "a" +rem set TESTS="c" "v" "a" "f -s1" "f -s2" "f -s3" "f -s4" "s" + +for %%t in ( %TESTS% ) DO ( + echo TEST: osmtest -f %%~t + echo TEST: osmtest -f %%~t >> %1 + %T% -f %%~t >> %1 + if !ERRORLEVEL! NEQ 0 ( + echo Error !ERRORLEVEL! reported in osmtest -f %%~t ? + if Not "%2" == "" exit /B 1 + ) + echo. >> %1 + echo PASS. +) +endlocal diff --git a/branches/opensm_3/user/scripts/redhat-opensm.init.in b/branches/opensm_3/user/scripts/redhat-opensm.init.in deleted file mode 100644 index 71d95d5d..00000000 --- a/branches/opensm_3/user/scripts/redhat-opensm.init.in +++ /dev/null @@ -1,292 +0,0 @@ -#!/bin/bash -# -# Bring up/down opensm -# -# chkconfig: - 15 85 -# description: Activates/Deactivates InfiniBand Subnet Manager -# -### BEGIN INIT INFO -# Provides: opensm -### END INIT INFO -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright (c) 2006 Mellanox Technologies. All rights reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. -# -# -# $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $ -# -# processname: @sbindir@/opensm -# config: @sysconfdir@/sysconfig/opensm -# pidfile: /var/run/opensm.pid - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -. /etc/rc.d/init.d/functions - -CONFIG=@sysconfdir@/sysconfig/opensm -if [ -f $CONFIG ]; then - . $CONFIG -fi - -prog=@sbindir@/opensm -bin=${prog##*/} - -# Handover daemon for updating guid2lid cache file -sldd_prog=@sbindir@/sldd.sh -sldd_bin=${sldd_prog##*/} -sldd_pid_file=/var/run/sldd.pid - -ACTION=$1 - -# Setting OpenSM start parameters -PID_FILE=/var/run/${bin}.pid -touch $PID_FILE - -if [[ -n "${OSM_HOSTS}" && $(echo -n ${OSM_HOSTS} | wc -w | tr -d '[:space:]') -gt 1 ]]; then - HONORE_GUID2LID="--honor_guid2lid" -fi - -######################################################################### - -start_sldd() -{ - if [ -f $sldd_pid_file ]; then - local line p - read line < $sldd_pid_file - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p" - done - fi - - if [ -z "$sldd_pid" ]; then - sldd_pid=`pidof -x $sldd_bin` - fi - - if [ -n "${sldd_pid:-}" ] ; then - kill -9 ${sldd_pid} > /dev/null 2>&1 - fi - - $sldd_prog > /dev/null 2>&1 & - sldd_pid=$! - - echo ${sldd_pid} > $sldd_pid_file - # Sleep is needed in order to update local gid2lid cache file before running opensm - sleep 3 -} - -stop_sldd() -{ - if [ -f $sldd_pid_file ]; then - local line p - read line < $sldd_pid_file - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && sldd_pid="$sldd_pid $p" - done - fi - - if [ -z "$sldd_pid" ]; then - sldd_pid=`pidof -x $sldd_bin` - fi - - if [ -n "${sldd_pid:-}" ] ; then - kill -15 ${sldd_pid} > /dev/null 2>&1 - fi - -} - -start() -{ - local OSM_PID= - - pid="" - - if [ -f $PID_FILE ]; then - local line p - read line < $PID_FILE - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p" - done - fi - - if [ -z "$pid" ]; then - pid=`pidof -o $$ -o $PPID -o %PPID -x $bin` - fi - - if [ -n "${pid:-}" ] ; then - echo $"${bin} (pid $pid) is already running..." - else - - if [ -n "${HONORE_GUID2LID}" ]; then - # Run sldd daemod - start_sldd - fi - - # Start opensm - echo -n "Starting IB Subnet Manager" - $prog --daemon ${HONORE_GUID2LID} ${OPTIONS} > /dev/null - cnt=0; alive=0 - while [ $cnt -lt 6 -a $alive -ne 1 ]; do - echo -n "."; - sleep 1 - alive=0 - OSM_PID=`pidof $prog` - if [ "$OSM_PID" != "" ]; then - alive=1 - fi - let cnt++; - done - - echo $OSM_PID > $PID_FILE - checkpid $OSM_PID - RC=$? - [ $RC -eq 0 ] && echo_success || echo_failure - [ $RC -eq 0 ] && touch /var/lock/subsys/opensm - echo - - fi -return $RC -} - -stop() -{ - local pid= - local pid1= - local pid2= - - # Stop sldd daemon - stop_sldd - - if [ -f $PID_FILE ]; then - local line p - read line < $PID_FILE - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid1="$pid1 $p" - done - fi - - pid2=`pidof -o $$ -o $PPID -o %PPID -x $bin` - - pid=`echo "$pid1 $pid2" | sed -e 's/\ /\n/g' | sort -n | uniq | sed -e 's/\n/\ /g'` - - if [ -n "${pid:-}" ] ; then - # Kill opensm - echo -n "Stopping IB Subnet Manager." - kill -15 $pid > /dev/null 2>&1 - cnt=0; alive=1 - while [ $cnt -lt 6 -a $alive -ne 0 ]; do - echo -n "."; - alive=0 - for p in $pid; do - if checkpid $p ; then alive=1; echo -n "-"; fi - done - let cnt++; - sleep $alive - done - - for p in $pid - do - while checkpid $p ; do - kill -KILL $p > /dev/null 2>&1 - echo -n "+" - sleep 1 - done - done - checkpid $pid - RC=$? - [ $RC -eq 0 ] && echo_failure || echo_success - echo - RC=$((! $RC)) - else - echo -n "Stopping IB Subnet Manager." - echo_failure - echo - RC=1 - fi - - # Remove pid file if any. - rm -f $PID_FILE - rm -f /var/lock/subsys/opensm - return $RC -} - -status() -{ - local pid - - # First try "pidof" - pid=`pidof -o $$ -o $PPID -o %PPID -x ${bin}` - if [ -n "$pid" ]; then - echo $"${bin} (pid $pid) is running..." - return 0 - fi - - # Next try "/var/run/opensm.pid" files - if [ -f $PID_FILE ] ; then - read pid < $PID_FILE - if [ -n "$pid" ]; then - echo $"${bin} dead but pid file $PID_FILE exists" - return 1 - fi - fi - echo $"${bin} is stopped" - return 3 -} - - - -case $ACTION in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - status) - status - ;; - condrestart) - pid=`pidof -o $$ -o $PPID -o %PPID -x $bin` - if [ -n "$pid" ]; then - stop - sleep 1 - start - fi - ;; - *) - echo - echo "Usage: `basename $0` {start|stop|restart|status}" - echo - exit 1 - ;; -esac - -RC=$? -exit $RC diff --git a/branches/opensm_3/user/scripts/sldd.sh.in b/branches/opensm_3/user/scripts/sldd.sh.in deleted file mode 100644 index b661f0f2..00000000 --- a/branches/opensm_3/user/scripts/sldd.sh.in +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2008 Voltaire, Inc. All rights reserved. -# Copyright (c) 2006 Mellanox Technologies. All rights reserved. -# -# This Software is licensed under one of the following licenses: -# -# 1) under the terms of the "Common Public License 1.0" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/cpl.php. -# -# 2) under the terms of the "The BSD License" a copy of which is -# available from the Open Source Initiative, see -# http://www.opensource.org/licenses/bsd-license.php. -# -# 3) under the terms of the "GNU General Public License (GPL) Version 2" a -# copy of which is available from the Open Source Initiative, see -# http://www.opensource.org/licenses/gpl-license.php. -# -# Licensee has the right to choose one of the above licenses. -# -# Redistributions of source code must retain the above copyright -# notice and one of the license notices. -# -# Redistributions in binary form must reproduce both the above copyright -# notice, one of the license notices in the documentation -# and/or other materials provided with the distribution. -# -# - -# OpenSM found to have the following problem -# when handover is performed: -# If some of the cluster nodes are rebooted during the handover they loose their LID assignment. -# The reason for it is that the standby SM does not obey its own Guid to LID table -# and simply uses the discovered LIDs. If some nodes are not available for it -# their previous LID assignment is lost forever. - -# The idea is to use an external daemon that will distribute -# the semi-static LID assignment table from the master SM to all standby SMs. -# A standby SM, becoming a master . needs to obey the copied semi static LID assignment table. - -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -CONFIG=@sysconfdir@/sysconfig/opensm -if [ -f $CONFIG ]; then - . $CONFIG -fi - -SLDD_DEBUG=${SLDD_DEBUG:-0} - -CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid} -CACHE_DIR=$(dirname ${CACHE_FILE}) -tmp_cache=${CACHE_FILE}.tmp - -PING='ping -w 1 -c 1' - -RCP=${RCP:-/usr/bin/scp} -RSH=${RSH:-/usr/bin/ssh} -IFCONFIG=${IFCONFIG:-'/sbin/ifconfig -a'} - -declare -i SLDD_DEBUG -RESCAN_TIME=${RESCAN_TIME:-60} - -if [ -z "${OSM_HOSTS}" ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "No OpenSM servers (OSM_HOSTS) configured for the IB subnet." - exit 0 -fi - - -declare -a arr_OSM_HOSTS -arr_OSM_HOSTS=(${OSM_HOSTS}) - -num_of_osm_hosts=${#arr_OSM_HOSTS[@]} - -if [ ${num_of_osm_hosts} -eq 1 ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "One OpenSM server configured in the IB subnet." && - echo "Nothing to be done for SLDD" - - exit 0 -fi - -trap 'trap_handler' 15 - -trap_handler() -{ - logger -i "SLDD: Exiting." - exit 0 -} - -is_alive() -{ - $PING $1 > /dev/null 2>&1 - return $? -} - -is_local() -{ - $IFCONFIG | grep -w "$1" > /dev/null 2>&1 - return $? -} - -update_remote_cache() -{ - /bin/rm -f ${CACHE_FILE}.upd - /bin/cp -a ${CACHE_FILE} ${CACHE_FILE}.upd - - [ $SLDD_DEBUG -eq 1 ] && - echo "Updating remote cache file" - - for host in ${OSM_HOSTS} - do - # Skip local host update - if [ "${host}" == "${local_host}" ]; then - continue - fi - - if is_alive $host; then - stat=$($RSH $host "/bin/mkdir -p ${CACHE_DIR} > /dev/null 2>&1; /bin/rm -f ${CACHE_FILE}.${local_host} > /dev/null 2>&1; echo \$?" | tr -d '[:space:]') - if [ "X${stat}" == "X0" ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Updating $host" - logger -i "SLDD: updating $host with ${CACHE_FILE}" - $RCP ${CACHE_FILE}.upd ${host}:${CACHE_FILE}.${local_host} - /bin/cp ${CACHE_FILE}.upd ${CACHE_FILE}.${host} - else - [ $SLDD_DEBUG -eq 1 ] && - echo "$RSH to $host failed." - logger -i "SLDD: Failed to update $host with ${CACHE_FILE}. $RSH without password should be enabled" - exit 5 - fi - else - [ $SLDD_DEBUG -eq 1 ] && - echo "$host is down." - continue - fi - done -} - -get_latest_remote_cache() -{ - # Find most updated remote cache file (the suffix should be like ip address: *.*.*.*) - echo -n "$(/bin/ls -1t ${CACHE_FILE}.*.* 2> /dev/null | head -1)" -} - -get_largest_remote_cache() -{ - # Find largest (size) remote cache file (the suffix should be like ip address: *.*.*.*) - echo -n "$(/bin/ls -1S ${CACHE_FILE}.*.* 2> /dev/null | head -1)" -} - -swap_cache_files() -{ - /bin/rm -f ${CACHE_FILE}.old - /bin/mv ${CACHE_FILE} ${CACHE_FILE}.old - /bin/cp ${largest_remote_cache} ${CACHE_FILE} - touch ${CACHE_FILE}.tmp -} - -# Find local host in the osm hosts list -local_host="" -for host in ${OSM_HOSTS} -do - if is_local $host; then - local_host=${host} - fi -done - -# Get cache file info -declare -i new_size=0 -declare -i last_size=0 -declare -i largest_remote_cache_size=0 - -if [ -e ${CACHE_FILE} ]; then - last_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]') -else - touch ${CACHE_FILE} ${CACHE_FILE}.tmp -fi - -# if [ ${last_size} -gt 0 ]; then -# # First time update -# update_remote_cache -# fi - -while true -do - if [ -s "${CACHE_FILE}" ]; then - new_size=$(du -b ${CACHE_FILE} | awk '{print$1}' | tr -d '[:space:]') - # Check if local cache file grew from its last version or the time stamp changed - if [ ${new_size} -gt ${last_size} ] - [ "$(/bin/ls -1t ${CACHE_FILE} ${CACHE_FILE}.tmp 2> /dev/null | head -1)" != "${CACHE_FILE}.tmp" ]; then - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]') - else - largest_remote_cache_size=0 - fi - - # Check if local cache file larger than remote chache file - if [ ${new_size} -gt ${largest_remote_cache_size} ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file larger then remote. Update remote cache files" - last_size=${new_size} - update_remote_cache - continue - fi - fi - - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - largest_remote_cache_size=$(du -b ${largest_remote_cache} 2> /dev/null | awk '{print$1}' | tr -d '[:space:]') - else - largest_remote_cache_size=0 - fi - - # Update local cache file from remote - if [ ${largest_remote_cache_size} -gt ${new_size} ]; then - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file shorter then remote. Use ${largest_remote_cache}" - logger -i "SLDD: updating local cache file with ${largest_remote_cache}" - swap_cache_files - last_size=${largest_remote_cache_size} - fi - - else # The local cache file is empty - [ $SLDD_DEBUG -eq 1 ] && - echo "${CACHE_FILE} is empty" - - largest_remote_cache=$(get_largest_remote_cache) - if [[ -n "${largest_remote_cache}" && -s "${largest_remote_cache}" ]]; then - # Copy it to the current cache - [ $SLDD_DEBUG -eq 1 ] && - echo "Local cache file is empty. Use ${largest_remote_cache}" - logger -i "SLDD: updating local cache file with ${largest_remote_cache}" - swap_cache_files - fi - - fi - - [ $SLDD_DEBUG -eq 1 ] && - echo "Sleeping ${RESCAN_TIME} seconds." - sleep ${RESCAN_TIME} - -done -- 2.41.0