├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── complib ├── ChangeLog ├── Makefile.am ├── cl_complib.c ├── cl_dispatcher.c ├── cl_event.c ├── cl_event_wheel.c ├── cl_heap.c ├── cl_list.c ├── cl_log.c ├── cl_map.c ├── cl_nodenamemap.c ├── cl_pool.c ├── cl_ptr_vector.c ├── cl_spinlock.c ├── cl_statustext.c ├── cl_thread.c ├── cl_threadpool.c ├── cl_timer.c ├── cl_vector.c ├── ib_statustext.c ├── libosmcomp.map └── libosmcomp.ver ├── config ├── metis.m4 └── osmvsel.m4 ├── configure.ac ├── doc ├── OpenSM_PKey_Mgr.txt ├── OpenSM_RN.pdf ├── OpenSM_UM.pdf ├── QoS_management_in_OpenSM.txt ├── current-routing.txt ├── modular-routing.txt ├── opensm-coding-style.txt ├── opensm-sriov.txt ├── opensm_release_notes-3.1.10.txt ├── opensm_release_notes-3.1.11.txt ├── opensm_release_notes-3.2.txt ├── opensm_release_notes-3.3.txt ├── opensm_release_notes_ibg2-2.0.1.txt ├── opensm_release_notes_openib-1.2.1.txt ├── opensm_release_notes_openib-2.0.5.txt ├── opensm_release_notes_openib-3.0.13.txt ├── partition-config.txt ├── perf-manager-arch.txt ├── performance-manager-HOWTO.txt ├── qos-config.txt └── todo ├── gen_chlog.sh ├── gen_ver.sh ├── include ├── Makefile.am ├── complib │ ├── cl_atomic.h │ ├── cl_atomic_osd.h │ ├── cl_byteswap.h │ ├── cl_byteswap_osd.h │ ├── cl_comppool.h │ ├── cl_debug.h │ ├── cl_debug_osd.h │ ├── cl_dispatcher.h │ ├── cl_event.h │ ├── cl_event_osd.h │ ├── cl_event_wheel.h │ ├── cl_fleximap.h │ ├── cl_heap.h │ ├── cl_list.h │ ├── cl_log.h │ ├── cl_map.h │ ├── cl_math.h │ ├── cl_nodenamemap.h │ ├── cl_packoff.h │ ├── cl_packon.h │ ├── cl_passivelock.h │ ├── cl_pool.h │ ├── cl_ptr_vector.h │ ├── cl_qcomppool.h │ ├── cl_qlist.h │ ├── cl_qmap.h │ ├── cl_qpool.h │ ├── cl_spinlock.h │ ├── cl_spinlock_osd.h │ ├── cl_thread.h │ ├── cl_thread_osd.h │ ├── cl_threadpool.h │ ├── cl_timer.h │ ├── cl_timer_osd.h │ ├── cl_types.h │ ├── cl_types_osd.h │ └── cl_vector.h ├── iba │ ├── ib_cm_types.h │ └── ib_types.h ├── opensm │ ├── osm_base.h │ ├── osm_config.h.in │ ├── osm_congestion_control.h │ ├── osm_console.h │ ├── osm_console_io.h │ ├── osm_db.h │ ├── osm_db_pack.h │ ├── osm_errors.h │ ├── osm_event_plugin.h │ ├── osm_file_ids.h │ ├── osm_guid.h │ ├── osm_helper.h │ ├── osm_inform.h │ ├── osm_lid_mgr.h │ ├── osm_log.h │ ├── osm_mad_pool.h │ ├── osm_madw.h │ ├── osm_mcast_mgr.h │ ├── osm_mcast_tbl.h │ ├── osm_mcm_port.h │ ├── osm_mesh.h │ ├── osm_msgdef.h │ ├── osm_mtree.h │ ├── osm_multicast.h │ ├── osm_node.h │ ├── osm_opensm.h │ ├── osm_partition.h │ ├── osm_path.h │ ├── osm_perfmgr.h │ ├── osm_perfmgr_db.h │ ├── osm_pkey.h │ ├── osm_port.h │ ├── osm_port_profile.h │ ├── osm_prefix_route.h │ ├── osm_qos_policy.h │ ├── osm_remote_sm.h │ ├── osm_router.h │ ├── osm_sa.h │ ├── osm_sa_mad_ctrl.h │ ├── osm_service.h │ ├── osm_sm.h │ ├── osm_sm_mad_ctrl.h │ ├── osm_stats.h │ ├── osm_subnet.h │ ├── osm_switch.h │ ├── osm_ucast_cache.h │ ├── osm_ucast_lash.h │ ├── osm_ucast_mgr.h │ ├── osm_version.h.in │ ├── osm_vl15intf.h │ └── st.h └── vendor │ ├── osm_mtl_bind.h │ ├── osm_pkt_randomizer.h │ ├── osm_ts_useraccess.h │ ├── osm_umadt.h │ ├── osm_vendor.h │ ├── osm_vendor_al.h │ ├── osm_vendor_api.h │ ├── osm_vendor_ibumad.h │ ├── osm_vendor_mlx.h │ ├── osm_vendor_mlx_defs.h │ ├── osm_vendor_mlx_dispatcher.h │ ├── osm_vendor_mlx_hca.h │ ├── osm_vendor_mlx_inout.h │ ├── osm_vendor_mlx_rmpp_ctx.h │ ├── osm_vendor_mlx_sar.h │ ├── osm_vendor_mlx_sender.h │ ├── osm_vendor_mlx_svc.h │ ├── osm_vendor_mlx_transport.h │ ├── osm_vendor_mlx_transport_anafa.h │ ├── osm_vendor_mlx_txn.h │ ├── osm_vendor_mtl.h │ ├── osm_vendor_mtl_hca_guid.h │ ├── osm_vendor_mtl_transaction_mgr.h │ ├── osm_vendor_sa_api.h │ ├── osm_vendor_test.h │ ├── osm_vendor_ts.h │ └── osm_vendor_umadt.h ├── libopensm ├── Makefile.am ├── libopensm.map ├── libopensm.ver ├── osm_helper.c └── osm_log.c ├── libvendor ├── ChangeLog ├── Makefile.am ├── libosmvendor.map ├── libosmvendor.ver ├── osm_mad_pool.c ├── osm_pkt_randomizer.c ├── osm_vendor_al.c ├── osm_vendor_ibumad.c ├── osm_vendor_ibumad_sa.c ├── osm_vendor_mlx.c ├── osm_vendor_mlx_anafa.c ├── osm_vendor_mlx_dispatcher.c ├── osm_vendor_mlx_hca.c ├── osm_vendor_mlx_hca_anafa.c ├── osm_vendor_mlx_hca_pfs.c ├── osm_vendor_mlx_hca_sim.c ├── osm_vendor_mlx_ibmgt.c ├── osm_vendor_mlx_rmpp_ctx.c ├── osm_vendor_mlx_sa.c ├── osm_vendor_mlx_sar.c ├── osm_vendor_mlx_sender.c ├── osm_vendor_mlx_sim.c ├── osm_vendor_mlx_ts.c ├── osm_vendor_mlx_ts_anafa.c ├── osm_vendor_mlx_txn.c ├── osm_vendor_mtl.c ├── osm_vendor_mtl_hca_guid.c ├── osm_vendor_mtl_transaction_mgr.c ├── osm_vendor_test.c ├── osm_vendor_ts.c └── osm_vendor_umadt.c ├── man ├── opensm.8.in ├── osmtest.8 ├── torus-2QoS.8.in └── torus-2QoS.conf.5.in ├── opensm.spec.in ├── opensm ├── ChangeLog ├── Makefile.am ├── main.c ├── osm_check ├── osm_check_n_fix ├── osm_congestion_control.c ├── osm_console.c ├── osm_console_io.c ├── osm_db_files.c ├── osm_db_pack.c ├── osm_drop_mgr.c ├── osm_dump.c ├── osm_event_plugin.c ├── osm_guid_info_rcv.c ├── osm_guid_mgr.c ├── osm_indent ├── osm_inform.c ├── osm_lid_mgr.c ├── osm_lin_fwd_rcv.c ├── osm_link_mgr.c ├── osm_mcast_fwd_rcv.c ├── osm_mcast_mgr.c ├── osm_mcast_tbl.c ├── osm_mcm_port.c ├── osm_mesh.c ├── osm_mlnx_ext_port_info_rcv.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_l.l ├── osm_qos_parser_y.y ├── 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_sm_mad_ctrl.c ├── osm_sm_state_mgr.c ├── osm_sminfo_rcv.c ├── osm_state_mgr.c ├── osm_subnet.c ├── osm_sw_info_rcv.c ├── osm_switch.c ├── osm_torus.c ├── osm_trap_rcv.c ├── osm_ucast_cache.c ├── osm_ucast_dfsssp.c ├── osm_ucast_dnup.c ├── osm_ucast_file.c ├── osm_ucast_ftree.c ├── osm_ucast_lash.c ├── osm_ucast_mgr.c ├── osm_ucast_nue.c ├── osm_ucast_updn.c ├── osm_vl15intf.c ├── osm_vl_arb_rcv.c └── st.c ├── osmeventplugin ├── Makefile.am ├── libosmeventplugin.map ├── libosmeventplugin.ver └── src │ └── osmeventplugin.c ├── osmroutingplugin ├── Makefile.am ├── libosmroutingplugin.map ├── libosmroutingplugin.ver └── src │ └── osmroutingplugin.c ├── osmtest ├── Makefile.am ├── include │ ├── osmt_inform.h │ ├── osmt_mtl_regular_qp.h │ ├── osmtest.h │ ├── osmtest_base.h │ └── osmtest_subnet.h ├── main.c ├── osmt_inform.c ├── osmt_mtl_regular_qp.c ├── osmt_multicast.c ├── osmt_service.c ├── osmt_slvl_vl_arb.c └── osmtest.c └── scripts ├── opensm.init.in ├── opensm.logrotate ├── opensm.sysconfig ├── redhat-opensm.init.in ├── sldd.sh.in ├── travis-build └── travis-checkpatch /.gitignore: -------------------------------------------------------------------------------- 1 | *.la 2 | *.lo 3 | *.o 4 | .deps 5 | .libs 6 | aclocal.m4 7 | autom4te.cache/ 8 | config.log 9 | config.status 10 | config/compile 11 | config/config.guess 12 | config/config.sub 13 | config/depcomp 14 | config/install-sh 15 | config/libtool.m4 16 | config/ltmain.sh 17 | config/ltoptions.m4 18 | config/ltsugar.m4 19 | config/ltversion.m4 20 | config/lt~obsolete.m4 21 | config/missing 22 | config/ylwrap 23 | configure 24 | include/config.h 25 | include/config.h.in 26 | include/opensm/osm_config.h 27 | include/opensm/osm_version.h 28 | include/opensm/stamp-h2 29 | include/stamp-h1 30 | libtool 31 | Makefile 32 | Makefile.in 33 | man/opensm.8 34 | man/torus-2QoS.8 35 | man/torus-2QoS.conf.5 36 | opensm.spec 37 | opensm/opensm 38 | opensm/osm_qos_parser_l.c 39 | opensm/osm_qos_parser_y.c 40 | opensm/osm_qos_parser_y.h 41 | osmtest/osmtest 42 | scripts/opensm.init 43 | scripts/redhat-opensm.init 44 | scripts/sldd.sh 45 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | dist: xenial 3 | addons: 4 | apt: 5 | sources: 6 | - ubuntu-toolchain-r-test 7 | packages: 8 | - bison 9 | - flex 10 | - autoconf 11 | - automake 12 | - gcc-8 13 | - libtool-bin 14 | - make 15 | - sparse 16 | - wget 17 | - libibumad-dev 18 | script: 19 | - scripts/travis-checkpatch 20 | - scripts/travis-build 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | By the chronological order of involvement: 3 | Steve King, Intel 4 | Anil Keshavamurthy, Intel 5 | Eitan Zahavi, Mellanox Technologies, eitan@mellanox.co.il 6 | Yael Kalka, Mellanox Technologies, yael@mellanox.co.il 7 | Shahar Frank, Voltaire 8 | Hal Rosenstock, Voltaire, halr@voltaire.com 9 | Sasha Khapyorsky, Voltaire, sashak@voltaire.com 10 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. 2 | Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 3 | Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 4 | 5 | This software is available to you under a choice of one of two 6 | licenses. You may choose to be licensed under the terms of the GNU 7 | General Public License (GPL) Version 2, available from the file 8 | COPYING in the main directory of this source tree, or the 9 | OpenIB.org BSD license below: 10 | 11 | Redistribution and use in source and binary forms, with or 12 | without modification, are permitted provided that the following 13 | conditions are met: 14 | 15 | - Redistributions of source code must retain the above 16 | copyright notice, this list of conditions and the following 17 | disclaimer. 18 | 19 | - Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following 21 | disclaimer in the documentation and/or other materials 22 | provided with the distribution. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-09-12 Hal Rosenstock 2 | 3 | * Improved SA MCMemberRecord error messages 4 | 5 | 2005-08-22 Yael Kalka 6 | 7 | * Merge of OpenSM 1.8.0 previously available only on Gen1 8 | 9 | 2005-08-14 Eitan Zahavi 10 | 11 | * Provided a top level auto tools project so there is no need to 12 | cd into each of the sub directories and do: 13 | ./autogen.sh && configure && make && make install 14 | 15 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | # note that order matters: make the libs first then use them 3 | SUBDIRS = complib libopensm libvendor opensm osmtest include $(DEFAULT_EVENT_PLUGIN) 4 | DIST_SUBDIRS = complib libopensm libvendor opensm osmtest include osmeventplugin osmroutingplugin 5 | 6 | ACLOCAL_AMFLAGS = -I config 7 | 8 | # we should provide a hint for other apps about the build mode of this project 9 | install-exec-hook: 10 | $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/init.d 11 | cp $(top_builddir)/scripts/opensm.init $(DESTDIR)/$(sysconfdir)/init.d/opensmd 12 | chmod 755 $(DESTDIR)/$(sysconfdir)/init.d/opensmd 13 | 14 | 15 | man_MANS = man/opensm.8 man/osmtest.8 man/torus-2QoS.8 man/torus-2QoS.conf.5 16 | 17 | various_scripts = $(wildcard scripts/*) 18 | docs = doc/performance-manager-HOWTO.txt doc/QoS_management_in_OpenSM.txt \ 19 | doc/partition-config.txt doc/opensm-sriov.txt \ 20 | doc/current-routing.txt doc/opensm_release_notes-3.3.txt 21 | 22 | EXTRA_DIST = autogen.sh opensm.spec $(various_scripts) $(man_MANS) $(docs) 23 | 24 | dist-hook: $(EXTRA_DIST) 25 | if [ -x $(top_srcdir)/gen_chlog.sh ] ; then \ 26 | cd $(top_srcdir); ./gen_chlog.sh > $(distdir)/ChangeLog ; cd - ; \ 27 | fi 28 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 2 | This file will hold news about the OpenSM project. 3 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | OpenSM README: 2 | -------------- 3 | 4 | OpenSM provides an implementation for an InfiniBand Subnet Manager and 5 | Administrator. Such a software entity is required to run for in order 6 | to initialize the InfiniBand hardware (at least one per each 7 | InfiniBand subnet). 8 | 9 | The full list of OpenSM features is described in the user manual 10 | provided in the doc sub directory. 11 | 12 | The installation of OpenSM includes: 13 | 14 | sbin/ 15 | opensm - the SM/SA executable 16 | osmtest - a test program for the SM/SA 17 | lib/ 18 | libosmcomp.{a,so} - component library with generic services and containers 19 | libopensm.{a,so} - opensm services for logs and mad buffer pool 20 | libosmvendor.{a,so} - interface to the user mad service of the driver 21 | include/ 22 | iba/ib_types.h - IBA types header file 23 | complib/ - component library includes 24 | vendor/ - vendor library includes 25 | opensm/ - public opensm library includes 26 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # We change dir since the later utilities assume to work in the project dir 4 | cd ${0%*/*} 5 | 6 | # make sure autoconf is up-to-date 7 | ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'` 8 | ac_maj=`echo $ac_ver|sed 's/\..*//'` 9 | ac_min=`echo $ac_ver|sed 's/.*\.//'` 10 | if [[ $ac_maj -lt 2 ]]; then 11 | echo Min autoconf version is 2.57 12 | exit 1 13 | elif [[ $ac_maj -eq 2 && $ac_min -lt 57 ]]; then 14 | echo Min autoconf version is 2.57 15 | exit 1 16 | fi 17 | 18 | # make sure automake is up-to-date 19 | am_ver=`automake --version | head -n 1 | awk '{print $NF}'` 20 | am_maj=`echo $am_ver|sed 's/\..*//'` 21 | am_min=`echo $am_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/'` 22 | am_sub=`echo $am_ver|sed 's/[^\.]*\.[^\.]*\.*//'` 23 | if [[ $am_maj -lt 1 ]]; then 24 | echo Min automake version is 1.6.3 25 | exit 1 26 | elif [[ $am_maj -eq 1 && $am_min -lt 6 ]]; then 27 | echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3" 28 | exit 1 29 | elif [[ $am_maj -eq 1 && $am_min -eq 6 && $am_sub -lt 3 ]]; then 30 | echo "automake version is too old:$am_maj.$am_min.$am_sub < required 1.6.3" 31 | exit 1 32 | fi 33 | 34 | # make sure libtool is up-to-date 35 | lt_ver=`libtool --version | head -n 1 | awk '{print $4}'` 36 | lt_maj=`echo $lt_ver|sed 's/\..*//'` 37 | lt_min=`echo $lt_ver|sed 's/[^\.]*\.\([^\.]*\)\.*.*/\1/'` 38 | lt_sub=`echo $lt_ver|sed 's/[^\.]*\.[^\.]*\.*//'` 39 | if [[ $lt_maj -lt 1 ]]; then 40 | echo Min libtool version is 1.4.2 41 | exit 1 42 | elif [[ $lt_maj -eq 1 && $lt_min -lt 4 ]]; then 43 | echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2" 44 | exit 1 45 | elif [[ $lt_maj -eq 1 && $lt_min -eq 4 && $lt_sub -lt 2 ]]; then 46 | echo "libtool version is too old:$lt_maj.$lt_min.$lt_sub < required 1.4.2" 47 | exit 1 48 | fi 49 | 50 | # cleanup 51 | find . \( -name Makefile.in -o -name aclocal.m4 -o -name autom4te.cache -o -name configure -o -name aclocal.m4 \) -exec \rm -rf {} \; -prune 52 | 53 | aclocal -I config && \ 54 | libtoolize --force --copy && \ 55 | autoheader && \ 56 | automake --foreign --add-missing --copy && \ 57 | autoconf 58 | -------------------------------------------------------------------------------- /complib/ChangeLog: -------------------------------------------------------------------------------- 1 | 2007-07=11 Hal Rosenstock 2 | 3 | * configure.in: to version 2.2.1 4 | 5 | 2007-06-25 Hal Rosenstock 6 | 7 | * cl_event_wheel.c: Fix some typos in printfs when 8 | __CL_EVENT_WHEEL_TEST__ defined 9 | 10 | 2007-06-20 Hal Rosenstock 11 | 12 | * libosmcomp.map: Add get_next map functions as global 13 | 14 | 2007-06-20 Todd Rimmer 15 | 16 | * include/complib/cl_map.h, include/complib/cl_qmap.h, 17 | include/complib/cl_fleximap.h, cl_map.c: 18 | Add get_next functions to the various maps 19 | 20 | * include/complib/cl_fleximap.h: In cl_fmap_remove_all, make 21 | sure the count field is properly maintained. 22 | 23 | 2007-06-19 Todd Rimmer 24 | 25 | * include/complib/cl_qmap.h: In cl_qmap_remove_all, make 26 | sure the count field is properly maintained. 27 | 28 | 2007-06-19 Hal Rosenstock 29 | 30 | * include/complib/cl_threadpool.h: Eliminate compile warning 31 | with cl_threadpool.c introduced by previous change 32 | 33 | 2007-06-13 Sasha Khapyorsky 34 | 35 | * include/complib/cl_threadpool.h, complib/cl_threadpool.c, 36 | complib/cl_dispatcher.c, complib/libosmcomp.map: Thread 37 | pool rework 38 | 39 | 2007-06-13 Hal Rosenstock 40 | 41 | * configure.in: Bump to version 2.2.0 42 | 43 | * libosmcomp.ver, libosmcomp.map: Update version info for 44 | previous API removals 45 | 46 | * include/complib/cl_memory.h, include/complib/cl_memtrack.h, 47 | complib/cl_memory.c, complib/cl_memtrack.c, include/Makefile.am: 48 | Remove deprecated memory allocation related routines 49 | 50 | 2007-06-13 Yevgeny Kliteynik 51 | 52 | * include/complib/cl_perf.h, include/complib/cl_async_proc.h, 53 | complib/cl_perf.c, complib/cl_async_proc.c, Makefile.am, 54 | libosmcomp.map: Remove unused cl_perf and cl_async_proc 55 | 56 | 2007-05-09 Hal Rosenstock 57 | 58 | * configure.in: Bump to version 2.1.2 59 | 60 | 2007-03-29 Hal Rosenstock 61 | 62 | * configure.in: Bump to version 2.1.1 63 | 64 | 2007-01-08 Sasha Khapyorsky 65 | 66 | * cl_log.c: SIGUSR1 fixes 67 | 68 | 2007-01-08 Ira Weiny 69 | 70 | * cl_log.c: Add SIGUSR1 handling to reopen osm.log 71 | 72 | 2006-10-31 Hal Rosenstock 73 | 74 | * configure.in: Bumped to version version 2.1.0 75 | 76 | 2006-09-05 Sasha Khapyorsky 77 | 78 | * cl_event_wheel.c: Changes to support new osm_log 79 | initializer osm_log_init_v2() 80 | 81 | 2006-08-29 Sasha Khapyorsky 82 | 83 | * cl_event_wheel.c: Support option to limit size of OpenSM 84 | log file 85 | 86 | 2006-07-20 Sasha Khapyorsky 87 | 88 | * cl_pool.c: Fix memory corruption in cl_qcpool_init 89 | 90 | 2006-07-19 Hal Rosenstock 91 | 92 | * Makefile.am: Eliminate deprecated warnings 93 | 94 | 2006-06-11 Hal Rosenstock 95 | 96 | * configure.in: Released version 1.2.1 (OFED 1.1) 97 | -------------------------------------------------------------------------------- /complib/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(srcdir)/../include 3 | 4 | lib_LTLIBRARIES = libosmcomp.la 5 | 6 | if DEBUG 7 | DBGFLAGS = -ggdb -D_DEBUG_ 8 | else 9 | DBGFLAGS = -g 10 | endif 11 | 12 | libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 13 | 14 | if HAVE_LD_VERSION_SCRIPT 15 | libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map 16 | else 17 | libosmcomp_version_script = 18 | endif 19 | 20 | complib_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmcomp.ver | sed 's/LIBVERSION=//') 21 | 22 | libosmcomp_la_SOURCES = cl_complib.c cl_dispatcher.c \ 23 | cl_event.c cl_event_wheel.c \ 24 | cl_list.c cl_log.c cl_map.c \ 25 | cl_pool.c cl_ptr_vector.c \ 26 | cl_spinlock.c cl_statustext.c \ 27 | cl_thread.c cl_threadpool.c \ 28 | cl_timer.c cl_vector.c \ 29 | cl_heap.c ib_statustext.c \ 30 | cl_nodenamemap.c 31 | 32 | libosmcomp_la_LDFLAGS = -version-info $(complib_api_version) \ 33 | -export-dynamic $(libosmcomp_version_script) 34 | libosmcomp_la_DEPENDENCIES = $(srcdir)/libosmcomp.map 35 | 36 | libosmcompincludedir = $(includedir)/infiniband/complib 37 | 38 | libosmcompinclude_HEADERS = $(srcdir)/../include/complib/cl_atomic.h \ 39 | $(srcdir)/../include/complib/cl_atomic_osd.h \ 40 | $(srcdir)/../include/complib/cl_byteswap.h \ 41 | $(srcdir)/../include/complib/cl_byteswap_osd.h \ 42 | $(srcdir)/../include/complib/cl_comppool.h \ 43 | $(srcdir)/../include/complib/cl_debug.h \ 44 | $(srcdir)/../include/complib/cl_debug_osd.h \ 45 | $(srcdir)/../include/complib/cl_dispatcher.h \ 46 | $(srcdir)/../include/complib/cl_event.h \ 47 | $(srcdir)/../include/complib/cl_event_wheel.h \ 48 | $(srcdir)/../include/complib/cl_event_osd.h \ 49 | $(srcdir)/../include/complib/cl_fleximap.h \ 50 | $(srcdir)/../include/complib/cl_list.h \ 51 | $(srcdir)/../include/complib/cl_log.h \ 52 | $(srcdir)/../include/complib/cl_map.h \ 53 | $(srcdir)/../include/complib/cl_math.h \ 54 | $(srcdir)/../include/complib/cl_nodenamemap.h \ 55 | $(srcdir)/../include/complib/cl_packoff.h \ 56 | $(srcdir)/../include/complib/cl_packon.h \ 57 | $(srcdir)/../include/complib/cl_passivelock.h \ 58 | $(srcdir)/../include/complib/cl_pool.h \ 59 | $(srcdir)/../include/complib/cl_ptr_vector.h \ 60 | $(srcdir)/../include/complib/cl_qcomppool.h \ 61 | $(srcdir)/../include/complib/cl_qlist.h \ 62 | $(srcdir)/../include/complib/cl_qmap.h \ 63 | $(srcdir)/../include/complib/cl_qpool.h \ 64 | $(srcdir)/../include/complib/cl_spinlock.h \ 65 | $(srcdir)/../include/complib/cl_spinlock_osd.h \ 66 | $(srcdir)/../include/complib/cl_thread.h \ 67 | $(srcdir)/../include/complib/cl_thread_osd.h \ 68 | $(srcdir)/../include/complib/cl_threadpool.h \ 69 | $(srcdir)/../include/complib/cl_timer.h \ 70 | $(srcdir)/../include/complib/cl_timer_osd.h \ 71 | $(srcdir)/../include/complib/cl_types.h \ 72 | $(srcdir)/../include/complib/cl_types_osd.h \ 73 | $(srcdir)/../include/complib/cl_vector.h \ 74 | $(srcdir)/../include/complib/cl_heap.h 75 | 76 | # headers are distributed as part of the include dir 77 | EXTRA_DIST = $(srcdir)/libosmcomp.map $(srcdir)/libosmcomp.ver 78 | -------------------------------------------------------------------------------- /complib/cl_complib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #if HAVE_CONFIG_H 37 | # include 38 | #endif /* HAVE_CONFIG_H */ 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | /* 49 | * Prototypes 50 | */ 51 | 52 | extern cl_status_t __cl_timer_prov_create(void); 53 | 54 | extern void __cl_timer_prov_destroy(void); 55 | 56 | cl_spinlock_t cl_atomic_spinlock; 57 | 58 | void complib_init(void) 59 | { 60 | cl_status_t status = CL_SUCCESS; 61 | 62 | status = cl_spinlock_init(&cl_atomic_spinlock); 63 | if (status != CL_SUCCESS) 64 | goto _error; 65 | 66 | status = __cl_timer_prov_create(); 67 | if (status != CL_SUCCESS) 68 | goto _error; 69 | return; 70 | 71 | _error: 72 | cl_msg_out("__init: failed to create complib (%s)\n", 73 | CL_STATUS_MSG(status)); 74 | exit(1); 75 | } 76 | 77 | cl_status_t complib_init_v2(void) 78 | { 79 | cl_status_t status = CL_SUCCESS; 80 | 81 | status = cl_spinlock_init(&cl_atomic_spinlock); 82 | if (status != CL_SUCCESS) 83 | goto _error; 84 | 85 | status = __cl_timer_prov_create(); 86 | if (status != CL_SUCCESS) 87 | goto _error; 88 | return status; 89 | 90 | _error: 91 | cl_msg_out("__init_v2: failed to create complib (%s)\n", 92 | CL_STATUS_MSG(status)); 93 | return status; 94 | } 95 | 96 | void complib_exit(void) 97 | { 98 | __cl_timer_prov_destroy(); 99 | cl_spinlock_destroy(&cl_atomic_spinlock); 100 | } 101 | 102 | boolean_t cl_is_debug(void) 103 | { 104 | #if defined( _DEBUG_ ) 105 | return TRUE; 106 | #else 107 | return FALSE; 108 | #endif /* defined( _DEBUG_ ) */ 109 | } 110 | -------------------------------------------------------------------------------- /complib/cl_log.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifdef __WIN__ 37 | #pragma warning(disable : 4996) 38 | #endif 39 | 40 | #if HAVE_CONFIG_H 41 | # include 42 | #endif /* HAVE_CONFIG_H */ 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | /* Maximum number of bytes that can be logged. */ 49 | #define CL_MAX_LOG_DATA (256) 50 | 51 | /* 52 | * Size of the character buffer to allow logging the above 53 | * number of bytes. A space is added after every DWORD, and 54 | * a new line is added after 8 DWORDS (for a line length less than 80). 55 | */ 56 | #define CL_LOG_DATA_SIZE (CL_MAX_LOG_DATA + (CL_MAX_LOG_DATA/4)) 57 | 58 | void cl_log_event(IN const char *const name, IN const cl_log_type_t type, 59 | IN const char *const message, 60 | IN const void *const p_data OPTIONAL, 61 | IN const uint32_t data_len) 62 | { 63 | int priority, i; 64 | char data[CL_LOG_DATA_SIZE]; 65 | char *p_buf; 66 | uint8_t *p_int_data = (uint8_t *) p_data; 67 | 68 | CL_ASSERT(name); 69 | CL_ASSERT(message); 70 | 71 | openlog(name, LOG_NDELAY | LOG_PID, LOG_USER); 72 | switch (type) { 73 | case CL_LOG_ERROR: 74 | priority = LOG_ERR; 75 | break; 76 | 77 | case CL_LOG_WARN: 78 | priority = LOG_WARNING; 79 | break; 80 | 81 | case CL_LOG_INFO: 82 | default: 83 | priority = LOG_INFO; 84 | break; 85 | } 86 | 87 | if (p_data) { 88 | CL_ASSERT(data_len); 89 | if (data_len < CL_MAX_LOG_DATA) { 90 | p_buf = data; 91 | /* Format the data into ASCII. */ 92 | for (i = 0; i < data_len; i++) { 93 | sprintf(p_buf, "%02x", *p_int_data++); 94 | p_buf += 2; 95 | 96 | /* Add line break after 8 DWORDS. */ 97 | if (i % 32) { 98 | sprintf(p_buf++, "\n"); 99 | continue; 100 | } 101 | 102 | /* Add a space between DWORDS. */ 103 | if (i % 4) 104 | sprintf(p_buf++, " "); 105 | } 106 | syslog(priority, "%s data:\n%s\n", message, p_buf); 107 | } else { 108 | /* The data portion is too large to log. */ 109 | cl_msg_out 110 | ("cl_log() - WARNING: data too large to log.\n"); 111 | syslog(priority, "%s\n", message); 112 | } 113 | } else { 114 | syslog(priority, "%s\n", message); 115 | } 116 | closelog(); 117 | } 118 | -------------------------------------------------------------------------------- /complib/cl_spinlock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #if HAVE_CONFIG_H 37 | # include 38 | #endif /* HAVE_CONFIG_H */ 39 | 40 | #include 41 | 42 | void cl_spinlock_construct(IN cl_spinlock_t * const p_spinlock) 43 | { 44 | CL_ASSERT(p_spinlock); 45 | 46 | p_spinlock->state = CL_UNINITIALIZED; 47 | } 48 | 49 | cl_status_t cl_spinlock_init(IN cl_spinlock_t * const p_spinlock) 50 | { 51 | CL_ASSERT(p_spinlock); 52 | 53 | cl_spinlock_construct(p_spinlock); 54 | 55 | /* Initialize with pthread_mutexattr_t = NULL */ 56 | if (pthread_mutex_init(&p_spinlock->mutex, NULL)) 57 | return (CL_ERROR); 58 | 59 | p_spinlock->state = CL_INITIALIZED; 60 | return (CL_SUCCESS); 61 | } 62 | 63 | void cl_spinlock_destroy(IN cl_spinlock_t * const p_spinlock) 64 | { 65 | CL_ASSERT(p_spinlock); 66 | CL_ASSERT(cl_is_state_valid(p_spinlock->state)); 67 | 68 | if (p_spinlock->state == CL_INITIALIZED) { 69 | p_spinlock->state = CL_UNINITIALIZED; 70 | pthread_mutex_lock(&p_spinlock->mutex); 71 | pthread_mutex_unlock(&p_spinlock->mutex); 72 | pthread_mutex_destroy(&p_spinlock->mutex); 73 | } 74 | p_spinlock->state = CL_UNINITIALIZED; 75 | } 76 | 77 | void cl_spinlock_acquire(IN cl_spinlock_t * const p_spinlock) 78 | { 79 | CL_ASSERT(p_spinlock); 80 | CL_ASSERT(p_spinlock->state == CL_INITIALIZED); 81 | 82 | pthread_mutex_lock(&p_spinlock->mutex); 83 | } 84 | 85 | void cl_spinlock_release(IN cl_spinlock_t * const p_spinlock) 86 | { 87 | CL_ASSERT(p_spinlock); 88 | CL_ASSERT(p_spinlock->state == CL_INITIALIZED); 89 | 90 | pthread_mutex_unlock(&p_spinlock->mutex); 91 | } 92 | -------------------------------------------------------------------------------- /complib/cl_statustext.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Defines string to decode cl_status_t return values. 39 | * 40 | */ 41 | 42 | #if HAVE_CONFIG_H 43 | # include 44 | #endif /* HAVE_CONFIG_H */ 45 | 46 | #include 47 | 48 | /* Status values above converted to text for easier printing. */ 49 | const char *cl_status_text[] = { 50 | "CL_SUCCESS", 51 | "CL_ERROR", 52 | "CL_INVALID_STATE", 53 | "CL_INVALID_OPERATION", 54 | "CL_INVALID_SETTING", 55 | "CL_INVALID_PARAMETER", 56 | "CL_INSUFFICIENT_RESOURCES", 57 | "CL_INSUFFICIENT_MEMORY", 58 | "CL_INVALID_PERMISSION", 59 | "CL_COMPLETED", 60 | "CL_NOT_DONE", 61 | "CL_PENDING", 62 | "CL_TIMEOUT", 63 | "CL_CANCELED", 64 | "CL_REJECT", 65 | "CL_OVERRUN", 66 | "CL_NOT_FOUND", 67 | "CL_UNAVAILABLE", 68 | "CL_BUSY", 69 | "CL_DISCONNECT", 70 | "CL_DUPLICATE" 71 | }; 72 | -------------------------------------------------------------------------------- /complib/cl_thread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #if HAVE_CONFIG_H 37 | # include 38 | #endif /* HAVE_CONFIG_H */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | /* 46 | * Internal function to run a new user mode thread. 47 | * This function is always run as a result of creation a new user mode thread. 48 | * Its main job is to synchronize the creation and running of the new thread. 49 | */ 50 | static void *__cl_thread_wrapper(void *arg) 51 | { 52 | cl_thread_t *p_thread = (cl_thread_t *) arg; 53 | 54 | CL_ASSERT(p_thread); 55 | CL_ASSERT(p_thread->pfn_callback); 56 | 57 | p_thread->pfn_callback((void *)p_thread->context); 58 | 59 | return (NULL); 60 | } 61 | 62 | void cl_thread_construct(IN cl_thread_t * const p_thread) 63 | { 64 | CL_ASSERT(p_thread); 65 | 66 | p_thread->osd.state = CL_UNINITIALIZED; 67 | } 68 | 69 | cl_status_t cl_thread_init(IN cl_thread_t * const p_thread, 70 | IN cl_pfn_thread_callback_t pfn_callback, 71 | IN const void *const context, 72 | IN const char *const name) 73 | { 74 | int ret; 75 | 76 | CL_ASSERT(p_thread); 77 | 78 | cl_thread_construct(p_thread); 79 | 80 | /* Initialize the thread structure */ 81 | p_thread->pfn_callback = pfn_callback; 82 | p_thread->context = context; 83 | 84 | ret = pthread_create(&p_thread->osd.id, NULL, 85 | __cl_thread_wrapper, (void *)p_thread); 86 | 87 | if (ret != 0) /* pthread_create returns a "0" for success */ 88 | return (CL_ERROR); 89 | 90 | p_thread->osd.state = CL_INITIALIZED; 91 | 92 | return (CL_SUCCESS); 93 | } 94 | 95 | void cl_thread_destroy(IN cl_thread_t * const p_thread) 96 | { 97 | CL_ASSERT(p_thread); 98 | CL_ASSERT(cl_is_state_valid(p_thread->osd.state)); 99 | 100 | if (p_thread->osd.state == CL_INITIALIZED) 101 | pthread_join(p_thread->osd.id, NULL); 102 | 103 | p_thread->osd.state = CL_UNINITIALIZED; 104 | } 105 | 106 | void cl_thread_suspend(IN const uint32_t pause_ms) 107 | { 108 | /* Convert to micro seconds */ 109 | usleep(pause_ms * 1000); 110 | } 111 | 112 | void cl_thread_stall(IN const uint32_t pause_us) 113 | { 114 | /* 115 | * Not quite a busy wait, but Linux is lacking in terms of high 116 | * resolution time stamp information in user mode. 117 | */ 118 | usleep(pause_us); 119 | } 120 | 121 | int cl_proc_count(void) 122 | { 123 | uint32_t ret; 124 | 125 | ret = get_nprocs(); 126 | if (!ret) 127 | return 1; /* Workaround for PPC where get_nprocs() returns 0 */ 128 | 129 | return ret; 130 | } 131 | 132 | boolean_t cl_is_current_thread(IN const cl_thread_t * const p_thread) 133 | { 134 | pthread_t current; 135 | 136 | CL_ASSERT(p_thread); 137 | CL_ASSERT(p_thread->osd.state == CL_INITIALIZED); 138 | 139 | current = pthread_self(); 140 | return (pthread_equal(current, p_thread->osd.id)); 141 | } 142 | -------------------------------------------------------------------------------- /complib/libosmcomp.map: -------------------------------------------------------------------------------- 1 | OSMCOMP_2.3 { 2 | global: 3 | complib_init; 4 | complib_exit; 5 | cl_is_debug; 6 | cl_disp_construct; 7 | cl_disp_init; 8 | cl_disp_destroy; 9 | cl_disp_register; 10 | cl_disp_unregister; 11 | cl_disp_post; 12 | cl_disp_shutdown; 13 | cl_disp_get_queue_status; 14 | cl_event_construct; 15 | cl_event_init; 16 | cl_event_destroy; 17 | cl_event_signal; 18 | cl_event_reset; 19 | cl_event_wait_on; 20 | cl_event_wheel_construct; 21 | cl_event_wheel_init; 22 | cl_event_wheel_init_ex; 23 | cl_event_wheel_destroy; 24 | cl_event_wheel_dump; 25 | cl_event_wheel_reg; 26 | cl_event_wheel_unreg; 27 | cl_event_wheel_num_regs; 28 | cl_qlist_insert_array_head; 29 | cl_qlist_insert_array_tail; 30 | cl_qlist_insert_list_head; 31 | cl_qlist_insert_list_tail; 32 | cl_is_item_in_qlist; 33 | cl_qlist_find_next; 34 | cl_qlist_find_prev; 35 | cl_qlist_apply_func; 36 | cl_qlist_move_items; 37 | cl_list_construct; 38 | cl_list_init; 39 | cl_list_destroy; 40 | cl_list_remove_object; 41 | cl_is_object_in_list; 42 | cl_list_insert_array_head; 43 | cl_list_insert_array_tail; 44 | cl_list_find_from_head; 45 | cl_list_find_from_tail; 46 | cl_list_apply_func; 47 | cl_log_event; 48 | cl_qmap_init; 49 | cl_qmap_get; 50 | cl_qmap_get_next; 51 | cl_qmap_apply_func; 52 | cl_qmap_insert; 53 | cl_qmap_remove_item; 54 | cl_qmap_remove; 55 | cl_qmap_merge; 56 | cl_qmap_delta; 57 | cl_map_construct; 58 | cl_map_init; 59 | cl_map_destroy; 60 | cl_map_insert; 61 | cl_map_get; 62 | cl_map_get_next; 63 | cl_map_remove_item; 64 | cl_map_remove; 65 | cl_map_remove_all; 66 | cl_map_merge; 67 | cl_map_delta; 68 | cl_fmap_init; 69 | cl_fmap_match; 70 | cl_fmap_get; 71 | cl_fmap_get_next; 72 | cl_fmap_apply_func; 73 | cl_fmap_insert; 74 | cl_fmap_remove_item; 75 | cl_fmap_remove; 76 | cl_fmap_merge; 77 | cl_fmap_delta; 78 | cl_qcpool_construct; 79 | cl_qcpool_init; 80 | cl_qcpool_destroy; 81 | cl_qcpool_grow; 82 | cl_qcpool_get; 83 | cl_qcpool_get_tail; 84 | cl_qpool_construct; 85 | cl_qpool_init; 86 | cl_cpool_construct; 87 | cl_cpool_init; 88 | cl_pool_construct; 89 | cl_pool_init; 90 | cl_ptr_vector_construct; 91 | cl_ptr_vector_init; 92 | cl_ptr_vector_destroy; 93 | cl_ptr_vector_at; 94 | cl_ptr_vector_set; 95 | cl_ptr_vector_remove; 96 | cl_ptr_vector_set_capacity; 97 | cl_ptr_vector_set_size; 98 | cl_ptr_vector_set_min_size; 99 | cl_ptr_vector_apply_func; 100 | cl_ptr_vector_find_from_start; 101 | cl_ptr_vector_find_from_end; 102 | cl_spinlock_construct; 103 | cl_spinlock_init; 104 | cl_spinlock_destroy; 105 | cl_spinlock_acquire; 106 | cl_spinlock_release; 107 | cl_status_text; 108 | cl_thread_construct; 109 | cl_thread_init; 110 | cl_thread_destroy; 111 | cl_thread_suspend; 112 | cl_thread_stall; 113 | cl_proc_count; 114 | cl_is_current_thread; 115 | cl_thread_pool_construct; 116 | cl_thread_pool_init; 117 | cl_thread_pool_destroy; 118 | cl_thread_pool_signal; 119 | __cl_timer_prov_create; 120 | __cl_timer_prov_destroy; 121 | cl_timer_construct; 122 | cl_timer_init; 123 | cl_timer_destroy; 124 | cl_timer_start; 125 | cl_timer_stop; 126 | cl_timer_trim; 127 | cl_get_time_stamp; 128 | cl_get_time_stamp_sec; 129 | cl_vector_construct; 130 | cl_vector_init; 131 | cl_vector_destroy; 132 | cl_vector_at; 133 | cl_vector_set; 134 | cl_vector_set_capacity; 135 | cl_vector_set_size; 136 | cl_vector_set_min_size; 137 | cl_vector_apply_func; 138 | cl_vector_find_from_start; 139 | cl_vector_find_from_end; 140 | cl_heap_construct; 141 | cl_heap_init; 142 | cl_heap_destroy; 143 | cl_heap_modify_key; 144 | cl_heap_insert; 145 | cl_heap_delete; 146 | cl_heap_extract_root; 147 | cl_heap_resize; 148 | cl_verify_heap_property; 149 | cl_is_stored_in_heap; 150 | cl_atomic_spinlock; 151 | cl_atomic_dec; 152 | ib_error_str; 153 | ib_async_event_str; 154 | ib_wc_status_str; 155 | open_node_name_map; 156 | close_node_name_map; 157 | parse_node_map; 158 | remap_node_name; 159 | clean_nodedesc; 160 | complib_init_v2; 161 | local: *; 162 | }; 163 | -------------------------------------------------------------------------------- /complib/libosmcomp.ver: -------------------------------------------------------------------------------- 1 | # In this file we track the current API version 2 | # of the complib library interface 3 | # The version is built of the following 4 | # tree numbers: 5 | # API_REV:RUNNING_REV:AGE 6 | # API_REV - advance on any added API 7 | # RUNNING_REV - advance any change to the vendor files 8 | # AGE - number of backward versions the API still supports 9 | LIBVERSION=5:1:0 10 | -------------------------------------------------------------------------------- /config/metis.m4: -------------------------------------------------------------------------------- 1 | 2 | dnl metis.m4: an autoconf for OpenSM Vendor Selection option 3 | dnl 4 | dnl To use this macro, just do METIS_SEL. 5 | dnl the new configure option --enable-metis will be defined. 6 | dnl The following variables are defined: 7 | dnl METIS_LDADD - LDADD additional libs for linking the vendor lib 8 | AC_DEFUN([METIS_SEL], [ 9 | # --- BEGIN METIS_SEL --- 10 | 11 | dnl Check if they want the metis support 12 | AC_MSG_CHECKING([to enable metis support for nue routing]) 13 | AC_ARG_ENABLE(metis, 14 | [ --enable-metis Enable the metis support for nue routing (default no)], 15 | [case $enableval in 16 | yes) metis_support=yes ;; 17 | no) metis_support=no ;; 18 | esac], 19 | metis_support=no) 20 | AC_MSG_RESULT([$metis_support]) 21 | 22 | if test "x$metis_support" = "xyes"; then 23 | METIS_LDADD="-lmetis" 24 | fi 25 | 26 | dnl Define a way for the user to provide the path to the metis includes 27 | AC_ARG_WITH(metis-includes, 28 | AC_HELP_STRING([--with-metis-includes=], 29 | [define the dir where metis includes are installed]), 30 | AC_MSG_NOTICE(Using metis includes from:$with_metis_includes), 31 | with_metis_includes="") 32 | 33 | if test "x$with_metis_includes" != "x"; then 34 | METIS_INCLUDES="-I$with_metis_includes" 35 | fi 36 | 37 | dnl Define a way for the user to provide the path to the metis libs 38 | AC_ARG_WITH(metis-libs, 39 | AC_HELP_STRING([--with-metis-libs=], 40 | [define the dir where metis libs are installed]), 41 | AC_MSG_NOTICE(Using metis libs from:$with_metis_libs), 42 | with_metis_libs="") 43 | 44 | if test "x$with_metis_libs" != "x"; then 45 | METIS_LDADD="-L$with_metis_libs $METIS_LDADD" 46 | fi 47 | 48 | AC_SUBST(METIS_LDADD) 49 | AC_SUBST(METIS_INCLUDES) 50 | 51 | # --- END METIS_SEL --- 52 | ]) dnl METIS_SEL 53 | 54 | dnl Check for the metis lib dependency 55 | AC_DEFUN([METIS_CHECK_LIB], [ 56 | # --- BEGIN METIS_CHECK_LIB --- 57 | if test "$metis_support" != "no"; then 58 | if test "$disable_libcheck" != "yes"; then 59 | sav_LDFLAGS=$LDFLAGS 60 | LDFLAGS="$LDFLAGS $METIS_LDADD" 61 | AC_CHECK_LIB(metis, METIS_PartGraphKway, 62 | AC_DEFINE(ENABLE_METIS_FOR_NUE, 63 | 1, [Define as 1 if you want to enable metis support for nue routing]), 64 | AC_MSG_ERROR([METIS_PartGraphKway() not found.])) 65 | LDFLAGS=$sav_LDFLAGS 66 | else 67 | AC_DEFINE(ENABLE_METIS_FOR_NUE, 68 | 1, [Define as 1 if you want to enable metis support for nue routing]) 69 | fi 70 | fi 71 | # --- END METIS_CHECK_LIB --- 72 | ]) dnl METIS_CHECK_LIB 73 | 74 | dnl Check for the vendor lib dependency 75 | AC_DEFUN([METIS_CHECK_HEADER], [ 76 | # --- BEGIN METIS_CHECK_HEADER --- 77 | 78 | dnl we might be required to ignore this check 79 | if test "$metis_support" != "no"; then 80 | if test "$disable_libcheck" != "yes"; then 81 | sav_CPPFLAGS=$CPPFLAGS 82 | CPPFLAGS="$CPPFLAGS $METIS_INCLUDES" 83 | AC_CHECK_HEADERS(metis.h) 84 | CPPFLAGS=$sav_CPPFLAGS 85 | fi 86 | fi 87 | # --- END METIS_CHECK_HEADER --- 88 | ]) dnl METIS_CHECK_HEADER 89 | -------------------------------------------------------------------------------- /doc/OpenSM_PKey_Mgr.txt: -------------------------------------------------------------------------------- 1 | OpenSM Partition Management 2 | --------------------------- 3 | 4 | Roadmap: 5 | Phase 1 - provide partition management at the EndPort (HCA, Router and Switch 6 | Port 0) level with no routing affects. 7 | Phase 2 - routing engine should take partitions into account. 8 | 9 | Phase 1 functionality: 10 | 11 | Supported Policy: 12 | 13 | 1. EndPort partition groups are to be defined by listing the 14 | PortGUIDs as full and limited members. 15 | 16 | 2. Each partition group might be assigned an explicit P_Key (only the 15 17 | LSB bits are valid) or the SM should assign it randomly. 18 | 19 | 3. A flag should control the generation of IPoIB broadcast group for 20 | that partition. Extra optional MGIDs can be provided to be setup (on 21 | top of the IPoIB broadcast group). 22 | 23 | 4. A global flag "Disconnect Unconfigured EndPorts": If TRUE prevents 24 | EndPorts that are not explicitly defined as part of any partition 25 | (thus "unconfigured") to communicate with any other EndPort. Otherwise, it 26 | will let these EndPorts send packets to all other EndPorts. 27 | 28 | Functionality: 29 | 30 | 1. The policy should be updated: 31 | - during SM bringup 32 | - after kill -HUP 33 | - through SNMP (once it is supported) 34 | 35 | 2. Partition tables will be updated on full sweep (new port/trap etc). 36 | As a first step, the policy feasibility should be 37 | verified. Feasibility could be limited by the EndPorts supports for 38 | number of partitions, etc. Unrealizable policy should be reported 39 | and extra rules ignored after providing error messages. 40 | 41 | 3. Each EndPort will be assigned P_Keys as follows: 42 | 43 | a. Default partition group limited membership as defined by rule #4 below. 44 | (only the SM port will get 0xffff). 45 | 46 | b. P_Keys for all partition groups it is part of as defined in 47 | the policy. 48 | 49 | c. P_Key update will preserve index for the existing P_Keys on the 50 | port. If port has limited resources that will require reuse of, 51 | on index a message will be provided and some of the settings will be 52 | ommitted. P_Key indexes will not change under any circumstances. 53 | 54 | 4. Each Switch Leaf Port (a switch port that is connected to an 55 | EndPort) should be configured according to the same rules that 56 | apply to the EndPort connected to that switch port. 57 | This actually enables unauthorized port isolation (with future 58 | usage of M_Key and ProtectBits). 59 | 60 | 5. Policy entries matching a non EndPort will be flagged as 61 | erroneous in the log file and ignored. 62 | 63 | 6. At the end of the P_Key setting phase, a check for successful 64 | setting should be made. 65 | Errors should be clearly logged and cause a new sweep. 66 | 67 | 7. Each partition that is marked to support IPoIB should define a 68 | broadcast MGRP. If the partition does not support IPoIB, it should 69 | define a dummy MGRP with parameters blocking IPoIB drivers from 70 | registering to it. 71 | 72 | Phase 2 functionality: 73 | 74 | The partition policy should be considered during the routing such that 75 | links are associated with particular partition or a set of 76 | partitions. Policy should be enhanced to provide hints for how to do 77 | that (correlating to QoS too). The exact algorithm is TBD. 78 | 79 | -------------------------------------------------------------------------------- /doc/OpenSM_RN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linux-rdma/opensm/844ab3b7edaad983449b5d3a4a773088b8daa299/doc/OpenSM_RN.pdf -------------------------------------------------------------------------------- /doc/OpenSM_UM.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linux-rdma/opensm/844ab3b7edaad983449b5d3a4a773088b8daa299/doc/OpenSM_UM.pdf -------------------------------------------------------------------------------- /doc/modular-routing.txt: -------------------------------------------------------------------------------- 1 | Modular Routine Engine 2 | 3 | Modular routing engine structure has been added to allow 4 | for ease of "plugging" new routing modules. 5 | 6 | Currently, only unicast callbacks are supported. Multicast 7 | can be added later. 8 | 9 | One of existing routing modules is up-down "updn", which may 10 | be activated with '-R updn' option (instead of old '-u'). 11 | 12 | General usage is: 13 | $ opensm -R 'module-name' 14 | 15 | There is also a trivial routing module which is able 16 | to load LFT tables from a file. 17 | 18 | Main features: 19 | 20 | - this will load switch LFTs and/or LID matrices (min hops tables) 21 | - this will load switch LFTs according to the path entries introduced in 22 | the file 23 | - no additional checks will be performed (such as "is port connected", etc.) 24 | - in case when fabric LIDs were changed this will try to reconstruct LFTs 25 | correctly if endport GUIDs are represented in the file (in order 26 | to disable this GUIDs may be removed from the file or zeroed) 27 | 28 | The file format is compatible with output of 'ibroute' util and for 29 | whole fabric may be generated with script like this: 30 | 31 | for sw_lid in `ibswitches | awk '{print $NF}'` ; do 32 | ibroute $sw_lid 33 | done > /path/to/lfts_file 34 | 35 | , or using DR paths: 36 | 37 | for sw_dr in `ibnetdiscover -v \ 38 | | sed -ne '/^DR path .* switch /s/^DR path \[\(.*\)\].*$/\1/p' \ 39 | | sed -e 's/\]\[/,/g' \ 40 | | sort -u` ; do 41 | ibroute -D ${sw_dr} 42 | done > /path/to/lfts_file 43 | 44 | This script is dump_lfts.sh 45 | 46 | In order to activate new module use: 47 | 48 | opensm -R file -U /path/to/lfts_file 49 | 50 | If the lfts_file is not found or is in error, the default routing 51 | algorithm is utilized. 52 | 53 | The ability to dump switch lid matrices (aka min hops tables) to file and 54 | later to load these is also supported. 55 | 56 | The usage is similar to unicast forwarding tables loading from a lfts 57 | file (introduced by 'file' routing engine), but new lid matrix file 58 | name should be specified by -M or --lid_matrix_file option. For example: 59 | 60 | opensm -R file -M ./opensm-lid-matrix.dump 61 | 62 | The dump file is named 'opensm-lid-matrix.dump' and will be generated in 63 | standard opensm dump directory (/var/log by default) when 64 | OSM_LOG_ROUTING logging flag is set. 65 | 66 | When routing engine 'file' is activated, but the lfts file is not specified 67 | or cannot be opened, the default lid matrix algorithm will be used. 68 | 69 | There is also a switch forwarding tables dumper which generates 70 | a file compatible with dump_lfts.sh output. This file can be used 71 | as input for forwarding tables loading by 'file' routing engine. 72 | Both or one of options -U and -M can be specified together with '-R file'. 73 | 74 | NOTE: ibroute has been updated (for switch management ports) to support this. 75 | Also, lmc was added to switch management ports. ibroute needs to be r7855 or 76 | later from the trunk. 77 | 78 | -------------------------------------------------------------------------------- /doc/opensm-coding-style.txt: -------------------------------------------------------------------------------- 1 | This short (hopefully) memo is about to define the coding style 2 | recommended for OpenSM development. 3 | 4 | The goal of this is to make OpenSM code base to be standard in terms of 5 | the rest of OpenIB management software, OpenIB projects and Linux in 6 | general. And in this way to make OpenSM more developer friendly and to 7 | involve more open source programmers to be part of OpenSM development 8 | process. 9 | 10 | The goal of this is not to provide long and boring list of coding style 11 | paradigms, but rather to define general coding style concept and to 12 | suggest a way for such a concept to be implemented in the existing 13 | OpenSM code base. 14 | 15 | The OpenSM project is an OpenIB and Linux centric project, so we think 16 | it is reasonable to use the coding style most popular with OpenIB 17 | projects (linux/Documentation/CodingStyle) as the starting point rather 18 | than reinventing one more coding style rule-set. 19 | 20 | Some things from there in short: tab character for indentation and space 21 | character for alignment, K&R style braces, short local and meanful 22 | global names, please no confused Hungary style, short functions. And of 23 | course to be reasonable about all above. 24 | 25 | 26 | Some ideas about existing OpenSM code improvements in terms of the 27 | Coding style: 28 | 29 | * When writing new code, please try to follow the new Coding style. 30 | * Coding style improvement patches are desired and accepted, but please 31 | try to not mix coding style improvement with functional and other 32 | changes in one patch. 33 | * When you are going to improve coding style for existing code, please 34 | try to do it for entire file(s). 35 | -------------------------------------------------------------------------------- /doc/qos-config.txt: -------------------------------------------------------------------------------- 1 | Trivial low level QoS configuration proposition 2 | =============================================== 3 | 4 | Basically there is a set of QoS related low-level configuration parameters. 5 | All these parameter names are prefixed by "qos_" string. Here is a full 6 | list of these parameters: 7 | 8 | qos_max_vls - The maximum number of VLs that will be on the subnet 9 | qos_high_limit - The limit of High Priority component of VL Arbitration 10 | table (IBA 7.6.9) 11 | qos_vlarb_low - Low priority VL Arbitration table (IBA 7.6.9) template 12 | qos_vlarb_high - High priority VL Arbitration table (IBA 7.6.9) template 13 | Both VL arbitration templates are pairs of VL and weight 14 | qos_sl2vl - SL2VL Mapping table (IBA 7.6.6) template. It is a list 15 | of VLs corresponding to SLs 0-15 (Note the VL15 used 16 | here means drop this SL) 17 | 18 | Typical default values (hard-coded in OpenSM initialization) are: 19 | 20 | qos_max_vls 15 21 | qos_high_limit 0 22 | qos_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4 23 | qos_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0 24 | qos_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7 25 | 26 | The syntax is compatible with rest of OpenSM configuration options and 27 | values may be stored in OpenSM config file (cached options file). 28 | 29 | In addition to the above, we may define separate QoS configuration 30 | parameters sets for various target types. As targets, we currently support 31 | CAs, routers, switch external ports, and switch's enhanced port 0. The 32 | names of such specialized parameters are prefixed by "qos__" 33 | string. Here is a full list of the currently supported sets: 34 | 35 | qos_ca_ - QoS configuration parameters set for CAs. 36 | qos_rtr_ - parameters set for routers. 37 | qos_sw0_ - parameters set for switches' port 0. 38 | qos_swe_ - parameters set for switches' external ports. 39 | 40 | Examples: 41 | 42 | qos_sw0_max_vls 2 43 | qos_ca_sl2vl 0,1,2,3,5,5,5,12,12,0, 44 | qos_swe_high_limit 0 45 | -------------------------------------------------------------------------------- /doc/todo: -------------------------------------------------------------------------------- 1 | # OSM List of todo, open issues, and futures: 2 | 3 | 1 041228 - Handle local events (local lid change, port state change, etc.) 4 | 2 041228 - SM port fail over to next port upon request ? 5 | 3 050912 - Handle busy status in SA client API/implementation 6 | 4 050912 - Handle o15-0.1.13 (SA ServiceRecord) as well as updates 7 | to osmtest for this 8 | 5 051207 - Client reregistration is indicated before SA is 9 | ready to accept subscriptions 10 | 6 060109 - Use LID routing for light sweep to guarantee trap 11 | delivery path to the SM 12 | 7 061201 - Finer grained locking ? 13 | 8 061201 - Mapping multiple MGIDs on single MLID when characteristics 14 | match (PKey, etc.) 15 | 9 070329 - Add ssh support into remote socket/console support 16 | 10 070329 - Add authentication for (at least remote) console 17 | 11 070413 - Add dynamic rate adjustment for multicast groups 18 | 19 | 20 | Futures 21 | 22 | LID partitioning ? 23 | Advanced failover 24 | Upper layer management 25 | Regression tests and automation 26 | Additional pathing algorithms 27 | 28 | -------------------------------------------------------------------------------- /gen_chlog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() 4 | { 5 | echo "Usage: $0 [--spec]" 6 | exit 2 7 | } 8 | 9 | if [ "$1" = "--spec" ] ; then 10 | spec_format=1 11 | fi 12 | 13 | GIT_DIR=`git rev-parse --git-dir 2>/dev/null` 14 | 15 | test -z "$GIT_DIR" && usage 16 | 17 | 18 | export GIT_DIR 19 | export GIT_PAGER="" 20 | export PAGER="" 21 | 22 | 23 | mkchlog() 24 | { 25 | format=$1 26 | 27 | prev_tag="" 28 | 29 | for tag in `git tag -l '*' | sort -V` ; do 30 | obj=`git describe $tag` 31 | base=`git merge-base $obj HEAD` 32 | if [ -z "$base" -o "$base" != $obj ] ; then 33 | continue 34 | fi 35 | all_vers="$prev_tag$tag $all_vers" 36 | prev_tag=$tag.. 37 | done 38 | 39 | if [ -z "$prev_tag" ] ; then 40 | all_vers=HEAD 41 | else 42 | all_vers="${prev_tag}HEAD $all_vers" 43 | fi 44 | 45 | for ver in $all_vers ; do 46 | log_out=`git log $ver -- ./` 47 | if [ -z "$log_out" ] ; then 48 | continue 49 | fi 50 | ver_name=`echo $ver | sed -e 's/^.*\.\.//'` 51 | echo "" 52 | echo "** Version: $ver_name" 53 | echo "" 54 | git log --no-merges "${format}" $ver -- ./ 55 | prev_t=$tag.. 56 | done 57 | } 58 | 59 | 60 | if [ -z "$spec_format" ] ; then 61 | mkchlog --pretty=format:"%ad %an%n%H%n%n* %s%n" \ 62 | | sed -e 's/^\* /\t* /' 63 | else 64 | echo "%changelog" 65 | mkchlog --pretty=format:"- %ad %an: %s" 66 | echo "" 67 | fi 68 | -------------------------------------------------------------------------------- /gen_ver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This generates a version string which includes recent version as 4 | # specified in correspondent sub project's configure.ac file, plus 5 | # git revision abbreviation in the case if sub-project HEAD is different 6 | # from recent tag, plus "-dirty" suffix if local uncommitted changes are 7 | # in the sub project tree. 8 | # 9 | 10 | usage() 11 | { 12 | echo "Usage: $0" 13 | exit 2 14 | } 15 | 16 | cd `dirname $0` 17 | 18 | packege=`basename \`pwd\`` 19 | conf_file=configure.ac 20 | version=`cat $conf_file | sed -ne '/AC_INIT.*.*/s/^AC_INIT.*, \(.*\),.*$/\1/p'` 21 | 22 | git diff --quiet $packege-$version..HEAD -- ./ > /dev/null 2>&1 23 | if [ $? -eq 1 ] ; then 24 | abbr=`git rev-parse --short --verify HEAD 2>/dev/null` 25 | if [ ! -z "$abbr" ] ; then 26 | version="${version}_${abbr}" 27 | fi 28 | fi 29 | 30 | git diff-index --quiet HEAD -- ./> /dev/null 2>&1 31 | if [ $? -eq 1 ] ; then 32 | version="${version}_dirty" 33 | fi 34 | 35 | echo $version 36 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = . 3 | 4 | nobase_pkginclude_HEADERS = iba/ib_types.h iba/ib_cm_types.h 5 | 6 | EXTRA_DIST = \ 7 | $(srcdir)/iba/ib_types.h \ 8 | $(srcdir)/iba/ib_cm_types.h \ 9 | $(srcdir)/vendor/osm_vendor_mlx_transport_anafa.h \ 10 | $(srcdir)/vendor/osm_vendor_mlx.h \ 11 | $(srcdir)/vendor/osm_vendor_mlx_sender.h \ 12 | $(srcdir)/vendor/osm_vendor_ibumad.h \ 13 | $(srcdir)/vendor/osm_vendor_mlx_defs.h \ 14 | $(srcdir)/vendor/osm_vendor_mtl_transaction_mgr.h \ 15 | $(srcdir)/vendor/osm_vendor_mlx_sar.h \ 16 | $(srcdir)/vendor/osm_vendor_mlx_dispatcher.h \ 17 | $(srcdir)/vendor/osm_vendor_umadt.h \ 18 | $(srcdir)/vendor/osm_vendor_mlx_svc.h \ 19 | $(srcdir)/vendor/osm_vendor_mlx_hca.h \ 20 | $(srcdir)/vendor/osm_vendor_mlx_rmpp_ctx.h \ 21 | $(srcdir)/vendor/osm_vendor_mlx_transport.h \ 22 | $(srcdir)/vendor/osm_vendor_mlx_inout.h \ 23 | $(srcdir)/vendor/osm_vendor_mtl_hca_guid.h \ 24 | $(srcdir)/vendor/osm_vendor_test.h \ 25 | $(srcdir)/vendor/osm_vendor_ts.h \ 26 | $(srcdir)/vendor/osm_vendor_mlx_txn.h \ 27 | $(srcdir)/vendor/osm_vendor_al.h \ 28 | $(srcdir)/vendor/osm_vendor_mtl.h \ 29 | $(srcdir)/vendor/osm_ts_useraccess.h \ 30 | $(srcdir)/vendor/osm_umadt.h \ 31 | $(srcdir)/vendor/osm_mtl_bind.h 32 | 33 | pkgincludedir = $(includedir)/infiniband 34 | -------------------------------------------------------------------------------- /include/complib/cl_atomic_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation specific header files for atomic operations. 39 | */ 40 | 41 | #ifndef _CL_ATOMIC_OSD_H_ 42 | #define _CL_ATOMIC_OSD_H_ 43 | 44 | #include 45 | #include 46 | 47 | #ifdef __cplusplus 48 | # define BEGIN_C_DECLS extern "C" { 49 | # define END_C_DECLS } 50 | #else /* !__cplusplus */ 51 | # define BEGIN_C_DECLS 52 | # define END_C_DECLS 53 | #endif /* __cplusplus */ 54 | 55 | BEGIN_C_DECLS 56 | 57 | extern cl_spinlock_t cl_atomic_spinlock; 58 | 59 | static inline int32_t cl_atomic_inc(IN atomic32_t * const p_value) 60 | { 61 | int32_t new_val; 62 | 63 | cl_spinlock_acquire(&cl_atomic_spinlock); 64 | new_val = *p_value + 1; 65 | *p_value = new_val; 66 | cl_spinlock_release(&cl_atomic_spinlock); 67 | return (new_val); 68 | } 69 | 70 | static inline int32_t cl_atomic_dec(IN atomic32_t * const p_value) 71 | { 72 | int32_t new_val; 73 | 74 | cl_spinlock_acquire(&cl_atomic_spinlock); 75 | new_val = *p_value - 1; 76 | *p_value = new_val; 77 | cl_spinlock_release(&cl_atomic_spinlock); 78 | return (new_val); 79 | } 80 | 81 | static inline int32_t 82 | cl_atomic_add(IN atomic32_t * const p_value, IN const int32_t increment) 83 | { 84 | int32_t new_val; 85 | 86 | cl_spinlock_acquire(&cl_atomic_spinlock); 87 | new_val = *p_value + increment; 88 | *p_value = new_val; 89 | cl_spinlock_release(&cl_atomic_spinlock); 90 | return (new_val); 91 | } 92 | 93 | static inline int32_t 94 | cl_atomic_sub(IN atomic32_t * const p_value, IN const int32_t decrement) 95 | { 96 | int32_t new_val; 97 | 98 | cl_spinlock_acquire(&cl_atomic_spinlock); 99 | new_val = *p_value - decrement; 100 | *p_value = new_val; 101 | cl_spinlock_release(&cl_atomic_spinlock); 102 | return (new_val); 103 | } 104 | 105 | END_C_DECLS 106 | #endif /* _CL_ATOMIC_OSD_H_ */ 107 | -------------------------------------------------------------------------------- /include/complib/cl_byteswap_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Provides common macros for dealing with byte swapping issues. 39 | */ 40 | 41 | #ifndef _CL_BYTESWAP_OSD_H_ 42 | #define _CL_BYTESWAP_OSD_H_ 43 | 44 | /* 45 | * This provides defines __LITTLE_ENDIAN, __BIG_ENDIAN and __BYTE_ORDER 46 | */ 47 | #include 48 | #include 49 | 50 | #ifdef __cplusplus 51 | # define BEGIN_C_DECLS extern "C" { 52 | # define END_C_DECLS } 53 | #else /* !__cplusplus */ 54 | # define BEGIN_C_DECLS 55 | # define END_C_DECLS 56 | #endif /* __cplusplus */ 57 | 58 | BEGIN_C_DECLS 59 | #if __BYTE_ORDER == __LITTLE_ENDIAN 60 | #define cl_ntoh16(x) bswap_16(x) 61 | #define cl_hton16(x) bswap_16(x) 62 | #define cl_ntoh32(x) bswap_32(x) 63 | #define cl_hton32(x) bswap_32(x) 64 | #define cl_ntoh64(x) (uint64_t)bswap_64(x) 65 | #define cl_hton64(x) (uint64_t)bswap_64(x) 66 | #else /* Big Endian */ 67 | #define cl_ntoh16(x) (x) 68 | #define cl_hton16(x) (x) 69 | #define cl_ntoh32(x) (x) 70 | #define cl_hton32(x) (x) 71 | #define cl_ntoh64(x) (x) 72 | #define cl_hton64(x) (x) 73 | #endif 74 | END_C_DECLS 75 | #endif /* _CL_BYTESWAP_OSD_H_ */ 76 | -------------------------------------------------------------------------------- /include/complib/cl_debug_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Debug Macros. 39 | */ 40 | 41 | #ifndef _CL_DEBUG_OSD_H_ 42 | #define _CL_DEBUG_OSD_H_ 43 | 44 | #include 45 | #include 46 | 47 | #ifdef __cplusplus 48 | # define BEGIN_C_DECLS extern "C" { 49 | # define END_C_DECLS } 50 | #else /* !__cplusplus */ 51 | # define BEGIN_C_DECLS 52 | # define END_C_DECLS 53 | #endif /* __cplusplus */ 54 | 55 | BEGIN_C_DECLS 56 | #if !defined(__MODULE__) 57 | #define __MODULE__ "" 58 | #define __MOD_DELIMITER__ "" 59 | #else /* !defined(__MODULE__) */ 60 | #define __MOD_DELIMITER__ ":" 61 | #endif /* !defined(__MODULE__) */ 62 | /* 63 | * Define specifiers for print functions based on the platform 64 | */ 65 | #ifdef __IA64__ 66 | #define PRIdSIZE_T "ld" 67 | #else 68 | #define PRIdSIZE_T "d" 69 | #endif 70 | #include 71 | #include 72 | #define cl_msg_out printf 73 | #if defined( _DEBUG_ ) 74 | #define cl_dbg_out printf 75 | #else 76 | #define cl_dbg_out foo 77 | #endif /* _DEBUG_ */ 78 | /* 79 | * The following macros are used internally by the CL_ENTER, CL_TRACE, 80 | * CL_TRACE_EXIT, and CL_EXIT macros. 81 | */ 82 | #define _CL_DBG_ENTER \ 83 | ("%s%s%s() [\n", __MODULE__, __MOD_DELIMITER__, __func__) 84 | #define _CL_DBG_EXIT \ 85 | ("%s%s%s() ]\n", __MODULE__, __MOD_DELIMITER__, __func__) 86 | #define _CL_DBG_INFO \ 87 | ("%s%s%s(): ", __MODULE__, __MOD_DELIMITER__, __func__) 88 | #define _CL_DBG_ERROR \ 89 | ("%s%s%s() !ERROR!: ", __MODULE__, __MOD_DELIMITER__, __func__) 90 | #define CL_CHK_STK 91 | END_C_DECLS 92 | #endif /* _CL_DEBUG_OSD_H_ */ 93 | -------------------------------------------------------------------------------- /include/complib/cl_event_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of event object. 39 | */ 40 | 41 | #ifndef _CL_EVENT_OSD_H_ 42 | #define _CL_EVENT_OSD_H_ 43 | 44 | #include 45 | 46 | #ifdef __cplusplus 47 | # define BEGIN_C_DECLS extern "C" { 48 | # define END_C_DECLS } 49 | #else /* !__cplusplus */ 50 | # define BEGIN_C_DECLS 51 | # define END_C_DECLS 52 | #endif /* __cplusplus */ 53 | 54 | BEGIN_C_DECLS 55 | #include /* usr/include */ 56 | /* 57 | * Linux user mode specific data structure for the event object. 58 | * Users should not access these variables directly. 59 | */ 60 | typedef struct _cl_event_t { 61 | pthread_cond_t condvar; 62 | pthread_mutex_t mutex; 63 | boolean_t signaled; 64 | boolean_t manual_reset; 65 | cl_state_t state; 66 | } cl_event_t; 67 | 68 | END_C_DECLS 69 | #endif /* _CL_EVENT_OSD_H_ */ 70 | -------------------------------------------------------------------------------- /include/complib/cl_math.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Defines standard math related macros and functions. 39 | */ 40 | 41 | #ifndef _CL_MATH_H_ 42 | #define _CL_MATH_H_ 43 | 44 | #include 45 | 46 | #ifdef __cplusplus 47 | # define BEGIN_C_DECLS extern "C" { 48 | # define END_C_DECLS } 49 | #else /* !__cplusplus */ 50 | # define BEGIN_C_DECLS 51 | # define END_C_DECLS 52 | #endif /* __cplusplus */ 53 | 54 | BEGIN_C_DECLS 55 | /****d* Component Library: Math/MAX 56 | * NAME 57 | * MAX 58 | * 59 | * DESCRIPTION 60 | * The MAX macro returns the greater of two values. 61 | * 62 | * SYNOPSIS 63 | * MAX( x, y ); 64 | * 65 | * PARAMETERS 66 | * x 67 | * [in] First of two values to compare. 68 | * 69 | * y 70 | * [in] Second of two values to compare. 71 | * 72 | * RETURN VALUE 73 | * Returns the greater of the x and y parameters. 74 | * 75 | * SEE ALSO 76 | * MIN, ROUNDUP 77 | *********/ 78 | #ifndef MAX 79 | #define MAX(x,y) ((x) > (y) ? (x) : (y)) 80 | #endif 81 | /****d* Component Library: Math/MIN 82 | * NAME 83 | * MIN 84 | * 85 | * DESCRIPTION 86 | * The MIN macro returns the greater of two values. 87 | * 88 | * SYNOPSIS 89 | * MIN( x, y ); 90 | * 91 | * PARAMETERS 92 | * x 93 | * [in] First of two values to compare. 94 | * 95 | * y 96 | * [in] Second of two values to compare. 97 | * 98 | * RETURN VALUE 99 | * Returns the lesser of the x and y parameters. 100 | * 101 | * SEE ALSO 102 | * MAX, ROUNDUP 103 | *********/ 104 | #ifndef MIN 105 | #define MIN(x,y) ((x) < (y) ? (x) : (y)) 106 | #endif 107 | /****d* Component Library: Math/ROUNDUP 108 | * NAME 109 | * ROUNDUP 110 | * 111 | * DESCRIPTION 112 | * The ROUNDUP macro rounds a value up to a given multiple. 113 | * 114 | * SYNOPSIS 115 | * ROUNDUP( val, align ); 116 | * 117 | * PARAMETERS 118 | * val 119 | * [in] Value that is to be rounded up. The type of the value is 120 | * indeterminate, but must be at most the size of a natural integer 121 | * for the platform. 122 | * 123 | * align 124 | * [in] Multiple to which the val parameter must be rounded up. 125 | * 126 | * RETURN VALUE 127 | * Returns a value that is the input value specified by val rounded up to 128 | * the nearest multiple of align. 129 | * 130 | * NOTES 131 | * The value provided must be of a type at most the size of a natural integer. 132 | *********/ 133 | #ifndef ROUNDUP 134 | #define ROUNDUP(val, align) \ 135 | ((((val) / (align))*(align)) + (((val) % (align)) ? (align) : 0)) 136 | #endif 137 | END_C_DECLS 138 | #endif /* _CL_MATH_H_ */ 139 | -------------------------------------------------------------------------------- /include/complib/cl_nodenamemap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2007 Lawrence Livermore National Lab 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | */ 34 | 35 | #ifndef _CL_NODE_NAME_MAP_H_ 36 | #define _CL_NODE_NAME_MAP_H_ 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | /* NOTE: this may modify the parameter "nodedesc". */ 43 | char *clean_nodedesc(char *nodedesc); 44 | 45 | typedef struct _name_map_item { 46 | cl_map_item_t item; 47 | uint64_t guid; 48 | char *name; 49 | } name_map_item_t; 50 | 51 | typedef cl_qmap_t nn_map_t; 52 | 53 | /** 54 | * Node name map interface. 55 | * It is OK to pass NULL for the node_name_map[_fp] parameters. 56 | */ 57 | nn_map_t *open_node_name_map(const char *node_name_map); 58 | void close_node_name_map(nn_map_t *map); 59 | char *remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc); 60 | /* NOTE: parameter "nodedesc" may be modified here. */ 61 | int parse_node_map(const char *file_name, 62 | int (*create)(void *, uint64_t, char *), void *cxt); 63 | 64 | #endif /* _CL_NODE_NAME_MAP_H_ */ 65 | -------------------------------------------------------------------------------- /include/complib/cl_packoff.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Turns off byte packing, which is necessary for passing information from 39 | * system to system over a network to ensure no padding by the compiler has 40 | * taken place. 41 | */ 42 | 43 | #ifdef PACK_SUFFIX 44 | #undef PACK_SUFFIX 45 | #endif 46 | 47 | #ifdef _MSC_VER 48 | #pragma pack (pop) 49 | #endif 50 | -------------------------------------------------------------------------------- /include/complib/cl_packon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Turns on byte packing, which is necessary for passing information from 39 | * system to system over a network to ensure no padding by the compiler has 40 | * taken place. 41 | */ 42 | 43 | /****h* Component Library/Structure Packing 44 | * NAME 45 | * Structure Packing 46 | * 47 | * DESCRIPTION 48 | * The structure packing header files allow packing structures on byte 49 | * boundaries. 50 | * 51 | * Structure packing should be used whenever a structure is transmitted 52 | * between systems, as different platforms pad structures differently if 53 | * they are not packed. Packing a structure that is not transmitted between 54 | * systems can be detrimental to performance, as fields in the structure may 55 | * not align properly for some platforms. Care must be taken when creating 56 | * packed structures that the alignment rules for all platforms are followed. 57 | * 58 | * To pack a structure, include cl_packon.h before defining the structure, and 59 | * include cl_packoff.h after the structure definition. Multiple structures 60 | * can be packed between the two include statements if desired. 61 | * 62 | * The structure definition itself must use the PACK_SUFFIX keyword. 63 | * 64 | * EXAMPLE 65 | * #include 66 | * 67 | * typedef _my_struct_t 68 | * { 69 | * uint64 large; 70 | * uint32 medium; 71 | * uint16 small; 72 | * 73 | * } PACK_SUFFIX my_struct_t; 74 | * #include 75 | *********/ 76 | 77 | #ifndef PACK_SUFFIX 78 | #define PACK_SUFFIX __attribute__((packed)) 79 | #endif 80 | 81 | #ifdef _MSC_VER 82 | #pragma pack (push, 1) 83 | #endif 84 | -------------------------------------------------------------------------------- /include/complib/cl_spinlock_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of spin lock object. 39 | */ 40 | 41 | #ifndef _CL_SPINLOCK_OSD_H_ 42 | #define _CL_SPINLOCK_OSD_H_ 43 | 44 | #ifdef __cplusplus 45 | # define BEGIN_C_DECLS extern "C" { 46 | # define END_C_DECLS } 47 | #else /* !__cplusplus */ 48 | # define BEGIN_C_DECLS 49 | # define END_C_DECLS 50 | #endif /* __cplusplus */ 51 | 52 | BEGIN_C_DECLS 53 | #include 54 | #include /* usr/include/ */ 55 | typedef struct _cl_spinlock_t { 56 | pthread_mutex_t mutex; 57 | cl_state_t state; 58 | } cl_spinlock_t; 59 | 60 | END_C_DECLS 61 | #endif /* _CL_SPINLOCK_OSD_H_ */ 62 | -------------------------------------------------------------------------------- /include/complib/cl_thread_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of thread abstraction and thread related operations. 39 | */ 40 | 41 | #ifndef _CL_THREAD_OSD_H_ 42 | #define _CL_THREAD_OSD_H_ 43 | 44 | #ifdef __cplusplus 45 | # define BEGIN_C_DECLS extern "C" { 46 | # define END_C_DECLS } 47 | #else /* !__cplusplus */ 48 | # define BEGIN_C_DECLS 49 | # define END_C_DECLS 50 | #endif /* __cplusplus */ 51 | 52 | BEGIN_C_DECLS 53 | #include 54 | #include 55 | #include 56 | /* Linux user mode thread object structure definition. */ 57 | typedef struct _cl_thread_osd_t { 58 | pthread_t id; 59 | cl_state_t state; 60 | } cl_thread_osd_t; 61 | 62 | static inline boolean_t cl_is_blockable(void) 63 | { 64 | return TRUE; 65 | } 66 | 67 | END_C_DECLS 68 | #endif /* _CL_THREAD_OSD_H_ */ 69 | -------------------------------------------------------------------------------- /include/complib/cl_timer_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of timer object. 39 | */ 40 | 41 | #ifndef _CL_TIMER_OSD_H_ 42 | #define _CL_TIMER_OSD_H_ 43 | 44 | #include 45 | #include 46 | 47 | #ifdef __cplusplus 48 | # define BEGIN_C_DECLS extern "C" { 49 | # define END_C_DECLS } 50 | #else /* !__cplusplus */ 51 | # define BEGIN_C_DECLS 52 | # define END_C_DECLS 53 | #endif /* __cplusplus */ 54 | 55 | BEGIN_C_DECLS 56 | #include 57 | #include 58 | typedef enum _cl_timer_state { 59 | CL_TIMER_IDLE, 60 | CL_TIMER_QUEUED, 61 | CL_TIMER_RUNNING 62 | } cl_timer_state_t; 63 | 64 | typedef struct _cl_timer_t { 65 | cl_list_item_t list_item; 66 | cl_timer_state_t timer_state; 67 | cl_state_t state; 68 | cl_pfn_timer_callback_t pfn_callback; 69 | const void *context; 70 | pthread_cond_t cond; 71 | struct timespec timeout; 72 | } cl_timer_t; 73 | 74 | /* Internal functions to create the timer provider. */ 75 | cl_status_t __cl_timer_prov_create(void); 76 | 77 | /* Internal function to destroy the timer provider. */ 78 | void __cl_timer_prov_destroy(void); 79 | 80 | END_C_DECLS 81 | #endif /* _CL_TIMER_OSD_H_ */ 82 | -------------------------------------------------------------------------------- /include/complib/cl_types_osd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Defines sized datatypes for Linux User mode 39 | * exported sizes are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t 40 | * int64_t, uint64_t. 41 | */ 42 | 43 | #ifndef _CL_TYPES_OSD_H_ 44 | #define _CL_TYPES_OSD_H_ 45 | 46 | #ifdef __cplusplus 47 | # define BEGIN_C_DECLS extern "C" { 48 | # define END_C_DECLS } 49 | #else /* !__cplusplus */ 50 | # define BEGIN_C_DECLS 51 | # define END_C_DECLS 52 | #endif /* __cplusplus */ 53 | 54 | BEGIN_C_DECLS 55 | #if defined (_DEBUG_) 56 | #ifdef __IA64__ 57 | #define cl_break() asm(" break 0") 58 | #else /* __IA64__ */ 59 | #define cl_break() asm(" int $3") 60 | #endif /* __IA64__ */ 61 | #else /* _DEBUG_ */ 62 | #define cl_break 63 | #endif 64 | #include 65 | #include 66 | #include 67 | 68 | /* 69 | * Branch prediction hints 70 | */ 71 | #if defined(HAVE_BUILTIN_EXPECT) 72 | #define PT(exp) __builtin_expect( ((uintptr_t)(exp)), 1 ) 73 | #define PF(exp) __builtin_expect( ((uintptr_t)(exp)), 0 ) 74 | #else 75 | #define PT(exp) (exp) 76 | #define PF(exp) (exp) 77 | #endif 78 | 79 | #if defined (_DEBUG_) 80 | #define CL_ASSERT assert 81 | #else /* _DEBUG_ */ 82 | #define CL_ASSERT( __exp__ ) 83 | #endif /* _DEBUG_ */ 84 | /* 85 | * Types not explicitly defined are native to the platform. 86 | */ 87 | typedef int boolean_t; 88 | typedef volatile int32_t atomic32_t; 89 | 90 | #ifndef NULL 91 | #define NULL (void*)0 92 | #endif 93 | 94 | #define UNUSED_PARAM( P ) 95 | 96 | END_C_DECLS 97 | #endif /* _CL_TYPES_OSD_H_ */ 98 | -------------------------------------------------------------------------------- /include/opensm/osm_config.h.in: -------------------------------------------------------------------------------- 1 | /* include/osm_config.h.in 2 | * 3 | * Defines various OpenSM configuration parameters to be used by various 4 | * plugins and third party tools. 5 | * 6 | * NOTE: Defines used in header files MUST be included here to ensure plugin 7 | * compatibility. 8 | */ 9 | 10 | #ifndef _OSM_CONFIG_H_ 11 | #define _OSM_CONFIG_H_ 12 | 13 | /* define 1 if OpenSM build is in a debug mode */ 14 | #undef OSM_DEBUG 15 | #undef _DEBUG_ 16 | 17 | /* Define as 1 if you want Dual Sided RMPP Support */ 18 | #undef DUAL_SIDED_RMPP 19 | 20 | /* Define as 1 if you want to enable a console on a socket connection */ 21 | #undef ENABLE_OSM_CONSOLE_SOCKET 22 | 23 | /* Define as 1 if you want to enable the event plugin */ 24 | #undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN 25 | 26 | /* Define as 1 if you want to enable the performance manager */ 27 | #undef ENABLE_OSM_PERF_MGR 28 | 29 | /* Define as 1 if you want to enable the performance manager profiling code */ 30 | #undef ENABLE_OSM_PERF_MGR_PROFILE 31 | 32 | /* Define a default node name map file */ 33 | #undef HAVE_DEFAULT_NODENAME_MAP 34 | 35 | /* Define a default OpenSM config file */ 36 | #undef HAVE_DEFAULT_OPENSM_CONFIG_FILE 37 | 38 | /* Define a Partition config file */ 39 | #undef HAVE_DEFAULT_PARTITION_CONFIG_FILE 40 | 41 | /* Define a Prefix Routes config file */ 42 | #undef HAVE_DEFAULT_PREFIX_ROUTES_FILE 43 | 44 | /* Define a QOS policy config file */ 45 | #undef HAVE_DEFAULT_QOS_POLICY_FILE 46 | 47 | /* Define OpenSM config directory */ 48 | #undef OPENSM_CONFIG_DIR 49 | 50 | /* Define as 1 for vapi vendor */ 51 | #undef OSM_VENDOR_INTF_MTL 52 | 53 | /* Define as 1 for OpenIB vendor */ 54 | #undef OSM_VENDOR_INTF_OPENIB 55 | 56 | /* Define as 1 for sim vendor */ 57 | #undef OSM_VENDOR_INTF_SIM 58 | 59 | /* Define as 1 for ts vendor */ 60 | #undef OSM_VENDOR_INTF_TS 61 | 62 | /* Define as 1 if you want Vendor RMPP Support */ 63 | #undef VENDOR_RMPP_SUPPORT 64 | 65 | /* Define to 1 if you have the `pthread' library (-lpthread). */ 66 | #undef HAVE_LIBPTHREAD 67 | 68 | #endif /* _OSM_CONFIG_H_ */ 69 | -------------------------------------------------------------------------------- /include/opensm/osm_console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2007 Voltaire, Inc. All rights reserved. 3 | * 4 | * This software is available to you under a choice of one of two 5 | * licenses. You may choose to be licensed under the terms of the GNU 6 | * General Public License (GPL) Version 2, available from the file 7 | * COPYING in the main directory of this source tree, or the 8 | * OpenIB.org BSD license below: 9 | * 10 | * Redistribution and use in source and binary forms, with or 11 | * without modification, are permitted provided that the following 12 | * conditions are met: 13 | * 14 | * - Redistributions of source code must retain the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer. 17 | * 18 | * - Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | * SOFTWARE. 31 | * 32 | */ 33 | 34 | #ifndef _OSM_CONSOLE_H_ 35 | #define _OSM_CONSOLE_H_ 36 | 37 | #include 38 | 39 | #ifdef __cplusplus 40 | # define BEGIN_C_DECLS extern "C" { 41 | # define END_C_DECLS } 42 | #else /* !__cplusplus */ 43 | # define BEGIN_C_DECLS 44 | # define END_C_DECLS 45 | #endif /* __cplusplus */ 46 | 47 | BEGIN_C_DECLS 48 | int osm_console(osm_opensm_t * p_osm); 49 | END_C_DECLS 50 | #endif /* _OSM_CONSOLE_H_ */ 51 | -------------------------------------------------------------------------------- /include/opensm/osm_console_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2007 Voltaire, Inc. All rights reserved. 3 | * 4 | * This software is available to you under a choice of one of two 5 | * licenses. You may choose to be licensed under the terms of the GNU 6 | * General Public License (GPL) Version 2, available from the file 7 | * COPYING in the main directory of this source tree, or the 8 | * OpenIB.org BSD license below: 9 | * 10 | * Redistribution and use in source and binary forms, with or 11 | * without modification, are permitted provided that the following 12 | * conditions are met: 13 | * 14 | * - Redistributions of source code must retain the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer. 17 | * 18 | * - Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | * SOFTWARE. 31 | * 32 | */ 33 | /* 34 | * Abstract: 35 | * Declaration of osm_console_t. 36 | * This object represents the OpenSM Console object. 37 | * This object is part of the OpenSM family of objects. 38 | */ 39 | 40 | #ifndef _OSM_CONSOLE_IO_H_ 41 | #define _OSM_CONSOLE_IO_H_ 42 | 43 | #include 44 | #include 45 | 46 | #define OSM_DISABLE_CONSOLE "off" 47 | #define OSM_LOCAL_CONSOLE "local" 48 | #ifdef ENABLE_OSM_CONSOLE_SOCKET 49 | #define OSM_REMOTE_CONSOLE "socket" 50 | #endif 51 | #ifdef ENABLE_OSM_CONSOLE_LOOPBACK 52 | #define OSM_LOOPBACK_CONSOLE "loopback" 53 | #endif 54 | #define OSM_CONSOLE_NAME "OSM Console" 55 | 56 | #define OSM_DEFAULT_CONSOLE OSM_DISABLE_CONSOLE 57 | #define OSM_DEFAULT_CONSOLE_PORT 10000 58 | #define OSM_DAEMON_NAME "opensm" 59 | 60 | #define OSM_COMMAND_PROMPT "$ " 61 | 62 | #ifdef __cplusplus 63 | # define BEGIN_C_DECLS extern "C" { 64 | # define END_C_DECLS } 65 | #else /* !__cplusplus */ 66 | # define BEGIN_C_DECLS 67 | # define END_C_DECLS 68 | #endif /* __cplusplus */ 69 | 70 | BEGIN_C_DECLS 71 | typedef struct osm_console { 72 | int socket; 73 | int in_fd; 74 | int out_fd; 75 | int authorized; 76 | FILE *in; 77 | FILE *out; 78 | char client_type[32]; 79 | char client_ip[64]; 80 | char client_hn[128]; 81 | } osm_console_t; 82 | 83 | void osm_console_prompt(FILE * out); 84 | int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_log); 85 | void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log); 86 | int is_console_enabled(osm_subn_opt_t *p_opt); 87 | 88 | #ifdef ENABLE_OSM_CONSOLE_LOOPBACK 89 | int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log); 90 | int cio_close(osm_console_t * p_oct, osm_log_t * p_log); 91 | int is_authorized(osm_console_t * p_oct); 92 | #else 93 | #define cio_close(c, log) 94 | #endif 95 | 96 | END_C_DECLS 97 | #endif /* _OSM_CONSOLE_IO_H_ */ 98 | -------------------------------------------------------------------------------- /include/opensm/osm_errors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of error code ranges for the various OpenSM modules. 39 | */ 40 | 41 | #ifndef _OSM_ERRORS_H_ 42 | #define _OSM_ERRORS_H_ 43 | 44 | /* 45 | Generic Request Controller 46 | 0100 - 01FF 47 | 48 | Node Info Receive Controller 49 | 0200 - 02FF 50 | 51 | Generic Requester 52 | 0300 - 03FF 53 | 54 | Node Info Receiver 55 | 0400 - 04FF 56 | 57 | Node Description Receiver 58 | 0500 - 05FF 59 | 60 | Node Description Receive Controller 61 | 0600 - 06FF 62 | 63 | Port Info Receiver 64 | 0700 - 07FF 65 | 66 | Port Info Receive Controller 67 | 0800 - 08FF 68 | 69 | Mad Pool 70 | 0900 - 09FF 71 | 72 | SM 73 | 1000 - 10FF 74 | 75 | SM MAD Controller 76 | 1100 - 11FF 77 | 78 | VL15 Interface 79 | 1200 - 12FF 80 | 81 | Switch Info Receive Controller 82 | 1300 - 13FF 83 | 84 | Switch Info Receiver 85 | 1400 - 14FF 86 | 87 | State Manager 88 | 1500 - 15FF 89 | 90 | State Manager Controller 91 | 1600 - 16FF 92 | 93 | LID Manager 94 | 1700 - 17FF 95 | 96 | Link Manager 97 | 1800 - 18FF 98 | 99 | Drop Manager 100 | 1900 - 19FF 101 | 102 | Linear Forwarding Receive Controller 103 | 2000 - 20FF 104 | 105 | Linear Forwarding Receiver 106 | 2100 - 21FF 107 | 108 | Vendor Specific 109 | 2200 - 22FF 110 | 111 | SMInfo Receive Controller 112 | 2300 - 23FF 113 | 114 | SMInfo Info Receiver 115 | 2400 - 24FF 116 | 117 | Generic Responder 118 | 2500 - 25FF 119 | 120 | Linear Forwarding Receive Controller 121 | 2600 - 26FF 122 | 123 | Linear Forwarding Receiver 124 | 2700 - 27FF 125 | 126 | SA MAD controller 127 | 2800 - 28FF 128 | 129 | Node Record Controller 130 | 2900 - 29FF 131 | 132 | PortInfo Record Controller 133 | 3000 - 30FF 134 | 135 | Link Record Controller 136 | 3100 - 31FF 137 | 138 | Path Record Controller 139 | 3200 - 32FF 140 | 141 | SMInfo Record Controller 142 | 3300 - 33FF 143 | 144 | Multicast Record Controller 145 | 3400 - 34FF 146 | 147 | Unicast Manager 148 | 3500 - 35FF 149 | 150 | Multicast Manager 151 | 3600 - 36FF 152 | 153 | SA Response 154 | 3700 - 37FF 155 | 156 | Link Record Receiver 157 | 3800 - 38FF 158 | 159 | Multicast Forwarding Receive Controller 160 | 3900 - 39FF 161 | 162 | Multicast Forwarding Receiver 163 | 4000 - 40FF 164 | 165 | SMInfo Record Receiver 166 | 4100 - 41FF 167 | 168 | PortInfo Record Receiver 169 | 4200 - 42FF 170 | 171 | Service Record Receiver 172 | 4300 - 43FF 173 | 174 | */ 175 | 176 | #endif /* _OSM_ERRORS_H_ */ 177 | -------------------------------------------------------------------------------- /include/opensm/osm_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mellanox Technologies LTD. All rights reserved. 3 | * 4 | * This software is available to you under a choice of one of two 5 | * licenses. You may choose to be licensed under the terms of the GNU 6 | * General Public License (GPL) Version 2, available from the file 7 | * COPYING in the main directory of this source tree, or the 8 | * OpenIB.org BSD license below: 9 | * 10 | * Redistribution and use in source and binary forms, with or 11 | * without modification, are permitted provided that the following 12 | * conditions are met: 13 | * 14 | * - Redistributions of source code must retain the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer. 17 | * 18 | * - Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | * SOFTWARE. 31 | * 32 | */ 33 | 34 | #ifndef _OSM_GUID_H_ 35 | #define _OSM_GUID_H_ 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | #ifdef __cplusplus 42 | # define BEGIN_C_DECLS extern "C" { 43 | # define END_C_DECLS } 44 | #else /* !__cplusplus */ 45 | # define BEGIN_C_DECLS 46 | # define END_C_DECLS 47 | #endif /* __cplusplus */ 48 | 49 | BEGIN_C_DECLS 50 | 51 | typedef struct osm_guidinfo_work_obj { 52 | cl_list_item_t list_item; 53 | osm_port_t *p_port; 54 | uint8_t block_num; 55 | } osm_guidinfo_work_obj_t; 56 | 57 | osm_guidinfo_work_obj_t *osm_guid_work_obj_new(IN osm_port_t * p_port, 58 | IN uint8_t block_num); 59 | 60 | void osm_guid_work_obj_delete(IN osm_guidinfo_work_obj_t * p_wobj); 61 | 62 | int osm_queue_guidinfo(IN osm_sa_t *sa, IN osm_port_t *p_port, 63 | IN uint8_t block_num); 64 | 65 | END_C_DECLS 66 | #endif /* _OSM_GUID_H_ */ 67 | -------------------------------------------------------------------------------- /include/opensm/osm_mcast_mgr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved. 6 | * Copyright (C) 2012-2013 Tokyo Institute of Technology. All rights reserved. 7 | * 8 | * This software is available to you under a choice of one of two 9 | * licenses. You may choose to be licensed under the terms of the GNU 10 | * General Public License (GPL) Version 2, available from the file 11 | * COPYING in the main directory of this source tree, or the 12 | * OpenIB.org BSD license below: 13 | * 14 | * Redistribution and use in source and binary forms, with or 15 | * without modification, are permitted provided that the following 16 | * conditions are met: 17 | * 18 | * - Redistributions of source code must retain the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer. 21 | * 22 | * - Redistributions in binary form must reproduce the above 23 | * copyright notice, this list of conditions and the following 24 | * disclaimer in the documentation and/or other materials 25 | * provided with the distribution. 26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 31 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 32 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 33 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 | * SOFTWARE. 35 | * 36 | */ 37 | 38 | /* 39 | * Abstract: 40 | * Declaration of osm_mcast_work_obj_t. 41 | * Provide access to a mcast function which searches the root swicth for 42 | * a spanning tree. 43 | */ 44 | 45 | #ifndef _OSM_MCAST_MGR_H_ 46 | #define _OSM_MCAST_MGR_H_ 47 | 48 | #ifdef __cplusplus 49 | # define BEGIN_C_DECLS extern "C" { 50 | # define END_C_DECLS } 51 | #else /* !__cplusplus */ 52 | # define BEGIN_C_DECLS 53 | # define END_C_DECLS 54 | #endif /* __cplusplus */ 55 | 56 | BEGIN_C_DECLS 57 | 58 | typedef struct osm_mcast_work_obj { 59 | cl_list_item_t list_item; 60 | osm_port_t *p_port; 61 | cl_map_item_t map_item; 62 | } osm_mcast_work_obj_t; 63 | 64 | int osm_mcast_make_port_list_and_map(cl_qlist_t * list, cl_qmap_t * map, 65 | osm_mgrp_box_t * mbox); 66 | 67 | void osm_mcast_drop_port_list(cl_qlist_t * list); 68 | 69 | osm_switch_t * osm_mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t * list); 70 | 71 | END_C_DECLS 72 | #endif /* _OSM_MCAST_MGR_H_ */ 73 | -------------------------------------------------------------------------------- /include/opensm/osm_mesh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | */ 34 | 35 | /* 36 | * Abstract: 37 | * Declarations for mesh analysis 38 | */ 39 | 40 | #ifndef OSM_MESH_H 41 | #define OSM_MESH_H 42 | 43 | struct _lash; 44 | struct _switch; 45 | 46 | /* 47 | * per switch to switch link info 48 | */ 49 | typedef struct _link { 50 | int switch_id; 51 | int link_id; 52 | int next_port; 53 | int num_ports; 54 | int ports[0]; 55 | } link_t; 56 | 57 | /* 58 | * per switch node mesh info 59 | */ 60 | typedef struct _mesh_node { 61 | int *axes; /* used to hold and reorder assigned axes */ 62 | int *coord; /* mesh coordinates of switch */ 63 | int **matrix; /* distances between adjacant switches */ 64 | int *poly; /* characteristic polynomial of matrix */ 65 | /* used as an invariant classification */ 66 | int dimension; /* apparent dimension of mesh around node */ 67 | int temp; /* temporary holder for distance info */ 68 | int type; /* index of node type in mesh_info array */ 69 | unsigned int num_links; /* number of 'links' to adjacent switches */ 70 | link_t *links[0]; /* per link information */ 71 | } mesh_node_t; 72 | 73 | void osm_mesh_node_delete(struct _lash *p_lash, struct _switch *sw); 74 | int osm_mesh_node_create(struct _lash *p_lash, struct _switch *sw); 75 | int osm_do_mesh_analysis(struct _lash *p_lash); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /include/opensm/osm_prefix_route.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSM_PREFIX_ROUTE_H_ 37 | #define _OSM_PREFIX_ROUTE_H_ 38 | 39 | #include 40 | #include 41 | 42 | #ifdef __cplusplus 43 | # define BEGIN_C_DECLS extern "C" { 44 | # define END_C_DECLS } 45 | #else /* !__cplusplus */ 46 | # define BEGIN_C_DECLS 47 | # define END_C_DECLS 48 | #endif /* __cplusplus */ 49 | 50 | BEGIN_C_DECLS 51 | 52 | typedef struct { 53 | cl_list_item_t list_item; /* must be first */ 54 | ib_net64_t prefix; /* zero means "any" */ 55 | ib_net64_t guid; /* zero means "any" */ 56 | } osm_prefix_route_t; 57 | 58 | #ifdef ROUTER_EXP 59 | #error ROUTER_EXP is deprecated, specify prefix routes at runtime instead (see opensm man page for details) 60 | #endif 61 | 62 | END_C_DECLS 63 | #endif /* _OSM_PREFIX_ROUTE_H_ */ 64 | -------------------------------------------------------------------------------- /include/opensm/osm_ucast_lash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved. 3 | * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. 4 | * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. 5 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 6 | * Copyright (c) 2007 Simula Research Laboratory. All rights reserved. 7 | * Copyright (c) 2007 Silicon Graphics Inc. All rights reserved. 8 | * 9 | * This software is available to you under a choice of one of two 10 | * licenses. You may choose to be licensed under the terms of the GNU 11 | * General Public License (GPL) Version 2, available from the file 12 | * COPYING in the main directory of this source tree, or the 13 | * OpenIB.org BSD license below: 14 | * 15 | * Redistribution and use in source and binary forms, with or 16 | * without modification, are permitted provided that the following 17 | * conditions are met: 18 | * 19 | * - Redistributions of source code must retain the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer. 22 | * 23 | * - Redistributions in binary form must reproduce the above 24 | * copyright notice, this list of conditions and the following 25 | * disclaimer in the documentation and/or other materials 26 | * provided with the distribution. 27 | * 28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 29 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 32 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 33 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 34 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE. 36 | * 37 | */ 38 | 39 | /* 40 | * Abstract: 41 | * Declarations for LASH algorithm 42 | */ 43 | 44 | #ifndef OSM_UCAST_LASH_H 45 | #define OSM_UCAST_LASH_H 46 | 47 | #include 48 | 49 | enum { 50 | UNQUEUED, 51 | Q_MEMBER, 52 | MST_MEMBER, 53 | MAX_INT = 9999, 54 | NONE = MAX_INT 55 | }; 56 | 57 | typedef struct _cdg_vertex { 58 | int from; 59 | int to; 60 | int seen; 61 | int temp; 62 | int visiting_number; 63 | struct _cdg_vertex *next; 64 | int num_temp_depend; 65 | int num_using_vertex; 66 | int num_deps; 67 | struct vertex_deps { 68 | struct _cdg_vertex *v; 69 | int num_used; 70 | } deps[0]; 71 | } cdg_vertex_t; 72 | 73 | typedef struct _switch { 74 | osm_switch_t *p_sw; 75 | int id; 76 | int used_channels; 77 | int *dij_channels; 78 | int q_state; 79 | mesh_node_t *node; 80 | struct routing_table { 81 | unsigned out_link; 82 | unsigned lane; 83 | } routing_table[0]; 84 | } switch_t; 85 | 86 | typedef struct _lash { 87 | osm_opensm_t *p_osm; 88 | int num_switches; 89 | uint8_t vl_min; 90 | int balance_limit; 91 | switch_t **switches; 92 | cdg_vertex_t ****cdg_vertex_matrix; 93 | int num_mst_in_lane[IB_MAX_NUM_VLS]; 94 | int ***virtual_location; 95 | } lash_t; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /include/opensm/osm_version.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSM_VERSION_H_ 37 | #define _OSM_VERSION_H_ 38 | 39 | /****s* OpenSM: Base/OSM_VERSION 40 | * NAME 41 | * OSM_VERSION 42 | * 43 | * DESCRIPTION 44 | * The version string for OpenSM 45 | * 46 | * SYNOPSIS 47 | */ 48 | #define OSM_VERSION "OpenSM @VERSION@" 49 | /********/ 50 | 51 | #endif /* _OSM_VERSION_H_ */ 52 | -------------------------------------------------------------------------------- /include/opensm/st.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* @(#) st.h 5.1 89/12/14 */ 37 | 38 | #ifndef ST_INCLUDED 39 | #define ST_INCLUDED 40 | 41 | #include 42 | #include 43 | 44 | #ifdef __cplusplus 45 | # define BEGIN_C_DECLS extern "C" { 46 | # define END_C_DECLS } 47 | #else /* !__cplusplus */ 48 | # define BEGIN_C_DECLS 49 | # define END_C_DECLS 50 | #endif /* __cplusplus */ 51 | 52 | BEGIN_C_DECLS 53 | #define st_ptr_t uintptr_t 54 | typedef st_ptr_t st_data_t; 55 | 56 | #define ST_DATA_T_DEFINED 57 | 58 | typedef struct st_table st_table; 59 | 60 | struct st_hash_type { 61 | int (*compare) (void *, void *); 62 | st_ptr_t(*hash) (void *); 63 | }; 64 | 65 | struct st_table { 66 | struct st_hash_type *type; 67 | int num_bins; 68 | int num_entries; 69 | struct st_table_entry **bins; 70 | }; 71 | 72 | #define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0) 73 | 74 | enum st_retval { ST_CONTINUE, ST_STOP, ST_DELETE }; 75 | 76 | st_table *st_init_table(struct st_hash_type *); 77 | st_table *st_init_table_with_size(struct st_hash_type *, size_t); 78 | st_table *st_init_numtable(void); 79 | st_table *st_init_numtable_with_size(size_t); 80 | st_table *st_init_strtable(void); 81 | st_table *st_init_strtable_with_size(size_t); 82 | int st_delete(st_table *, st_data_t *, st_data_t *); 83 | int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t); 84 | int st_insert(st_table *, st_data_t, st_data_t); 85 | int st_lookup(st_table *, st_data_t, st_data_t *); 86 | void st_foreach(st_table *, 87 | int (*)(st_data_t key, st_data_t val, st_data_t arg), 88 | st_data_t); 89 | void st_add_direct(st_table *, st_data_t, st_data_t); 90 | void st_free_table(st_table *); 91 | void st_cleanup_safe(st_table *, st_data_t); 92 | st_table *st_copy(st_table *); 93 | 94 | #define ST_NUMCMP ((int (*)()) 0) 95 | #define ST_NUMHASH ((int (*)()) -2) 96 | 97 | #define st_numcmp ST_NUMCMP 98 | #define st_numhash ST_NUMHASH 99 | 100 | /* int st_strhash(void); */ 101 | 102 | END_C_DECLS 103 | #endif /* ST_INCLUDED */ 104 | -------------------------------------------------------------------------------- /include/vendor/osm_mtl_bind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSM_BIND_H_ 37 | #define _OSM_BIND_H_ 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #ifdef __cplusplus 46 | # define BEGIN_C_DECLS extern "C" { 47 | # define END_C_DECLS } 48 | #else /* !__cplusplus */ 49 | # define BEGIN_C_DECLS 50 | # define END_C_DECLS 51 | #endif /* __cplusplus */ 52 | 53 | BEGIN_C_DECLS 54 | /****s* OpenSM: Vendor/osm_vendor_mgt_bind 55 | * NAME 56 | * osm_vendor_mgt_bind_t 57 | * 58 | * DESCRIPTION 59 | * Tracks the handles returned by IB_MGT to the SMI and GSI 60 | * Nulled on init of the vendor obj. Populated on first bind. 61 | * 62 | * SYNOPSIS 63 | */ 64 | typedef struct _osm_vendor_mgt_bind { 65 | boolean_t smi_init, gsi_init; 66 | IB_MGT_mad_hndl_t smi_mads_hdl; 67 | IB_MGT_mad_hndl_t gsi_mads_hdl; 68 | struct _osm_mtl_bind_info *smi_p_bind; 69 | } osm_vendor_mgt_bind_t; 70 | 71 | /* 72 | * FIELDS 73 | * smi_mads_hdl 74 | * Handle returned by IB_MGT_get_handle to the IB_MGT_SMI 75 | * 76 | * gsi_mads_hdl 77 | * Handle returned by IB_MGT_get_handle to the IB_MGT_GSI 78 | * 79 | * SEE ALSO 80 | *********/ 81 | 82 | /****s* OpenSM: Vendor osm_mtl_bind_info_t 83 | * NAME 84 | * osm_mtl_bind_info_t 85 | * 86 | * DESCRIPTION 87 | * Handle to the result of binding a class callbacks to IB_MGT. 88 | * 89 | * SYNOPSIS 90 | */ 91 | typedef struct _osm_mtl_bind_info { 92 | IB_MGT_mad_hndl_t mad_hndl; 93 | osm_vendor_t *p_vend; 94 | void *client_context; 95 | VAPI_hca_hndl_t hca_hndl; 96 | VAPI_hca_id_t hca_id; 97 | uint8_t port_num; 98 | osm_vend_mad_recv_callback_t rcv_callback; 99 | osm_vend_mad_send_err_callback_t send_err_callback; 100 | osm_mad_pool_t *p_osm_pool; 101 | } osm_mtl_bind_info_t; 102 | 103 | /* 104 | * FIELDS 105 | * mad_hndl 106 | * the handle returned from the registration in IB_MGT 107 | * 108 | * p_vend 109 | * Pointer to the vendor object. 110 | * 111 | * client_context 112 | * User's context passed during osm_bind 113 | * 114 | * hca_id 115 | * HCA Id we bind to. 116 | * 117 | * port_num 118 | * Port number (within the HCA) of the bound port. 119 | * 120 | * rcv_callback 121 | * OSM Callback function to be called on receive of MAD. 122 | * 123 | * send_err_callback 124 | * OSM Callback to be called on send error. 125 | * 126 | * p_osm_pool 127 | * Points to the MAD pool used by OSM 128 | * 129 | * 130 | * SEE ALSO 131 | *********/ 132 | ib_api_status_t 133 | osm_mtl_send_mad(IN osm_mtl_bind_info_t * p_bind, IN osm_madw_t * const p_madw); 134 | 135 | END_C_DECLS 136 | #endif // _OSM_BIND_H_ 137 | -------------------------------------------------------------------------------- /include/vendor/osm_ts_useraccess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #include "ts_ib_useraccess.h" 37 | 38 | #ifdef __cplusplus 39 | # define BEGIN_C_DECLS extern "C" { 40 | # define END_C_DECLS } 41 | #else /* !__cplusplus */ 42 | # define BEGIN_C_DECLS 43 | # define END_C_DECLS 44 | #endif /* __cplusplus */ 45 | 46 | BEGIN_C_DECLS 47 | typedef struct ib_user_mad_filter osm_ts_user_mad_filter; 48 | typedef struct ib_set_port_info_ioctl osm_ts_set_port_info_ioctl; 49 | typedef struct ib_get_port_info_ioctl osm_ts_get_port_info_ioctl; 50 | typedef struct ib_gid_entry_ioctl osm_ts_gid_entry_ioctl; 51 | 52 | END_C_DECLS 53 | -------------------------------------------------------------------------------- /include/vendor/osm_umadt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of osm_mad_wrapper_t. 39 | * This object represents the context wrapper for OpenSM MAD processing. 40 | * This object is part of the OpenSM family of objects. 41 | */ 42 | 43 | #ifndef _OSM_UMADT_h_ 44 | #define _OSM_UMADT_h_ 45 | 46 | #include "iba/ib_types.h" 47 | #include 48 | #include 49 | #include "umadt.h" 50 | #include "ibt.h" 51 | 52 | #ifdef __cplusplus 53 | # define BEGIN_C_DECLS extern "C" { 54 | # define END_C_DECLS } 55 | #else /* !__cplusplus */ 56 | # define BEGIN_C_DECLS 57 | # define END_C_DECLS 58 | #endif /* __cplusplus */ 59 | 60 | BEGIN_C_DECLS 61 | 62 | typedef struct _umadt_obj_t { 63 | void *umadt_handle; 64 | UMADT_INTERFACE uMadtInterface; 65 | IBT_INTERFACE IbtInterface; 66 | boolean init_done; 67 | cl_spinlock_t register_lock; 68 | cl_qlist_t register_list; 69 | osm_log_t *p_log; 70 | uint32_t timeout; 71 | 72 | } umadt_obj_t; 73 | /*********/ 74 | 75 | /****s* OpenSM: Umadt MAD Wrapper/osm_bind_info 76 | * NAME 77 | * osm_bind_info 78 | * 79 | * DESCRIPTION 80 | * Context needed for processing individual MADs 81 | * 82 | * SYNOPSIS 83 | */ 84 | 85 | typedef struct _mad_bind_info_t { 86 | cl_list_item_t list_item; 87 | umadt_obj_t *p_umadt_obj; 88 | osm_mad_pool_t *p_mad_pool; 89 | osm_vend_mad_recv_callback_t mad_recv_callback; 90 | void *client_context; 91 | cl_thread_t recv_processor_thread; 92 | cl_spinlock_t trans_ctxt_lock; 93 | cl_qlist_t trans_ctxt_list; 94 | cl_timer_t timeout_timer; 95 | cl_spinlock_t timeout_list_lock; 96 | cl_qlist_t timeout_list; 97 | RegisterClassStruct umadt_reg_class; 98 | MADT_HANDLE umadt_handle; /* Umadt type */ 99 | 100 | } mad_bind_info_t; 101 | 102 | typedef struct _trans_context_t { 103 | cl_list_item_t list_item; 104 | uint64_t trans_id; 105 | uint64_t sent_time; /* micro secs */ 106 | void *context; 107 | } trans_context_t; 108 | 109 | /* 110 | * FIELDS 111 | * list_item 112 | * List linkage for pools and lists. MUST BE FIRST MEMBER! 113 | * 114 | * p_mad_pool 115 | * Pointer to the MAD pool to be used by mads with this bind handle. 116 | * 117 | * mad_recv_callback 118 | * Callback function called by the mad receive processor. 119 | * 120 | * client_context 121 | * context to be passed to the receive callback. 122 | * 123 | * recv_processor_thread 124 | * Thread structure for the receive processor thread. 125 | * 126 | * umadt_reg_class 127 | * Umadt register class struct used to register with Umadt. 128 | * 129 | * umadt_handle 130 | * Umadt returns this handle from a registration call. The transport layer 131 | * uses this handle to talk to Umadt. 132 | * 133 | * SEE ALSO 134 | *********/ 135 | 136 | END_C_DECLS 137 | #endif /*_OSM_UMADT_h_ */ 138 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Include file used by OpenSM to pull in the correct vendor file. 39 | */ 40 | 41 | /* 42 | this is the generic include file which includes 43 | the proper vendor specific file 44 | */ 45 | #include 46 | 47 | #if defined( OSM_VENDOR_INTF_TEST ) 48 | #include 49 | #elif defined( OSM_VENDOR_INTF_UMADT ) 50 | #include 51 | #elif defined( OSM_VENDOR_INTF_MTL ) 52 | /* HACK - I do not know how to prevent complib from loading kernel H files */ 53 | #undef __init 54 | #include 55 | #elif defined( OSM_VENDOR_INTF_TS ) 56 | #undef __init 57 | #include 58 | #elif defined( OSM_VENDOR_INTF_ANAFA ) 59 | #undef __init 60 | #include 61 | #elif defined( OSM_VENDOR_INTF_SIM ) 62 | #undef __init 63 | #include 64 | #elif defined( OSM_VENDOR_INTF_OPENIB ) 65 | #include 66 | #elif defined( OSM_VENDOR_INTF_AL ) 67 | #include 68 | #else 69 | #error No MAD Interface selected! 70 | #error Choose an interface in osm_config.h 71 | #endif 72 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2007,2009 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_H_ 37 | #define _OSMV_H_ 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #ifdef __cplusplus 44 | # define BEGIN_C_DECLS extern "C" { 45 | # define END_C_DECLS } 46 | #else /* !__cplusplus */ 47 | # define BEGIN_C_DECLS 48 | # define END_C_DECLS 49 | #endif /* __cplusplus */ 50 | 51 | BEGIN_C_DECLS 52 | /* 53 | Forward reference 54 | */ 55 | struct _osm_pkt_randomizer; 56 | 57 | /* The structure behind the OSM Vendor handle */ 58 | 59 | typedef struct _osm_vendor { 60 | 61 | /* for holding common transport info - useful at ibmgt transport */ 62 | void *p_transport_info; 63 | 64 | osm_log_t *p_log; 65 | 66 | /* Uniform timeout for every ACK/single MAD */ 67 | uint32_t resp_timeout; 68 | 69 | /* Uniform timeout for every rmpp transaction */ 70 | uint32_t ttime_timeout; 71 | 72 | /* All the bind handles associated with the vendor */ 73 | cl_qlist_t bind_handles; 74 | 75 | /* run randomizer flag */ 76 | boolean_t run_randomizer; 77 | 78 | /* Packet Randomizer object */ 79 | struct _osm_pkt_randomizer *p_pkt_randomizer; 80 | 81 | } osm_vendor_t; 82 | 83 | /* Repeating the definitions in osm_vendor_api.h */ 84 | 85 | typedef void *osm_bind_handle_t; 86 | 87 | typedef struct _osm_vend_wrap { 88 | ib_mad_t *p_mad; 89 | } osm_vend_wrap_t; 90 | 91 | #ifndef OSM_BIND_INVALID_HANDLE 92 | #define OSM_BIND_INVALID_HANDLE NULL 93 | #endif 94 | 95 | /* The maximum number of retransmissions of the same MAD */ 96 | #define OSM_DEFAULT_RETRY_COUNT 3 97 | 98 | END_C_DECLS 99 | #endif 100 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005,2009 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_DEFS_H_ 37 | #define _OSMV_DEFS_H_ 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #ifdef __cplusplus 45 | # define BEGIN_C_DECLS extern "C" { 46 | # define END_C_DECLS } 47 | #else /* !__cplusplus */ 48 | # define BEGIN_C_DECLS 49 | # define END_C_DECLS 50 | #endif /* __cplusplus */ 51 | 52 | BEGIN_C_DECLS 53 | /* The maximum number of outstanding MADs an RMPP sender can transmit */ 54 | #define OSMV_RMPP_RECV_WIN 16 55 | /* Transaction Timeout = OSMV_TXN_TIMEOUT_FACTOR * Response Timeout */ 56 | #define OSMV_TXN_TIMEOUT_FACTOR 128 57 | /************/ 58 | /****s* OSM Vendor: Types/osmv_bind_obj_t 59 | * NAME 60 | * osmv_bind_obj_t 61 | * 62 | * DESCRIPTION 63 | * The object managing a single bind context. 64 | * The bind handle is a direct pointer to it. 65 | * 66 | * SYNOPSIS 67 | */ 68 | typedef struct _osmv_bind_obj { 69 | /* Used to signal when the struct is being destroyed */ 70 | struct _osmv_bind_obj *magic_ptr; 71 | 72 | osm_vendor_t /*const */ * p_vendor; 73 | 74 | uint32_t hca_hndl; 75 | uint32_t port_num; 76 | 77 | /* Atomic access protector */ 78 | cl_spinlock_t lock; 79 | 80 | /* is_closing == TRUE --> the handle is being unbound */ 81 | boolean_t is_closing; 82 | 83 | /* Event callbacks */ 84 | osm_vend_mad_recv_callback_t recv_cb; 85 | osm_vend_mad_send_err_callback_t send_err_cb; 86 | /* ... and their context */ 87 | void *cb_context; 88 | 89 | /* A pool to manage MAD wrappers */ 90 | osm_mad_pool_t *p_osm_pool; 91 | 92 | /* each subvendor implements its own transport mgr */ 93 | void *p_transp_mgr; 94 | 95 | /* The transaction DB */ 96 | osmv_txn_mgr_t txn_mgr; 97 | 98 | } osmv_bind_obj_t; 99 | 100 | END_C_DECLS 101 | #endif /* _OSMV_DEFS_H_ */ 102 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_dispatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_MAD_DISPATCHER_H_ 37 | #define _OSMV_MAD_DISPATCHER_H_ 38 | 39 | #ifdef __cplusplus 40 | # define BEGIN_C_DECLS extern "C" { 41 | # define END_C_DECLS } 42 | #else /* !__cplusplus */ 43 | # define BEGIN_C_DECLS 44 | # define END_C_DECLS 45 | #endif /* __cplusplus */ 46 | 47 | BEGIN_C_DECLS 48 | /* 49 | * NAME 50 | * osmv_dispatch_mad 51 | * 52 | * DESCRIPTION 53 | * Lower-level MAD dispatcher. 54 | * Implements a switch between the following MAD consumers: 55 | * (1) Non-RMPP consumer (DATA) 56 | * (2) RMPP receiver (DATA/ABORT/STOP) 57 | * (3) RMPP sender (ACK/ABORT/STOP) 58 | * 59 | * PARAMETERS 60 | * h_bind The bind handle 61 | * p_mad_buf The 256 byte buffer of individual MAD 62 | * p_mad_addr The MAD originator's address 63 | */ 64 | ib_api_status_t 65 | osmv_dispatch_mad(IN osm_bind_handle_t h_bind, 66 | IN const void *p_mad_buf, 67 | IN const osm_mad_addr_t * p_mad_addr); 68 | 69 | END_C_DECLS 70 | #endif 71 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_hca.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_HCA_H_ 37 | #define _OSMV_HCA_H_ 38 | 39 | #include 40 | #include 41 | 42 | #ifdef __cplusplus 43 | # define BEGIN_C_DECLS extern "C" { 44 | # define END_C_DECLS } 45 | #else /* !__cplusplus */ 46 | # define BEGIN_C_DECLS 47 | # define END_C_DECLS 48 | #endif /* __cplusplus */ 49 | 50 | BEGIN_C_DECLS 51 | #if defined( OSM_VENDOR_INTF_TS_NO_VAPI ) || defined( OSM_VENDOR_INTF_SIM ) 52 | #define VAPI_hca_hndl_t uint32_t 53 | #define VAPI_hca_id_t char* 54 | #endif 55 | ib_api_status_t 56 | osm_vendor_get_guid_ca_and_port(IN osm_vendor_t const *p_vend, 57 | IN ib_net64_t const guid, 58 | OUT uint32_t * p_hca_hndl, 59 | OUT char *p_hca_id, 60 | OUT uint8_t * p_hca_idx, 61 | OUT uint32_t * p_port_num); 62 | 63 | END_C_DECLS 64 | #endif /* _OSMV_HCA_H_ */ 65 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_inout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_INOUT_H_ 37 | #define _OSMV_INOUT_H_ 38 | 39 | #ifdef __cplusplus 40 | # define BEGIN_C_DECLS extern "C" { 41 | # define END_C_DECLS } 42 | #else /* !__cplusplus */ 43 | # define BEGIN_C_DECLS 44 | # define END_C_DECLS 45 | #endif /* __cplusplus */ 46 | 47 | BEGIN_C_DECLS 48 | #ifdef IN 49 | #undef IN 50 | #endif 51 | #ifdef OUT 52 | #undef OUT 53 | #endif 54 | #ifndef OSM_VENDOR_INTF_ANAFA 55 | #ifndef OSM_VENDOR_INTF_TS_NO_VAPI 56 | #ifndef OSM_VENDOR_INTF_SIM 57 | #include 58 | #endif 59 | #endif 60 | #endif 61 | #ifndef IN 62 | #define IN 63 | #endif 64 | #ifndef OUT 65 | #define OUT 66 | #endif 67 | #ifndef OSM_VENDOR_INTF_TS_NO_VAPI 68 | #ifndef OSM_VENDOR_INTF_ANAFA 69 | #ifndef OSM_VENDOR_INTF_SIM 70 | #include 71 | #include 72 | #endif 73 | #endif 74 | #endif 75 | END_C_DECLS 76 | #endif /* _OSMV_INOUT_H_ */ 77 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_sar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_SAR_H_ 37 | #define _OSMV_SAR_H_ 38 | 39 | #include 40 | #include 41 | 42 | #ifdef __cplusplus 43 | # define BEGIN_C_DECLS extern "C" { 44 | # define END_C_DECLS } 45 | #else /* !__cplusplus */ 46 | # define BEGIN_C_DECLS 47 | # define END_C_DECLS 48 | #endif /* __cplusplus */ 49 | 50 | BEGIN_C_DECLS 51 | 52 | typedef struct _osmv_rmpp_sar { 53 | void *p_arbt_mad; 54 | uint32_t data_len; /* total data len in all the mads */ 55 | /* these data members contain only constants */ 56 | uint32_t hdr_sz; 57 | uint32_t data_sz; /*typical data sz for this kind of mad (sa or regular */ 58 | 59 | } osmv_rmpp_sar_t; 60 | 61 | /* 62 | * NAME 63 | * osmv_rmpp_sar_alloc 64 | * 65 | * DESCRIPTION 66 | * c'tor for rmpp_sar object 67 | * 68 | * SEE ALSO 69 | * 70 | */ 71 | ib_api_status_t 72 | osmv_rmpp_sar_init(osmv_rmpp_sar_t * p_sar, void *p_arbt_mad, 73 | uint32_t mad_size, boolean_t is_sa_mad); 74 | 75 | /* 76 | * NAME 77 | * osmv_rmpp_sar_dealloc 78 | * 79 | * DESCRIPTION 80 | * d'tor for rmpp_sar object 81 | * 82 | * SEE ALSO 83 | * 84 | */ 85 | void osmv_rmpp_sar_done(osmv_rmpp_sar_t * p_sar); 86 | 87 | /* 88 | * NAME 89 | * osmv_rmpp_sar_get_mad_seg 90 | * 91 | * DESCRIPTION 92 | * segments the original mad buffer . returnes a mad with the data of the i-th segment 93 | * 94 | * SEE ALSO 95 | * 96 | */ 97 | ib_api_status_t 98 | osmv_rmpp_sar_get_mad_seg(osmv_rmpp_sar_t * p_sar, uint32_t seg_idx, 99 | void *p_buf); 100 | 101 | /* 102 | * NAME 103 | * osmv_rmpp_sar_reassemble_arbt_mad 104 | * 105 | * DESCRIPTION 106 | * gets a qlist of mads and reassmbles to one big mad buffer 107 | * ALSO - deallocates the mad list 108 | * 109 | * SEE ALSO 110 | * 111 | */ 112 | ib_api_status_t 113 | osmv_rmpp_sar_reassemble_arbt_mad(osmv_rmpp_sar_t * p_sar, cl_qlist_t * p_bufs); 114 | 115 | END_C_DECLS 116 | #endif /* _OSMV_SAR_H_ */ 117 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_sender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSMV_RMPP_SENDER_H_ 37 | #define _OSMV_RMPP_SENDER_H_ 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #ifdef __cplusplus 44 | # define BEGIN_C_DECLS extern "C" { 45 | # define END_C_DECLS } 46 | #else /* !__cplusplus */ 47 | # define BEGIN_C_DECLS 48 | # define END_C_DECLS 49 | #endif /* __cplusplus */ 50 | 51 | BEGIN_C_DECLS 52 | /****d* OSM Vendor/osmv_simple_send_madw 53 | * NAME 54 | * osmv_simple_send_madw 55 | * 56 | * DESCRIPTION 57 | * Send a single MAD (256 bytes). 58 | * 59 | * If this MAD requires a response, set the timeout event. 60 | * The function call returns when the MAD's send completion is received. 61 | * 62 | */ 63 | ib_api_status_t 64 | osmv_simple_send_madw(IN osm_bind_handle_t h_bind, 65 | IN osm_madw_t * const p_madw, 66 | IN osmv_txn_ctx_t * p_txn, IN boolean_t is_retry); 67 | 68 | /****d* OSM Vendor/osmv_rmpp_send_madw 69 | * NAME 70 | * osmv_rmpp_send_madw 71 | * 72 | * DESCRIPTION 73 | * Send a single MAD wrapper (of arbitrary length). 74 | * Follow the RMPP semantics 75 | * (segmentation, send window, timeouts etc). 76 | * 77 | * The function call returns either when the whole MAD 78 | * has been acknowledged, or upon error. 79 | */ 80 | ib_api_status_t 81 | osmv_rmpp_send_madw(IN osm_bind_handle_t h_bind, 82 | IN osm_madw_t * const p_madw, 83 | IN osmv_txn_ctx_t * p_txn, IN boolean_t is_rmpp_ds); 84 | 85 | /* 86 | * NAME osmv_rmpp_send_ack 87 | * 88 | * DESCRIPTION 89 | */ 90 | 91 | ib_api_status_t 92 | osmv_rmpp_send_ack(IN osm_bind_handle_t h_bind, 93 | IN const ib_mad_t * p_req_mad, 94 | IN uint32_t seg_num, 95 | IN uint32_t nwl, IN const osm_mad_addr_t * p_mad_addr); 96 | 97 | /* 98 | * NAME osmv_rmpp_send_nak 99 | * 100 | * DESCRIPTION Send the RMPP ABORT or STOP packet 101 | */ 102 | 103 | ib_api_status_t 104 | osmv_rmpp_send_nak(IN osm_bind_handle_t h_bind, 105 | IN const ib_mad_t * p_req_mad, 106 | IN const osm_mad_addr_t * p_mad_addr, 107 | IN uint8_t nak_type, IN uint8_t status); 108 | 109 | /* 110 | * NAME osmv_rmpp_snd_error 111 | * 112 | * DESCRIPTION Mark an error status and signal the sender thread to handle it 113 | */ 114 | 115 | static inline void 116 | osmv_rmpp_snd_error(IN osmv_rmpp_send_ctx_t * p_send_ctx, 117 | IN ib_api_status_t status) 118 | { 119 | p_send_ctx->status = status; 120 | 121 | /* Release the thread waiting on send() 122 | * It will release the transaction's context 123 | */ 124 | cl_event_signal(&p_send_ctx->event); 125 | } 126 | 127 | END_C_DECLS 128 | #endif /* _OSMV_RMPP_SENDER_H_ */ 129 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_transport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /** 37 | * FILE osmv_transport.h 38 | * AUTHOR Edward Bortnikov 39 | * 40 | * DESCRIPTION 41 | * The lower-level MAD transport interface implementation 42 | * that allows sending a single MAD/receiving a callback 43 | * when a single MAD is received. 44 | */ 45 | 46 | #ifndef _OSMV_TRANSPORT_H_ 47 | #define _OSMV_TRANSPORT_H_ 48 | 49 | #include 50 | #include 51 | 52 | #ifdef __cplusplus 53 | # define BEGIN_C_DECLS extern "C" { 54 | # define END_C_DECLS } 55 | #else /* !__cplusplus */ 56 | # define BEGIN_C_DECLS 57 | # define END_C_DECLS 58 | #endif /* __cplusplus */ 59 | 60 | BEGIN_C_DECLS 61 | /* 62 | * NAME 63 | * osmv_transport_init 64 | * 65 | * DESCRIPTION 66 | * Setup the MAD transport infrastructure (filters, callbacks etc). 67 | */ 68 | #define VENDOR_HCA_MAXNAMES 32 69 | ib_api_status_t 70 | osmv_transport_init(IN osm_bind_info_t * p_info, 71 | IN char hca_id[VENDOR_HCA_MAXNAMES], 72 | IN uint8_t hca_idx, IN osmv_bind_obj_t * p_bo); 73 | 74 | /* 75 | * NAME 76 | * osmv_transport_send_mad 77 | * 78 | * DESCRIPTION 79 | * Send a single MAD (256 byte) 80 | */ 81 | ib_api_status_t 82 | osmv_transport_mad_send(IN const osm_bind_handle_t h_bind, 83 | IN void *p_mad, IN const osm_mad_addr_t * p_mad_addr); 84 | 85 | /* 86 | * NAME 87 | * osmv_transport_done 88 | * 89 | * DESCRIPTION 90 | * deallocator of transportation infrastructure 91 | */ 92 | void osmv_transport_done(IN const osm_bind_handle_t h_bind); 93 | 94 | END_C_DECLS 95 | #endif /* _OSMV_TRANSPORT_H_ */ 96 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_mlx_transport_anafa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /** 37 | * FILE osmv_transport.h 38 | * AUTHOR Edward Bortnikov 39 | * 40 | * DESCRIPTION 41 | * The lower-level MAD transport interface implementation 42 | * that allows sending a single MAD/receiving a callback 43 | * when a single MAD is received. 44 | */ 45 | 46 | #ifndef _OSMV_TRANSPORT_ANAFA_H_ 47 | #define _OSMV_TRANSPORT_ANAFA_H_ 48 | 49 | #ifdef __cplusplus 50 | # define BEGIN_C_DECLS extern "C" { 51 | # define END_C_DECLS } 52 | #else /* !__cplusplus */ 53 | # define BEGIN_C_DECLS 54 | # define END_C_DECLS 55 | #endif /* __cplusplus */ 56 | 57 | BEGIN_C_DECLS 58 | #define OSMV_ANAFA_ID 0 59 | typedef struct _osmv_TOPSPIN_ANAFA_transport_mgr_ { 60 | int device_fd; 61 | cl_thread_t receiver; 62 | } osmv_TOPSPIN_ANAFA_transport_mgr_t; 63 | 64 | typedef struct _osmv_TOPSPIN_ANAFA_transport_info_ { 65 | int device_fd; 66 | } osmv_TOPSPIN_ANAFA_transport_info_t; 67 | 68 | END_C_DECLS 69 | #endif /* _OSMV_TRANSPORT_ANAFA_H_ */ 70 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | #ifndef _OSM_VENDOR_TEST_H_ 37 | #define _OSM_VENDOR_TEST_H_ 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #ifdef __cplusplus 44 | # define BEGIN_C_DECLS extern "C" { 45 | # define END_C_DECLS } 46 | #else /* !__cplusplus */ 47 | # define BEGIN_C_DECLS 48 | # define END_C_DECLS 49 | #endif /* __cplusplus */ 50 | 51 | BEGIN_C_DECLS 52 | /* This value must be zero for the TEST transport. */ 53 | #define OSM_BIND_INVALID_HANDLE 0 54 | /* 55 | * Abstract: 56 | * Declaration of vendor specific transport interface. 57 | * This is the "Test" vendor which allows compilation and some 58 | * testing without a real vendor interface. 59 | * These objects are part of the OpenSM family of objects. 60 | */ 61 | /****h* OpenSM/Vendor Test 62 | * NAME 63 | * Vendor Test 64 | * 65 | * DESCRIPTION 66 | * The Vendor Test structure encapsulates an artificial transport layer 67 | * interface for testing. 68 | * 69 | * AUTHOR 70 | * Steve King, Intel 71 | * 72 | *********/ 73 | /****s* OpenSM: Vendor Test/osm_vend_wrap_t 74 | * NAME 75 | * osm_vend_wrap_t 76 | * 77 | * DESCRIPTION 78 | * Vendor specific MAD wrapper context. 79 | * 80 | * This structure allows direct access to member variables. 81 | * 82 | * SYNOPSIS 83 | */ 84 | typedef struct _osm_vend_wrap { 85 | uint32_t dummy; 86 | 87 | } osm_vend_wrap_t; 88 | /*********/ 89 | 90 | /****s* OpenSM: Vendor Test/osm_vendor_t 91 | * NAME 92 | * osm_vendor_t 93 | * 94 | * DESCRIPTION 95 | * Vendor specific MAD interface. 96 | * 97 | * This interface defines access to the vendor specific MAD 98 | * transport layer. 99 | * 100 | * SYNOPSIS 101 | */ 102 | typedef struct _osm_vendor { 103 | osm_log_t *p_log; 104 | uint32_t timeout; 105 | 106 | } osm_vendor_t; 107 | /*********/ 108 | 109 | typedef struct _osm_bind_handle { 110 | osm_vendor_t *p_vend; 111 | ib_net64_t port_guid; 112 | uint8_t mad_class; 113 | uint8_t class_version; 114 | boolean_t is_responder; 115 | boolean_t is_trap_processor; 116 | boolean_t is_report_processor; 117 | uint32_t send_q_size; 118 | uint32_t recv_q_size; 119 | 120 | } *osm_bind_handle_t; 121 | 122 | END_C_DECLS 123 | #endif /* _OSM_VENDOR_TEST_H_ */ 124 | -------------------------------------------------------------------------------- /include/vendor/osm_vendor_umadt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Declaration of osm_mad_wrapper_t. 39 | * This object represents the context wrapper for OpenSM MAD processing. 40 | * This object is part of the OpenSM family of objects. 41 | */ 42 | 43 | #ifndef _OSM_VENDOR_UMADT_h_ 44 | #define _OSM_VENDOR_UMADT_h_ 45 | 46 | #include "iba/ib_types.h" 47 | #include "complib/cl_qlist.h" 48 | #include "complib/cl_thread.h" 49 | #include 50 | #include 51 | 52 | #ifdef __cplusplus 53 | # define BEGIN_C_DECLS extern "C" { 54 | # define END_C_DECLS } 55 | #else /* !__cplusplus */ 56 | # define BEGIN_C_DECLS 57 | # define END_C_DECLS 58 | #endif /* __cplusplus */ 59 | 60 | BEGIN_C_DECLS 61 | /****h* OpenSM/ Vendor Umadt 62 | * NAME 63 | * MAD Wrapper 64 | * 65 | * DESCRIPTION 66 | * 67 | * 68 | * AUTHOR 69 | * Ranjit Pandit, Intel 70 | * 71 | *********/ 72 | typedef void *osm_vendor_t; 73 | #define OSM_BIND_INVALID_HANDLE 0 74 | 75 | /****s* OpenSM: Vendor Umadt /osm_bind_handle_t 76 | * NAME 77 | * osm_bind_handle_t 78 | * 79 | * DESCRIPTION 80 | * handle returned by the vendor transport bind call. 81 | * 82 | * SYNOPSIS 83 | */ 84 | 85 | typedef void *osm_bind_handle_t; 86 | 87 | /****s* OpenSM: Vendor Umadt /mad_direction_t 88 | * NAME 89 | * mad_direction_t 90 | * 91 | * DESCRIPTION 92 | * Tags for mad wrapper to indicate the direction of mads. 93 | * Umadt vendor transport layer uses this tag to call the appropriate 94 | * Umadt APIs. 95 | * 96 | * SYNOPSIS 97 | */ 98 | typedef enum _mad_direction_t { 99 | SEND = 0, 100 | RECEIVE, 101 | } mad_direction_t; 102 | 103 | /****s* OpenSM/ osm_vend_wrap_t 104 | * NAME 105 | * Umadt Vendor MAD Wrapper 106 | * 107 | * DESCRIPTION 108 | * Umadt specific MAD wrapper. Umadt transport layer sets this for 109 | * housekeeping. 110 | * 111 | * SYNOPSIS 112 | *********/ 113 | typedef struct _osm_vend_wrap_t { 114 | MadtStruct *p_madt_struct; 115 | mad_direction_t direction; // send or receive 116 | uint32_t size; 117 | } osm_vend_wrap_t; 118 | /* 119 | * FIELDS 120 | * p_madt_struct 121 | * Umadt mad structure to identify a mad. 122 | * 123 | * direction 124 | * Used to identify a mad with it's direction. 125 | * 126 | * SEE ALSO 127 | *********/ 128 | 129 | END_C_DECLS 130 | #endif /* _OSM_VENDOR_UMADT_h_ */ 131 | -------------------------------------------------------------------------------- /libopensm/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(srcdir)/../include 3 | 4 | lib_LTLIBRARIES = libopensm.la 5 | 6 | if DEBUG 7 | DBGFLAGS = -ggdb -D_DEBUG_ 8 | else 9 | DBGFLAGS = -g 10 | endif 11 | 12 | libopensm_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 13 | 14 | if HAVE_LD_VERSION_SCRIPT 15 | libopensm_version_script = -Wl,--version-script=$(srcdir)/libopensm.map 16 | else 17 | libopensm_version_script = 18 | endif 19 | 20 | opensm_api_version=$(shell grep LIBVERSION= $(srcdir)/libopensm.ver | sed 's/LIBVERSION=//') 21 | 22 | libopensm_la_SOURCES = osm_log.c osm_helper.c 23 | 24 | libopensm_la_LIBADD = -L../complib -losmcomp 25 | libopensm_la_LDFLAGS = -version-info $(opensm_api_version) \ 26 | -export-dynamic $(libopensm_version_script) 27 | libopensm_la_DEPENDENCIES = $(srcdir)/libopensm.map 28 | 29 | EXTRA_DIST = $(srcdir)/libopensm.map $(srcdir)/libopensm.ver 30 | -------------------------------------------------------------------------------- /libopensm/libopensm.map: -------------------------------------------------------------------------------- 1 | OPENSM_1.5 { 2 | global: 3 | osm_log; 4 | osm_log_msg_box; 5 | osm_is_debug; 6 | osm_log_init; 7 | osm_log_init_v2; 8 | osm_log_reopen_file; 9 | ib_get_sa_method_str; 10 | ib_get_sm_method_str; 11 | ib_get_sm_attr_str; 12 | ib_get_sa_attr_str; 13 | ib_get_trap_str; 14 | ib_zero_gid; 15 | osm_dump_port_info; 16 | osm_dump_port_info_v2; 17 | osm_dump_portinfo_record; 18 | osm_dump_portinfo_record_v2; 19 | osm_dump_guid_info; 20 | osm_dump_guid_info_v2; 21 | osm_dump_guidinfo_record; 22 | osm_dump_guidinfo_record_v2; 23 | osm_dump_node_info; 24 | osm_dump_node_info_v2; 25 | osm_dump_node_record; 26 | osm_dump_node_record_v2; 27 | osm_dump_path_record; 28 | osm_dump_path_record_v2; 29 | osm_dump_multipath_record; 30 | osm_dump_multipath_record_v2; 31 | osm_dump_mc_record; 32 | osm_dump_mc_record_v2; 33 | osm_dump_service_record; 34 | osm_dump_service_record_v2; 35 | osm_dump_inform_info; 36 | osm_dump_inform_info_v2; 37 | osm_dump_inform_info_record; 38 | osm_dump_inform_info_record_v2; 39 | osm_dump_link_record; 40 | osm_dump_link_record_v2; 41 | osm_dump_switch_info; 42 | osm_dump_switch_info_v2; 43 | osm_dump_switch_info_record; 44 | osm_dump_switch_info_record_v2; 45 | osm_dump_slvl_map_table; 46 | osm_dump_slvl_map_table_v2; 47 | osm_dump_vl_arb_table; 48 | osm_dump_vl_arb_table_v2; 49 | osm_dump_sm_info; 50 | osm_dump_sm_info_v2; 51 | osm_dump_sm_info_record; 52 | osm_dump_sm_info_record_v2; 53 | osm_dump_notice; 54 | osm_dump_notice_v2; 55 | osm_dump_dr_smp; 56 | osm_dump_dr_smp_v2; 57 | osm_dump_sa_mad; 58 | osm_dump_sa_mad_v2; 59 | osm_dump_dr_path; 60 | osm_dump_dr_path_v2; 61 | osm_dump_dr_path_as_buf; 62 | osm_dump_smp_dr_path; 63 | osm_dump_smp_dr_path_v2; 64 | osm_dump_pkey_block; 65 | osm_dump_pkey_block_v2; 66 | osm_log_raw; 67 | osm_get_sm_state_str; 68 | osm_get_sm_signal_str; 69 | osm_get_disp_msg_str; 70 | osm_get_port_state_str_fixed_width; 71 | osm_get_node_type_str_fixed_width; 72 | osm_get_manufacturer_str; 73 | osm_get_mtu_str; 74 | osm_get_lwa_str; 75 | osm_get_lsa_str; 76 | osm_get_sm_mgr_signal_str; 77 | osm_get_sm_mgr_state_str; 78 | ib_mtu_is_valid; 79 | ib_rate_is_valid; 80 | ib_path_compare_rates; 81 | ib_path_rate_get_prev; 82 | ib_path_rate_get_next; 83 | osm_dump_mlnx_ext_port_info; 84 | osm_dump_mlnx_ext_port_info_v2; 85 | osm_log_v2; 86 | osm_log_msg_box_v2; 87 | osm_log_is_active_v2; 88 | osm_get_log_per_module; 89 | osm_set_log_per_module; 90 | osm_reset_log_per_module; 91 | sprint_uint8_arr; 92 | ib_path_rate_max_12xedr; 93 | ib_path_rate_2x_hdr_fixups; 94 | ib_path_get_reduced_rate; 95 | local: *; 96 | }; 97 | -------------------------------------------------------------------------------- /libopensm/libopensm.ver: -------------------------------------------------------------------------------- 1 | # In this file we track the current API version 2 | # of the opensm common interface (and libraries) 3 | # The version is built of the following 4 | # tree numbers: 5 | # API_REV:RUNNING_REV:AGE 6 | # API_REV - advance on any added API 7 | # RUNNING_REV - advance any change to the vendor files 8 | # AGE - number of backward versions the API still supports 9 | LIBVERSION=11:0:2 10 | -------------------------------------------------------------------------------- /libvendor/ChangeLog: -------------------------------------------------------------------------------- 1 | 2007-07-11 Hal Rosenstock 2 | 3 | * configure.in: Bump version to 2.2.1 4 | 5 | 2007-07-10 Sean Hefty 6 | 7 | * osm_vendor_ibumad.c: Use pkey index, rather than pkey 8 | on umad_set_pkey call. Using index 0 for now. 9 | 10 | 2007-05-07 Hal Rosenstock 11 | 12 | * osm_vendor_ibumad.(h c): Remove support for issmdisabled 13 | 14 | 2007-03-29 Hal Rosenstock 15 | 16 | * configure.in: Bump version to 2.2.0 17 | 18 | 2007-03-27 Hal Rosenstock 19 | 20 | * osm_vendor_ibumad.(h c): Add support for issmdisabled 21 | 22 | 2007-03-13 Hal Rosenstock 23 | 24 | * osm_vendor_ibumad.c: In osm_vendor_set_sm, set issmfd to 25 | -1 on open error 26 | 27 | 2007-03-12 Hal Rosenstock 28 | 29 | * osm_vendor_ibumad.c: In umad_receiver, display DR path of 30 | sent MAD when it times out. In osm_vendor_send, simplify redundant 31 | code. Cosmetic change to osm_log message in osm_vendor_bind. 32 | 33 | 2007-02-20 Hal Rosenstock 34 | 35 | * configure.in: Bump version to 2.1.1 36 | 37 | 2007-02-20 Sasha Khapyorsky 38 | 39 | * osm_vendor_ibumad.(h c): Fix termination crash associated 40 | with umad_receiver thread termination. 41 | 42 | * osm_vendor_mlx_sa.c, osm_vendor_mlx_sim.c: Changes for 43 | compilation failures detected during ibutils/ibmgtsim building 44 | 45 | 2007=01-10 Sasha Khapyorsky 46 | 47 | * osm_vendor_ibumad.c: Close umad port in 48 | osm_vendor_delete so same process can reinitialize 49 | and resuse vendor layer. 50 | 51 | 2006-10-12 Hal Rosenstock 52 | 53 | * osm_vendor_ibumad.c (umad_receiver): Fix endian of LID 54 | displayed in send timeout error message. 55 | 56 | 2006-10-10 Hal Rosenstock 57 | 58 | * osm_vendor_ibumad.c: Print errors to stderr rather than 59 | stdout. 60 | 61 | 2006-09-28 Eitan Zahavi 62 | 63 | * osm_vendor_mlx_sa.c: Missing status on timeout SA query. 64 | 65 | -------------------------------------------------------------------------------- /libvendor/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = . 3 | 4 | if DEBUG 5 | DBGFLAGS = -ggdb -D_DEBUG_ 6 | else 7 | DBGFLAGS = -g 8 | endif 9 | 10 | AM_CPPFLAGS = $(OSMV_INCLUDES) 11 | 12 | lib_LTLIBRARIES = libosmvendor.la 13 | 14 | libosmvendor_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) 15 | 16 | if HAVE_LD_VERSION_SCRIPT 17 | libosmvendor_version_script = -Wl,--version-script=$(srcdir)/libosmvendor.map 18 | else 19 | libosmvendor_version_script = 20 | endif 21 | 22 | osmvendor_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmvendor.ver | sed 's/LIBVERSION=//') 23 | 24 | COMM_HDRS= $(srcdir)/../include/vendor/osm_vendor_api.h \ 25 | $(srcdir)/../include/vendor/osm_vendor.h \ 26 | $(srcdir)/../include/vendor/osm_vendor_sa_api.h 27 | 28 | if OSMV_OPENIB 29 | libosmvendor_la_SOURCES = osm_vendor_ibumad.c \ 30 | osm_vendor_ibumad_sa.c \ 31 | osm_mad_pool.c 32 | HDRS =$(COMM_HDRS) $(srcdir)/../include/vendor/osm_vendor_ibumad.h 33 | endif 34 | if OSMV_SIM 35 | libosmvendor_la_SOURCES = osm_vendor_mlx.c \ 36 | osm_vendor_mlx_sim.c \ 37 | osm_vendor_mlx_hca_sim.c \ 38 | osm_vendor_mlx_dispatcher.c \ 39 | osm_vendor_mlx_rmpp_ctx.c \ 40 | osm_vendor_mlx_sar.c \ 41 | osm_vendor_mlx_sender.c \ 42 | osm_vendor_mlx_txn.c \ 43 | osm_vendor_mlx_sa.c \ 44 | osm_pkt_randomizer.c \ 45 | osm_mad_pool.c 46 | HDRS =$(COMM_HDRS) $(srcdir)/../include/vendor/osm_vendor_mlx.h \ 47 | $(srcdir)/../include/vendor/osm_pkt_randomizer.h 48 | endif 49 | if OSMV_GEN1 50 | libosmvendor_la_SOURCES = osm_vendor_mlx.c \ 51 | osm_pkt_randomizer.c \ 52 | osm_vendor_mlx_hca.c \ 53 | osm_vendor_mlx_dispatcher.c \ 54 | osm_vendor_mlx_rmpp_ctx.c \ 55 | osm_vendor_mlx_sar.c \ 56 | osm_vendor_mlx_sender.c \ 57 | osm_vendor_mlx_ts.c \ 58 | osm_vendor_mlx_txn.c \ 59 | osm_vendor_mlx_sa.c \ 60 | osm_mad_pool.c 61 | HDRS =$(COMM_HDRS) $(srcdir)/../include/vendor/osm_vendor_mlx.h \ 62 | $(srcdir)/../include/vendor/osm_pkt_randomizer.h 63 | endif 64 | if OSMV_VAPI 65 | libosmvendor_la_SOURCES = osm_vendor_mlx.c \ 66 | osm_pkt_randomizer.c \ 67 | osm_vendor_mlx_hca.c \ 68 | osm_vendor_mlx_dispatcher.c \ 69 | osm_vendor_mlx_rmpp_ctx.c \ 70 | osm_vendor_mlx_sar.c \ 71 | osm_vendor_mlx_sender.c \ 72 | osm_vendor_mlx_ibmgt.c \ 73 | osm_vendor_mlx_txn.c \ 74 | osm_vendor_mlx_sa.c \ 75 | osm_mad_pool.c 76 | HDRS =$(COMM_HDRS) $(srcdir)/../include/vendor/osm_vendor_mlx.h \ 77 | $(srcdir)/../include/vendor/osm_pkt_randomizer.h 78 | endif 79 | 80 | libosmvendor_la_LIBADD = -L../complib -losmcomp -L../libopensm -lopensm 81 | libosmvendor_la_LDFLAGS = -version-info $(osmvendor_api_version) \ 82 | -export-dynamic $(libosmvendor_version_script) 83 | libosmvendor_la_DEPENDENCIES = $(srcdir)/libosmvendor.map 84 | 85 | libosmvendorincludedir = $(includedir)/infiniband/vendor 86 | 87 | libosmvendorinclude_HEADERS = $(HDRS) 88 | 89 | # headers are distributed as part of the include dir 90 | EXTRA_DIST = $(srcdir)/libosmvendor.map $(srcdir)/libosmvendor.ver 91 | -------------------------------------------------------------------------------- /libvendor/libosmvendor.map: -------------------------------------------------------------------------------- 1 | OSMVENDOR_2.0 { 2 | global: 3 | umad_receiver; 4 | osm_vendor_init; 5 | osm_vendor_new; 6 | osm_vendor_delete; 7 | osm_vendor_get_all_port_attr; 8 | osm_vendor_bind; 9 | osm_vendor_unbind; 10 | osm_vendor_get; 11 | osm_vendor_put; 12 | osm_vendor_send; 13 | osm_vendor_local_lid_change; 14 | osm_vendor_set_sm; 15 | osm_vendor_set_debug; 16 | osmv_bind_sa; 17 | osmv_query_sa; 18 | osm_vendor_get_guid_ca_and_port; 19 | osm_mad_pool_construct; 20 | osm_mad_pool_destroy; 21 | osm_mad_pool_init; 22 | osm_mad_pool_get; 23 | osm_mad_pool_put; 24 | osm_mad_pool_get_wrapper; 25 | osm_mad_pool_get_wrapper_raw; 26 | local: *; 27 | }; 28 | -------------------------------------------------------------------------------- /libvendor/libosmvendor.ver: -------------------------------------------------------------------------------- 1 | # In this file we track the current API version 2 | # of the vendor interface (and libraries) 3 | # The version is built of the following 4 | # tree numbers: 5 | # API_REV:RUNNING_REV:AGE 6 | # API_REV - advance on any added API 7 | # RUNNING_REV - advance any change to the vendor files 8 | # AGE - number of backward versions the API still supports 9 | LIBVERSION=5:0:0 10 | -------------------------------------------------------------------------------- /opensm/ChangeLog: -------------------------------------------------------------------------------- 1 | 2007-07-11 Hal Rosenstock 2 | 3 | * configure.in: Bump to version 2.2.1 4 | 5 | 2007-06-20 Hal Rosenstock 6 | 7 | * osm_helper.c: Add 3LeafNetworks and Xsigo to osm_get_manufacturer_str 8 | 9 | 2007-06-15 Sasha Khapyorsky 10 | 11 | * osm_helper.c: Fix PortInfo:CapMask printing when CapMask is 0 12 | 13 | 2007-06-11 Sasha Khapyorsky 14 | 15 | * osm_helper.c: Remove OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED 16 | from __osm_sm_mgr_signal_str 17 | 18 | 2007-06-06 Sasha Khapyorsky 19 | 20 | * osm_helper.c: More optimally deal with manufacturer strings 21 | 22 | 2007-06-06 Hal Rosenstock 23 | 24 | * osm_helper.c: Add Sun to osm_get_manufacturer_str 25 | 26 | 2007-06-04 Hal Rosenstock 27 | 28 | * osm_helper.c: Add 8x to __osm_lwa_str_fixed_width 29 | 30 | 2007-05-07 Sasha Khapyorsky 31 | 32 | * osm_helper.c: Remove repeated strlen() calls 33 | 34 | 2007-04-27 Ira K. Weiny 35 | 36 | * osm_helper.c: In osm_dump_notice, use ib_get_producer_type_str 37 | for printing producer type 38 | 39 | 2007-04-26 Hal Rosenstock 40 | 41 | * osm_helper.c: Clarify the proper usage of 42 | osm_get_node_type_str_fixed_width to take uint8_t rather 43 | than uint32_t for node_type argument 44 | 45 | 2007-04-25 Yevgeny Kliteynik 46 | 47 | * osm_helper.c: Fix problematic usage of sprintf() when 48 | source and destination strings overlap. 49 | 50 | 2007-04-24 Albert L. Chu 51 | 52 | * osm_helper.c: In osm_get_node_type_str_fixed_width, fix 53 | both range limit and endian of node type check 54 | 55 | 2007-03-29 Hal Rosenstock 56 | 57 | * configure.in: Bump version to 2.2.0 58 | 59 | 2007-03-21 Sasha Khapyorsky 60 | 61 | * osm_log.c: Changed to support daemon mode 62 | 63 | 2007-03-01 Hal Rosenstock 64 | 65 | * configure.in: Bump version to 2.1.2 66 | 67 | * osm_helper.c: Eliminate extraneous comma in __osm_disp_msg_ string 68 | for OSM_MSG_MAD_PORT_INFO 69 | 70 | 2007-02-26 Sasha Khapyorsky 71 | 72 | * osm_log.c: Minor optimization to previous change to osm_log 73 | for also flushing on OSM_LOG_SYS 74 | 75 | 2007-02-26 Yevgeny Kliteynik 76 | 77 | * osm_log.c: In osm_log, flush log on OSM_LOG_SYS (as well 78 | as OSM_LOG_ERROR) 79 | 80 | 2007-02-20 Hal Rosenstock 81 | 82 | * configure.in: Bump version to 2.1.1 83 | 84 | * osm_helper.c: In osm_dbg_get_capabilities_str, only display 85 | Capability Mask if there are capabilities present 86 | 87 | 2007-01-22 Hal Rosenstock 88 | 89 | * osm_helper.c: Change DR path format from [%X] to %d, 90 | 91 | 2007-01-08 Sasha Khapyorsky 92 | 93 | * osm_log.c: Add osm_log_reopen_file API 94 | 95 | 2006-12-22 Hal Rosenstock 96 | 97 | * osm_helper.c: Add osm_dump_switch_info_record API 98 | 99 | 2006-11-03 Sasha Khapyorsky 100 | 101 | * osm_log.c: Add osm_log_printf API 102 | 103 | 2006-10-30 Sasha Khapyorsky 104 | 105 | * osm_helper.c: Fix seg fault with strings which 106 | might not be null terminated 107 | 108 | 2006-10-18 Yevgeny Kliteynik 109 | 110 | * osm_log.c: Windows porting changes 111 | 112 | 2006-09-19 Yevgeny Kliteynik 113 | 114 | * osm_log.c: Windows porting changes 115 | 116 | -------------------------------------------------------------------------------- /opensm/osm_guid_info_rcv.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of osm_gi_rcv_t. 39 | * This object represents the GUIDInfo Receiver object. 40 | * This object is part of the opensm family of objects. 41 | */ 42 | 43 | #if HAVE_CONFIG_H 44 | # include 45 | #endif /* HAVE_CONFIG_H */ 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #define FILE_ID OSM_FILE_GUID_INFO_RCV_C 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | void osm_gi_rcv_process(IN void *context, IN void *data) 67 | { 68 | osm_sm_t *sm = context; 69 | osm_madw_t *p_madw = data; 70 | ib_guid_info_t *p_gi; 71 | ib_smp_t *p_smp; 72 | osm_port_t *p_port; 73 | osm_gi_context_t *p_context; 74 | ib_net64_t port_guid, node_guid; 75 | uint8_t block_num; 76 | 77 | CL_ASSERT(sm); 78 | 79 | OSM_LOG_ENTER(sm->p_log); 80 | 81 | CL_ASSERT(p_madw); 82 | 83 | p_smp = osm_madw_get_smp_ptr(p_madw); 84 | p_context = osm_madw_get_gi_context_ptr(p_madw); 85 | p_gi = ib_smp_get_payload_ptr(p_smp); 86 | 87 | CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_GUID_INFO); 88 | 89 | block_num = (uint8_t) cl_ntoh32(p_smp->attr_mod); 90 | 91 | port_guid = p_context->port_guid; 92 | node_guid = p_context->node_guid; 93 | 94 | osm_dump_guid_info_v2(sm->p_log, node_guid, port_guid, block_num, p_gi, 95 | FILE_ID, OSM_LOG_DEBUG); 96 | 97 | if (ib_smp_get_status(p_smp)) { 98 | OSM_LOG(sm->p_log, OSM_LOG_DEBUG, 99 | "MAD status 0x%x received\n", 100 | cl_ntoh16(ib_smp_get_status(p_smp))); 101 | goto Exit; 102 | } 103 | 104 | CL_PLOCK_EXCL_ACQUIRE(sm->p_lock); 105 | p_port = osm_get_port_by_guid(sm->p_subn, port_guid); 106 | if (!p_port) { 107 | CL_PLOCK_RELEASE(sm->p_lock); 108 | OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 4701: " 109 | "No port object for port with GUID 0x%" PRIx64 110 | "\n\t\t\t\tfor parent node GUID 0x%" PRIx64 111 | ", TID 0x%" PRIx64 "\n", 112 | cl_ntoh64(port_guid), cl_ntoh64(node_guid), 113 | cl_ntoh64(p_smp->trans_id)); 114 | goto Exit; 115 | } 116 | 117 | CL_PLOCK_RELEASE(sm->p_lock); 118 | 119 | Exit: 120 | /* 121 | Release the lock before jumping here!! 122 | */ 123 | OSM_LOG_EXIT(sm->p_log); 124 | } 125 | -------------------------------------------------------------------------------- /opensm/osm_indent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved. 4 | # Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. 5 | # Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 6 | # 7 | # This software is available to you under a choice of one of two 8 | # licenses. You may choose to be licensed under the terms of the GNU 9 | # General Public License (GPL) Version 2, available from the file 10 | # COPYING in the main directory of this source tree, or the 11 | # OpenIB.org BSD license below: 12 | # 13 | # Redistribution and use in source and binary forms, with or 14 | # without modification, are permitted provided that the following 15 | # conditions are met: 16 | # 17 | # - Redistributions of source code must retain the above 18 | # copyright notice, this list of conditions and the following 19 | # disclaimer. 20 | # 21 | # - Redistributions in binary form must reproduce the above 22 | # copyright notice, this list of conditions and the following 23 | # disclaimer in the documentation and/or other materials 24 | # provided with the distribution. 25 | # 26 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 30 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 31 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | # SOFTWARE. 34 | # 35 | ######################################################################### 36 | # 37 | # Abstract: 38 | # Indent script for source code formatting. 39 | # 40 | # Environment: 41 | # Linux User Mode 42 | # 43 | # This is the indent format used for OpenSM (similar to one used in 44 | # linux/scripts/Lindent). 45 | 46 | indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" 47 | 48 | # indent doesn't have an option for label indentation, so do it with sed 49 | for f in $@ ; do 50 | test -f $f || continue 51 | temp=`mktemp -t osm_indent.XXXXXXXX` 52 | cat $f \ 53 | | sed -e 's/^ \([A-Za-z_]\+[A-Za-z_0-9]*:\)$/\1/' > $temp 54 | diff $f $temp > /dev/null || cat $temp > $f 55 | rm -f $temp 56 | done 57 | -------------------------------------------------------------------------------- /opensm/osm_mcm_port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of osm_mcm_port_t. 39 | * This object represents the membership of a port in a multicast group. 40 | * This object is part of the OpenSM family of objects. 41 | */ 42 | 43 | #if HAVE_CONFIG_H 44 | # include 45 | #endif /* HAVE_CONFIG_H */ 46 | 47 | #include 48 | #include 49 | #include 50 | #define FILE_ID OSM_FILE_MCM_PORT_C 51 | #include 52 | #include 53 | 54 | osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t *port, IN osm_mgrp_t *mgrp) 55 | { 56 | osm_mcm_port_t *p_mcm; 57 | 58 | p_mcm = malloc(sizeof(*p_mcm)); 59 | if (p_mcm) { 60 | memset(p_mcm, 0, sizeof(*p_mcm)); 61 | p_mcm->port = port; 62 | p_mcm->mgrp = mgrp; 63 | } 64 | 65 | return p_mcm; 66 | } 67 | 68 | void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm) 69 | { 70 | CL_ASSERT(p_mcm); 71 | 72 | free(p_mcm); 73 | } 74 | 75 | osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port, 76 | IN ib_member_rec_t *mcmr, 77 | IN boolean_t proxy) 78 | { 79 | osm_mcm_alias_guid_t *p_mcm_alias_guid; 80 | 81 | p_mcm_alias_guid = calloc(1, sizeof(*p_mcm_alias_guid)); 82 | if (p_mcm_alias_guid) { 83 | p_mcm_alias_guid->alias_guid = mcmr->port_gid.unicast.interface_id; 84 | p_mcm_alias_guid->p_base_mcm_port = p_base_mcm_port; 85 | p_mcm_alias_guid->port_gid.unicast.prefix = mcmr->port_gid.unicast.prefix; 86 | p_mcm_alias_guid->port_gid.unicast.interface_id = mcmr->port_gid.unicast.interface_id; 87 | p_mcm_alias_guid->scope_state = mcmr->scope_state; 88 | p_mcm_alias_guid->proxy_join = proxy; 89 | } 90 | 91 | return p_mcm_alias_guid; 92 | } 93 | 94 | void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid) 95 | { 96 | free(*pp_mcm_alias_guid); 97 | *pp_mcm_alias_guid = NULL; 98 | } 99 | -------------------------------------------------------------------------------- /opensm/osm_mtree.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of osm_mtree_node_t. 39 | * This file implements the Multicast Tree object. 40 | */ 41 | 42 | #if HAVE_CONFIG_H 43 | # include 44 | #endif /* HAVE_CONFIG_H */ 45 | 46 | #include 47 | #include 48 | #define FILE_ID OSM_FILE_MTREE_C 49 | #include 50 | #include 51 | 52 | osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw) 53 | { 54 | osm_mtree_node_t *p_mtn; 55 | uint32_t i; 56 | 57 | p_mtn = malloc(sizeof(osm_mtree_node_t) + 58 | sizeof(void *) * (p_sw->num_ports - 1)); 59 | if (!p_mtn) 60 | return NULL; 61 | 62 | memset(p_mtn, 0, sizeof(*p_mtn)); 63 | p_mtn->p_sw = p_sw; 64 | p_mtn->max_children = p_sw->num_ports; 65 | for (i = 0; i < p_mtn->max_children; i++) 66 | p_mtn->child_array[i] = NULL; 67 | 68 | return p_mtn; 69 | } 70 | 71 | void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn) 72 | { 73 | uint8_t i; 74 | 75 | if (p_mtn == NULL) 76 | return; 77 | 78 | for (i = 0; i < p_mtn->max_children; i++) 79 | if ((p_mtn->child_array[i] != NULL) && 80 | (p_mtn->child_array[i] != OSM_MTREE_LEAF)) 81 | osm_mtree_destroy(p_mtn->child_array[i]); 82 | 83 | free(p_mtn); 84 | } 85 | 86 | #if 0 87 | static void mtree_dump(IN osm_mtree_node_t * p_mtn) 88 | { 89 | uint32_t i; 90 | 91 | if (p_mtn == NULL) 92 | return; 93 | 94 | printf("GUID:0x%016" PRIx64 " max_children:%u\n", 95 | cl_ntoh64(p_mtn->p_sw->p_node->node_info.node_guid), 96 | p_mtn->max_children); 97 | if (p_mtn->child_array != NULL) { 98 | for (i = 0; i < p_mtn->max_children; i++) { 99 | printf("i=%d\n", i); 100 | if ((p_mtn->child_array[i] != NULL) 101 | && (p_mtn->child_array[i] != OSM_MTREE_LEAF)) 102 | mtree_dump(p_mtn->child_array[i]); 103 | } 104 | } 105 | } 106 | #endif 107 | -------------------------------------------------------------------------------- /opensm/osm_remote_sm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of osm_remote_sm_t. 39 | * This object represents the remote SM object. 40 | * This object is part of the opensm family of objects. 41 | */ 42 | 43 | #if HAVE_CONFIG_H 44 | # include 45 | #endif /* HAVE_CONFIG_H */ 46 | 47 | #include 48 | #include 49 | #define FILE_ID OSM_FILE_REMOTE_SM_C 50 | #include 51 | 52 | void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm) 53 | { 54 | memset(p_sm, 0, sizeof(*p_sm)); 55 | } 56 | 57 | void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm) 58 | { 59 | memset(p_sm, 0, sizeof(*p_sm)); 60 | } 61 | 62 | void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, 63 | IN const ib_sm_info_t * p_smi) 64 | { 65 | CL_ASSERT(p_sm); 66 | 67 | osm_remote_sm_construct(p_sm); 68 | 69 | p_sm->smi = *p_smi; 70 | return; 71 | } 72 | -------------------------------------------------------------------------------- /opensm/osm_router.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | * 34 | */ 35 | 36 | /* 37 | * Abstract: 38 | * Implementation of osm_router_t. 39 | * This object represents an Infiniband router. 40 | * This object is part of the opensm family of objects. 41 | */ 42 | 43 | #if HAVE_CONFIG_H 44 | # include 45 | #endif /* HAVE_CONFIG_H */ 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #define FILE_ID OSM_FILE_ROUTER_C 52 | #include 53 | 54 | void osm_router_delete(IN OUT osm_router_t ** pp_rtr) 55 | { 56 | free(*pp_rtr); 57 | *pp_rtr = NULL; 58 | } 59 | 60 | osm_router_t *osm_router_new(IN osm_port_t * p_port) 61 | { 62 | osm_router_t *p_rtr; 63 | 64 | CL_ASSERT(p_port); 65 | 66 | p_rtr = malloc(sizeof(*p_rtr)); 67 | if (p_rtr) { 68 | memset(p_rtr, 0, sizeof(*p_rtr)); 69 | p_rtr->p_port = p_port; 70 | } 71 | 72 | return p_rtr; 73 | } 74 | -------------------------------------------------------------------------------- /osmeventplugin/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(srcdir)/../include \ 3 | -I$(includedir)/infiniband 4 | 5 | lib_LTLIBRARIES = libosmeventplugin.la 6 | 7 | if DEBUG 8 | DBGFLAGS = -ggdb -D_DEBUG_ 9 | else 10 | DBGFLAGS = -g 11 | endif 12 | 13 | libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 14 | 15 | if HAVE_LD_VERSION_SCRIPT 16 | libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map 17 | else 18 | libosmeventplugin_version_script = 19 | endif 20 | 21 | osmeventplugin_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmeventplugin.ver | sed 's/LIBVERSION=//') 22 | 23 | libosmeventplugin_la_SOURCES = src/osmeventplugin.c 24 | libosmeventplugin_la_LDFLAGS = -version-info $(osmeventplugin_api_version) \ 25 | -export-dynamic $(libosmeventplugin_version_script) 26 | libosmeventplugin_la_LIBADD = -L../complib -losmcomp -L../libopensm -lopensm $(OSMV_LDADD) 27 | libosmeventplugin_la_DEPENDENCIES = $(srcdir)/libosmeventplugin.map 28 | 29 | libosmeventpluginincludedir = $(includedir)/infiniband/complib 30 | 31 | libosmeventplugininclude_HEADERS = 32 | 33 | # headers are distributed as part of the include dir 34 | EXTRA_DIST = $(srcdir)/libosmeventplugin.map $(srcdir)/libosmeventplugin.ver 35 | -------------------------------------------------------------------------------- /osmeventplugin/libosmeventplugin.map: -------------------------------------------------------------------------------- 1 | OSMPMDB_1.0 { 2 | global: 3 | osm_event_plugin; 4 | local: *; 5 | }; 6 | -------------------------------------------------------------------------------- /osmeventplugin/libosmeventplugin.ver: -------------------------------------------------------------------------------- 1 | # In this file we track the current API version 2 | # of the vendor interface (and libraries) 3 | # The version is built of the following 4 | # tree numbers: 5 | # API_REV:RUNNING_REV:AGE 6 | # API_REV - advance on any added API 7 | # RUNNING_REV - advance any change to the vendor files 8 | # AGE - number of backward versions the API still supports 9 | LIBVERSION=1:2:0 10 | -------------------------------------------------------------------------------- /osmroutingplugin/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CPPFLAGS = -I$(srcdir)/../include \ 3 | -I$(includedir)/infiniband 4 | 5 | lib_LTLIBRARIES = libosmroutingplugin.la 6 | 7 | if DEBUG 8 | DBGFLAGS = -ggdb -D_DEBUG_ 9 | else 10 | DBGFLAGS = -g 11 | endif 12 | 13 | libosmroutingplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 14 | 15 | if HAVE_LD_VERSION_SCRIPT 16 | libosmroutingplugin_version_script = -Wl,--version-script=$(srcdir)/libosmroutingplugin.map 17 | else 18 | libosmroutingplugin_version_script = 19 | endif 20 | 21 | osmroutingplugin_api_version=$(shell grep LIBVERSION= $(srcdir)/libosmroutingplugin.ver | sed 's/LIBVERSION=//') 22 | 23 | libosmroutingplugin_la_SOURCES = src/osmroutingplugin.c 24 | libosmroutingplugin_la_LDFLAGS = -version-info $(osmroutingplugin_api_version) \ 25 | -export-dynamic $(libosmroutingplugin_version_script) 26 | libosmroutingplugin_la_LIBADD = -L../complib -losmcomp -L../libopensm -lopensm $(OSMV_LDADD) 27 | libosmroutingplugin_la_DEPENDENCIES = $(srcdir)/libosmroutingplugin.map 28 | 29 | libosmroutingpluginincludedir = $(includedir)/infiniband/complib 30 | 31 | libosmroutingplugininclude_HEADERS = 32 | 33 | # headers are distributed as part of the include dir 34 | EXTRA_DIST = $(srcdir)/libosmroutingplugin.map $(srcdir)/libosmroutingplugin.ver 35 | -------------------------------------------------------------------------------- /osmroutingplugin/libosmroutingplugin.map: -------------------------------------------------------------------------------- 1 | OSMPMDB_1.0 { 2 | global: 3 | osm_event_plugin; 4 | local: *; 5 | }; 6 | -------------------------------------------------------------------------------- /osmroutingplugin/libosmroutingplugin.ver: -------------------------------------------------------------------------------- 1 | # In this file we track the current API version 2 | # of the vendor interface (and libraries) 3 | # The version is built of the following 4 | # tree numbers: 5 | # API_REV:RUNNING_REV:AGE 6 | # API_REV - advance on any added API 7 | # RUNNING_REV - advance any change to the vendor files 8 | # AGE - number of backward versions the API still supports 9 | LIBVERSION=1:0:0 10 | -------------------------------------------------------------------------------- /osmtest/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | if DEBUG 3 | DBGFLAGS = -ggdb -D_DEBUG_ 4 | else 5 | DBGFLAGS = -g 6 | endif 7 | 8 | AM_CPPFLAGS = -I$(srcdir)/include $(OSMV_INCLUDES) 9 | 10 | sbin_PROGRAMS = osmtest 11 | osmtest_SOURCES = main.c osmtest.c osmt_service.c osmt_slvl_vl_arb.c \ 12 | osmt_multicast.c osmt_inform.c 13 | if OSMV_VAPI 14 | osmtest_SOURCES += osmt_mtl_regular_qp.c 15 | endif 16 | osmtest_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) 17 | osmtest_LDADD = -L../complib -losmcomp -L../libopensm -lopensm -L../libvendor -losmvendor $(OSMV_LDADD) 18 | 19 | EXTRA_DIST = $(srcdir)/include/osmt_inform.h \ 20 | $(srcdir)/include/osmtest_subnet.h \ 21 | $(srcdir)/include/osmtest.h \ 22 | $(srcdir)/include/osmt_mtl_regular_qp.h \ 23 | $(srcdir)/include/osmtest_base.h 24 | -------------------------------------------------------------------------------- /osmtest/include/osmt_inform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 3 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | */ 34 | 35 | #ifndef __OSMT_INFORM__ 36 | #define __OSMT_INFORM__ 37 | 38 | #ifdef OSM_VENDOR_INTF_MTL 39 | #include 40 | #include 41 | #include "osmt_mtl_regular_qp.h" 42 | #endif 43 | 44 | typedef struct _osmt_qp_ctx { 45 | #ifdef OSM_VENDOR_INTF_MTL 46 | osmt_mtl_mad_res_t qp_bind_hndl; 47 | #endif 48 | uint8_t *p_send_buf; 49 | uint8_t *p_recv_buf; 50 | #ifdef OSM_VENDOR_INTF_MTL 51 | IB_MGT_mad_hndl_t ib_mgt_qp0_handle; 52 | #endif 53 | } osmt_qp_ctx_t; 54 | 55 | ib_api_status_t 56 | osmt_bind_inform_qp(IN osmtest_t * const p_osmt, OUT osmt_qp_ctx_t * p_qp_ctx); 57 | 58 | void 59 | osmt_unbind_inform_qp(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx); 60 | 61 | ib_api_status_t 62 | osmt_reg_unreg_inform_info(IN osmtest_t * p_osmt, 63 | IN osmt_qp_ctx_t * p_qp_ctx, 64 | IN ib_inform_info_t * p_inform_info, 65 | IN uint8_t reg_flag); 66 | 67 | ib_api_status_t 68 | osmt_trap_wait(IN osmtest_t * const p_osmt, IN osmt_qp_ctx_t * p_qp_ctx); 69 | 70 | ib_api_status_t 71 | osmt_init_inform_info(IN osmtest_t * const p_osmt, OUT ib_inform_info_t * p_ii); 72 | 73 | ib_api_status_t 74 | osmt_init_inform_info_by_trap(IN osmtest_t * const p_osmt, 75 | IN ib_net16_t trap_num, 76 | OUT ib_inform_info_t * p_ii); 77 | 78 | #endif /* __OSMT_INFORM__ */ 79 | -------------------------------------------------------------------------------- /osmtest/include/osmtest_base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 3 | * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | */ 34 | 35 | /* 36 | * Abstract: 37 | * Declaration of osmtest_t. 38 | * This object represents the OSMTest Test object. 39 | * 40 | */ 41 | #ifndef _OSMTEST_BASE_H_ 42 | #define _OSMTEST_BASE_H_ 43 | 44 | #ifndef __WIN__ 45 | #include 46 | #else 47 | #include 48 | #endif 49 | 50 | #define OSMTEST_MAX_LINE_LEN 120 51 | #define OSMTEST_FILE_PATH_MAX PATH_MAX 52 | 53 | #define STRESS_SMALL_RMPP_THR 100000 54 | /* 55 | Take long times when querying big clusters (over 40 nodes), an average of : 0.25 sec for query 56 | each query receives 1000 records 57 | */ 58 | #define STRESS_LARGE_RMPP_THR 4000 59 | #define STRESS_LARGE_PR_RMPP_THR 20000 60 | #define STRESS_GET_PR 100000 61 | 62 | extern const char *const p_file; 63 | 64 | #endif /* _OSMTEST_BASE_H_ */ 65 | -------------------------------------------------------------------------------- /scripts/opensm.init.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # opensm: Manage OpenSM 4 | # 5 | # chkconfig: - 09 91 6 | # description: Manage OpenSM 7 | # 8 | ### BEGIN INIT INFO 9 | # Provides: opensm 10 | # Required-Start: $syslog @RDMA_SERVICE@ 11 | # Required-Stop: $syslog @RDMA_SERVICE@ 12 | # Default-Start: @DEFAULT_START@ 13 | # Default-Stop: @DEFAULT_STOP@ 14 | # Description: Manage OpenSM 15 | ### END INIT INFO 16 | # 17 | # Copyright (c) 2008 Voltaire, Inc. All rights reserved. 18 | # Copyright 2006 PathScale, Inc. All Rights Reserved. 19 | # 20 | # This Software is licensed under one of the following licenses: 21 | # 22 | # 1) under the terms of the "Common Public License 1.0" a copy of which is 23 | # available from the Open Source Initiative, see 24 | # http://www.opensource.org/licenses/cpl.php. 25 | # 26 | # 2) under the terms of the "The BSD License" a copy of which is 27 | # available from the Open Source Initiative, see 28 | # http://www.opensource.org/licenses/bsd-license.php. 29 | # 30 | # 3) under the terms of the "GNU General Public License (GPL) Version 2" a 31 | # copy of which is available from the Open Source Initiative, see 32 | # http://www.opensource.org/licenses/gpl-license.php. 33 | # 34 | # Licensee has the right to choose one of the above licenses. 35 | # 36 | # Redistributions of source code must retain the above copyright 37 | # notice and one of the license notices. 38 | # 39 | # Redistributions in binary form must reproduce both the above copyright 40 | # notice, one of the license notices in the documentation 41 | # and/or other materials provided with the distribution. 42 | 43 | prefix=@prefix@ 44 | exec_prefix=@exec_prefix@ 45 | pidfile=/var/run/opensm.pid 46 | 47 | # Source function library. 48 | if [[ -s /etc/init.d/functions ]]; then 49 | # RHEL / CentOS / SL / Fedora. 50 | . /etc/init.d/functions 51 | rc_status() { :; } 52 | rc_exit() { exit $RETVAL; } 53 | elif [[ -s /lib/lsb/init-functions ]]; then 54 | # SLES / openSuSE / Debian. 55 | . /lib/lsb/init-functions 56 | rc_exit() { exit $RETVAL; } 57 | success() { log_success_msg; } 58 | failure() { log_failure_msg; } 59 | elif [[ -s /etc/rc.status ]]; then 60 | # Older SuSE systems. 61 | . /etc/rc.status 62 | failure() { rc_status -v; } 63 | success() { rc_status -v; } 64 | fi 65 | 66 | CONFIG=@sysconfdir@/sysconfig/opensm 67 | if [[ -s $CONFIG ]]; then 68 | . $CONFIG 69 | fi 70 | 71 | running () { 72 | [ -e $pidfile ] && 73 | [ "$(readlink "/proc/$(<$pidfile)/exe")" = "@sbindir@/opensm" ] 74 | } 75 | 76 | start () { 77 | if running; then 78 | echo Already started 79 | return 1 80 | fi 81 | echo -n "Starting opensm: " 82 | @sbindir@/opensm --daemon --pidfile $pidfile $OPTIONS > /dev/null 83 | RETVAL=$? 84 | if [[ $RETVAL -eq 0 ]]; then 85 | success 86 | else 87 | failure 88 | fi 89 | echo 90 | } 91 | 92 | stop () { 93 | echo -n "Shutting down opensm: " 94 | killproc opensm 95 | RETVAL=$? 96 | if [[ $RETVAL -eq 0 ]]; then 97 | success 98 | else 99 | failure 100 | fi 101 | echo 102 | } 103 | 104 | Xstatus () { 105 | pid="`pidof opensm`" 106 | ret=$? 107 | if [ $ret -eq 0 ] ; then 108 | echo "OpenSM is running... pid=$pid" 109 | else 110 | echo "OpenSM is not running." 111 | fi 112 | } 113 | 114 | restart() { 115 | stop 116 | start 117 | } 118 | 119 | # See how we were called. 120 | case "$1" in 121 | start) 122 | start 123 | ;; 124 | stop) 125 | stop 126 | ;; 127 | status) 128 | Xstatus 129 | ;; 130 | restart | force-reload | reload) 131 | restart 132 | ;; 133 | try-restart | condrestart) 134 | [ -e $pidfile ] && restart 135 | ;; 136 | resweep) 137 | killall -HUP opensm 138 | RETVAL=$? 139 | ;; 140 | rotatelog) 141 | killall -USR1 opensm 142 | RETVAL=$? 143 | ;; 144 | *) 145 | echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|resweep|rotatelog}" 146 | RETVAL=1 147 | ;; 148 | esac 149 | 150 | _rc_status_all=$RETVAL 151 | rc_exit 152 | -------------------------------------------------------------------------------- /scripts/opensm.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/opensm.log { 2 | missingok 3 | notifempty 4 | copytruncate 5 | weekly 6 | compress 7 | } 8 | -------------------------------------------------------------------------------- /scripts/opensm.sysconfig: -------------------------------------------------------------------------------- 1 | # It will be used for sldd.sh 2 | OSM_HOSTS="" 3 | -------------------------------------------------------------------------------- /scripts/travis-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PATH=/home/`whoami`/.local/bin:$PATH 4 | DIR=$(readlink -f .) 5 | # Stop on error 6 | set -e 7 | # Echo all commands to Travis log 8 | set -x 9 | 10 | ./autogen.sh 11 | 12 | 13 | # Clang doesn't like getting pointers from packed struct members, even if aligned. 14 | CC=clang CFLAGS="-Wno-address-of-packed-member" ./configure 15 | make 16 | make clean 17 | 18 | # Run sparse on the subdirectories which are sparse clean 19 | CC=cgcc CFLAGS="-Werror" make > /dev/null 2>&1 | grep -v '^/usr/include' | tee out 20 | make clean 21 | # sparse does not fail gcc on messages 22 | if [ -s out ]; then 23 | false 24 | fi 25 | 26 | CC=gcc-8 CFLAGS="" ./configure 27 | make 28 | make dist 29 | -------------------------------------------------------------------------------- /scripts/travis-checkpatch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2017 Mellanox Technologies Ltd. 3 | # Licensed under BSD (MIT variant) or GPLv2. See COPYING. 4 | 5 | 6 | if [ "x$TRAVIS_EVENT_TYPE" != "xpull_request" ]; then 7 | # Peform checkpatch checks on pull requests only 8 | exit 0 9 | fi 10 | 11 | # The below "set" is commented, because the checkpatch.pl returns 1 (error) for warnings too. 12 | # And the rdma-core code is not mature enough to be warning safe 13 | # set -e 14 | 15 | if [ "x$TRAVIS_COMMIT_RANGE" != "x" ]; then 16 | wget -q https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl \ 17 | https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/spelling.txt 18 | DIR_FOR_PATCHES_TO_CHECK=$(mktemp -d) 19 | git format-patch --no-cover-letter $TRAVIS_COMMIT_RANGE ^$TRAVIS_BRANCH -o $DIR_FOR_PATCHES_TO_CHECK/ 20 | CHECKPATCH_OPT="--no-tree --ignore PREFER_KERNEL_TYPES,FILE_PATH_CHANGES,EXECUTE_PERMISSIONS,USE_NEGATIVE_ERRNO,CONST_STRUCT $DIR_FOR_PATCHES_TO_CHECK/*" 21 | perl checkpatch.pl $CHECKPATCH_OPT 22 | if [ $? -ne 0 ]; then 23 | # We rerun checkpatch to simplify parsing and to understand if we failed for errors 24 | # For example, the output on some arbitrary patchset of the following line without awk is: 25 | # total: 1 errors, 3 warnings, 42 lines checked 26 | NUMB_ERRRORS=$(perl checkpatch.pl --terse $CHECKPATCH_OPT | awk 'BEGIN {FS = "total:"} ; {sum+=$2} END {print sum}') 27 | exit $NUMB_ERRRORS 28 | fi 29 | fi 30 | --------------------------------------------------------------------------------